fix: 优化驳回选择节点重复展示

Signed-off-by: 搬砖的小庄 <1909017815@qq.com>
This commit is contained in:
搬砖的小庄 2025-12-10 10:48:49 +00:00 committed by Gitee
parent 39b19ac361
commit f401c17e3a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -527,20 +527,19 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
} }
//获取可驳回的前置节点 //获取可驳回的前置节点
List<Node> nodes = nodeService.previousNodeList(task.getDefinitionId(), nowNodeCode); List<Node> nodes = nodeService.previousNodeList(task.getDefinitionId(), nowNodeCode);
List<HisTask> taskList = hisTaskService.getByInsId(task.getInstanceId()); List<HisTask> hisTaskList = hisTaskService.getByInsId(task.getInstanceId());
Map<String, Node> nodeMap = StreamUtils.toIdentityMap(nodes, Node::getNodeCode); Map<String, Node> nodeMap = StreamUtils.toIdentityMap(nodes, Node::getNodeCode);
Set<String> added = new HashSet<>();
List<Node> backNodeList = new ArrayList<>(); List<Node> backNodeList = new ArrayList<>();
for (HisTask hisTask : taskList) { for (HisTask hisTask : hisTaskList) {
Node nodeValue = nodeMap.get(hisTask.getNodeCode()); Node nodeValue = nodeMap.get(hisTask.getNodeCode());
if (nodeValue != null) { if (nodeValue != null && NodeType.BETWEEN.getKey().equals(nodeValue.getNodeType()) && added.add(nodeValue.getNodeCode())) {
backNodeList.add(nodeValue); backNodeList.add(nodeValue);
} }
} }
if (CollUtil.isNotEmpty(backNodeList)) { if (CollUtil.isNotEmpty(backNodeList)) {
List<Node> prefixOrSuffixNodes = StreamUtils.filter(backNodeList, e -> NodeType.BETWEEN.getKey().equals(e.getNodeType())); Collections.reverse(backNodeList);
Collections.reverse(prefixOrSuffixNodes); return backNodeList;
return prefixOrSuffixNodes;
} }
return nodes; return nodes;
} }