Commit 9bee8ce6 by “zcwang”

modify:必传文件判断

parent 02bc13b8
...@@ -557,9 +557,8 @@ public class ChangeFlowBiz { ...@@ -557,9 +557,8 @@ public class ChangeFlowBiz {
Assert.notNull(changeConfig, "二级变更类型不存在"); Assert.notNull(changeConfig, "二级变更类型不存在");
Integer needFile = changeConfig.getNeedFile(); Integer needFile = changeConfig.getNeedFile();
if (NeedFileEnum.NEED.getStatus().equals(needFile)) { if (NeedFileEnum.NEED.getStatus().equals(needFile)) {
List<ChangeFlowFile> fileList = changeFlowSubmitReq.getChangeFiles(); List<ChangeFlowFile> uploadFiles = changeFlowSubmitReq.getUploadFiles();
fileList.addAll(changeFlowSubmitReq.getUploadFiles()); if (CollectionUtils.isEmpty(uploadFiles)) {
if (CollectionUtils.isEmpty(fileList)) {
throw ExceptionFactory.createBiz(ResponseCode.BAD_REQUEST, "必须上传资料"); throw ExceptionFactory.createBiz(ResponseCode.BAD_REQUEST, "必须上传资料");
} }
} }
...@@ -601,17 +600,20 @@ public class ChangeFlowBiz { ...@@ -601,17 +600,20 @@ public class ChangeFlowBiz {
// 更新附件,覆盖操作,先删除,后插入 // 更新附件,覆盖操作,先删除,后插入
Integer fileCount = changeFileService.deleteByChangeRecordId(changeRecord.getId()); Integer fileCount = changeFileService.deleteByChangeRecordId(changeRecord.getId());
log.debug("[CHANGE_FLOW_SUBMIT] delete fileCount:{}", fileCount); log.debug("[CHANGE_FLOW_SUBMIT] delete fileCount:{}", fileCount);
List<ChangeFlowFile> files = changeFlowSubmitReq.getChangeFiles(); List<ChangeFile> allFiles = new ArrayList<>();
if (CollectionUtils.isNotEmpty(files)) { List<ChangeFlowFile> changeFiles = changeFlowSubmitReq.getChangeFiles();
List<ChangeFile> changeFiles = buildChangeFileRecord(changeRecord.getId(), files, FileTypeEnum.CHANGE.getType()); if (CollectionUtils.isNotEmpty(changeFiles)) {
changeFiles.forEach(file -> changeFileService.saveRecord(file)); allFiles.addAll(buildChangeFileRecord(changeRecord.getId(), changeFiles, FileTypeEnum.CHANGE.getType()));
} }
// 保存附件,根据配置看是否必传
List<ChangeFlowFile> uploadFiles = changeFlowSubmitReq.getUploadFiles(); List<ChangeFlowFile> uploadFiles = changeFlowSubmitReq.getUploadFiles();
if (CollectionUtils.isNotEmpty(uploadFiles)) { if (CollectionUtils.isNotEmpty(uploadFiles)) {
List<ChangeFile> changeFiles = buildChangeFileRecord(changeRecord.getId(), uploadFiles, FileTypeEnum.UPLOAD.getType()); allFiles.addAll(buildChangeFileRecord(changeRecord.getId(), uploadFiles, FileTypeEnum.UPLOAD.getType()));
changeFiles.forEach(file -> changeFileService.saveRecord(file)); }
if (CollectionUtils.isNotEmpty(allFiles)) {
allFiles.forEach(file -> changeFileService.saveRecord(file));
} }
log.debug("[CHANGE_FLOW_SUBMIT] files:{}, uploadFiles:{}", JSON.toJSONString(files), log.debug("[CHANGE_FLOW_SUBMIT] files:{}, uploadFiles:{}", JSON.toJSONString(allFiles),
JSON.toJSONString(uploadFiles)); JSON.toJSONString(uploadFiles));
HashMap<String, Object> param = new HashMap<>(); HashMap<String, Object> param = new HashMap<>();
param.put("changeId", changeRecord.getFlowId()); param.put("changeId", changeRecord.getFlowId());
...@@ -670,8 +672,8 @@ public class ChangeFlowBiz { ...@@ -670,8 +672,8 @@ public class ChangeFlowBiz {
List<ChangeFlowFile> finialFiles = changeFlowSubmitReq.getChangeResultFiles(); List<ChangeFlowFile> finialFiles = changeFlowSubmitReq.getChangeResultFiles();
if (CollectionUtils.isNotEmpty(finialFiles)) { if (CollectionUtils.isNotEmpty(finialFiles)) {
changeFileService.deleteByChangeRecordIdAndType(changeRecord.getId(), FileTypeEnum.CHANGE_RESULT_INFO); changeFileService.deleteByChangeRecordIdAndType(changeRecord.getId(), FileTypeEnum.CHANGE_RESULT_INFO);
List<ChangeFile> changeFiles = buildChangeFileRecord(changeRecord.getId(), finialFiles, FileTypeEnum.CHANGE_RESULT_INFO.getType()); List<ChangeFile> finialFileList = buildChangeFileRecord(changeRecord.getId(), finialFiles, FileTypeEnum.CHANGE_RESULT_INFO.getType());
changeFiles.forEach(file -> changeFileService.saveRecord(file)); finialFileList.forEach(file -> changeFileService.saveRecord(file));
} }
switch (changeResultStatus) { switch (changeResultStatus) {
case FINISH_ALL: case FINISH_ALL:
......
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