Ver código fonte

Merge remote-tracking branch 'origin/master'

liuyc 2 anos atrás
pai
commit
c85250f673

+ 7 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/FormData.java

@@ -11,6 +11,7 @@ import org.springblade.manager.entity.Formula;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Objects;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -109,10 +110,15 @@ public class FormData {
         }
     }
 
+    /**是否还需要执行公式*/
     public Boolean verify(){
         return !this.finished;
     }
-
+    /**是否存可执行公式*/
+    public Boolean executable(){
+        return !Objects.isNull(this.getFormula());
+    }
+   /**元素内容是否为空*/
     public Boolean empty(){
       return  Func.isEmpty(this.values);
     }

+ 3 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/EVisaConfigClient.java

@@ -18,6 +18,9 @@ public interface EVisaConfigClient {
      */
     String API_PREFIX = "/api/manager/eVisaConfig";
 
+    @PostMapping(API_PREFIX + "/queryEVisaConfigAllByTableIds")
+    List<JSONObject> queryEVisaConfigAllByTableIds(@RequestBody List<String> tableIds);
+
     @PostMapping(API_PREFIX + "/queryEVisaConfigByTableIds")
     List<JSONObject> queryEVisaConfigByTableIds(@RequestBody List<String> tableIds, @RequestParam String contractId, @RequestParam String isFinal);
 

+ 106 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/EVisaTaskCheckController.java

@@ -0,0 +1,106 @@
+package org.springblade.business.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.apache.commons.lang.StringUtils;
+import org.springblade.business.entity.FixedFlowLink;
+import org.springblade.business.service.IFixedFlowLinkService;
+import org.springblade.core.secure.utils.AuthUtil;
+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.feign.ContractClient;
+import org.springblade.manager.feign.EVisaConfigClient;
+import org.springblade.manager.feign.SignPfxClient;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/eVisaTaskCheck")
+@Api(value = "所有上报前的相关检查接口", tags = "所有上报前的相关检查接口")
+public class EVisaTaskCheckController {
+
+    private final ContractClient contractClient;
+
+    private final IFixedFlowLinkService fixedFlowLinkService;
+
+    private final EVisaConfigClient eVisaConfigClient;
+
+    private final SignPfxClient signPfxClient;
+
+    /**
+     * 检查当前审批人是否存在证书
+     */
+    @GetMapping("/checkFlowUserIsExistPfxFile")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "检查当前审批人是否存在证书")
+    public R<Boolean> checkTaskUserIsExistPfxFile(){
+        //获取当前审批人的证书
+        List<SignPfxFile> signPfxFiles = this.signPfxClient.querySignPfxByUserIdOrContractId(AuthUtil.getUserId().toString(), "");
+        if(signPfxFiles != null && signPfxFiles.size() > 0){
+            SignPfxFile signPfxFile = signPfxFiles.get(0);
+            if(StringUtils.isEmpty(signPfxFile.getCertificateFileUrl())){
+                return R.data(300, false, "当前用户未配置签字证书,请联系维护人员处理");
+            }
+            if(!new Integer("1").equals(signPfxFile.getIsRegister())){
+                return R.data(300, false, "当前用户的证书未注册,请联系维护人员处理");
+            }
+            if(StringUtils.isEmpty(signPfxFile.getSignatureFileUrl())){
+                return R.data(300, false, "当前用户未配置签字体,请联系维护人员处理");
+            }
+            return R.data(true);
+        }
+        return R.data(300, false, "当前用户未找到签字证书,请联系维护人员处理");
+    }
+
+    /**
+     * 检查所选的流程环节处理人是否具有审批权限
+     */
+    @PostMapping("/checkFlowUserIsEVisaPermissions")
+    @ApiOperation(value = "检查当前合同段是否开启电签")
+    @ApiOperationSupport(order = 2)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "flowId", value = "所选的流程ID", required = true),
+            @ApiImplicitParam(name = "privatePKeyId", value = "表单列表中的isTypePrivatePid字段,集合形式", required = true)
+    })
+    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> jsonList = this.eVisaConfigClient.queryEVisaConfigAllByTableIds(json.getJSONArray("privatePKeyId").toJavaList(String.class));
+
+        }
+
+        return null;
+    }
+
+    /**
+     * 检查当前合同段是否开启电签
+     */
+    @GetMapping("/checkContractIsOpenEVisa")
+    @ApiOperation(value = "检查当前合同段是否开启电签")
+    @ApiOperationSupport(order = 1)
+    public R<Boolean> checkContractIsOpenEVisa(@RequestParam String contractId){
+        ContractInfo contract = this.contractClient.getContractById(Func.toLong(contractId));
+        if(contract != null){
+            boolean isOpen = new Integer("1").equals(contract.getIsElectronicSignature());
+            return R.data(isOpen, isOpen ? "当前合同段已经开启电签" : "当前合同段未开启电签,不允许上报,请联系维护人员处理");
+        }
+        return R.data(300, false, "未找到对应合同段");
+    }
+
+}

+ 2 - 4
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml

@@ -124,7 +124,7 @@
                 FROM
                     m_wbs_tree_contract AS wtc
                 LEFT JOIN m_wbs_tree_contract AS wtc1 ON wtc1.ancestors like concat('%', wtc.id, '%') AND wtc1.is_deleted = 0 and wtc1.contract_id = wtc.contract_id AND wtc1.major_data_type IN(1,2,3,4)
-                LEFT JOIN u_information_query AS iq ON (iq.wbs_id = wtc1.p_key_id OR iq.wbs_id = wtc.p_key_id) AND classify = #{classify}
+                LEFT JOIN u_information_query AS iq ON (iq.wbs_id = wtc1.p_key_id OR iq.wbs_id = wtc.p_key_id) AND classify = #{classify} AND iq.type != 3
                 WHERE
                     wtc.contract_id IN
                 <foreach collection="contractIds" item="contractId" open="(" separator="," close=")">
@@ -133,7 +133,6 @@
                 and wtc.parent_id = #{parentId}
                 and wtc.is_deleted= '0'
                 AND wtc.node_type != 111
-                AND iq.type != 3
                 group by wtc.p_key_id
             ) AS querys
         ) AS querys ON wtc.p_key_id = querys.pKeyId
@@ -202,13 +201,12 @@
                 FROM
                     m_wbs_tree_contract AS wtc
                 LEFT JOIN m_wbs_tree_contract AS wtc1 ON wtc1.ancestors like concat('%', wtc.id, '%') AND wtc1.is_deleted = 0 and wtc1.contract_id = wtc.contract_id AND wtc1.major_data_type IN(1,2,3,4)
-                LEFT JOIN u_information_query AS iq ON (iq.wbs_id = wtc1.p_key_id OR iq.wbs_id = wtc.p_key_id) AND iq.classify = #{classify}
+                LEFT JOIN u_information_query AS iq ON (iq.wbs_id = wtc1.p_key_id OR iq.wbs_id = wtc.p_key_id) AND iq.classify = #{classify} AND iq.type != 3
                 WHERE
                     wtc.contract_id = #{contractId}
                 and wtc.parent_id = #{parentId}
                 and wtc.is_deleted= '0'
                 AND wtc.node_type != 111
-                AND iq.type != 3
                 AND wtc.type = 1
                 group by wtc.p_key_id
             ) AS querys

+ 3 - 1
blade-service/blade-manager/src/main/java/com/mixsmart/utils/CustomFunction.java

@@ -2015,7 +2015,9 @@ public class CustomFunction {
 			List<String> list = Arrays.asList(param.split("[^.\\d]"));
 			List<Integer> index =list.stream().map(Integer::parseInt).collect(Collectors.toList());
 			for(Integer i:index){
-				result.add(nodes.get(i));
+				if(i<nodes.size()) {
+					result.add(nodes.get(i));
+				}
 			}
 			return String.join("", result);
 		}

+ 13 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/EVisaConfigClientImpl.java

@@ -1,5 +1,6 @@
 package org.springblade.manager.feign;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.AllArgsConstructor;
@@ -23,6 +24,18 @@ public class EVisaConfigClientImpl implements EVisaConfigClient {
 
     private final SaveUserInfoByProjectService saveUserInfoByProjectService;
 
+    @Override
+    public List<JSONObject> queryEVisaConfigAllByTableIds(List<String> tableIds) {
+        //获取所有配置信息
+        List<TextdictInfo> configResult = this.textdictInfoService.list(Wrappers.<TextdictInfo>lambdaQuery().in(TextdictInfo::getTabId, tableIds));
+
+        if(configResult != null && configResult.size() > 0){
+            return JSONArray.parseArray(JSONObject.toJSONString(configResult), JSONObject.class);
+        }
+
+        return null;
+    }
+
     @Override
     public List<JSONObject> queryEVisaConfigByTableIds(List<String> tableIds, String contractId, String isFinal) {
         List<JSONObject> jsonResult = new ArrayList<>();

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

@@ -29,6 +29,6 @@ public interface IFormulaService extends BaseService<Formula> {
     /**
      * 公式运算*/
     IFormulaService calculate();
-    /*格式化*/
+    /**格式化*/
     void format();
 }

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

@@ -129,7 +129,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         if(CollectionUtil.isNotEmpty(this.env.formDataList)){
             for(FormData fd:this.env.formDataList){
                 /*预处理公式脚本*/
-                if(!fd.verify()){
+                if(!fd.executable()){
                     /*不存公式,则认为执行完成,不会再主动执行*/
                     fd.setFinished(Boolean.TRUE);
                     continue;

+ 2 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsParamServiceImpl.java

@@ -43,6 +43,8 @@ public class WbsParamServiceImpl extends BaseServiceImpl<WbsParamMapper, WbsPara
             StaticLog.info("获取节点{}文件题名",nodeId);
             List<WbsTreeContract> nodes = treeContractService.searchParentAllNode(nodeId,contractId);
             if(Func.isNotEmpty(nodes)){
+                /*移除根节点*/
+                nodes.remove(nodes.size()-1);
                 wbsTreeContract.setNodeName(wbsTreeContract.getFullName());
                 nodes.set(0,wbsTreeContract);
                 WbsParam wp = this.getOne(Wrappers.<WbsParam>lambdaQuery().eq(WbsParam::getWbsId,nodeId).eq(WbsParam::getK,FILE_TITLE));