Commit 48642fc6 by 王志超

feat: 工单提交至新流程

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