ソースを参照

Merge branch 'master' of http://121.41.40.202:3000/zhuwei/bladex

huangtf 1 年間 前
コミット
a24ce61bbc
16 ファイル変更281 行追加188 行削除
  1. 3 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/BusinessTaskPageVO.java
  2. 122 129
      blade-service/blade-business/src/main/java/org/springblade/business/controller/EVisaTaskCheckController.java
  3. 32 20
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  4. 2 1
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java
  5. 42 0
      blade-service/blade-business/src/main/java/org/springblade/business/utils/PDFUtil.java
  6. 3 1
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/AttachmentInfoMapper.java
  7. 8 1
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/AttachmentInfoMapper.xml
  8. 3 1
      blade-service/blade-land/src/main/java/org/springblade/land/service/IAttachmentInfoService.java
  9. 11 2
      blade-service/blade-land/src/main/java/org/springblade/land/service/impl/AttachmentInfoServiceImpl.java
  10. 8 6
      blade-service/blade-land/src/main/java/org/springblade/land/service/impl/PolicyInfoServiceImpl.java
  11. 6 0
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/CustomFunction.java
  12. 2 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/FormulaController.java
  13. 30 22
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsParamController.java
  14. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/TableElementConverter.java
  15. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java
  16. 7 3
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsParamServiceImpl.java

+ 3 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/BusinessTaskPageVO.java

@@ -47,4 +47,7 @@ public class BusinessTaskPageVO implements Serializable {
     @ApiModelProperty(value = "流程实例id")
     private String processInstanceId;
 
+    @ApiModelProperty(value = "流程分支实例id")
+    private String parallelProcessInstanceId;
+
 }

+ 122 - 129
blade-service/blade-business/src/main/java/org/springblade/business/controller/EVisaTaskCheckController.java

@@ -3,6 +3,7 @@ package org.springblade.business.controller;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
@@ -17,6 +18,8 @@ import org.springblade.business.entity.InformationQuery;
 import org.springblade.business.service.IFixedFlowLinkService;
 import org.springblade.business.service.IFixedFlowService;
 import org.springblade.business.service.IInformationQueryService;
+import org.springblade.business.utils.PDFUtil;
+import org.springblade.business.vo.AddContractTreeNodeVO;
 import org.springblade.business.vo.FixedFlowVO;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
@@ -71,20 +74,34 @@ public class EVisaTaskCheckController {
     @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> checkCustomFlowUserIsEVisaPermissions(@RequestBody JSONObject json) {
         if (json.containsKey("customFlowUserList") && !json.getJSONArray("customFlowUserList").isEmpty()) {
+            //获取对应表格的所有电签配置
+            String tableOwner = json.getString("tableOwner");
+            if (StringUtils.isBlank(tableOwner)){
+                tableOwner = json.getString("classifyType");
+            }
+            //查询当前节点的PDF
+            InformationQuery node = informationQueryService.getOne(new LambdaQueryWrapper<InformationQuery>()
+                    .eq(InformationQuery::getWbsId,json.getString("nodeId"))
+                    .eq(InformationQuery::getClassify,tableOwner));
+
+            if (node == null || StringUtils.isBlank(node.getPdfUrl())){
+                return  R.fail(300, "当前节点还未生成PDF,不能上报");
+            }
             //获取审批人
             List<Long> customFlowUserList = json.getJSONArray("customFlowUserList").toJavaList(Long.class);
-            //获取这些审批人在当前合同段的权限
-            List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(customFlowUserList, json.getString("contractId"));
+            //获取这些审批人在资料合同段的权限
+            List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(customFlowUserList, node.getContractId()+"");
             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 = " + json.getString("contractId")+")",Long.class);
+                        "and id in (SELECT contract_id_jlyz  FROM m_contract_relation_jlyz WHERE contract_id_sg = " + node.getContractId()+")",Long.class);
                 if (contractId == null) {
                     return R.data(300, false, "所选审批人均未找到当前表格所需要的签字岗位,请联系服务人员处理");
                 }
@@ -95,9 +112,9 @@ public class EVisaTaskCheckController {
             }
 
             //获取电签配置
-            List<JSONObject> jsonList = this.queryTableEVisaConfig(json);
+            List<JSONObject> jsonList = this.queryTableEVisaConfig(json,node.getPdfUrl());
             if (jsonList == null) {
-                return R.data(300, false, "未找到符合电签配置的相关流程,请联系服务人员处理");
+                return R.data(300, false, "未找到符合电签配置的相关流程,请重新保存后上报");
             }
 
             //汇总电签配置的审批角色
@@ -140,55 +157,39 @@ public class EVisaTaskCheckController {
     })
     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"));
+            //获取电签配置,先获取所有节点的infoIds
+            List<Long> list = Func.toLongList( json.getString("infoIds"));
+            if (list == null || list.size() <= 0){
+                return R.fail( "请选择一条数据");
+            }
+            List<InformationQuery> infoList = informationQueryService.list(new LambdaQueryWrapper<InformationQuery>()
+                    .in(InformationQuery::getId, list));
+            if (infoList == null || infoList.size() <= 0){
+                return R.fail("没有获取到当前所有资料的上报信息");
+            }
+            //获取这些审批人在资料合同段的权限
+            List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(customFlowUserList, infoList.get(0).getContractId()+"");
             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 = " + json.getString("contractId")+")",Long.class);
                 if (contractId == null) {
-                    return R.data(300, false, "所选审批人均未找到当前表格所需要的签字岗位,请联系服务人员处理");
+                    return R.fail( "所选审批人均未找到当前表格所需要的签字岗位,请联系服务人员处理");
                 }
                 userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(customFlowUserList, contractId+"");
                 if (userRoleList == null || userRoleList.size() <= 0){
-                    return R.data(300, false, "所选审批人均未找到当前表格所需要的签字岗位,请联系服务人员处理");
+                    return R.fail("所选审批人均未找到当前表格所需要的签字岗位,请联系服务人员处理");
                 }
             }
 
-            //获取电签配置
-            List<String> list = json.getJSONArray("privatePKeyId").toJavaList(String.class);
             Map<String, Set<String>> userNameFail = new HashMap<>();
-            for (String nodeId : list) {
-                //获取节点信息
-                WbsTreeContract contract = wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.valueOf(nodeId));
-                //获取节点下每个填报表
-                List<WbsTreeContract> node = wbsTreeContractClient.queryChildByParentId(contract, "", "");
-                Set<Long> ids = new HashSet<>();
-                //获取每个填报表对应的wbs_tree_private的id
-//                for (WbsTreeContract treeContract : node) {
-//                    WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.queryPeersNodeByProjectIdAndId(treeContract.getProjectId(), treeContract.getId());
-//                    ids.add(wbsTreePrivate.getPKeyId());
-////                    if (StringUtils.isNotBlank(treeContract.getIsTypePrivatePid()+"")){
-////                        ids.add(treeContract.getIsTypePrivatePid());
-////                    }
-//                }
-                if (node != null && node.size() > 0){
-                    List<Long> setIds = node.stream().map(l -> l.getId()).collect(Collectors.toList());
-                    Set<Long> setPIds = node.stream().map(l -> l.getIsTypePrivatePid()).collect(Collectors.toSet());
-                    ids.addAll(setPIds);
-                    Set<Long> tableIds = wbsTreePrivateClient.getAllPrivateTableByIds(Long.parseLong(contract.getProjectId()), setIds);
-                    if (tableIds != null && tableIds.size() > 0) {
-                        ids.addAll(tableIds);
-                    }
-                    ids.addAll(tableIds);
-                }
-                JSONObject object = new JSONObject();
-                object.put("privatePKeyId", ids);
-                List<JSONObject> jsonList = this.queryTableEVisaConfig(object);
+            for (InformationQuery info : infoList) {
+                List<JSONObject> jsonList = this.queryTableEVisaConfig(json,info.getPdfUrl());
                 if (jsonList == null || jsonList.size() <= 0) {
-                    return R.data(300, false, contract.getNodeName() + ":未找到符合电签配置的相关流程,请联系服务人员处理");
+                    return R.fail( info.getName() + ":未找到电签配置");
                 }
 
                 //汇总电签配置的审批角色
@@ -199,7 +200,6 @@ public class EVisaTaskCheckController {
                 for (JSONObject userRole : userRoleList) {
                     if (!eVisaRoleList.contains(userRole.getString("roleId"))) {
                         User user = this.userClient.userInfoById(userRole.getLong("userId")).getData();
-                        InformationQuery info = informationQueryService.getInfoByWbsId(nodeId);
                         if (userNameFail.containsKey(user.getRealName())) {
                             Set<String> set = userNameFail.get(user.getRealName());
                             set.add(info.getName());
@@ -219,7 +219,7 @@ public class EVisaTaskCheckController {
                 for (String key : userNameFail.keySet()) {
                     stringBuilder.append("所选中的用户【" + key + "】不具备【" + StringUtils.join(userNameFail.get(key), ",") + "】表格所需要的签字岗位,请联系维护人员处理或更换审批人员");
                 }
-                return R.data(300, false, stringBuilder.toString());
+                return R.fail(stringBuilder.toString());
             }
 
             //均满足
@@ -237,6 +237,7 @@ public class EVisaTaskCheckController {
     @ApiOperation(value = "获取符合条件的预设流程(三大填报页、日志列表的批量上报、首件列表的批量上报)")
     @ApiImplicitParams({
             @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,列表批量上报时传任意一个即可")
@@ -253,10 +254,22 @@ public class EVisaTaskCheckController {
         List<FixedFlowVO> flowList = flowPage.getRecords();
 
         //获取对应表格的所有电签配置
-        List<JSONObject> jsonList = this.queryTableEVisaConfig(json);
+        String tableOwner = json.getString("tableOwner");
+        if (StringUtils.isBlank(tableOwner)){
+            tableOwner = json.getString("classifyType");
+        }
+        //查询当前节点的PDF
+        InformationQuery node = informationQueryService.getOne(new LambdaQueryWrapper<InformationQuery>()
+                .eq(InformationQuery::getWbsId,json.getString("nodeId"))
+                .eq(InformationQuery::getClassify,tableOwner));
 
-        if (jsonList == null) {
-            return R.fail(300, "未找到符合电签配置的相关流程,请联系服务人员处理");
+        if (node == null || StringUtils.isBlank(node.getPdfUrl())){
+            return  R.fail(300, "当前节点还未生成PDF,不能上报");
+        }
+        List<JSONObject> jsonList = this.queryTableEVisaConfig(json,node.getPdfUrl());
+
+        if (jsonList == null || jsonList.size() == 0) {
+            return R.fail(300, "未找到符合电签配置的相关流程,请重新保存再上报");
         }
 
 
@@ -271,8 +284,8 @@ public class EVisaTaskCheckController {
             //首先找到对应流程下的审批人组
             List<FixedFlowLink> flowLink = this.fixedFlowLinkService.selectFixedFlowLink(next.getId().toString());
 
-            //获取这些人当前合同段下的权限
-            List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(flowLink.stream().map(FixedFlowLink::getFixedFlowLinkUser).distinct().collect(Collectors.toList()), json.getString("contractId"));
+            //获取这些人资料合同段下的权限
+            List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(flowLink.stream().map(FixedFlowLink::getFixedFlowLinkUser).distinct().collect(Collectors.toList()), node.getContractId()+"");
             if (userRoleList == null) {
                 next.setDisabled(true);
             } else {
@@ -330,39 +343,23 @@ public class EVisaTaskCheckController {
         //每个自定义流程
         List<FixedFlowVO> flowList = flowPage.getRecords();
 
-        //获取电签配置
-        List<String> list = json.getJSONArray("privatePKeyId").toJavaList(String.class);
+        //获取电签配置,先获取所有节点的infoIds
+        List<Long> list = Func.toLongList( json.getString("infoIds"));
+        if (list == null || list.size() <= 0){
+            return R.fail("请选择一条数据");
+        }
+        List<InformationQuery> infoList = informationQueryService.list(new LambdaQueryWrapper<InformationQuery>()
+                .in(InformationQuery::getId, list));
         Map<String,List<String>> map = new HashMap<>();
-        for (String nodeId : list) {
-            //获取节点信息
-            WbsTreeContract contract = wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.valueOf(nodeId));
-            //获取节点下每个填报表
-            List<WbsTreeContract> node = wbsTreeContractClient.queryChildByParentId(contract, "", "");
-            Set<Long> ids = new HashSet<>();
-            //获取每个填报表对应的wbs_tree_private的id
-//            for (WbsTreeContract treeContract : node) {
-//                WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.queryPeersNodeByProjectIdAndId(treeContract.getProjectId(), treeContract.getId());
-//                ids.add(wbsTreePrivate.getPKeyId());
-//            }
-            if (node != null && node.size() > 0){
-                List<Long> setIds = node.stream().map(l -> l.getId()).collect(Collectors.toList());
-                Set<Long> setPIds = node.stream().map(l -> l.getIsTypePrivatePid()).collect(Collectors.toSet());
-                ids.addAll(setPIds);
-                Set<Long> tableIds = wbsTreePrivateClient.getAllPrivateTableByIds(Long.parseLong(contract.getProjectId()), setIds);
-                if (tableIds != null && tableIds.size() > 0) {
-                    ids.addAll(tableIds);
-                }
-            }
-            JSONObject object = new JSONObject();
-            object.put("privatePKeyId", ids);
-            List<JSONObject> jsonList = this.queryTableEVisaConfig(object);
+        for (InformationQuery info : infoList) {
+            List<JSONObject> jsonList = this.queryTableEVisaConfig(json,info.getPdfUrl());
             if (jsonList == null || jsonList.size() <= 0) {
-                return R.data(300, null, contract.getNodeName() + ":有节点下所有表单都没配置电签,请联系服务人员处理");
+                return R.fail("资料没有配置电签,请尝试重新保存再上报");
             }
 
             //汇总电签配置的审批角色
             List<String> eVisaRoleList = jsonList.stream().map(jsonObject -> jsonObject.getString("sigRoleId")).distinct().collect(Collectors.toList());
-            map.put(nodeId,eVisaRoleList);
+            map.put(info.getWbsId()+"",eVisaRoleList);
         }
 
 
@@ -376,12 +373,12 @@ 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()), json.getString("contractId"));
+            //获取这些人资料合同段下的权限
+            List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(flowLink.stream().map(FixedFlowLink::getFixedFlowLinkUser).distinct().collect(Collectors.toList()),infoList.get(0).getContractId()+"" );
             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 = " + json.getString("contractId")+")",Long.class);
+                        "and id in (SELECT contract_id_jlyz  FROM m_contract_relation_jlyz WHERE contract_id_sg = " + infoList.get(0).getContractId()+")",Long.class);
                 if (contractId != null) {
                     userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(ids, contractId+"");
                 }
@@ -517,55 +514,55 @@ public class EVisaTaskCheckController {
     }
 
 
-    /**
-     * 检查所选的流程环节处理人是否具有审批权限(三大填报页、日志列表的批量上报、首件列表的批量上报)
-     */
-    @PostMapping("/checkFlowUserIsEVisaPermissions")
-    @ApiOperation(value = "检查所选的流程环节处理人是否具有审批权限(三大填报页、日志列表的批量上报、首件列表的批量上报)")
-    @ApiOperationSupport(order = 2)
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "flowId", value = "所选的流程ID", 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> checkFlowUserIsEVisaPermissions(@RequestBody JSONObject json) {
-        if (json.containsKey("flowId")) {
-            //首先找到对应流程下的审批人组
-            List<FixedFlowLink> flowLink = this.fixedFlowLinkService.selectFixedFlowLink(json.getString("flowId"));
-
-            //获取这些人当前合同段下的权限
-            List<Long> linkUserList = flowLink.stream().map(FixedFlowLink::getFixedFlowLinkUser).distinct().collect(Collectors.toList());
-            List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(linkUserList, json.getString("contractId"));
-
-            //获取对应表格的所有电签配置
-            List<JSONObject> jsonList = this.queryTableEVisaConfig(json);
-
-            if (jsonList == null) {
-                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();
-                    return R.data(300, false, "所选流程中的用户【" + user.getRealName() + "】不具有相关审批权限,请联系维护人员处理或更换审批流程");
-                }
-            }
-
-            return R.data(200, true, "满足上报条件");
-        }
-
-        return R.data(300, false, "未找到对应流程,请重新选择");
-    }
+//    /**
+//     * 检查所选的流程环节处理人是否具有审批权限(三大填报页、日志列表的批量上报、首件列表的批量上报)
+//     */
+//    @PostMapping("/checkFlowUserIsEVisaPermissions")
+//    @ApiOperation(value = "检查所选的流程环节处理人是否具有审批权限(三大填报页、日志列表的批量上报、首件列表的批量上报)")
+//    @ApiOperationSupport(order = 2)
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "flowId", value = "所选的流程ID", 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> checkFlowUserIsEVisaPermissions(@RequestBody JSONObject json) {
+//        if (json.containsKey("flowId")) {
+//            //首先找到对应流程下的审批人组
+//            List<FixedFlowLink> flowLink = this.fixedFlowLinkService.selectFixedFlowLink(json.getString("flowId"));
+//
+//            //获取这些人当前合同段下的权限
+//            List<Long> linkUserList = flowLink.stream().map(FixedFlowLink::getFixedFlowLinkUser).distinct().collect(Collectors.toList());
+//            List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(linkUserList, json.getString("contractId"));
+//
+//            //获取对应表格的所有电签配置
+//            List<JSONObject> jsonList = this.queryTableEVisaConfig(json);
+//
+//            if (jsonList == null) {
+//                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();
+//                    return R.data(300, false, "所选流程中的用户【" + user.getRealName() + "】不具有相关审批权限,请联系维护人员处理或更换审批流程");
+//                }
+//            }
+//
+//            return R.data(200, true, "满足上报条件");
+//        }
+//
+//        return R.data(300, false, "未找到对应流程,请重新选择");
+//    }
 
     /**
      * 获取表格的电签配置
      */
-    private List<JSONObject> queryTableEVisaConfig(JSONObject json) {
+    private List<JSONObject> queryTableEVisaConfig(JSONObject json,String eVisaPDFUrl) {
         List<JSONObject> jsonList;
         if (json.containsKey("theLogPrimaryKeyId") && StringUtils.isNotEmpty(json.getString("theLogPrimaryKeyId"))) {
             //日志,需要先获取对应的表格
@@ -582,12 +579,8 @@ public class EVisaTaskCheckController {
 
         } else {
             //资料填报
-            //jsonList = this.eVisaConfigClient.queryEVisaConfigAllByTableIds(json.getJSONArray("privatePKeyId").toJavaList(String.class));
-            List<String> ids = json.getJSONArray("privatePKeyId").toJavaList(String.class);
-            //指向项目级的ID有可能为null
-            ids = ids.stream().filter(Objects::nonNull).collect(Collectors.toList());
-
-            String sql = "select * from m_textdict_info where tab_id in(" + StringUtils.join(ids, ",") + ") or excel_id in (SELECT excel_id from m_wbs_tree_private where p_key_id in(" + StringUtils.join(ids, ",") + "))";
+            List<String> ids = PDFUtil.getPdfSignIds(eVisaPDFUrl);
+            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);
         }

+ 32 - 20
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -1343,7 +1343,7 @@ public class InformationWriteQueryController extends BladeController {
                 return R.data(true);
             }
         }
-        return R.data(false);
+        return R.fail("上报失败,没有找到选中数据的id");
     }
 
     /**
@@ -1485,6 +1485,7 @@ public class InformationWriteQueryController extends BladeController {
 
                         //获取实体表对应字段
                         List<QueryProcessDataVO> nodeTabCols = informationQueryService.getNodeChildTabColsAllByTabName(tableName);
+
                         //转化为map
                         Map<String, String> nodeTabColsMap = nodeTabCols.stream().collect(Collectors.toMap(QueryProcessDataVO::getQueryType, QueryProcessDataVO::getAncestors, (key1, key2) -> key2));
 
@@ -1499,8 +1500,9 @@ public class InformationWriteQueryController extends BladeController {
                         String keys = StringUtils.join(filteredList, ",");
 
                         /*重置*/
-                        Map<String, String> eMap = reviseValue(nodeOld, null, ekvMap);
-                        //构造入参
+                        //Map<String, String> eMap = reviseValue(nodeOld, null, ekvMap);
+
+                        //构造入参(获取列名、列值)
                         String dataSql = "SELECT " + keys + " FROM " + tableName + " WHERE p_key_id= " + nodeOld.getPKeyId() + " LIMIT 1;";
                         List<LinkedHashMap<String, Object>> resultList = jdbcTemplate.query(dataSql, new RowMapper<LinkedHashMap<String, Object>>() {
                             @Override
@@ -1511,51 +1513,61 @@ public class InformationWriteQueryController extends BladeController {
                                 for (int i = 1; i <= columnCount; i++) {
                                     String columnName = metaData.getColumnName(i);
                                     Object columnValue = rs.getObject(i);
-                                    resultMap.put(columnName, columnValue);
+                                    //判断列值不为null或者不为空串
+                                    if (columnValue != null && !columnValue.toString().isEmpty()) {
+                                        resultMap.put(columnName, columnValue);
+                                    }
                                 }
                                 return resultMap;
                             }
                         });
+
                         StringBuilder newString = new StringBuilder();
+                        List<String> keySet = new LinkedList<>();
                         if (!resultList.isEmpty()) {
                             LinkedHashMap<String, Object> resultMap = resultList.get(0);
                             for (Map.Entry<String, Object> entry : resultMap.entrySet()) {
-                                Object value = reviseValue(eMap, entry.getKey(), entry.getValue());
+                                keySet.add(entry.getKey());
+                                /*Object value = reviseValue(eMap, entry.getKey(), entry.getValue());*/
+                                Object value = entry.getValue();
                                 if (value != null) {
                                     if (value.toString().contains("\n")) {
                                         //如果值中包含换行符,则将换行符替换
                                         value = value.toString().replace("\n", "\\n");
                                     }
                                     newString.append("'").append(value).append("',");
-                                } else {
-                                    newString.append("null,");
                                 }
                             }
                         }
 
-                        if (newString.length() <= 0) {
-                            //如果没值,那么根据keys构造keys数位的null值字符串
-                            int size = filteredList.size();
-                            for (int i = 0; i < size; i++) {
-                                newString.append("null,");
+                        if (newString.length() > 0) {
+                            //首位添加逗号分隔符
+                            newString.insert(0, ',');
+                            //移除最后逗号分隔符
+                            if (newString.charAt(newString.length() - 1) == ',') {
+                                newString.deleteCharAt(newString.length() - 1);
                             }
                         }
-                        //去除末尾的逗号
-                        newString.deleteCharAt(newString.length() - 1);
-                        //首位拼接逗号
-                        newString.insert(0, ",");
+
+                        //所有有值的key
+                        String keysHaveValue = StringUtils.join(keySet, ",");
+                        if (keysHaveValue.length() > 0) {
+                            //首位添加逗号分隔符
+                            keysHaveValue = "," + keysHaveValue;
+                        }
 
                         //delete SQL (先删除旧数据,再新增)
                         String delSql = "DELETE FROM " + tableName + " WHERE p_key_id = " + newData.getPKeyId() + " ; ";
 
                         //insert into SQL
                         copySql.append(delSql).append("INSERT INTO ").append(tableName)
-                                .append(" (id,p_key_id,group_id,")
-                                .append(keys)
+                                .append(" (id,p_key_id,group_id")
+                                .append(keysHaveValue)
                                 .append(") VALUES (")
                                 .append(SnowFlakeUtil.getId()).append(",")
                                 .append(newData.getPKeyId()).append(",null")
-                                .append(newString).append(") ; ");
+                                .append(newString)
+                                .append(");");
                     }
                 }
             }
@@ -1792,7 +1804,7 @@ public class InformationWriteQueryController extends BladeController {
                     addNames.setLength(addNames.length() - 1);
                     addNames.append("}");
                     needCopyNodeRoot.setNodeName(addNames.toString());
-                    //return R.success("操作成功");
+
                     return this.saveOrCopyNodeTree2(addNodeList, null, 32, needCopyNodeRoot);
                 } else {
                     throw new ServiceException("没有找到需要复制的节点信息,请联系管理员");

+ 2 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java

@@ -1223,7 +1223,7 @@ public class TaskController extends BladeController {
             String resultIds = processInstanceIds.stream()
                     .map(id -> "'" + id + "'")
                     .collect(Collectors.joining(","));
-            taskParallelGroupMap = jdbcTemplate.query("select process_instance_id,task_user,task_user_name,e_visa_status,e_visa_content from u_task_parallel where process_instance_id in(" + resultIds + ") order by id", new BeanPropertyRowMapper<>(TaskParallel.class)).stream().collect(Collectors.groupingBy(TaskParallel::getProcessInstanceId));
+            taskParallelGroupMap = jdbcTemplate.query("select process_instance_id,task_user,task_user_name,e_visa_status,e_visa_content,parallel_process_instance_id from u_task_parallel where process_instance_id in(" + resultIds + ") order by id", new BeanPropertyRowMapper<>(TaskParallel.class)).stream().collect(Collectors.groupingBy(TaskParallel::getProcessInstanceId));
         }
 
         Map<String, List<TaskParallel>> finalTaskParallelGroupMap = taskParallelGroupMap;
@@ -1258,6 +1258,7 @@ public class TaskController extends BladeController {
                         TaskParallel taskParallel = taskParallelList.stream().filter(f -> ObjectUtil.isNotEmpty(f.getTaskUser()) && f.getTaskUser().equals(SecureUtil.getUserId().toString())).findAny().orElse(null);
                         if (taskParallel != null) {
                             vo.setEVisaStatus(taskParallel.getEVisaContent() != null ? taskParallel.getEVisaContent() : "");
+                            vo.setParallelProcessInstanceId(taskParallel.getParallelProcessInstanceId());
                         }
                         if (vo.getTaskStatusName().equals("已废除")) {
                             vo.setEVisaStatus("废除成功");

+ 42 - 0
blade-service/blade-business/src/main/java/org/springblade/business/utils/PDFUtil.java

@@ -4,6 +4,16 @@ import com.lowagie.text.*;
 import com.lowagie.text.Font;
 import com.lowagie.text.pdf.PdfPCell;
 import com.lowagie.text.pdf.PdfPTable;
+import com.spire.pdf.PdfDocument;
+import com.spire.pdf.PdfPageBase;
+import com.spire.pdf.general.find.PdfTextFind;
+import com.spire.pdf.general.find.PdfTextFindCollection;
+import org.springblade.common.utils.CommonUtil;
+import org.springblade.core.tool.utils.Func;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
 
 
 public class PDFUtil {
@@ -79,6 +89,38 @@ public class PDFUtil {
         table.addCell(cell);
     }
 
+    public static List<String> getPdfSignIds(String pdfUrl) {
+        PdfDocument pdf = new PdfDocument();
+        List<String> eVisaConfigList = new ArrayList<>();
+        try {
+            InputStream ossInputStream = CommonUtil.getOSSInputStream(pdfUrl);
+            //加载PDF文档
+            pdf.loadFromStream(ossInputStream);
+
+            for(int i= 0;i<pdf.getPages().getCount();i++){
+                PdfPageBase page = pdf.getPages().get(i);
+                PdfTextFindCollection allText = page.findAllText();
+                PdfTextFind[] finds = allText.getFinds();
+                for(int k=0;k<finds.length;k++){
+                    String textStr = finds[k].getMatchText();
+                    if (textStr.length() >= 15 && Func.isNumeric(textStr)) {
+                        System.out.println(textStr);
+                        eVisaConfigList.add(textStr);
+                    }
+                }
+            }
+            ossInputStream.close();
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return eVisaConfigList;
+    }
+
+//    public static void main(String[] args) {
+//        List<String> list = getPdfSignIds("https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com//upload/20230921/fdfa82f3254c975c9debd1ad040930c0.pdf");
+//        System.out.println();
+//    }
+
 }
 
 

+ 3 - 1
blade-service/blade-land/src/main/java/org/springblade/land/mapper/AttachmentInfoMapper.java

@@ -32,9 +32,11 @@ import java.util.List;
  */
 public interface AttachmentInfoMapper extends BaseMapper<AttachmentInfo> {
 
-    void deleteByMasterId(@Param("masterId") Long masterId);
+    void deleteByMasterId(@Param("masterId") Long masterId,@Param("projectId") Long projectId);
 
     void deleteByMasterIds(@Param("masterIds") List<Long> masterIds);
 
     void delete(@Param("id") Long id);
+
+    void deleteBatch(@Param("ids") List<Long> collect);
 }

+ 8 - 1
blade-service/blade-land/src/main/java/org/springblade/land/mapper/AttachmentInfoMapper.xml

@@ -5,7 +5,7 @@
 
     <delete id="deleteByMasterId">
         delete from l_attachment_info
-        where master_id = #{masterId}
+        where master_id = #{masterId} and project_id = #{projectId}
     </delete>
     <delete id="deleteByMasterIds">
         delete from l_attachment_info
@@ -18,4 +18,11 @@
         delete from l_attachment_info
         where id = #{id}
     </delete>
+    <delete id="deleteBatch">
+        delete from l_attachment_info
+        where id in
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
 </mapper>

+ 3 - 1
blade-service/blade-land/src/main/java/org/springblade/land/service/IAttachmentInfoService.java

@@ -34,11 +34,13 @@ public interface IAttachmentInfoService extends BaseService<AttachmentInfo> {
     List<AttachmentInfo> getAllFile(Long masterId);
 
     //根据主件id删除附件
-    void deleteByMasterId(Long id);
+    void deleteByMasterId(Long id,Long projectId);
 
     //根据主件id批量删除附件
     void deleteByMasterIds(List<Long> ids);
 
     //根据附件id删除附件
     void delete(Long id);
+
+    void deleteBatch(List<Long> collect);
 }

+ 11 - 2
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/AttachmentInfoServiceImpl.java

@@ -78,8 +78,8 @@ public class AttachmentInfoServiceImpl extends BaseServiceImpl<AttachmentInfoMap
      * @param masterId
      */
     @Override
-    public void deleteByMasterId(Long masterId) {
-        baseMapper.deleteByMasterId(masterId);
+    public void deleteByMasterId(Long masterId,Long projectId) {
+        baseMapper.deleteByMasterId(masterId,projectId);
     }
 
     /**
@@ -95,4 +95,13 @@ public class AttachmentInfoServiceImpl extends BaseServiceImpl<AttachmentInfoMap
     public void delete(Long id) {
         baseMapper.delete(id);
     }
+
+    /**
+     * 根据id批量删除
+     * @param collect
+     */
+    @Override
+    public void deleteBatch(List<Long> collect) {
+        baseMapper.deleteBatch(collect);
+    }
 }

+ 8 - 6
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/PolicyInfoServiceImpl.java

@@ -52,19 +52,21 @@ public class PolicyInfoServiceImpl extends BaseServiceImpl<PolicyInfoMapper, Pol
         PolicyInfo policyInfo = new PolicyInfo();
         BeanUtils.copyProperties(dto,policyInfo);
         Boolean isExist = true;
+        List<AttachmentInfo> list = dto.getList();
+        if (list == null || list.size() == 0){
+            throw new ServiceException("请上传附件");
+        }
         if (policyInfo.getId() == null){
             isExist = false;
             policyInfo.setId(SnowFlakeUtil.getId());
             policyInfo.setUploadDate(LocalDate.now());
             //删除之前的附件
-            attachmentInfoService.deleteByMasterId(-1L);
+            attachmentInfoService.deleteByMasterId(-1L,dto.getProjectId());
         }else {
             //删除之前的附件
-            attachmentInfoService.deleteByMasterId(policyInfo.getId());
-        }
-        List<AttachmentInfo> list = dto.getList();
-        if (list == null || list.size() == 0){
-            throw new ServiceException("请上传附件");
+            attachmentInfoService.deleteByMasterId(policyInfo.getId(),dto.getProjectId());
+            //再删除本次上传的附件
+            attachmentInfoService.deleteBatch(list.stream().map(l->l.getId()).collect(Collectors.toList()));
         }
         List<String> data = new ArrayList<>();
         for (AttachmentInfo info : list) {

+ 6 - 0
blade-service/blade-manager/src/main/java/com/mixsmart/utils/CustomFunction.java

@@ -2696,6 +2696,12 @@ public class CustomFunction {
             return StringPool.EMPTY;
     }
 
+/*
+    public static void main(String[] args) {
+        List<Object> list = Arrays.asList(0.83,0.82,0.91,0.89,0.97,0.98);
+        ( (List<Object>)stepSum(list)).forEach(System.out::println);
+    }
+*/
 
 
 

+ 2 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/FormulaController.java

@@ -931,4 +931,6 @@ public class FormulaController {
         return false;
     }
 
+
+
 }

+ 30 - 22
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsParamController.java

@@ -342,27 +342,6 @@ public class WbsParamController {
     public R<Boolean> specified(@ApiParam(value = "关联id", required = true) Long paramId, Long elementId) {
         /*先删旧关联,检查是否存在公式,没有就新增 再增新关联*/
         this.jdbcTemplate.execute("update m_element_formula_mapping set is_deleted=1 where element_id=" + elementId + " and param_id=" + paramId);
-//        Formula formula = this.formulaService.getOne(Wrappers.<Formula>lambdaQuery().eq(Formula::getParamId, paramId));
-//        if (formula == null) {
-//            Map<String, Object> tmpMap = new HashMap<>();
-//            formula = new Formula();
-//            WbsParam param = this.service.getById(paramId);
-//            formula.setOutm(Formula.FULL);
-//            formula.setParamId(param.getId());
-//            Map<String, String> keyMap = new HashMap<>();
-//            keyMap.put("name", param.getName());
-//            keyMap.put("id", param.getId().toString());
-//            tmpMap.put(param.getK(), keyMap);
-//            if (RegexUtil.match(ParamElements.LEVEL_REG, param.getV().trim())) {
-//                /*取层级*/
-//                formula.setFormula("FC.tree(trees,WP[" + param.getK() + "])");
-//            } else {
-//                /*直接取数*/
-//                formula.setFormula("WP[" + param.getK() + "]");
-//            }
-//            formula.setMap(JSON.toJSONString(tmpMap));
-//            this.formulaService.save(formula);
-//        }
         WbsParam wbsParam=this.service.getById(paramId);
         Long formulaId=this.service.formulaId(wbsParam.getK());
         if(formulaId==null){
@@ -577,7 +556,36 @@ public class WbsParamController {
         return R.fail("创建失败");
     }
 
-
+    /**按照项目id刷新无效文件题名*/
+    @GetMapping("/file-title")
+    public R<Object> ref(Long projectId) {
+        if (StringUtils.isNumber(projectId)) {
+            String sql ="select a.id, a.wbs_id pkeyId  from u_information_query a  join m_wbs_tree_contract b on a.wbs_id=b.p_Key_id where a.name='还未配置提名规则' and a.project_id=?";
+            List<Map<String,Object>> listMaps=this.jdbcTemplate.queryForList(sql,projectId);
+            if(listMaps.size()>0){
+                List<Long> pkeyIds= listMaps.stream().map(m->Long.parseLong(m.get("pkeyId").toString())).distinct().collect(Collectors.toList());
+                Map<Long,String> map = new HashMap<>(pkeyIds.size()*2);
+                pkeyIds.forEach(pk->{
+                    try {
+                        map.put(pk,this.service.createFileTitle(pk));
+                    }catch (Exception e){
+                        System.out.println("无法溯源节点"+pk);
+                        e.printStackTrace();
+                    }
+                });
+                if(map.size()>0){
+                    String sqlUpdate="UPDATE u_information_query SET name = ? WHERE wbs_id = ?";
+                    List<Object[]> params = map.entrySet().stream()
+                            .map(entry -> new Object[]{entry.getValue(), entry.getKey()})
+                            .collect(Collectors.toList());
+                    this.jdbcTemplate.batchUpdate(sqlUpdate,params);
+                    return R.success("刷新成功");
+                }
+            }
+            return R.fail("执行异常");
+        }
+        return R.fail("项目Id格式有问题");
+    }
 
 
 }

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/TableElementConverter.java

@@ -155,7 +155,7 @@ public class TableElementConverter implements ITableElementConverter {
                             for (String s : values) {
                                 String[] t = s.split("_\\^_");
                                 String[] c = t[1].split("_");
-                                tmpMap.put(StringUtils.join(fd.getCode(), groupId, i, Func.toInt(c[1]), Func.toInt(c[0]), StringPool.AT), t[0]);
+                                tmpMap.put(StringUtils.join(fd.getCode(), groupId, i, Func.toInt(c[1]), Func.toInt(c[0]), StringPool.AT), t[0].trim());
                             }
                         }
                         if (Func.isNotEmpty(fd.getCoordsList())) {

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -567,7 +567,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         return this;
     }
 
-    /*汇总阶段执行的公式*/
+    /**汇总阶段执行的公式*/
     public void summaryPre(){
         tec.formDataList.stream().filter(FormData::executable).filter(e->StringUtils.isEquals("CKI",e.getFormula().getNumber())||StringUtils.isEquals("CKD",e.getFormula().getNumber())).forEach(t->tec.summary.add(t));
         tec.formDataList.removeAll(tec.summary);

+ 7 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsParamServiceImpl.java

@@ -88,9 +88,13 @@ public class WbsParamServiceImpl extends BaseServiceImpl<WbsParamMapper, WbsPara
             String parentId = one.getParentId().toString();
             while (loop < max && StringUtils.isNotEquals(0, parentId)) {
                 WbsTreeContract next = this.treeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getContractId, one.getContractId()).eq(WbsTreeContract::getId, parentId));
-                parentId = next.getParentId().toString();
-                list.add(next);
-                loop++;
+                if(next!=null) {
+                    parentId = next.getParentId().toString();
+                    list.add(next);
+                    loop++;
+                }else{
+                    loop=max;
+                }
             }
             Collections.reverse(list);
             list.remove(0);