فهرست منبع

资料查询时,批量上报,审批人电签权限校验

qianxb 2 سال پیش
والد
کامیت
2405e65c38

+ 66 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/EVisaTaskCheckController.java

@@ -114,6 +114,72 @@ public class EVisaTaskCheckController {
         return R.data(300, false, "未选择审批人!!!");
         return R.data(300, false, "未选择审批人!!!");
     }
     }
 
 
+    /**
+     * 资料查询批量上报,检查自定义流程,审批人权限
+     */
+    @PostMapping("/checkCustomFlowUserIsEVisaPermissions2")
+    @ApiOperation(value = "资料查询批量上报,检查自定义流程,审批人权限")
+    @ApiOperationSupport(order = 6)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "customFlowUserList", value = "所选的任务人集合,集合形式", required = true),
+            @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true),
+            @ApiImplicitParam(name = "privatePKeyId", value = "表单列表中的isTypePrivatePid字段,集合形式"),
+            @ApiImplicitParam(name = "theLogPrimaryKeyId", value = "日志左侧所选的填报类型ID"),
+            @ApiImplicitParam(name = "firstId", value = "首件记录ID,列表批量上报时传任意一个即可")
+    })
+    public R<Boolean> batchCheckCustomFlowUserIsEVisaPermissions2(@RequestBody JSONObject json) {
+        if (json.containsKey("customFlowUserList") && !json.getJSONArray("customFlowUserList").isEmpty()) {
+            //获取审批人
+            List<Long> customFlowUserList = json.getJSONArray("customFlowUserList").toJavaList(Long.class);
+            //获取这些审批人在当前合同段的权限
+            List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(customFlowUserList, json.getString("contractId"));
+            if (userRoleList == null || userRoleList.size() <= 0) {
+                return R.data(300, false, "所选审批人均未找到当前表格所需要的签字岗位,请联系服务人员处理");
+            }
+
+            //获取电签配置
+            List<String> list = json.getJSONArray("wbsIds").toJavaList(String.class);
+            Set<String> userNameFail = new HashSet<>();
+            for (String nodeId : list) {
+                WbsTreeContract contract = wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.valueOf(nodeId));
+                List<WbsTreeContract> node = wbsTreeContractClient.queryChildByParentId(contract,"", "");
+                List<Long> ids = new ArrayList<>();
+                for (WbsTreeContract treeContract : node) {
+                    WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.queryPeersNodeByProjectIdAndId(treeContract.getProjectId(), treeContract.getId());
+                    ids.add(wbsTreePrivate.getPKeyId());
+                }
+                JSONObject object = new JSONObject();
+                object.put("privatePKeyId",ids);
+                List<JSONObject> jsonList = this.queryTableEVisaConfig(object);
+                if (jsonList == null || jsonList.size() <= 0) {
+                    return R.data(300, false, "未找到符合电签配置的相关流程,请联系服务人员处理");
+                }
+
+                //汇总电签配置的审批角色
+                List<String> eVisaRoleList = jsonList.stream().map(jsonObject -> jsonObject.getString("sigRoleId")).distinct().collect(Collectors.toList());
+
+                //检查
+                //循环审批人的角色集合,并判断电签配置中是否含有这个角色
+                for (JSONObject userRole : userRoleList) {
+                    if (!eVisaRoleList.contains(userRole.getString("roleId"))) {
+                        User user = this.userClient.userInfoById(userRole.getLong("userId")).getData();
+                        userNameFail.add(user.getRealName());
+                    }
+                }
+
+            }
+            //批量提示
+            if (userNameFail.size() > 0) {
+                return R.data(300, false, "所选中的用户【" + StringUtils.join(userNameFail, ",") + "】不具备当前表格所需要的签字岗位,请联系维护人员处理或更换审批人员");
+            }
+
+            //均满足
+            return R.data(true);
+        }
+
+        return R.data(300, false, "未选择审批人!!!");
+    }
+
     /**
     /**
      * 获取符合条件的预设流程(三大填报页、日志列表的批量上报、首件列表的批量上报)
      * 获取符合条件的预设流程(三大填报页、日志列表的批量上报、首件列表的批量上报)
      */
      */
@@ -363,7 +429,6 @@ public class EVisaTaskCheckController {
         } else {
         } else {
             //资料填报
             //资料填报
             //jsonList = this.eVisaConfigClient.queryEVisaConfigAllByTableIds(json.getJSONArray("privatePKeyId").toJavaList(String.class));
             //jsonList = this.eVisaConfigClient.queryEVisaConfigAllByTableIds(json.getJSONArray("privatePKeyId").toJavaList(String.class));
-
             List<String> ids = json.getJSONArray("privatePKeyId").toJavaList(String.class);
             List<String> ids = json.getJSONArray("privatePKeyId").toJavaList(String.class);
             String sql = "select * from m_textdict_info where tab_id in(" + StringUtils.join(ids, ",") + ")";
             String sql = "select * from m_textdict_info where tab_id in(" + StringUtils.join(ids, ",") + ")";
             List<TextdictInfo> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TextdictInfo.class));
             List<TextdictInfo> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TextdictInfo.class));