review: 重构组装下一个节点审批人方法

This commit is contained in:
smallNorthLee 2025-03-18 19:12:39 +08:00
parent 67e548d545
commit 41639d5dd7
1 changed files with 5 additions and 6 deletions

View File

@ -267,7 +267,6 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
FlowElement flowElement = bpmnModel.getFlowElement(task.getTaskDefinitionKey()); FlowElement flowElement = bpmnModel.getFlowElement(task.getTaskDefinitionKey());
List<FlowNode> nextFlowNodes = BpmnModelUtils.getNextFlowNodes(flowElement, bpmnModel, processVariables); List<FlowNode> nextFlowNodes = BpmnModelUtils.getNextFlowNodes(flowElement, bpmnModel, processVariables);
// TODO @小北还是可以优化下哈4. 组装节点信息 只拼接出 candidateUserIds之后再第二次循环查询用户和部门信息进行拼接
// 2. 收集所有节点的候选用户 ID // 2. 收集所有节点的候选用户 ID
Set<Long> allCandidateUsers = new HashSet<>(); Set<Long> allCandidateUsers = new HashSet<>();
for (FlowNode node : nextFlowNodes) { for (FlowNode node : nextFlowNodes) {
@ -287,13 +286,13 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
loginUserId, historicProcessInstance.getProcessDefinitionId(), processVariables); loginUserId, historicProcessInstance.getProcessDefinitionId(), processVariables);
// 4.2 组装候选用户信息 // 4.2 组装候选用户信息
List<UserSimpleBaseVO> candidateUsers = new ArrayList<>(); List<UserSimpleBaseVO> candidateUsers = convertList(candidateUserIds, userId -> {
for (Long userId : candidateUserIds) { AdminUserRespDTO user = userMap.get(userId);
UserSimpleBaseVO user = BpmProcessInstanceConvert.INSTANCE.buildUser(userId, userMap, deptMap);
if (user != null) { if (user != null) {
candidateUsers.add(user); return BpmProcessInstanceConvert.INSTANCE.buildUser(userId, userMap, deptMap);
} }
} return null;
});
// 4.3 构建节点信息 // 4.3 构建节点信息
return new ActivityNode() return new ActivityNode()