Przeglądaj źródła

质检首件4个电签权限校验

qianxb 1 rok temu
rodzic
commit
5dba404b7f

+ 1 - 1
blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/dto/ArchiveWarningDTO.java

@@ -12,7 +12,7 @@ import lombok.Data;
 public class ArchiveWarningDTO {
 
     @ApiModelProperty(value = "节点id")
-    private Long nodeId;
+    private Long nodeIds;
 
     @ApiModelProperty(value = "项目id")
     private Long projectId;

+ 5 - 5
blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/vo/ArchiveWarningVO.java

@@ -12,13 +12,13 @@ import lombok.Data;
 public class ArchiveWarningVO {
 
     @ApiModelProperty(value = "节点id")
-    private Long archiveId;
+    private Long nodeId;
 
-    @ApiModelProperty(value = "项目id")
-    private Long archiveName;
+    @ApiModelProperty(value = "档案名称")
+    private String archiveName;
 
-    @ApiModelProperty(value = "合同id")
-    private Long allOpinion;
+    @ApiModelProperty(value = "问题描述")
+    private String allopinion;
 
     @ApiModelProperty(value = "文件名称")
     private String fileName;

+ 3 - 5
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchivesAutoController.java

@@ -929,7 +929,7 @@ public class ArchivesAutoController extends BladeController {
 	/**
 	 * 档案预警-分页查询
 	 */
-	@GetMapping("/warningPage")
+	@PostMapping("/warningPage")
 	@ApiOperationSupport(order = 36)
 	@ApiOperation(value = "在线验收-编写报告", notes = "传入项目id,节点和整改状态,返回分页信息")
 	@ApiImplicitParams(value = {
@@ -938,7 +938,7 @@ public class ArchivesAutoController extends BladeController {
 			@ApiImplicitParam(name = "projectId", value = "项目id", required = true),
 			@ApiImplicitParam(name = "contractId", value = "合同id", required = true)
 	})
-	public R<IPage<ArchiveWarningVO>> warningPage(Query query, ArchiveWarningDTO dto) {
+	public R<IPage<ArchiveWarningVO>> warningPage(@RequestBody Query query,@RequestBody ArchiveWarningDTO dto) {
 		IPage<ArchiveWarningVO> iPage = archivesAutoService.warningPage(query, dto);
 		return R.data(iPage);
 	}
@@ -946,6 +946,4 @@ public class ArchivesAutoController extends BladeController {
 
 
 
-
-
-	}
+}

+ 4 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.java

@@ -196,4 +196,8 @@ public interface ArchivesAutoMapper extends BaseMapper<ArchivesAuto> {
     List<ArchivesAutoVO2> getAllArchive(@Param("ids") List<Long> longs);
 
 	List<ArchiveFile> searchArchiveFileByArchivesId(@Param("ids") List<Long> ids);
+
+    List<ArchiveWarningVO> getRoutingInspection(@Param("projectId") Long projectId,@Param("nodeId") Long nodeId,@Param("rec") Integer rectification);
+
+	List<ArchiveWarningVO> getSpotCheck(@Param("projectId") Long projectId,@Param("nodeId") Long nodeId);
 }

+ 19 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.xml

@@ -1134,6 +1134,25 @@
             #{id}
         </foreach>
     </select>
+    <select id="getRoutingInspection" resultType="org.springblade.archive.vo.ArchiveWarningVO">
+        select uaf.file_name ,uaf.file_url,0 as sourceType,uaf.node_id,
+               (select uaa.name from u_archives_auto uaa WHERE uaa.id = uaf.archive_id) as archive_name,
+               (select GROUP_CONCAT(uai.opinion) from u_archive_inspection uai WHERE uai.file_id = uaf.id) as allopinion
+        from u_archive_file uaf join m_archive_tree_contract atc on uaf.node_id  = atc.id
+        where uaf.project_id  = #{projectId} and uaf.is_deleted = 0 and uaf.rectification = #{rec}
+          and atc.is_deleted = 0
+          and (atc.id = #{nodeId} or FIND_IN_SET(#{nodeId}, atc.ancestors))
+    </select>
+    <select id="getSpotCheck" resultType="org.springblade.archive.vo.ArchiveWarningVO">
+        select GROUP_CONCAT(aei.opinion) as allopinion,aei.archive_name ,aei.node_id,1 as sourceType
+               (select uaf.file_name from u_archive_file uaf WHERE uaf.id = aei.file_id) as fileName,
+               (select uaf.file_url from u_archive_file uaf WHERE uaf.id = aei.file_id) as fileUrl
+        from m_archive_tree_contract atc join u_archive_expert_inspection aei on aei.node_id  = atc.id
+        where atc.project_id  = #{projectId} and atc.is_deleted = 0 and aei.is_deleted = 0 and aei.is_pass = 0
+          and atc.is_deleted = 0
+          and (atc.id = #{nodeId} or FIND_IN_SET(#{nodeId}, atc.ancestors))
+        GROUP by aei.file_id
+    </select>
 
 
     <update id="splitFiles">

+ 41 - 2
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java

@@ -3521,8 +3521,47 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 	 */
 	@Override
 	public IPage<ArchiveWarningVO> warningPage(Query query, ArchiveWarningDTO dto) {
-
-		return null;
+		Integer current = query.getCurrent();
+		Integer size = query.getSize();
+		IPage<ArchiveWarningVO> iPage = new Page<>(current,size);
+		//总结果集
+		List<ArchiveWarningVO> vos = new ArrayList<>();
+		//查询档案巡检的数据
+		List<ArchiveWarningVO> vo1 = baseMapper.getRoutingInspection(dto.getProjectId(),dto.getNodeIds(),dto.getRectification());
+		if (vo1.size() != 0){
+			vos.addAll(vo1);
+		}
+		//查询出档案验收的数据
+		List<ArchiveWarningVO> vo2 = baseMapper.getSpotCheck(dto.getProjectId(),dto.getNodeIds());
+		if (vo2.size() != 0){
+			vos.addAll(vo2);
+		}
+		if (vos.size() == 0){
+			iPage.setTotal(0);
+			return iPage;
+		}
+		iPage.setTotal(vos.size());
+		//根据节点id排序,手动分页
+		vos = vos.stream().sorted(Comparator.comparing(ArchiveWarningVO::getNodeId)).collect(Collectors.toList());
+		if (current*size <= vos.size()) {
+			vos = vos.subList((current - 1) * size, current * size);
+		}else {
+			vos = vos.subList((current - 1) * size, vos.size());
+		}
+		//循环验收的数据,拼接专家意见
+		vos.stream().forEach(l->{
+			String allopinion = l.getAllopinion();
+			if (StringUtils.isNotBlank(allopinion)){
+				List<String> list = Func.toStrList(allopinion);
+				StringBuilder str = new StringBuilder();
+				for (int i = 1; i <= list.size(); i++) {
+					str.append(i+""+list.get(i-1));
+				}
+				l.setAllopinion(str.toString());
+			}
+		});
+		iPage.setRecords(vos);
+		return iPage;
 	}
 
 

+ 130 - 23
blade-service/blade-business/src/main/java/org/springblade/business/controller/EVisaTaskCheckController.java

@@ -235,6 +235,95 @@ public class EVisaTaskCheckController {
         return R.data(300, false, "未选择审批人!!!");
     }
 
+    /**
+     * 检查自选的任务人是否存在电签信息,日志,首件使用
+     */
+    @PostMapping("/checkCustomFlowUserIsEVisaPermissions3")
+    @ApiOperation(value = "检查所选的流程环节处理人是否具有审批权限(三大填报页、日志列表的批量上报、首件列表的批量上报)")
+    @ApiOperationSupport(order = 6)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "customFlowUserList", value = "所选的任务人集合,集合形式", required = true),
+            @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true),
+            @ApiImplicitParam(name = "nodeId", value = "当前节点的PkeyId", required = true),
+            @ApiImplicitParam(name = "privatePKeyId", value = "表单列表中的isTypePrivatePid字段,集合形式"),
+            @ApiImplicitParam(name = "theLogPrimaryKeyId", value = "日志左侧所选的填报类型ID"),
+            @ApiImplicitParam(name = "firstId", value = "首件记录ID,列表批量上报时传任意一个即可")
+    })
+    public R<Boolean> checkCustomFlowUserIsEVisaPermissions3(@RequestBody JSONObject json) {
+        if (json.containsKey("customFlowUserList") && !json.getJSONArray("customFlowUserList").isEmpty()) {
+            Long cId = json.getLong("contractId");
+            //获取对应表格的所有电签配置
+            String logIds = json.getString("theLogPrimaryKeyId");
+            String firstIds = json.getString("firstId");
+            List<Long> longs = new ArrayList<>();
+            String pdfUrl = "";
+            if (StringUtils.isNotBlank(logIds)) {
+                longs = Func.toLongList(logIds);
+                ContractLog log = logService.getById(longs.get(0));
+                if (log == null || StringUtils.isBlank(log.getPdfUrl())) {
+                    return R.fail(300, "当前日志还未生成PDF,不能上报");
+                }
+                pdfUrl = log.getPdfUrl();
+            }else if (StringUtils.isNotBlank(firstIds)){
+                longs = Func.toLongList(firstIds);
+                InformationQuery query = informationQueryService.getById(longs.get(0));
+                if (query == null || StringUtils.isBlank(query.getPdfUrl())) {
+                    return R.fail(300, "当前首件还未生成PDF,不能上报");
+                }
+                pdfUrl = query.getPdfUrl();
+            }
+
+            if (StringUtils.isBlank(pdfUrl)) {
+                return R.fail(300, "当前节点还未生成PDF,不能上报");
+            }
+            //获取审批人
+            List<Long> customFlowUserList = json.getJSONArray("customFlowUserList").toJavaList(Long.class);
+            //获取这些审批人在资料合同段的权限
+            List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(customFlowUserList, cId + "");
+            if (userRoleList == null || userRoleList.size() <= 0) {
+                //查看项目下是否有监理合同段关联资料合同段
+                Long contractId = jdbcTemplate.queryForObject("SELECT id from m_contract_info mci WHERE contract_type = 2 \n" +
+                        "and id in (SELECT contract_id_jlyz  FROM m_contract_relation_jlyz WHERE contract_id_sg = " + cId + ")", Long.class);
+                if (contractId == null) {
+                    return R.data(300, false, "所选审批人均未找到当前表格所需要的签字岗位,请联系服务人员处理");
+                }
+                userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(customFlowUserList, contractId + "");
+                if (userRoleList == null || userRoleList.size() <= 0) {
+                    return R.data(300, false, "所选审批人均未找到当前表格所需要的签字岗位,请联系服务人员处理");
+                }
+            }
+
+            //获取电签配置
+            List<JSONObject> jsonList = this.queryTableEVisaConfig(json, pdfUrl);
+            if (jsonList == null) {
+                return R.data(300, false, "未找到符合电签配置的相关流程,请重新保存后上报");
+            }
+
+            //汇总电签配置的审批角色
+            List<String> eVisaRoleList = jsonList.stream().map(jsonObject -> jsonObject.getString("sigRoleId")).distinct().collect(Collectors.toList());
+
+            //检查
+            //循环审批人的角色集合,并判断电签配置中是否含有这个角色
+            List<String> userNameFail = new ArrayList<>();
+            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, "未选择审批人!!!");
+    }
+
     /**
      * 获取符合条件的预设流程(三大填报页、日志列表的批量上报、首件列表的批量上报)
      */
@@ -443,20 +532,38 @@ public class EVisaTaskCheckController {
         FixedFlowVO vo = new FixedFlowVO();
         vo.setCurrent(1);
         vo.setSize(100);
-        vo.setContractId(json.getLong("contractId"));
+        Long contractId = json.getLong("contractId");
+        vo.setContractId(contractId);
         vo.setProjectId(json.getLong("projectId"));
 
         IPage<FixedFlowVO> flowPage = this.fixedFlowService.selectFixedFlowPage(vo);
         List<FixedFlowVO> flowList = flowPage.getRecords();
 
         //获取对应表格的所有电签配置
-        String logIds = json.getString("nodeId");
-        List<Long> longs = Func.toLongList(logIds);
-        ContractLog log = logService.getById(longs.get(0));
-        if (log == null || StringUtils.isBlank(log.getPdfUrl())) {
+        String logIds = json.getString("theLogPrimaryKeyId");
+        String firstIds = json.getString("firstId");
+        List<Long> longs = new ArrayList<>();
+        String pdfUrl = "";
+        if (StringUtils.isNotBlank(logIds)) {
+            longs = Func.toLongList(logIds);
+            ContractLog log = logService.getById(longs.get(0));
+            if (log == null || StringUtils.isBlank(log.getPdfUrl())) {
+                return R.fail(300, "当前日志还未生成PDF,不能上报");
+            }
+            pdfUrl = log.getPdfUrl();
+        }else if (StringUtils.isNotBlank(firstIds)){
+                longs = Func.toLongList(firstIds);
+            InformationQuery query = informationQueryService.getById(longs.get(0));
+            if (query == null || StringUtils.isBlank(query.getPdfUrl())) {
+                return R.fail(300, "当前首件还未生成PDF,不能上报");
+            }
+            pdfUrl = query.getPdfUrl();
+        }
+
+        if (StringUtils.isBlank(pdfUrl)) {
             return R.fail(300, "当前节点还未生成PDF,不能上报");
         }
-        List<JSONObject> jsonList = this.queryTableEVisaConfig(json, log.getPdfUrl());
+        List<JSONObject> jsonList = this.queryTableEVisaConfig(json, pdfUrl);
 
         if (jsonList == null || jsonList.size() == 0) {
             return R.fail(300, "未找到符合电签配置的相关流程,请重新保存再上报");
@@ -476,10 +583,10 @@ public class EVisaTaskCheckController {
             List<Long> ids = flowLink.stream().map(l -> l.getFixedFlowLinkUser()).collect(Collectors.toList());
 
             //获取这些人资料合同段下的权限
-            List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(flowLink.stream().map(FixedFlowLink::getFixedFlowLinkUser).distinct().collect(Collectors.toList()), log.getContractId() + "");
+            List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(flowLink.stream().map(FixedFlowLink::getFixedFlowLinkUser).distinct().collect(Collectors.toList()), contractId + "");
             if (userRoleList == null || userRoleList.size() <= 0) {
                 //查看当前项目下是否有监理合同段关联此合同段
-                String sql = "SELECT id from m_contract_info mci WHERE contract_type = 2 and id in (SELECT contract_id_jlyz  FROM m_contract_relation_jlyz WHERE contract_id_sg = " + log.getContractId() + ")";
+                String sql = "SELECT id from m_contract_info mci WHERE contract_type = 2 and id in (SELECT contract_id_jlyz  FROM m_contract_relation_jlyz WHERE contract_id_sg = " + contractId + ")";
                 ContractInfo contractInfo = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
                 if (contractInfo != null) {
                     userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(ids, contractInfo.getId() + "");
@@ -693,20 +800,20 @@ public class EVisaTaskCheckController {
      */
     private List<JSONObject> queryTableEVisaConfig(JSONObject json, String eVisaPDFUrl) {
         List<JSONObject> jsonList;
-        if (json.containsKey("theLogPrimaryKeyId") && StringUtils.isNotEmpty(json.getString("theLogPrimaryKeyId"))) {
-            //日志,需要先获取对应的表格
-            jsonList = this.queryTableEVisaConfig(Func.toStrList(json.getString("theLogPrimaryKeyId")));
-
-        } else if (json.containsKey("firstId") && StringUtils.isNotEmpty(json.getString("firstId"))) {
-            //首件,先获取记录
-            InformationQuery query = this.informationQueryService.getById(json.getLong("firstId"));
-            if (query != null) {
-                jsonList = this.queryTableEVisaConfig(Func.toStrList(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(query.getTableId()).getIsTypePrivatePid().toString()));
-            } else {
-                jsonList = null;
-            }
-
-        } else {
+//        if (json.containsKey("theLogPrimaryKeyId") && StringUtils.isNotEmpty(json.getString("theLogPrimaryKeyId"))) {
+//            //日志,需要先获取对应的表格
+//            jsonList = this.queryTableEVisaConfig(Func.toStrList(json.getString("theLogPrimaryKeyId")));
+//
+//        } else if (json.containsKey("firstId") && StringUtils.isNotEmpty(json.getString("firstId"))) {
+//            //首件,先获取记录
+//            InformationQuery query = this.informationQueryService.getById(json.getLong("firstId"));
+//            if (query != null) {
+//                jsonList = this.queryTableEVisaConfig(Func.toStrList(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(query.getTableId()).getIsTypePrivatePid().toString()));
+//            } else {
+//                jsonList = null;
+//            }
+//
+//        } else {
             //资料填报
             List<String> ids = PDFUtil.getPdfSignIds(eVisaPDFUrl);
             if (ids == null || ids.size() == 0) {
@@ -715,7 +822,7 @@ public class EVisaTaskCheckController {
             String sql = "select * from m_textdict_info where id in(" + StringUtils.join(ids, ",") + ") ";
             List<TextdictInfo> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TextdictInfo.class));
             jsonList = JSONArray.parseArray(JSONObject.toJSONString(query), JSONObject.class);
-        }
+//        }
         return jsonList;
     }
 

+ 1 - 1
blade-service/blade-land/src/main/resources/application-dev.yml

@@ -1,6 +1,6 @@
 #服务器端口
 server:
-  port: 9102
+  port: 9107
 
 #数据源配置
 spring: