Bladeren bron

资料填报&资料查询:上报选择固定流程增加删除用户校验

qianxb 1 jaar geleden
bovenliggende
commit
978f2b6230

+ 37 - 2
blade-service/blade-business/src/main/java/org/springblade/business/controller/EVisaTaskCheckController.java

@@ -372,7 +372,11 @@ public class EVisaTaskCheckController {
 
         //汇总电签配置的审批角色
         List<String> eVisaRoleList = jsonList.stream().map(jsonObject -> jsonObject.getString("sigRoleId")).distinct().collect(Collectors.toList());
-
+        List<User> users = userClient.selectUserAll();
+        if (ObjectUtil.isEmpty(users)){
+            return R.fail(300, "未获取到当前项目用户信息");
+        }
+        List<Long> userIds = users.stream().map(l -> l.getId()).collect(Collectors.toList());
         //校验这些预设流程哪些是符合条件的
         for (FixedFlowVO next : flowList) {
             //先将流程设置为可选
@@ -382,6 +386,20 @@ public class EVisaTaskCheckController {
             List<FixedFlowLink> flowLink = this.fixedFlowLinkService.selectFixedFlowLink(next.getId().toString());
             List<Long> ids = flowLink.stream().map(l -> l.getFixedFlowLinkUser()).collect(Collectors.toList());
 
+            /** 因删除用户没做限制,存在固定流程用户被删除情况,校验用户是否存在 */
+            Set<Long> flowUser = new HashSet<>(ids);
+            flowUser.removeAll(userIds);
+            if (flowUser.size() > 0){
+                next.setDisabled(true);
+                Map<Long, String> nameMap = flowLink.stream().collect(Collectors.toMap(l -> l.getFixedFlowLinkUser(), l -> l.getFixedFlowLinkUserName()));
+                List<String> names = new ArrayList<>();
+                for (Long id : flowUser) {
+                    names.add(nameMap.get(id));
+                }
+                next.setTips("以下用户账号已经删除:"+String.join(",",names));
+                continue;
+            }
+
             //获取这些人资料合同段下的权限
             List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(flowLink.stream().map(FixedFlowLink::getFixedFlowLinkUser).distinct().collect(Collectors.toList()), node.getContractId() + "");
             if (userRoleList == null || userRoleList.size() <= 0) {
@@ -466,7 +484,11 @@ public class EVisaTaskCheckController {
             map.put(info.getWbsId() + "", eVisaRoleList);
         }
 
-
+        List<User> users = userClient.selectUserAll();
+        if (ObjectUtil.isEmpty(users)){
+            return R.fail(300, "未获取到当前项目用户信息");
+        }
+        List<Long> userIds = users.stream().map(l -> l.getId()).collect(Collectors.toList());
         //校验这些预设流程哪些是符合条件的
         for (FixedFlowVO next : flowList) {
             //先将流程设置为可选
@@ -476,6 +498,19 @@ public class EVisaTaskCheckController {
             List<FixedFlowLink> flowLink = this.fixedFlowLinkService.selectFixedFlowLink(next.getId().toString());
             List<Long> ids = flowLink.stream().map(l -> l.getFixedFlowLinkUser()).collect(Collectors.toList());
 
+            /** 因删除用户没做限制,存在固定流程用户被删除情况,校验用户是否存在 */
+            Set<Long> flowUser = new HashSet<>(ids);
+            flowUser.removeAll(userIds);
+            if (flowUser.size() > 0){
+                next.setDisabled(true);
+                Map<Long, String> nameMap = flowLink.stream().collect(Collectors.toMap(l -> l.getFixedFlowLinkUser(), l -> l.getFixedFlowLinkUserName()));
+                List<String> names = new ArrayList<>();
+                for (Long id : flowUser) {
+                    names.add(nameMap.get(id));
+                }
+                next.setTips("以下用户账号已经删除:"+String.join(",",names));
+                continue;
+            }
 
             //获取这些人资料合同段下的权限
             List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(flowLink.stream().map(FixedFlowLink::getFixedFlowLinkUser).distinct().collect(Collectors.toList()), infoList.get(0).getContractId() + "");