fix: 修复立项变更流程缺少创建人的Bug

This commit is contained in:
2023-10-26 18:04:17 +08:00
parent 7103f6d893
commit b2732e45c2
3 changed files with 27 additions and 26 deletions
@@ -3,7 +3,6 @@ package com.jero.modules.activiti.process.esInitChange.entity.vo;
import com.jero.modules.activiti.process.common.entity.CommonVO;
import com.jero.modules.activiti.process.esInitChange.entity.ProcessEsInitChange;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
@@ -18,5 +17,5 @@ public class InitChangeDataVO {
List<ProcessEsInitChange> dataList;
FlowUserInfoVO flowUserInfoVO;
InitChangeFlowUserVO initChangeFlowUserVO;
}
@@ -8,7 +8,7 @@ import lombok.Data;
* @Date: 2023/10/9 16:57
*/
@Data
public class FlowUserInfoVO {
public class InitChangeFlowUserVO {
@ApiModelProperty("主起草人")
private String mainDraftUser;
@@ -18,7 +18,7 @@ import com.jero.modules.activiti.process.common.enums.ProcessType;
import com.jero.modules.activiti.process.common.service.ActFlowCommonService;
import com.jero.modules.activiti.process.common.service.ProcessDraftService;
import com.jero.modules.activiti.process.esInitChange.entity.ProcessEsInitChange;
import com.jero.modules.activiti.process.esInitChange.entity.vo.FlowUserInfoVO;
import com.jero.modules.activiti.process.esInitChange.entity.vo.InitChangeFlowUserVO;
import com.jero.modules.activiti.process.esInitChange.entity.vo.InitChangeDataVO;
import com.jero.modules.activiti.process.esInitChange.service.ProcessEsInitChangeService;
import com.jero.modules.activiti.process.esInitChange.mapper.ProcessEsInitChangeMapper;
@@ -30,7 +30,6 @@ 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.TaskService;
import org.activiti.engine.runtime.ProcessInstance;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -96,17 +95,17 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
initChangeDataVO.setDataList(dataList);
// 选人组件内容填充
List<ProcessNode> nodeList = processNodeService.getNodeList(processDefinitionId, processInstanceId);
FlowUserInfoVO flowUserInfoVO = new FlowUserInfoVO();
InitChangeFlowUserVO initChangeFlowUserVO = new InitChangeFlowUserVO();
Map<String, ProcessNode> userMap = nodeList.stream().collect(Collectors.toMap(ProcessNode::getVariableName, node -> node));
flowUserInfoVO.setCreateUser(userMap.get("createUser").getLinkUserIds());
flowUserInfoVO.setContactUser(userMap.get("contactUser").getLinkUserIds());
flowUserInfoVO.setMainDraftUserLeader(userMap.get("mainDraftUserLeader").getLinkUserIds());
flowUserInfoVO.setMainDraftUserLeaderLeader(userMap.get("mainDraftUserLeaderLeader").getLinkUserIds());
flowUserInfoVO.setStandardizationApprovalUser(userMap.get("standardizationApprovalUser").getLinkUserIds());
flowUserInfoVO.setNewMainDraftUserLeaderLeader(userMap.get("newMainDraftUserLeaderLeader").getLinkUserIds());
flowUserInfoVO.setNewMainDraftUserLeader(userMap.get("newMainDraftUserLeader").getLinkUserIds());
flowUserInfoVO.setCopyUser(userMap.get("copyUser").getLinkUserIds());
initChangeDataVO.setFlowUserInfoVO(flowUserInfoVO);
initChangeFlowUserVO.setCreateUser(userMap.get("createUser").getLinkUserIds());
initChangeFlowUserVO.setContactUser(userMap.get("contactUser").getLinkUserIds());
initChangeFlowUserVO.setMainDraftUserLeader(userMap.get("mainDraftUserLeader").getLinkUserIds());
initChangeFlowUserVO.setMainDraftUserLeaderLeader(userMap.get("mainDraftUserLeaderLeader").getLinkUserIds());
initChangeFlowUserVO.setStandardizationApprovalUser(userMap.get("standardizationApprovalUser").getLinkUserIds());
initChangeFlowUserVO.setNewMainDraftUserLeaderLeader(userMap.get("newMainDraftUserLeaderLeader").getLinkUserIds());
initChangeFlowUserVO.setNewMainDraftUserLeader(userMap.get("newMainDraftUserLeader").getLinkUserIds());
initChangeFlowUserVO.setCopyUser(userMap.get("copyUser").getLinkUserIds());
initChangeDataVO.setInitChangeFlowUserVO(initChangeFlowUserVO);
return initChangeDataVO;
}
@@ -159,6 +158,9 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
String userId = UserUtils.getUserId();
CommonVO commonVO = initChangeDataVO.getCommonVO();
String taskId = commonVO.getTaskId();
if (StrUtil.isBlank(taskId) && !actFlowCommonService.taskExists(taskId)) {
throw new JeroBootException("taskId为空或任务不存在");
}
List<ProcessEsInitChange> esInitChangeList = initChangeDataVO.getDataList();
Map<String, Object> variables = new HashMap<>();
String processInstanceId = actFlowCommonService.getProcessInstanceIdByTaskId(taskId);
@@ -236,20 +238,20 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
}
public Map<String, Object> setVariables(InitChangeDataVO initChangeData) {
FlowUserInfoVO flowUserInfoVO = initChangeData.getFlowUserInfoVO();
InitChangeFlowUserVO initChangeFlowUserVO = initChangeData.getInitChangeFlowUserVO();
ProcessEsInitChange initChange = initChangeData.getDataList().get(0);
Map<String, Object> map = new HashMap<>();
// 设置流程中各个节点的人
map.put("createUser", UserUtils.getUserIdByUserName(flowUserInfoVO.getCreateUser()));
map.put("contactUser", flowUserInfoVO.getContactUser());
map.put("standardExpertList", Optional.ofNullable(flowUserInfoVO.getStandardExpert()).map(s -> Arrays.asList(s.split(","))).orElse(Collections.emptyList()));
map.put("mainDraftUserLeader", flowUserInfoVO.getMainDraftUserLeader());
map.put("mainDraftUserLeaderLeader", flowUserInfoVO.getMainDraftUserLeaderLeader());
map.put("standardizationApprovalUser", flowUserInfoVO.getStandardizationApprovalUser());
map.put("newMainDraftUserLeaderLeader", flowUserInfoVO.getNewMainDraftUserLeaderLeader());
map.put("newMainDraftUserLeader", flowUserInfoVO.getNewMainDraftUserLeader());
map.put("relatedUserList", Optional.ofNullable(flowUserInfoVO.getRelatedUser()).map(s -> Arrays.asList(s.split(","))).orElse(Collections.emptyList()));
map.put("copyUser", flowUserInfoVO.getCopyUser());
map.put("createUser", initChangeFlowUserVO.getMainDraftUser());
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());
map.put("mainDraftUserLeaderLeader", initChangeFlowUserVO.getMainDraftUserLeaderLeader());
map.put("standardizationApprovalUser", initChangeFlowUserVO.getStandardizationApprovalUser());
map.put("newMainDraftUserLeaderLeader", initChangeFlowUserVO.getNewMainDraftUserLeaderLeader());
map.put("newMainDraftUserLeader", initChangeFlowUserVO.getNewMainDraftUserLeader());
map.put("relatedUserList", Optional.ofNullable(initChangeFlowUserVO.getRelatedUser()).map(s -> Arrays.asList(s.split(","))).orElse(Collections.emptyList()));
map.put("copyUser", initChangeFlowUserVO.getCopyUser());
// 设置流程分支判断变量
map.put("applicationCategory", initChange.getApplicationCategory());
map.put("projectType", initChange.getProjectType());