Browse Source

解决传阅选择人员重复问题

dzx 8 months ago
parent
commit
5dcfef12cb
1 changed files with 9 additions and 9 deletions
  1. 9 9
      src/main/java/com/xjrsoft/module/workflow/utils/WorkFlowUtil.java

+ 9 - 9
src/main/java/com/xjrsoft/module/workflow/utils/WorkFlowUtil.java

@@ -239,10 +239,10 @@ public class WorkFlowUtil {
      * @return
      */
     public static List<Long> getUserIdsByMemberConfig(List<MemberConfig> memberConfigs, List<Map<String, Object>> childNodeConfig, String processId) {
-        List<Long> result = new ArrayList<>();
+        Set<Long> result = new HashSet<>();
 
-        if (memberConfigs.size() == 0) {
-            return result;
+        if (memberConfigs.isEmpty()) {
+            return new ArrayList<>();
         }
 
         RedisUtil redisUtil = SpringUtil.getBean(RedisUtil.class);
@@ -330,7 +330,7 @@ public class WorkFlowUtil {
                 Optional<Map<String, Object>> nodeMap = childNodeConfig.stream().filter(x -> x.get(GlobalConstant.DEFAULT_PK).equals(leaderConfig.getNodeId())).findFirst();
 
                 if (!nodeMap.isPresent()) {
-                    return result;
+                    return new ArrayList<>(result);
                 }
 
                 //如果是开始节点
@@ -344,7 +344,7 @@ public class WorkFlowUtil {
                     //获取到发起人用户信息
                     Optional<User> startUserOp = users.stream().filter(x -> x.getId().equals(startUserId)).findFirst();
                     if (!startUserOp.isPresent()) {
-                        return result;
+                        return new ArrayList<>(result);
                     }
 
                     Long postId;
@@ -362,7 +362,7 @@ public class WorkFlowUtil {
 
                     Optional<Post> thisApproveOp = posts.stream().filter(x -> x.getId().equals(postId)).findFirst();
                     if (!thisApproveOp.isPresent()) {
-                        return result;
+                        return new ArrayList<>(result);
                     }
 
                     Post thisUserPost = thisApproveOp.get();
@@ -374,7 +374,7 @@ public class WorkFlowUtil {
 
                         //如果当前循环次数 找不到上级
                         if (!parentPostOp.isPresent()) {
-                            return result;
+                            return new ArrayList<>(result);
                         } else {
                             thisUserPost = parentPostOp.get();
                         }
@@ -405,7 +405,7 @@ public class WorkFlowUtil {
 //                            }
 //                        }
 //                    }
-                    return result;
+                    return new ArrayList<>(result);
 
                 } else {
                     //将map 转为 java类  默认只有用户任务节点才有审批人
@@ -496,7 +496,7 @@ public class WorkFlowUtil {
 
             }
         }
-        return result;
+        return new ArrayList<>(result);
     }