Commit 9bee8ce6 by “zcwang”

modify:必传文件判断

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