fix: 立项变更驳回报错
This commit is contained in:
+33
-5
@@ -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<ProcessEsInitCha
|
||||
@Resource
|
||||
private ProcessNodeService processNodeService;
|
||||
|
||||
@Resource
|
||||
private RuntimeService runtimeService;
|
||||
|
||||
|
||||
@Override
|
||||
public InitChangeDataVO getHandleData(String taskId) {
|
||||
if (!actFlowCommonService.taskExists(taskId)) {
|
||||
@@ -94,6 +99,11 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
||||
List<ProcessEsInitChange> dataList = list(lambdaQueryWrapper);
|
||||
initChangeDataVO.setDataList(dataList);
|
||||
// 选人组件内容填充
|
||||
initChangeDataVO.setFlowUserInfoVO(this.getProcessUserInfo(processDefinitionId, processInstanceId));
|
||||
return initChangeDataVO;
|
||||
}
|
||||
|
||||
private InitChangeFlowUserVO getProcessUserInfo(String processDefinitionId, String processInstanceId) {
|
||||
List<ProcessNode> nodeList = processNodeService.getNodeList(processDefinitionId, processInstanceId);
|
||||
InitChangeFlowUserVO initChangeFlowUserVO = new InitChangeFlowUserVO();
|
||||
Map<String, ProcessNode> userMap = nodeList.stream().collect(Collectors.toMap(ProcessNode::getVariableName, node -> node));
|
||||
@@ -105,8 +115,7 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
||||
initChangeFlowUserVO.setNewMainDraftUserLeaderLeader(userMap.get("newMainDraftUserLeaderLeader").getLinkUserIds());
|
||||
initChangeFlowUserVO.setNewMainDraftUserLeader(userMap.get("newMainDraftUserLeader").getLinkUserIds());
|
||||
initChangeFlowUserVO.setCopyUser(userMap.get("copyUser").getLinkUserIds());
|
||||
initChangeDataVO.setFlowUserInfoVO(initChangeFlowUserVO);
|
||||
return initChangeDataVO;
|
||||
return initChangeFlowUserVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -173,12 +182,17 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
||||
// 更新业务流程数据
|
||||
saveOrUpdateBatch(esInitChangeList);
|
||||
variables = setVariables(initChangeDataVO);
|
||||
variables.put("pass", true);
|
||||
// 保存选人信息
|
||||
Map<String, Object> 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<ProcessEsInitCha
|
||||
return variables;
|
||||
}
|
||||
|
||||
private void setUserMap(Map<String, Object> 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<ProcessEsInitCha
|
||||
ProcessEsInitChange initChange = initChangeData.getDataList().get(0);
|
||||
Map<String, Object> 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());
|
||||
|
||||
Reference in New Issue
Block a user