Browse Source

电签相关

huangjn 2 năm trước cách đây
mục cha
commit
6deb27ee43

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

@@ -10,7 +10,9 @@ import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.springblade.business.entity.FixedFlowLink;
+import org.springblade.business.entity.InformationQuery;
 import org.springblade.business.service.IFixedFlowLinkService;
+import org.springblade.business.service.IInformationQueryService;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
@@ -45,6 +47,8 @@ public class EVisaTaskCheckController {
 
     private final IUserClient userClient;
 
+    private final IInformationQueryService informationQueryService;
+
     /**
      * 检查当前审批人是否存在证书
      */
@@ -80,7 +84,8 @@ public class EVisaTaskCheckController {
             @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 = "theLogPrimaryKeyId", value = "日志左侧所选的填报类型ID"),
+            @ApiImplicitParam(name = "firstId", value = "首件记录ID")
     })
     public R<Boolean> checkFlowUserIsEVisaPermissions(@RequestBody JSONObject json){
         if(json.containsKey("flowId")){
@@ -95,10 +100,13 @@ public class EVisaTaskCheckController {
             List<JSONObject> jsonList;
             if(json.containsKey("theLogPrimaryKeyId") && StringUtils.isNotEmpty(json.getString("theLogPrimaryKeyId"))){
                 //日志,需要先获取对应的表格
-                List<WbsTreePrivate> privateTreeList = this.wbsTreePrivateClient.queryExcelTableByParentId(this.wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(json.getString("theLogPrimaryKeyId"))).get(0));
-                if(privateTreeList != null && privateTreeList.size() > 0){
-                    List<Long> pKeyList = privateTreeList.stream().map(WbsTreePrivate::getPKeyId).distinct().collect(Collectors.toList());
-                    jsonList = this.eVisaConfigClient.queryEVisaConfigAllByTableIds(JSONArray.parseArray(JSONObject.toJSONString(pKeyList), String.class));
+                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(query.getTableId()));
                 } else {
                     jsonList = null;
                 }
@@ -127,6 +135,23 @@ public class EVisaTaskCheckController {
         return R.data(300, false, "未找到对应流程,请重新选择");
     }
 
+    /**
+     * 获取表格的电签配置
+     */
+    private List<JSONObject> queryTableEVisaConfig(List<String> primaryKeyIds){
+        List<JSONObject> jsonList;
+
+        List<WbsTreePrivate> privateTreeList = this.wbsTreePrivateClient.queryExcelTableByParentId(this.wbsTreePrivateClient.queryByPKeyIds(primaryKeyIds).get(0));
+        if(privateTreeList != null && privateTreeList.size() > 0){
+            List<Long> pKeyList = privateTreeList.stream().map(WbsTreePrivate::getPKeyId).distinct().collect(Collectors.toList());
+            jsonList = this.eVisaConfigClient.queryEVisaConfigAllByTableIds(JSONArray.parseArray(JSONObject.toJSONString(pKeyList), String.class));
+        } else {
+            jsonList = null;
+        }
+
+        return jsonList;
+    }
+
     /**
      * 检查当前合同段是否开启电签
      */