Commit 48642fc6 by 王志超

feat: 工单提交至新流程

parent 2df23f02
...@@ -370,8 +370,8 @@ public class ChangeFlowBiz { ...@@ -370,8 +370,8 @@ public class ChangeFlowBiz {
if (null == nextNodeId) { if (null == nextNodeId) {
throw ExceptionFactory.createBiz(ResponseCode.SUBMIT_FLOW_ERROR, "首次提交节点失败"); throw ExceptionFactory.createBiz(ResponseCode.SUBMIT_FLOW_ERROR, "首次提交节点失败");
} }
// 更新节点id // 更新节点id,使用返回的节点ID
changeRecord.setFlowNode(ChangeFlowEnum.NEW_CHANGE_FLOW_CONFIRM_EXEC_PLAN.getNodeId()); changeRecord.setFlowNode(nextNodeId);
changeRecord.setState(ChangeStatusEnum.IN.getStatus()); changeRecord.setState(ChangeStatusEnum.IN.getStatus());
changeRecord.setUpdateTime(DateUtils.getCurrentTime()); changeRecord.setUpdateTime(DateUtils.getCurrentTime());
changeFlowService.updateRecord(changeRecord); changeFlowService.updateRecord(changeRecord);
...@@ -601,8 +601,8 @@ public class ChangeFlowBiz { ...@@ -601,8 +601,8 @@ public class ChangeFlowBiz {
content.put("updateTime", System.currentTimeMillis()); content.put("updateTime", System.currentTimeMillis());
content.put(CommonConstants.FLOW_OPERATION_KEY, FlowOperationTypeEnum.PASS.getValue()); content.put(CommonConstants.FLOW_OPERATION_KEY, FlowOperationTypeEnum.PASS.getValue());
switch (node) { switch (node) {
// 变更申请提交节点,可以修改数据,以新的数据为准 // 提交变更申请节点,可以修改数据,以新的数据为准
case CHANGE_FLOW_SUBMIT: case NEW_CHANGE_FLOW_START:
// 检验是否需要资料 // 检验是否需要资料
ChangeConfig changeConfig = changeConfigService.getSonChange(changeFlowSubmitReq.getSonChangeClassId()); ChangeConfig changeConfig = changeConfigService.getSonChange(changeFlowSubmitReq.getSonChangeClassId());
Assert.notNull(changeConfig, "二级变更类型不存在"); Assert.notNull(changeConfig, "二级变更类型不存在");
...@@ -634,25 +634,19 @@ public class ChangeFlowBiz { ...@@ -634,25 +634,19 @@ public class ChangeFlowBiz {
changeRecord.setChangeConfirmResultTime(changeFlowSubmitReq.getChangeConfirmResultTime()); changeRecord.setChangeConfirmResultTime(changeFlowSubmitReq.getChangeConfirmResultTime());
changeRecord.setUpdateTime(DateUtils.getCurrentTime()); changeRecord.setUpdateTime(DateUtils.getCurrentTime());
changeRecord.setChangeProfitAmount(changeFlowSubmitReq.getChangeProfitAmount()); changeRecord.setChangeProfitAmount(changeFlowSubmitReq.getChangeProfitAmount());
// 提交工单 // 提交工单并更新节点
String submitNode = flowService.submitFlow(flowId.toString(), flowDataDTO, uid, submitToExecutionNode(flowId.toString(), flowDataDTO, uid, content, changeRecord);
ChangeFlowEnum.CHANGE_FLOW_SUBMIT.getTopoId(), JSON.toJSONString(content), true, String submitNode = changeRecord.getFlowNode();
FlowxOperationEnum.SUBMIT.getName(), "提交工单", changeRecord.getCreateTime());
// 更新工单数据
changeRecord.setFlowNode(submitNode);
changeRecord.setState(ChangeStatusEnum.IN.getStatus());
changeRecord.setUpdateTime(DateUtils.getCurrentTime());
changeFlowService.updateRecord(changeRecord);
// 更新行动执行方案,覆盖操作,先删除,后插入 // 更新行动执行方案,覆盖操作,先删除,后插入
Integer changeExecCount = changeFlowExecService.deleteByChangeRecordId(changeRecord.getId()); Integer changeExecCount = changeFlowExecService.deleteByChangeRecordId(changeRecord.getId());
log.debug("[CHANGE_FLOW_SUBMIT] delete id:{}, changeExecCount:{}", changeRecord.getId(), changeExecCount); log.debug("[NEW_CHANGE_FLOW_START] delete id:{}, changeExecCount:{}", changeRecord.getId(), changeExecCount);
// 保存变更行动方案记录 // 保存变更行动方案记录
List<ChangeExecRecord> changeExecRecords = buildChangeExecRecord(changeRecord.getId(), List<ChangeExecRecord> changeExecRecords = buildChangeExecRecord(changeRecord.getId(),
changeFlowSubmitReq.getChangeExecProjectList()); changeFlowSubmitReq.getChangeExecProjectList());
changeExecRecords.forEach(exec -> changeFlowExecService.saveRecord(exec)); changeExecRecords.forEach(exec -> changeFlowExecService.saveRecord(exec));
// 更新附件,覆盖操作,先删除,后插入 // 更新附件,覆盖操作,先删除,后插入
Integer fileCount = changeFileService.deleteByChangeRecordId(changeRecord.getId()); Integer fileCount = changeFileService.deleteByChangeRecordId(changeRecord.getId());
log.debug("[CHANGE_FLOW_SUBMIT] delete fileCount:{}", fileCount); log.debug("[NEW_CHANGE_FLOW_START] delete fileCount:{}", fileCount);
List<ChangeFile> allFiles = new ArrayList<>(); List<ChangeFile> allFiles = new ArrayList<>();
List<ChangeFlowFile> changeFiles = changeFlowSubmitReq.getChangeFiles(); List<ChangeFlowFile> changeFiles = changeFlowSubmitReq.getChangeFiles();
if (CollectionUtils.isNotEmpty(changeFiles)) { if (CollectionUtils.isNotEmpty(changeFiles)) {
...@@ -666,7 +660,7 @@ public class ChangeFlowBiz { ...@@ -666,7 +660,7 @@ public class ChangeFlowBiz {
if (CollectionUtils.isNotEmpty(allFiles)) { if (CollectionUtils.isNotEmpty(allFiles)) {
allFiles.forEach(file -> changeFileService.saveRecord(file)); allFiles.forEach(file -> changeFileService.saveRecord(file));
} }
log.debug("[CHANGE_FLOW_SUBMIT] changeFiles:{}, uploadFiles:{}, allFiles:{}", JSON.toJSONString(changeFiles), log.debug("[NEW_CHANGE_FLOW_START] changeFiles:{}, uploadFiles:{}, allFiles:{}", JSON.toJSONString(changeFiles),
JSON.toJSONString(uploadFiles), JSON.toJSONString(allFiles)); JSON.toJSONString(uploadFiles), JSON.toJSONString(allFiles));
buildAndSendEmail.buildAndSendEmailSubmit(changeRecord, changeExecRecords); buildAndSendEmail.buildAndSendEmailSubmit(changeRecord, changeExecRecords);
return submitNode; return submitNode;
......
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