فهرست منبع

Merge remote-tracking branch 'origin/master'

liuyc 2 سال پیش
والد
کامیت
04ffc9531c

+ 33 - 5
blade-service/blade-business/src/main/java/org/springblade/business/controller/EVisaTaskCheckController.java

@@ -18,6 +18,7 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.entity.SignPfxFile;
+import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.feign.*;
 import org.springblade.system.user.entity.User;
@@ -45,6 +46,8 @@ public class EVisaTaskCheckController {
 
     private final WbsTreePrivateClient wbsTreePrivateClient;
 
+    private final WbsTreeContractClient wbsTreeContractClient;
+
     private final IUserClient userClient;
 
     private final IInformationQueryService informationQueryService;
@@ -94,12 +97,36 @@ public class EVisaTaskCheckController {
             List<Long> linkUserList = flowLink.stream().map(FixedFlowLink::getFixedFlowLinkUser).distinct().collect(Collectors.toList());
             List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(linkUserList, json.getString("contractId"));
 
-            
-
-        }
+            //因为是批量的,所以需要一一校验
+            List<String> queryIds = json.getJSONArray("queryIds").toJavaList(String.class);
+            for(String queryId : queryIds){
+                //先获取记录
+                InformationQuery query = this.informationQueryService.getById(queryId);
+                //根据节点及具体类型做表格区分
+                List<WbsTreeContract> tableList = this.wbsTreeContractClient.queryChildByParentId(this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(query.getWbsId()), "queryTable", String.valueOf(query.getClassify()));
+                //获取指向ID
+                List<Long> privateTablePrimaryKeyIds = tableList.stream().map(WbsTreeContract::getIsTypePrivatePid).distinct().collect(Collectors.toList());
+
+                //获取这些表格的电签配置信息
+                List<JSONObject> jsonList = this.queryTableEVisaConfig(JSONArray.parseArray(JSONObject.toJSONString(privateTablePrimaryKeyIds), String.class));
+                if(jsonList == null){
+                    return R.data(300, false, "所选资料【" + query.getName() + "】未找到电签配置,请联系维护人员处理或暂时取消这份资料的上报");
+                }
 
+                //汇总电签配置的审批角色
+                List<String> eVisaRoleList = jsonList.stream().map(jsonObject -> jsonObject.getString("sigRoleId")).distinct().collect(Collectors.toList());
 
-        return R.data(300, false, "未找到流程");
+                //循环审批人的角色集合,并判断电签配置中是否含有这个角色
+                for(JSONObject userRole : userRoleList){
+                    if(!eVisaRoleList.contains(userRole.getString("roleId"))){
+                        User user = this.userClient.userInfoById(userRole.getLong("userId")).getData();
+                        return R.data(300, false, "所选流程中的用户【" + user.getRealName() + "】对于所选资料【" + query.getName() + "】不具有相关审批权限,请联系维护人员处理或更换审批流程");
+                    }
+                }
+            }
+            return R.data(200, true, "满足上报条件");
+        }
+        return R.data(300, false, "未找到对应流程,请重新选择");
     }
 
 
@@ -141,6 +168,7 @@ public class EVisaTaskCheckController {
                 }
 
             } else {
+                //资料填报
                 jsonList = this.eVisaConfigClient.queryEVisaConfigAllByTableIds(json.getJSONArray("privatePKeyId").toJavaList(String.class));
             }
 
@@ -154,7 +182,7 @@ public class EVisaTaskCheckController {
             for(JSONObject userRole : userRoleList){
                 if(!eVisaRoleList.contains(userRole.getString("roleId"))){
                     User user = this.userClient.userInfoById(userRole.getLong("userId")).getData();
-                    return R.data(300, false, "所选流程中的用户【" + user.getRealName() + "】不具有相关审批角色,请联系维护人员处理或更换审批流程");
+                    return R.data(300, false, "所选流程中的用户【" + user.getRealName() + "】不具有相关审批权限,请联系维护人员处理或更换审批流程");
                 }
             }