Commit ebfabe34 authored by 赵啸非's avatar 赵啸非

修改同步事项

parent b9ca272d
...@@ -8,6 +8,10 @@ import com.mortals.xhx.base.system.upload.service.UploadService; ...@@ -8,6 +8,10 @@ import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.module.menu.model.MenuEntity; import com.mortals.xhx.module.menu.model.MenuEntity;
import com.mortals.xhx.module.menu.service.MenuService; import com.mortals.xhx.module.menu.service.MenuService;
import com.mortals.xhx.module.param.service.ParamService; import com.mortals.xhx.module.param.service.ParamService;
import com.mortals.xhx.module.product.model.ProductAppsEntity;
import com.mortals.xhx.module.product.model.ProductDocumentEntity;
import com.mortals.xhx.module.product.service.ProductAppsService;
import com.mortals.xhx.module.product.service.ProductDocumentService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -66,6 +70,11 @@ public class UploadfileController extends BaseCRUDJsonBodyMappingController<Uplo ...@@ -66,6 +70,11 @@ public class UploadfileController extends BaseCRUDJsonBodyMappingController<Uplo
@Autowired @Autowired
private MenuService menuService; private MenuService menuService;
@Autowired
private ProductDocumentService productDocumentService;
@Autowired
private ProductAppsService productAppsService;
public UploadfileController() { public UploadfileController() {
super.setFormClass(UploadfileForm.class); super.setFormClass(UploadfileForm.class);
super.setModuleDesc("上传文件业务"); super.setModuleDesc("上传文件业务");
...@@ -107,9 +116,43 @@ public class UploadfileController extends BaseCRUDJsonBodyMappingController<Uplo ...@@ -107,9 +116,43 @@ public class UploadfileController extends BaseCRUDJsonBodyMappingController<Uplo
} }
} }
List<ProductDocumentEntity> productDocumentEntities = productDocumentService.find(new ProductDocumentEntity());
for (ProductDocumentEntity productDocumentEntity : productDocumentEntities) {
String docFileUrl = productDocumentEntity.getDocFileUrl();
String filePath = uploadService.getFilePath(docFileUrl);
File file = new File(filePath);
if (file.exists()) {
try {
zip.putNextEntry(new ZipEntry(StrUtil.subAfter(docFileUrl, "/", false)));
IOUtils.write(FileUtil.readBytes(file), zip);
zip.flush();
zip.closeEntry();
} catch (Exception e) {
log.error("异常", e.getMessage());
}
}
}
List<ProductAppsEntity> productAppsEntities = productAppsService.find(new ProductAppsEntity());
for (ProductAppsEntity productAppsEntity : productAppsEntities) {
String appFileUrl = productAppsEntity.getAppFileUrl();
String filePath = uploadService.getFilePath(appFileUrl);
File file = new File(filePath);
if (file.exists()) {
try {
zip.putNextEntry(new ZipEntry(StrUtil.subAfter(appFileUrl, "/", false)));
IOUtils.write(FileUtil.readBytes(file), zip);
zip.flush();
zip.closeEntry();
} catch (Exception e) {
log.error("异常", e.getMessage());
}
}
}
IOUtils.closeQuietly(zip); IOUtils.closeQuietly(zip);
byte[] bytes = outputStream.toByteArray(); byte[] bytes = outputStream.toByteArray();
genCode(response, bytes); genCode(response, bytes);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment