Ver Fonte

fix 修复 获取可驳回节点重复问题(感谢 搬砖的小庄)

疯狂的狮子Li há 7 meses atrás
pai
commit
1921b22a57

+ 8 - 6
ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/FlwTaskServiceImpl.java

@@ -527,20 +527,22 @@ 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(prefixOrSuffixNodes);
-            return prefixOrSuffixNodes;
+            Collections.reverse(backNodeList);
+            return backNodeList;
         }
         }
         return nodes;
         return nodes;
     }
     }