diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/service/impl/ProcessEsInitChangeServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/service/impl/ProcessEsInitChangeServiceImpl.java index d1220305..81247a92 100644 --- a/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/service/impl/ProcessEsInitChangeServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/service/impl/ProcessEsInitChangeServiceImpl.java @@ -30,6 +30,7 @@ import com.jero.modules.laws.enterprise.service.ESSequenceNumberProvider; import com.jero.modules.laws.enterprise.util.EnterpriseStandardUtil; import com.jero.modules.sys.utils.UserUtils; import lombok.extern.slf4j.Slf4j; +import org.activiti.engine.RuntimeService; import org.activiti.engine.runtime.ProcessInstance; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -70,6 +71,10 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl dataList = list(lambdaQueryWrapper); initChangeDataVO.setDataList(dataList); // 选人组件内容填充 + initChangeDataVO.setFlowUserInfoVO(this.getProcessUserInfo(processDefinitionId, processInstanceId)); + return initChangeDataVO; + } + + private InitChangeFlowUserVO getProcessUserInfo(String processDefinitionId, String processInstanceId) { List nodeList = processNodeService.getNodeList(processDefinitionId, processInstanceId); InitChangeFlowUserVO initChangeFlowUserVO = new InitChangeFlowUserVO(); Map userMap = nodeList.stream().collect(Collectors.toMap(ProcessNode::getVariableName, node -> node)); @@ -105,8 +115,7 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl userMap = this.getUserMap(variables); processNodeLinkService.saveNodeUserLink(processDefinitionId, processInstanceId, userMap); + } else { + // 设置流程变量 + InitChangeFlowUserVO processUserInfo = this.getProcessUserInfo(processDefinitionId, processInstanceId); + initChangeDataVO.setFlowUserInfoVO(processUserInfo); + this.setUserMap(variables, processUserInfo); + variables.put("pass", false); } - // 设置流程变量 - variables.put("pass", pass); //更新审批表为完成,填充数据 ProcessApprovalRecord approvalRecord = processApprovalRecordService.getToDoByTaskId(taskId); approvalRecord.setCommitFlag(pass ? CommitFlagEnum.PASS.getValue() : CommitFlagEnum.REJECT.getValue()); @@ -198,6 +212,20 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl variables, InitChangeFlowUserVO initChangeFlowUserVO) { + // 设置流程中各个节点的人 + variables.put("createUser", initChangeFlowUserVO.getCreateUser()); + variables.put("contactUser", initChangeFlowUserVO.getContactUser()); + variables.put("standardExpertList", Optional.ofNullable(initChangeFlowUserVO.getStandardExpert()).map(s -> Arrays.asList(s.split(","))).orElse(Collections.emptyList())); + variables.put("mainDraftUserLeader", initChangeFlowUserVO.getMainDraftUserLeader()); + variables.put("mainDraftUserLeaderLeader", initChangeFlowUserVO.getMainDraftUserLeaderLeader()); + variables.put("standardizationApprovalUser", initChangeFlowUserVO.getStandardizationApprovalUser()); + variables.put("newMainDraftUserLeaderLeader", initChangeFlowUserVO.getNewMainDraftUserLeaderLeader()); + variables.put("newMainDraftUserLeader", initChangeFlowUserVO.getNewMainDraftUserLeader()); + variables.put("relatedUserList", Optional.ofNullable(initChangeFlowUserVO.getRelatedUser()).map(s -> Arrays.asList(s.split(","))).orElse(Collections.emptyList())); + variables.put("copyUser", initChangeFlowUserVO.getCopyUser()); + } + @Override public void saveToDraft(InitChangeDataVO initChangeData) { CommonVO commonVO = initChangeData.getCommonVO(); @@ -242,7 +270,7 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl map = new HashMap<>(); // 设置流程中各个节点的人 - map.put("createUser", initChangeFlowUserVO.getMainDraftUser()); + map.put("createUser", initChangeFlowUserVO.getCreateUser()); map.put("contactUser", initChangeFlowUserVO.getContactUser()); map.put("standardExpertList", Optional.ofNullable(initChangeFlowUserVO.getStandardExpert()).map(s -> Arrays.asList(s.split(","))).orElse(Collections.emptyList())); map.put("mainDraftUserLeader", initChangeFlowUserVO.getMainDraftUserLeader());