Parcourir la source

Merge branch 'test-merge' of http://219.151.181.73:3000/zhuwei/bladex into test-merge

lvy il y a 1 mois
Parent
commit
782b079bfb
38 fichiers modifiés avec 1159 ajouts et 671 suppressions
  1. 7 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/InformationQuery.java
  2. 45 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/ChekPdfPaceVo.java
  3. 8 3
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/InformationQueryVO.java
  4. 4 1
      blade-service-api/blade-e-visa-api/src/main/java/org/springblade/evisa/vo/SealStrategyVO.java
  5. 5 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/ProjectInfo.java
  6. 1 1
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/WbsTreeContractClient.java
  7. 9 7
      blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveFileController.java
  8. 1 1
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java
  9. 39 1
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  10. 20 2
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java
  11. 7 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.java
  12. 22 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml
  13. 8 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/IInformationQueryService.java
  14. 4 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITaskService.java
  15. 60 50
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ArchiveFileServiceImpl.java
  16. 15 6
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ContractLogServiceImpl.java
  17. 35 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java
  18. 345 211
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java
  19. 0 152
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/Chek.java
  20. 6 5
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/ChekSignData.java
  21. 3 3
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/EVController.java
  22. 0 99
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/testTaskInfo222.java
  23. 54 7
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVDataServiceImpl.java
  24. 211 21
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/ScrDataServiceImpl.java
  25. 75 11
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/utils/PdfAddimgUtil.java
  26. 2 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreeContractClientImpl.java
  27. 5 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ArchiveTreeContractMapper.java
  28. 59 11
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ArchiveTreeContractMapper.xml
  29. 1 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ExcelTabMapper.xml
  30. 1 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ProjectInfoMapper.xml
  31. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java
  32. 4 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractServiceImpl.java
  33. 62 56
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractSyncImpl.java
  34. 16 10
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java
  35. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaDaoImpl.java
  36. 11 3
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java
  37. 7 0
      blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.xml
  38. 5 1
      blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

+ 7 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/InformationQuery.java

@@ -143,4 +143,11 @@ public class InformationQuery extends BaseEntity {
 
     @ApiModelProperty("重刷次数:如果次数大于5次 每次都是3,就停止重刷")
     private Integer saveAgainCount;
+
+    @ApiModelProperty("0-未检出,1-已提交,2-检查无误,3-检查有误")
+    private Integer chekStatus;
+
+    @ApiModelProperty("检查描述")
+    private String checkDesc;
+
 }

+ 45 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/ChekPdfPaceVo.java

@@ -0,0 +1,45 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.business.entity.ArchiveFile;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2022-07-08
+ */
+@Data
+public class ChekPdfPaceVo {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 当前页
+     */
+    @ApiModelProperty("完成数量")
+    private Integer finishCount;
+
+    @ApiModelProperty("总数量")
+    private Integer totalCount;
+
+    @ApiModelProperty("完成比")
+    private double pace;
+}

+ 8 - 3
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/InformationQueryVO.java

@@ -92,11 +92,11 @@ public class InformationQueryVO extends InformationQuery {
     @ApiModelProperty("重刷次数:如果次数大于5次 每次都是3,就停止重刷")
     private Integer saveAgainCount;
 
-    public void setWaitingUserList(String waitingUserName, Integer status) {
+    public void setWaitingUserList(String waitingUserName, Integer status, String userId) {
         if (this.waitingUserList == null) {
             this.waitingUserList = new ArrayList<>();
         }
-        this.waitingUserList.add(new WaitingUser(waitingUserName, status));
+        this.waitingUserList.add(new WaitingUser(waitingUserName, status, userId));
     }
 
     @Data
@@ -107,9 +107,14 @@ public class InformationQueryVO extends InformationQuery {
         @ApiModelProperty("审批状态,1未签字(黑色),2已签字(绿色),3已废除(黄色),999签字异常(红色)")
         private Integer status;
 
-        public WaitingUser(String waitingUserName, Integer status) {
+        @ApiModelProperty("用户ID")
+        private String userId;
+
+
+        public WaitingUser(String waitingUserName, Integer status, String userId) {
             this.waitingUserName = waitingUserName;
             this.status = status;
+            this.userId=userId;
         }
     }
 

+ 4 - 1
blade-service-api/blade-e-visa-api/src/main/java/org/springblade/evisa/vo/SealStrategyVO.java

@@ -74,9 +74,12 @@ public class SealStrategyVO {
     private String sealLocation;
 
     /**
-     * 签章原因,可以为空
+     * 用户名称
      */
     private String sealReason;
+
+    // 用户Id
+    private String userId;
     //坐标签章结束 ======================================
 
     /**

+ 5 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/ProjectInfo.java

@@ -211,4 +211,9 @@ public class ProjectInfo extends BaseEntity {
     private String jlSuffix;
 
 
+    /**
+     *
+     */
+    @ApiModelProperty(value = "短信时间")
+    private int msTime;
 }

+ 1 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/WbsTreeContractClient.java

@@ -208,7 +208,7 @@ public interface WbsTreeContractClient {
     void saveNameRuleByPkeyId(@RequestParam Long  pKeyId, @RequestParam String s,  @RequestParam Long projectId);
 
     @PostMapping(API_PREFIX + "/queryListByPIds")
-    List<WbsTreeContract> queryListByPIds(@RequestBody List<Long> pIds);
+    List<WbsTreeContract> queryListByPIds(@RequestBody List<Long> pIds,@RequestParam Integer classify);
 
     @PostMapping(API_PREFIX + "/findIsExistTreeNode")
     Integer findIsExistTreeNode(@RequestBody List<String> ids);

+ 9 - 7
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveFileController.java

@@ -68,6 +68,7 @@ public class ArchiveFileController extends BladeController {
     private final MetadataClassificationClient metadataClassificationClient;
     private final IArchivesAutoService autoService;
     private final CommonFileClient commonFileClient;
+
     /**
      * 上传文件
      *
@@ -102,11 +103,11 @@ public class ArchiveFileController extends BladeController {
                 int i = 1;
                 for (ArchiveFileVO saveVo : saveList) {
                     try {
-                        if(StringUtils.isNotEmpty(saveVo.getPdfFileUrl())&&saveVo.getPageNum()==null){
+                        if (StringUtils.isNotEmpty(saveVo.getPdfFileUrl()) && saveVo.getPageNum() == null) {
                             String num = commonFileClient.getPdfNum(saveVo.getPdfFileUrl());
                             saveVo.setFilePage(Integer.valueOf(num));
                         }
-                    }catch (Exception e){
+                    } catch (Exception e) {
                         saveVo.setFilePage(0);
                     }
                     saveVo.setId(SnowFlakeUtil.getId());
@@ -159,8 +160,8 @@ public class ArchiveFileController extends BladeController {
         if (queryVo.getNodeIds().isEmpty() || queryVo.getNodeIds().equals("")) {
 
         } else {
-            ArchiveTreeContract rootNode=  this.archiveTreeContractClient.getArchiveTreeContractById(Long.parseLong(queryVo.getNodeIds()));
-            if (rootNode != null && rootNode.getExtType()!= null ) {
+            ArchiveTreeContract rootNode = this.archiveTreeContractClient.getArchiveTreeContractById(Long.parseLong(queryVo.getNodeIds()));
+            if (rootNode != null && rootNode.getExtType() != null) {
                 queryVo.setExtType(1);
             }
 
@@ -188,6 +189,7 @@ public class ArchiveFileController extends BladeController {
             this.archiveFileClient.updateArchiveFileSort(vo);
             try {
                 for (ArchiveFileVO saveVo : vo.getList()) {
+                    //获取源信息
                     metadataClassificationClient.createMetadataFile(saveVo.getId(), 0);
                 }
             } catch (Exception e) {
@@ -425,7 +427,7 @@ public class ArchiveFileController extends BladeController {
     @ApiOperation(value = "文件收集-上传文件责任者")
     public R getMetadataFile(String fileId) {
         long id;
-        try  {
+        try {
             fileId = fileId.split("_")[0];
             id = Long.parseLong(fileId);
         } catch (Exception e) {
@@ -462,12 +464,12 @@ public class ArchiveFileController extends BladeController {
             //数据入库
             autoService.sendFileToEArchives(v);
         }
-        return  R.success("操作成功");
+        return R.success("操作成功");
     }
 
 
 
-    @PostMapping("/findAndReplace")
+   @PostMapping("/findAndReplace")
     @ApiOperationSupport(order = 12)
     @ApiOperation(value = "查找并替换", notes = "传入ids")
     public R findAndReplace(@RequestBody FindAndReplaceDto dto){

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

@@ -4579,7 +4579,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		String[] ids = archiveIds.split(",");
 		for (String archiveId : ids) {
 			ArchivesAuto auto = baseMapper.selectById(archiveId);
-			String sql = "select * from u_archive_file where archive_id = " + archiveId + " and is_deleted = 0 order by sort,sort_num,create_time";
+			String sql = "SELECT u.* FROM u_archive_file u LEFT JOIN m_archive_tree_contract m ON u.node_id = m.id WHERE u.archive_id = "+archiveId+" AND u.is_deleted = 0 ORDER BY m.sort, u.sort, u.sort_num, u.create_time";
 			//List<ArchiveFile> archiveFiles = archiveFileClient.getArchiveFileByArchiveID(Long.valueOf(archiveId));
 			List<ArchiveFile> archiveFiles = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ArchiveFile.class));
 			archiveAutoPdfService.buildArchiveFrontPdfs(projectId, auto, archiveFiles, true);

+ 39 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -1232,7 +1232,7 @@ public class InformationWriteQueryController extends BladeController {
         } else { //质检
             //记录选中节点的所有表单旧html
             List<Long> list = Arrays.stream(startTaskVO.getIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
-            List<WbsTreeContract> wbsTreeContracts =  wbsTreeContractClient.queryListByPIds(list);
+            List<WbsTreeContract> wbsTreeContracts =  wbsTreeContractClient.queryListByPIds(list,startTaskVO.getClassify());
 
 
             businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, startTaskVO.getIds().replaceAll(",", "")).eq(InformationQuery::getClassify, startTaskVO.getClassify().toString()).eq(InformationQuery::getType, 1).last("order by id desc limit 1"));
@@ -5279,4 +5279,42 @@ public R<Object> customAddContractNode(@RequestBody CustomAddContractNodeDTO dto
         }
         throw new IllegalArgumentException("新数据中未找到根节点");
     }
+
+    // pdf 检查任务添加
+    /**
+     * 首件wbs 树
+     *
+     * @return 结果
+     */
+    @GetMapping("/updateCheckPdfInfo")
+    @ApiOperationSupport(order = 40)
+    @ApiOperation(value = "添加pdf检查接口")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "type", value = "1:节点添加 2:文件添加",required = true),
+            @ApiImplicitParam(name = "classify", value = "1施工2监理",required = true),
+            @ApiImplicitParam(name = "ids", value = "多个用,拼接", required = true)
+    })
+    public  R updateCheckPdfInfo(@RequestParam String type, @RequestParam String ids,@RequestParam String classify) {
+
+        return informationQueryService.updateCheckPdfInfo(type, ids,classify);
+    }
+
+    /**
+     * 首件wbs 树
+     *
+     * @return 结果
+     */
+    @GetMapping("/getCheckPdfPaceInfo")
+    @ApiOperationSupport(order = 40)
+    @ApiOperation(value = "添加pdf检查接口")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "type", value = "1:节点添加 2:文件添加",required = true),
+            @ApiImplicitParam(name = "classify", value = "1施工2监理",required = true),
+            @ApiImplicitParam(name = "ids", value = "多个用,拼接", required = true)
+    })
+    public  R<ChekPdfPaceVo> getCheckPdfPaceInfo(@RequestParam String contractId,@RequestParam String classify) {
+
+        ChekPdfPaceVo checkPdfPaceInfo = informationQueryService.getCheckPdfPaceInfo(contractId, classify);
+        return R.data(checkPdfPaceInfo);
+    }
 }

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

@@ -52,6 +52,7 @@ import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.entity.ContractRelationJlyz;
 import org.springblade.manager.entity.ProjectInfo;
+import org.springblade.manager.feign.ProjectClient;
 import org.springblade.resource.feign.CommonFileClient;
 import org.springblade.resource.feign.NewISmsClient;
 import org.springblade.system.cache.ParamCache;
@@ -103,6 +104,7 @@ public class TaskController extends BladeController {
     private final ArchiveExpertConclusionClient conclusionClient;
     private final MessageWarningServiceImpl messageWarningServiceImpl;
     private final OperationLogClient operationLogClient;
+    private final ProjectClient projectClient;
 
     /**
      * 记录短信验证码超时时间
@@ -110,18 +112,23 @@ public class TaskController extends BladeController {
     @GetMapping("/save-sms-timeout")
     @ApiOperationSupport(order = 13)
     @ApiOperation(value = "记录短信验证码超时时间")
-    public void saveSmsTimeout(@RequestParam String code) {
+    public void saveSmsTimeout(@RequestParam String code,String projectId) {
         //获取账户记录
      ///   String aesKey = "O2BEeIv399qHQNhD6aGW8R8DEj4bqHXm";
      //   String accode = AesUtil.decryptFormBase64ToString(code, aesKey);
         DefaultConfig config = this.defaultConfigService.getOne(Wrappers.<DefaultConfig>lambdaQuery()
                 .eq(DefaultConfig::getCreateUser, AuthUtil.getUserId())
                 .isNotNull(DefaultConfig::getSmsCode));
+        int addTime = 1;
         if (config != null) {
+            if(projectId!=null && !projectId.equals("") && Func.isNotEmpty(projectId)){
+                ProjectInfo projectInfo = projectClient.getById(projectId);
+                addTime = projectInfo.getMsTime();
+            }
             //获取当前时间
             Date now = DateUtil.now();
             // 16 改为 1小时后超时
-            now = DateUtil.plusHours(now, 1);
+            now = DateUtil.plusHours(now, addTime);
 
             LambdaUpdateWrapper<DefaultConfig> wrapper = new LambdaUpdateWrapper<>();
             wrapper.set(DefaultConfig::getSmsTimeOut, DateUtil.format(now, "yyyy-MM-dd HH:mm:ss"));
@@ -2222,4 +2229,15 @@ public class TaskController extends BladeController {
         return R.data(true);
     }
 
+    /**
+     * 资料填报-任务管理- 电签签字
+     */
+    @PostMapping("/reSigningEVisaByUserIds")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "任务管理-一键重签", notes = "传入taskIds、下拉框的contractId、projectId")
+    public R<Object> reSigningEVisaByUserIds(@RequestParam String ids, @RequestParam String userIds) {
+
+       return taskService.reSigningEVisaByUserIds(ids,userIds);
+    }
+
 }

+ 7 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.java

@@ -17,6 +17,7 @@
 package org.springblade.business.mapper;
 
 import org.springblade.business.entity.InformationQuery;
+import org.springblade.business.vo.ChekPdfPaceVo;
 import org.springblade.business.vo.InformationQueryVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -145,4 +146,10 @@ public interface InformationQueryMapper extends BaseMapper<InformationQuery> {
     List<TabBusstimeInfo> getTabussTimeInfo(@Param("tables") List<String> tables);
 
     List<Long> getInfoByNodeIds(@Param("ids") List<Long> ids);
+
+    int addCheckPdfInfoByNodeId(@Param("ids") String ids,@Param("classify") String classify);
+
+    int addCheckPdfInfoByIds(@Param("ids") List<String> ids,@Param("classify") String classify);
+
+    ChekPdfPaceVo getCheckPdfPaceInfo(@Param("contractId") String contractI, @Param("classify") String classify);
 }

+ 22 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml

@@ -1008,4 +1008,26 @@
             #{id}
         </foreach>
     </select>
+
+    <update id="addCheckPdfInfoByNodeId" >
+        update u_information_query a set a.chek_status=1
+        where a.is_deleted = 0 and a.classify=#{classify} and a.wbs_id
+        in( select b.p_key_id from m_wbs_tree_contract b where b.is_deleted = 0 and b.ancestors_p_id like CONCAT(CONCAT('%', #{ids}), '%') and b.is_deleted = 0) and a.status in(1,2)
+    </update>
+
+    <update id="addCheckPdfInfoByIds">
+        update u_information_query set chek_status=1
+        where is_deleted = 0 and classify=#{classify} and id in
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+
+    <select id="getCheckPdfPaceInfo" resultType="org.springblade.business.vo.ChekPdfPaceVo">
+        SELECT c.TotalCount,c.finishCount, IF(FLOOR(finishCount/TotalCount),null,0) as pace from (
+           SELECT COUNT(1) as TotalCount,IF(SUM(IF(status = 'chek_status', 1, 0)),null,0) AS finishCount from u_information_query where contract_id=#{contractId} and classify=#{classify} and chek_status in(1,2,3)
+        ) c
+    </select>
+
 </mapper>

+ 8 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/IInformationQueryService.java

@@ -18,11 +18,13 @@ package org.springblade.business.service;
 
 import com.alibaba.fastjson.JSONObject;
 import org.springblade.business.entity.InformationQuery;
+import org.springblade.business.vo.ChekPdfPaceVo;
 import org.springblade.business.vo.FileUserVO;
 import org.springblade.business.vo.InformationQueryVO;
 import org.springblade.business.vo.QueryProcessDataVO;
 import org.springblade.core.mp.base.BaseService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.tool.api.R;
 import org.springblade.manager.entity.TabBusstimeInfo;
 import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.vo.WbsTreeContractTreeVOS;
@@ -162,4 +164,10 @@ public interface IInformationQueryService extends BaseService<InformationQuery>
     List<Long> getInfoByNodeIds(List<Long> ids);
 
     void createNewInformationQueriesByStatusForLock(Collection<String> ids);
+
+    // 测试节点信息
+    R updateCheckPdfInfo(String type, String ids, String classify);
+
+    ChekPdfPaceVo getCheckPdfPaceInfo(String contractId, String classify);
+
 }

+ 4 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/ITaskService.java

@@ -57,7 +57,7 @@ public interface ITaskService extends BaseService<Task> {
     /**
      * 批量审批
      */
-    void batchCompleteApprovalTask(List<TaskApprovalVO> taskApprovalVOS) throws FileNotFoundException;
+    Boolean batchCompleteApprovalTask(List<TaskApprovalVO> taskApprovalVOS) throws FileNotFoundException;
 
     /**
      * 启动流程
@@ -136,4 +136,7 @@ public interface ITaskService extends BaseService<Task> {
     R reSigningEVisaStatus0(List<reSigningEVisaStatus> dtos, String header) throws Exception;
 
     void logSaveAgain(LogSaveAgainDto dto) throws Exception;
+
+    //
+    R reSigningEVisaByUserIds(String ids, String userIds);
 }

+ 60 - 50
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ArchiveFileServiceImpl.java

@@ -75,7 +75,7 @@ public class ArchiveFileServiceImpl extends BaseServiceImpl<ArchiveFileMapper, A
         pageVoList.forEach(vos -> {
             vos.setIsApprovalValue(new Integer("0").equals(vos.getStatus()) ? "未上报" : new Integer("1").equals(vos.getStatus()) ? "待审批" : new Integer("2").equals(vos.getStatus()) ? "已审批" : "已废除");
             vos.setIsCertificationValue(new Integer("1").equals(vos.getIsCertification()) ? "已认证" : "未认证");
-            vos.setIsArchive(vos.getIsArchive()==null?0: vos.getIsArchive());
+            vos.setIsArchive(vos.getIsArchive() == null ? 0 : vos.getIsArchive());
             if (StringUtils.isNotEmpty(vos.getSheetSource())) {
                 sheetSourceList.forEach(source -> {
                     if (source.getDictKey().equals(vos.getSheetSource())) {
@@ -83,9 +83,9 @@ public class ArchiveFileServiceImpl extends BaseServiceImpl<ArchiveFileMapper, A
                     }
                 });
             }
-            fileIds.append(vos.getId()+",");
+            fileIds.append(vos.getId() + ",");
         });
-        if(vo.getRectification() != null &&(vo.getRectification() == 1 || vo.getRectification() == 2)) {
+        if (vo.getRectification() != null && (vo.getRectification() == 1 || vo.getRectification() == 2)) {
             Map<String, Map<String, Object>> allopinion = archiveInspectionInfoClient.getAllopinion(fileIds.toString());
             if (allopinion != null) {
                 pageVoList.forEach(vos -> {
@@ -135,41 +135,51 @@ public class ArchiveFileServiceImpl extends BaseServiceImpl<ArchiveFileMapper, A
         for (int i = 0; i < list.size(); i++) {
             listInt.add(list.get(i).getSort());
         }
-        //按照从大到小进行排序
-//		Collections.sort(listInt, new Comparator<Integer>() {
-//			@Override
-//			public int compare(Integer integer, Integer t1) {
-//				return integer-t1;
-//			}
-//		});
+
         StringBuffer ids = new StringBuffer();
+        StringBuffer ids2 = new StringBuffer();
+        Map<Long, Integer> mapkey = new HashMap<>();
         Collections.sort(listInt);
         for (int i = 0; i < list.size(); i++) {
+            ids2.append(list.get(i).getId() + ",");
             list.get(i).setSort(listInt.get(i));
-            if(list.get(i).getIsUpdateUrl() != null && list.get(i).getIsUpdateUrl() == 1) {
+            if (list.get(i).getIsUpdateUrl() != null && list.get(i).getIsUpdateUrl() == 1) {
                 ids.append(list.get(i).getId() + ",");
-                if(list.get(i).getRectification() != null && list.get(i).getRectification() == 1){
+                if (list.get(i).getRectification() != null && list.get(i).getRectification() == 1) {
                     list.get(i).setRectification(2);
                 }
             }
         }
-        if(ids != null && ids.length()>0){
-        List<String> removeFiles = new ArrayList<>();
-        List<ArchiveFile> archiveFileByFileIds = baseMapper.getArchiveFileByFileIds(Func.toLongList(ids.toString()));
-        if(archiveFileByFileIds!=null && archiveFileByFileIds.size()>0){
-            for(ArchiveFile archiveFile:archiveFileByFileIds){
-                if(StringUtils.isNotEmpty(archiveFile.getFileUrl().trim())){
-                    removeFiles.add(archiveFile.getFileUrl());
+        // 删除oss文件
+        if (ids != null && ids.length() > 0) {
+            List<String> removeFiles = new ArrayList<>();
+            List<ArchiveFile> archiveFileByFileIds = baseMapper.getArchiveFileByFileIds(Func.toLongList(ids.toString()));
+            if (archiveFileByFileIds != null && archiveFileByFileIds.size() > 0) {
+                for (ArchiveFile archiveFile : archiveFileByFileIds) {
+                    if (StringUtils.isNotEmpty(archiveFile.getFileUrl().trim())) {
+                        removeFiles.add(archiveFile.getFileUrl());
+                    }
+                    mapkey.put(archiveFile.getId(), archiveFile.getIsApproval());
                 }
+                executorService.execute(() -> {
+                    iossClient.removeFiles(removeFiles);
+                });
             }
-            executorService.execute(()->{
-                iossClient.removeFiles(removeFiles);
-            });
         }
+
+        //获取所有文件
+        if (ids2 != null && ids2.length() > 0) {
+            List<ArchiveFile> archiveFileByFileIds = baseMapper.getArchiveFileByFileIds(Func.toLongList(ids2.toString()));
+            if (archiveFileByFileIds != null && archiveFileByFileIds.size() > 0) {
+                for (ArchiveFile archiveFile : archiveFileByFileIds) {
+                    mapkey.put(archiveFile.getId(), archiveFile.getIsApproval());
+                }
+            }
         }
+
         for (ArchiveFile vo : list) {
             // 修改所有的认证状态,如果是不需要认证就设置为已认证,如果是需要认证就设置为未认证
-            if (Func.isNotEmpty(vo.getIsNeedCertification())){
+            if (Func.isNotEmpty(vo.getIsNeedCertification())) {
                 if (vo.getIsNeedCertification() == 0) {
                     vo.setIsCertification(1);
                 } else if (vo.getIsNeedCertification() == 1) {
@@ -177,10 +187,10 @@ public class ArchiveFileServiceImpl extends BaseServiceImpl<ArchiveFileMapper, A
                 }
             }
             //循环查看是否把需要审批改为不需要审批,  不可能把不需要审批改为需要审批 ,0不需要,1需要
-            if (vo.getStatus() != null && vo.getStatus() == 0 && vo.getIsApproval() != null &&  vo.getIsApproval() == 0) {
+            if (vo.getStatus() != null && vo.getStatus() == 0 && vo.getIsApproval() != null && vo.getIsApproval() == 0) {
                 vo.setStatus(2);
             }
-            if(vo.getIsApproval() != null && vo.getIsApproval() == 1){
+            if (vo.getIsApproval() != null && vo.getIsApproval() == 1 && vo.getIsApproval() != mapkey.get(vo.getId())) {
                 Set<String> aopParamsSet = new HashSet<>();
                 //判断现在的数据是否是待审批数据,只有上报状态、未认证状态的数据才能撤销
                 ArchiveFile archiveFile = jdbcTemplate.queryForObject("select * from u_archive_file where id = " + vo.getId(), new BeanPropertyRowMapper<>(ArchiveFile.class));
@@ -303,43 +313,43 @@ public class ArchiveFileServiceImpl extends BaseServiceImpl<ArchiveFileMapper, A
 
     @Override
     public void addArchiveFileEx(List<ArchiveFile> files) {
-        executorService.execute(()->{
+        executorService.execute(() -> {
             this.saveBatch(files);
         });
     }
 
     @Override
     public void updateArchiveFileEx(List<ArchiveFile> files) {
-        executorService.execute(()->{
+        executorService.execute(() -> {
             this.updateBatchById(files);
         });
     }
 
     @Override
     public boolean sortByFileTime(Long nodeId) {
-     String sql="SELECT id,file_time,node_id FROM u_archive_file WHERE node_id IN (SELECT id FROM m_archive_tree_contract WHERE  FIND_IN_SET("+nodeId+",ancestors)) AND is_deleted=0";
-     List<ArchiveFile> list=jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(ArchiveFile.class));
-     if(list.size()>0){
-         Map<String, List<ArchiveFile>> group = list.stream()
-             .collect(Collectors.groupingBy(ArchiveFile::getNodeId));
-         for (Map.Entry<String, List<ArchiveFile>> entry : group.entrySet()) {
-             List<ArchiveFile> archiveFiles = entry.getValue();
-             archiveFiles.sort((a, b) -> {
-                 if (a.getFileTime() == null && b.getFileTime() == null) return 0;
-                 if (a.getFileTime() == null) return -1;
-                 if (b.getFileTime() == null) return 1;
-                 return a.getFileTime().compareTo(b.getFileTime());
-             });
-             int sort = 0;
-             for (ArchiveFile file : archiveFiles) {
-                 file.setSort(sort++);
-             }
-             this.updateBatchById(archiveFiles);
-         }
-         return true;
-     }else {
-         return false;
-     }
+        String sql = "SELECT id,file_time,node_id FROM u_archive_file WHERE node_id IN (SELECT id FROM m_archive_tree_contract WHERE  FIND_IN_SET(" + nodeId + ",ancestors)) AND is_deleted=0";
+        List<ArchiveFile> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ArchiveFile.class));
+        if (list.size() > 0) {
+            Map<String, List<ArchiveFile>> group = list.stream()
+                    .collect(Collectors.groupingBy(ArchiveFile::getNodeId));
+            for (Map.Entry<String, List<ArchiveFile>> entry : group.entrySet()) {
+                List<ArchiveFile> archiveFiles = entry.getValue();
+                archiveFiles.sort((a, b) -> {
+                    if (a.getFileTime() == null && b.getFileTime() == null) return 0;
+                    if (a.getFileTime() == null) return -1;
+                    if (b.getFileTime() == null) return 1;
+                    return a.getFileTime().compareTo(b.getFileTime());
+                });
+                int sort = 0;
+                for (ArchiveFile file : archiveFiles) {
+                    file.setSort(sort++);
+                }
+                this.updateBatchById(archiveFiles);
+            }
+            return true;
+        } else {
+            return false;
+        }
     }
 
 }

+ 15 - 6
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ContractLogServiceImpl.java

@@ -329,13 +329,22 @@ public class ContractLogServiceImpl extends BaseServiceImpl<ContractLogMapper, C
             }
         });
         if(CollectionUtil.isNotEmpty(contractLogMonthPacks)){
-            List<String> collect1 = contractLogMonthPacks.stream().map(ContractLogMonthPack::getRecordTime).collect(Collectors.toList());
-            //删除文件
-            List<ContractLogMonthPack> list = contractLogMonthPackService.list(Wrappers.<ContractLogMonthPack>lambdaQuery()
-                    .eq(ContractLogMonthPack::getContractId, logVo.getContractId())
-                    .eq(ContractLogMonthPack::getWbsNodeId, logVo.getWbsNodeId())
-                    .in(ContractLogMonthPack::getRecordTime, collect1));
+            List<String> collect1 = contractLogMonthPacks.stream().map(map ->{
+                DateTime dateTime = DateUtil.parse(map.getRecordTime(), "yyyyMMdd");
+                return dateTime.toString("yyyyMM");
+            }).collect(Collectors.toList());
+            List<ContractLogMonthPack> list = new ArrayList<>();
+            for (String date : collect1) {
+                //删除文件
+                List<ContractLogMonthPack> listed = contractLogMonthPackService.list(Wrappers.<ContractLogMonthPack>lambdaQuery()
+                        .eq(ContractLogMonthPack::getContractId, logVo.getContractId())
+                        .eq(ContractLogMonthPack::getWbsNodeId, logVo.getWbsNodeId())
+                        .likeRight(ContractLogMonthPack::getRecordTime, date));
 
+                if(CollectionUtil.isNotEmpty(listed)){
+                    list.addAll(listed);
+                }
+            }
             if(CollectionUtil.isNotEmpty(list)){
                 //删除文件
                 list.forEach(f -> {

+ 35 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java

@@ -15,6 +15,7 @@ import org.springblade.business.feign.TaskClient;
 import org.springblade.business.mapper.InformationQueryMapper;
 import org.springblade.business.service.*;
 import org.springblade.business.utils.FileUtils;
+import org.springblade.business.vo.ChekPdfPaceVo;
 import org.springblade.business.vo.FileUserVO;
 import org.springblade.business.vo.InformationQueryVO;
 import org.springblade.business.vo.QueryProcessDataVO;
@@ -872,7 +873,7 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
                     eVisaFailedInfo = taskPa.getEVisaContent();
                 }
             }
-            vo.setWaitingUserList(taskPa.getTaskUserName(), taskPa.getEVisaStatus());
+            vo.setWaitingUserList(taskPa.getTaskUserName(), taskPa.getEVisaStatus(), taskPa.getTaskUser());
             vo.setEVisaFailedInfo(eVisaFailedInfo);
         }
     }
@@ -1110,4 +1111,37 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
             }
         }
     }
+
+    @Override
+    public R updateCheckPdfInfo(String type, String ids,String classify) {
+        if(type==null || Func.isNull(type)){
+            return R.fail("type不能weinull");
+        }
+        if(ids==null || Func.isNull(ids)){
+            return R.fail("ids不能weinull");
+        }
+        if(classify==null || Func.isNull(classify)){
+            return R.fail("classify不能weinull");
+        }
+        List<String> strList = Func.toStrList((ids));
+        if(type.equals("1")){
+
+            this.baseMapper.addCheckPdfInfoByNodeId(ids,classify);
+        } else if (type.equals("2")) {
+            this.baseMapper.addCheckPdfInfoByIds(strList,classify);
+        }else{
+            return R.fail("type有误,无法处理该业务");
+        }
+        return R.success("操作成功");
+    }
+    @Override
+    public ChekPdfPaceVo getCheckPdfPaceInfo(String contractId, String classify) {
+       /* ChekPdfPaceVo da = new ChekPdfPaceVo();
+        da.setPace(20);
+        da.setTotalCount(100);
+        da.setFinishCount(20);*/
+
+        ChekPdfPaceVo checkPdfPaceInfo = baseMapper.getCheckPdfPaceInfo(contractId, classify);
+        return checkPdfPaceInfo;
+    }
 }

+ 345 - 211
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -134,9 +134,9 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
     private final TrialSelfInspectionRecordMapper trialSelfInspectionRecordMapper;
     private final WbsTreeContractStatisticsClientImpl wbsTreeContractStatisticsClient;
     //超级管理员的角色id
-    private final String SUPER_ADMIN_ROLE_ID ="1123598816738675201";
+    private final String SUPER_ADMIN_ROLE_ID = "1123598816738675201";
     //泓创智诚公司的部门id
-    private final Long  HONGCHENG_DEPT_ID = 1536982621165592577L;
+    private final Long HONGCHENG_DEPT_ID = 1536982621165592577L;
 
     @Autowired
     StringRedisTemplate RedisTemplate;
@@ -247,7 +247,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     //封面
                     String url = StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl();
                     String s = getHppsToHttp(url);
-                    vo.setApprovalFileList(query.getName(), s, query.getWbsId()+"", query.getClassify() + "", query.getProjectId() + "", query.getContractId() + "");
+                    vo.setApprovalFileList(query.getName(), s, query.getWbsId() + "", query.getClassify() + "", query.getProjectId() + "", query.getContractId() + "");
                 }
                 //不是签章时再查关联资料,因为关联资料都是审批好的pdf,存在关键字,不能再执行签 字/章
                 if (!isTask) {
@@ -257,7 +257,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     }
                     InformationQueryFile queryFile = this.informationQueryFileService.getOne(Wrappers.<InformationQueryFile>lambdaQuery().eq(InformationQueryFile::getQueryId, query.getId()));
                     if (queryFile != null) {
-                        vo.setApprovalFileList(queryFile.getName(), getHppsToHttp(queryFile.getPdfUrl()),query.getWbsId()+"", query.getClassify() + "", query.getProjectId() + "", query.getContractId() + "");
+                        vo.setApprovalFileList(queryFile.getName(), getHppsToHttp(queryFile.getPdfUrl()), query.getWbsId() + "", query.getClassify() + "", query.getProjectId() + "", query.getContractId() + "");
                     }
                 }
 
@@ -280,13 +280,13 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     //资料填报原始pdf
 //                    String approvalPdf = StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl();
                     /** 修改需求,任务查看时,附件不在列表中显示,需要拼接在电签后面。如果此处修改影响其他地方,则到时候再说*/
-                    if(isTask){
+                    if (isTask) {
                         String approvalPdf = StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl();
-                        vo.setApprovalFileList(query.getName(), this.getHppsToHttp(approvalPdf), query.getWbsId()+"", query.getClassify()+"", query.getProjectId()+"", query.getContractId()+"");
-                    }else{
+                        vo.setApprovalFileList(query.getName(), this.getHppsToHttp(approvalPdf), query.getWbsId() + "", query.getClassify() + "", query.getProjectId() + "", query.getContractId() + "");
+                    } else {
                         String approvalPdf = StringUtils.isNotEmpty(query.getNodePdfUrl()) ? query.getNodePdfUrl() : query.getEVisaPdfUrl();
                         String approvalPdf2 = StringUtils.isNotEmpty(approvalPdf) ? approvalPdf : query.getPdfUrl();
-                        vo.setApprovalFileList(query.getName(), this.getHppsToHttp(approvalPdf2), query.getWbsId()+"", query.getClassify()+"", query.getProjectId()+"", query.getContractId()+"");
+                        vo.setApprovalFileList(query.getName(), this.getHppsToHttp(approvalPdf2), query.getWbsId() + "", query.getClassify() + "", query.getProjectId() + "", query.getContractId() + "");
                     }
 
                     //试验关联文件合并pdf
@@ -296,7 +296,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                             query.setPdfTrialUrl(replaceHTTPURL);
                         }
                         String trialPdf = StringUtils.isNotEmpty(query.getPdfTrialUrl()) ? query.getPdfTrialUrl() : null;
-                        vo.setApprovalFileList(query.getName() + "(关联试验文件)", getHppsToHttp(trialPdf), query.getWbsId()+"", query.getClassify()+"", query.getProjectId()+"", query.getContractId()+"");
+                        vo.setApprovalFileList(query.getName() + "(关联试验文件)", getHppsToHttp(trialPdf), query.getWbsId() + "", query.getClassify() + "", query.getProjectId() + "", query.getContractId() + "");
                     }
 
                     //试验关联的工程部位信息合并pdf
@@ -307,7 +307,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                         }
 
                         String trailpdf = StringUtils.isNotEmpty(query.getPdfTrialUrlPosition()) ? query.getPdfTrialUrlPosition() : null;
-                        vo.setApprovalFileList(query.getName() + "(关联试验工程部位信息文件)", getHppsToHttp(trailpdf), query.getWbsId()+"", query.getClassify()+"", query.getProjectId()+"", query.getContractId()+"");
+                        vo.setApprovalFileList(query.getName() + "(关联试验工程部位信息文件)", getHppsToHttp(trailpdf), query.getWbsId() + "", query.getClassify() + "", query.getProjectId() + "", query.getContractId() + "");
                     }
                 }
             } else if (new Integer("2").equals(query.getType())) {
@@ -329,14 +329,14 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     //试验原始pdf
                     String approvalPdf = StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl();
                     try {
-                        String sql="Select * from u_trial_self_inspection_record where id="+query.getWbsId();
+                        String sql = "Select * from u_trial_self_inspection_record where id=" + query.getWbsId();
                         TrialSelfInspectionRecord record = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class));
-                        String sql1="select * from u_entrust_info where id="+record.getEntrustId();
+                        String sql1 = "select * from u_entrust_info where id=" + record.getEntrustId();
                         EntrustInfo entrustInfo = jdbcTemplate.queryForObject(sql1, new BeanPropertyRowMapper<>(EntrustInfo.class));
                         List<String> pdfList = new ArrayList<>();
-                        if(entrustInfo!=null){
+                        if (entrustInfo != null) {
                             pdfList.add(approvalPdf);
-                            pdfList.add(entrustInfo.getEntrustEPdf()!=null?entrustInfo.getEntrustEPdf():entrustInfo.getEntrustPdf());
+                            pdfList.add(entrustInfo.getEntrustEPdf() != null ? entrustInfo.getEntrustEPdf() : entrustInfo.getEntrustPdf());
                             if (pdfList.size() > 0) {
                                 String file_path = FileUtils.getSysLocalFileUrl();
                                 Long id = SnowFlakeUtil.getId();
@@ -353,10 +353,10 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                                 }
                             }
                         }
-                    }catch (Exception e){
+                    } catch (Exception e) {
                         e.printStackTrace();
                     }
-                    vo.setApprovalFileList(query.getName(), getHppsToHttp(approvalPdf), query.getWbsId()+"", query.getClassify()+"", query.getProjectId()+"", query.getContractId()+"");
+                    vo.setApprovalFileList(query.getName(), getHppsToHttp(approvalPdf), query.getWbsId() + "", query.getClassify() + "", query.getProjectId() + "", query.getContractId() + "");
 
                     //试验关联的原材料检测报告合并pdf (wbsId=试验记录id)
                     String sqlRecord = "select old_pdf_url from u_trial_raw_material_self_record where self_record_id =" + query.getWbsId();
@@ -369,7 +369,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                             }
                         }
                         String clPdf = StringUtils.isNotEmpty(recordObj.getOldPdfUrl()) ? recordObj.getOldPdfUrl() : null;
-                        vo.setApprovalFileList(query.getName() + "(原材料检测报告)", getHppsToHttp(clPdf), query.getWbsId()+"", query.getClassify()+"", query.getProjectId()+"", query.getContractId()+"");
+                        vo.setApprovalFileList(query.getName() + "(原材料检测报告)", getHppsToHttp(clPdf), query.getWbsId() + "", query.getClassify() + "", query.getProjectId() + "", query.getContractId() + "");
                     }
                 }
             }
@@ -401,6 +401,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         }
         return url;
     }
+
     private String getHppsToHttp(String url) {
         String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
         if (url.contains("https:") && sys_isonline.equals("20")) {
@@ -623,13 +624,13 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
      * @throws FileNotFoundException
      */
     @Override
-    public void batchCompleteApprovalTask(List<TaskApprovalVO> taskApprovalVOS) {
+    public Boolean batchCompleteApprovalTask(List<TaskApprovalVO> taskApprovalVOS) {
         Long userId = AuthUtil.getUserId();
         String nickName = AuthUtil.getNickName();
         // 批量审批接口
-        if(taskApprovalVOS!=null && taskApprovalVOS.size()>0){
+        if (taskApprovalVOS != null && taskApprovalVOS.size() > 0) {
             TaskApprovalVO taskAppr = taskApprovalVOS.get(0);
-            if(taskAppr.getFlag().equals("OK")){ //同意
+            if (taskAppr.getFlag().equals("OK")) { //同意
                 List<String> taskIds = taskApprovalVOS.stream().map(TaskApprovalVO::getParallelProcessInstanceId).distinct().collect(Collectors.toList());
                 this.taskParallelService.update(Wrappers.<TaskParallel>lambdaUpdate()
                         .set(TaskParallel::getEVisaContent, "当前等待电签的批次较多,请等待几分钟后刷新页面查看........")
@@ -657,12 +658,12 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     taskList.add(taskBatch);
                     //设置委托单的状态
                     try {
-                        String sql="SELECT uei.* FROM u_entrust_info uei JOIN u_trial_self_inspection_record utsr ON uei.id = utsr.entrust_id JOIN u_information_query uiq ON utsr.id = uiq.wbs_id WHERE uiq.id = "+taskApprovalVO.getFormDataId()+" and uiq.status !=3 and uiq.is_deleted=0";
+                        String sql = "SELECT uei.* FROM u_entrust_info uei JOIN u_trial_self_inspection_record utsr ON uei.id = utsr.entrust_id JOIN u_information_query uiq ON utsr.id = uiq.wbs_id WHERE uiq.id = " + taskApprovalVO.getFormDataId() + " and uiq.status !=3 and uiq.is_deleted=0";
                         List<EntrustInfo> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(EntrustInfo.class));
-                        if(!query.isEmpty()){
+                        if (!query.isEmpty()) {
                             EntrustInfo entrustInfo = query.get(0);
-                            if(entrustInfo.getStatus()==3){
-                                String update="update u_entrust_info set status = 4 where id="+entrustInfo.getId();
+                            if (entrustInfo.getStatus() == 3) {
+                                String update = "update u_entrust_info set status = 4 where id=" + entrustInfo.getId();
                                 jdbcTemplate.execute(update);
                             }
                         }
@@ -670,8 +671,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                         e.printStackTrace();
                     }
                 }
-                this.taskBatchService.saveBatch(taskList);
-            }else if (taskAppr.getFlag().equals("NO")){ //废除
+                return this.taskBatchService.saveBatch(taskList);
+            } else if (taskAppr.getFlag().equals("NO")) { //废除
                 Set<String> taskIds = taskApprovalVOS.stream().map(TaskApprovalVO::getTaskId).collect(Collectors.toSet());
                 List<Task> tasks = this.listByIds(taskIds);
                 Map<String, Task> taskMap = tasks.stream().collect(Collectors.toMap(task -> task.getId() + "", task -> task));
@@ -688,19 +689,19 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     // 废除信息
                     Integer appType = taskApp.getApprovalType();
                     //质检系统
-                    String up_task_par = "update u_task_parallel set status=3 , e_visa_content = '驳回成功,驳回原因:" + taskApp.getComment() + "', initiative=10,update_time=SYSDATE(),update_user="+userId+"  where parallel_process_instance_id='"+taskApp.getParallelProcessInstanceId()+"'";
-                    String up_task = "update u_task set status=3, update_time=SYSDATE(),update_user="+userId+" where id='"+taskApp.getTaskId()+"'";
-                    this.jdbcTemplate.execute("delete from u_task_batch where JSON_UNQUOTE(JSON_EXTRACT(json_data, '$.taskId'))="+taskApp.getTaskId()+"");
+                    String up_task_par = "update u_task_parallel set status=3 , e_visa_content = '驳回成功,驳回原因:" + taskApp.getComment() + "', initiative=10,update_time=SYSDATE(),update_user=" + userId + "  where parallel_process_instance_id='" + taskApp.getParallelProcessInstanceId() + "'";
+                    String up_task = "update u_task set status=3, update_time=SYSDATE(),update_user=" + userId + " where id='" + taskApp.getTaskId() + "'";
+                    this.jdbcTemplate.execute("delete from u_task_batch where JSON_UNQUOTE(JSON_EXTRACT(json_data, '$.taskId'))=" + taskApp.getTaskId() + "");
                     jdbcTemplate.execute(up_task_par);
                     jdbcTemplate.execute(up_task);
 
-                    if(taskApp.getApprovalType() == 3){
-                        jdbcTemplate.execute("update u_contract_log set status=3 where id='"+taskApp.getFormDataId()+"'");
-                    }else if (taskApp.getApprovalType()==8) {
-                        this.jdbcTemplate.execute("update u_entrust_info set status=1 where id=(SELECT wbs_id from u_information_query where id='"+taskApp.getFormDataId()+"')");
-                        this.jdbcTemplate.execute("update u_information_query set status=3 where id='"+taskApp.getFormDataId()+"'");
-                    }else {
-                        jdbcTemplate.execute("update u_information_query set e_visa_pdf_url='',status=3 where id='"+taskApp.getFormDataId()+"'");
+                    if (taskApp.getApprovalType() == 3) {
+                        jdbcTemplate.execute("update u_contract_log set status=3 where id='" + taskApp.getFormDataId() + "'");
+                    } else if (taskApp.getApprovalType() == 8) {
+                        this.jdbcTemplate.execute("update u_entrust_info set status=1 where id=(SELECT wbs_id from u_information_query where id='" + taskApp.getFormDataId() + "')");
+                        this.jdbcTemplate.execute("update u_information_query set status=3 where id='" + taskApp.getFormDataId() + "'");
+                    } else {
+                        jdbcTemplate.execute("update u_information_query set e_visa_pdf_url='',status=3 where id='" + taskApp.getFormDataId() + "'");
                         InformationQuery informationQuery = informationQueryService.getById(taskApp.getFormDataId());
                         Long primaryKeyId = informationQuery.getWbsId();
                         informationQuery.setStatus(0);
@@ -763,12 +764,14 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     }
                 }
                 wbsTreeContractStatisticsClient.updateInformationQueryStatusByTaskId(String.join(",", taskIds));
+                return true;
             }
         }
+        return false;
     }
 
 
-   // @Scheduled(cron = "0/20 * * * * ?")
+    // @Scheduled(cron = "0/20 * * * * ?")
    /* public void SignInfo() throws InterruptedException {
         //执行代码
         logger.debug("扫描开始");
@@ -1119,7 +1122,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
      * 质检-日志重签
      */
     @Override
-    public void logReSigningEVisa( String logids,Long logPkeyId, Long nodePrimaryKeyId, String contractId ,HttpServletRequest request, Integer type) {
+    public void logReSigningEVisa(String logids, Long logPkeyId, Long nodePrimaryKeyId, String contractId, HttpServletRequest request, Integer type) {
         List<Task> taskList = jdbcTemplate.query("select * from u_task where is_deleted = 0 and status != 3 and  form_data_id in(" + logids + ")", new BeanPropertyRowMapper<>(Task.class));
         if (taskList.size() > 0) {
             //获取任务详情信息Map
@@ -1141,14 +1144,14 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 for (Task task : taskList) {
                     ContractLog contractLog = contractLogMap.get(Long.valueOf(task.getFormDataId()));
                     R result = new R();
-                    jdbcTemplate.execute("DELETE from u_task_batch where json_data like '%"+task.getId()+"%'");
+                    jdbcTemplate.execute("DELETE from u_task_batch where json_data like '%" + task.getId() + "%'");
                     boolean b = false;
-                    if(type == 1){
-                         b = contractLogService.update(new LambdaUpdateWrapper<ContractLog>().eq(ContractLog::getId, contractLog.getId())
+                    if (type == 1) {
+                        b = contractLogService.update(new LambdaUpdateWrapper<ContractLog>().eq(ContractLog::getId, contractLog.getId())
                                 .set(ContractLog::getEVisaPdfUrl, null)
                                 .set(ContractLog::getPdfUrl, null));
-                    }else {
-                         b = contractLogService.update(new LambdaUpdateWrapper<ContractLog>().eq(ContractLog::getId, contractLog.getId())
+                    } else {
+                        b = contractLogService.update(new LambdaUpdateWrapper<ContractLog>().eq(ContractLog::getId, contractLog.getId())
                                 .set(ContractLog::getEVisaPdfUrl, null));
                     }
 
@@ -1158,12 +1161,12 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                         long startTime_1 = System.currentTimeMillis();
                         //获取详细的日志数据
 
-                        result = excelTabClient.getTheContractLogBusinessData(logPkeyId.toString(), nodePrimaryKeyId.toString(), contractLog.getRecordTime(), contractId,contractLog.getCreateUser());
+                        result = excelTabClient.getTheContractLogBusinessData(logPkeyId.toString(), nodePrimaryKeyId.toString(), contractLog.getRecordTime(), contractId, contractLog.getCreateUser());
                         long endTime_1 = System.currentTimeMillis();
                         long executionTime_1 = endTime_1 - startTime_1;
                         log.info("saveNodePdf执行时间:" + executionTime_1 + " 毫秒");
-                    }else{
-                        if (!b){
+                    } else {
+                        if (!b) {
                             throw new ServiceException("清空电签PDF失败");
                         }
                         result.setData("成功");
@@ -1188,7 +1191,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                             }
                         }
                         long startTime_2 = System.currentTimeMillis();
-                        if(taskApprovalVOS!=null && taskApprovalVOS.size()>=1){
+                        if (taskApprovalVOS != null && taskApprovalVOS.size() >= 1) {
                             this.batchCompleteApprovalTask(taskApprovalVOS);
                         }
                         long endTime_2 = System.currentTimeMillis();
@@ -1216,7 +1219,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());
             }
 
-        }else {
+        } else {
             throw new ServiceException("未获取到任务信息,操作失败!");
         }
     }
@@ -1245,13 +1248,13 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             try {
                 for (Task task : taskList) {
                     R result = new R();
-                    jdbcTemplate.execute("DELETE from u_task_batch where json_data like '%"+task.getId()+"%'");
+                    jdbcTemplate.execute("DELETE from u_task_batch where json_data like '%" + task.getId() + "%'");
                     boolean b = false;
-                    if(type == 1){
+                    if (type == 1) {
                         b = informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
                                 .eq(InformationQuery::getId, task.getFormDataId())
                                 .set(InformationQuery::getEVisaPdfUrl, null));
-                    }else {
+                    } else {
                         b = informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
                                 .eq(InformationQuery::getId, task.getFormDataId())
                                 .set(InformationQuery::getEVisaPdfUrl, null));
@@ -1260,12 +1263,12 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     if (type == 1) {
                         //重新保存
                         long startTime_1 = System.currentTimeMillis();
-                        result = this.saveTrialSelfNodePdf(dto,queryMap.get(task.getFormDataId()));
+                        result = this.saveTrialSelfNodePdf(dto, queryMap.get(task.getFormDataId()));
                         long endTime_1 = System.currentTimeMillis();
                         long executionTime_1 = endTime_1 - startTime_1;
                         log.info("saveNodePdf执行时间:" + executionTime_1 + " 毫秒");
-                    }else{
-                        if (!b){
+                    } else {
+                        if (!b) {
                             throw new ServiceException("清空电签PDF失败");
                         }
                         result.setData("成功");
@@ -1276,7 +1279,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                         List<TaskParallel> taskParallelList = finalTaskParallelGroupMap.get(task.getProcessInstanceId());
                         for (TaskParallel taskParallel : taskParallelList) {
                             //待审批的不进行重签, 存在待审批,但是电签状态是失败的
-                            if ((new Integer(2)).equals(taskParallel.getStatus()) || Func.isNotEmpty(taskParallel.getEVisaStatus()) || Func.isNotEmpty(taskParallel.getEVisaContent()) ) {
+                            if ((new Integer(2)).equals(taskParallel.getStatus()) || Func.isNotEmpty(taskParallel.getEVisaStatus()) || Func.isNotEmpty(taskParallel.getEVisaContent())) {
                                 TaskApprovalVO approvalVO = new TaskApprovalVO();
                                 approvalVO.setTaskId(task.getId().toString());
                                 approvalVO.setFlag("OK");
@@ -1290,7 +1293,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                             }
                         }
                         long startTime_2 = System.currentTimeMillis();
-                        if(taskApprovalVOS!=null && taskApprovalVOS.size()>=1){
+                        if (taskApprovalVOS != null && taskApprovalVOS.size() >= 1) {
                             this.batchCompleteApprovalTask(taskApprovalVOS);
                         }
                         long endTime_2 = System.currentTimeMillis();
@@ -1316,7 +1319,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 e.printStackTrace();
                 throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());
             }
-        }else {
+        } else {
             throw new ServiceException("未获取到任务信息,操作失败!");
         }
 
@@ -1327,10 +1330,10 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
     public void reSigningEntrust(List<ReSigningEntrustDto> dtos, String header, HttpServletRequest request) {
         String taskIds = dtos.stream().map(d -> d.getTaskId()).collect(Collectors.joining(","));
         Map<String, ReSigningEntrustDto> map = dtos.stream()
-            .filter(dto -> dto.getTaskId() != null) // 确保taskId不为空
-            .collect(Collectors.toMap(ReSigningEntrustDto::getTaskId, dto -> dto));
+                .filter(dto -> dto.getTaskId() != null) // 确保taskId不为空
+                .collect(Collectors.toMap(ReSigningEntrustDto::getTaskId, dto -> dto));
         Map<Long, ReSigningEntrustDto> longMap = map.values().stream()
-            .collect(Collectors.toMap(ReSigningEntrustDto::getTaskIdLong, dto -> dto));
+                .collect(Collectors.toMap(ReSigningEntrustDto::getTaskIdLong, dto -> dto));
         //查询任务信息
         List<Task> taskList = jdbcTemplate.query("select * from u_task where id in(" + taskIds + ")", new BeanPropertyRowMapper<>(Task.class));
         if (taskList.size() > 0) {
@@ -1339,8 +1342,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             Map<String, List<TaskParallel>> taskParallelGroupMap = new HashMap<>();
             if (processInstanceIds.size() > 0) {
                 String resultIds = processInstanceIds.stream()
-                    .map(id -> "'" + id + "'")
-                    .collect(Collectors.joining(","));
+                        .map(id -> "'" + id + "'")
+                        .collect(Collectors.joining(","));
                 taskParallelGroupMap = jdbcTemplate.query("select parallel_process_instance_id,process_instance_id,e_visa_status,task_user,task_user_name,status 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;
@@ -1348,20 +1351,20 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 for (int i = 0; i < taskList.size(); i++) {
                     ReSigningEntrustDto dto = longMap.get(taskList.get(i).getId());
                     R result = new R();
-                    jdbcTemplate.execute("DELETE from u_task_batch where json_data like '%"+taskList.get(i).getId()+"%'");
+                    jdbcTemplate.execute("DELETE from u_task_batch where json_data like '%" + taskList.get(i).getId() + "%'");
                     boolean b = false;
-                    if(dto.getType() == 1){
+                    if (dto.getType() == 1) {
                         b = informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
-                            .eq(InformationQuery::getId, taskList.get(i).getFormDataId())
-                            .set(InformationQuery::getEVisaPdfUrl, null)
-                            .set(InformationQuery::getPdfUrl, null));
-                        String update="update u_entrust_info set entrust_e_pdf=null,entrust_pdf=null where id="+dto.getEntrustId();
+                                .eq(InformationQuery::getId, taskList.get(i).getFormDataId())
+                                .set(InformationQuery::getEVisaPdfUrl, null)
+                                .set(InformationQuery::getPdfUrl, null));
+                        String update = "update u_entrust_info set entrust_e_pdf=null,entrust_pdf=null where id=" + dto.getEntrustId();
                         jdbcTemplate.update(update);
-                    }else {
+                    } else {
                         b = informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
-                            .eq(InformationQuery::getId, taskList.get(i).getFormDataId())
-                            .set(InformationQuery::getEVisaPdfUrl, null));
-                        String update="update u_entrust_info set entrust_e_pdf=null where id="+dto.getEntrustId();
+                                .eq(InformationQuery::getId, taskList.get(i).getFormDataId())
+                                .set(InformationQuery::getEVisaPdfUrl, null));
+                        String update = "update u_entrust_info set entrust_e_pdf=null where id=" + dto.getEntrustId();
                         jdbcTemplate.update(update);
                     }
 
@@ -1369,12 +1372,12 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     if (dto.getType() == 1) {
                         //重新保存
                         long startTime_1 = System.currentTimeMillis();
-                        result=excelTabClient.saveReEntrustTabData(dto,header);
+                        result = excelTabClient.saveReEntrustTabData(dto, header);
                         long endTime_1 = System.currentTimeMillis();
                         long executionTime_1 = endTime_1 - startTime_1;
                         log.info("saveNodePdf执行时间:" + executionTime_1 + " 毫秒");
-                    }else{
-                        if (!b){
+                    } else {
+                        if (!b) {
                             throw new ServiceException("清空电签PDF失败");
                         }
                         result.setData("成功");
@@ -1385,7 +1388,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                         List<TaskParallel> taskParallelList = finalTaskParallelGroupMap.get(taskList.get(i).getProcessInstanceId());
                         for (TaskParallel taskParallel : taskParallelList) {
                             //待审批的不进行重签, 存在待审批,但是电签状态是失败的
-                            if ((new Integer(2)).equals(taskParallel.getStatus()) || Func.isNotEmpty(taskParallel.getEVisaStatus()) || Func.isNotEmpty(taskParallel.getEVisaContent()) ) {
+                            if ((new Integer(2)).equals(taskParallel.getStatus()) || Func.isNotEmpty(taskParallel.getEVisaStatus()) || Func.isNotEmpty(taskParallel.getEVisaContent())) {
                                 TaskApprovalVO approvalVO = new TaskApprovalVO();
                                 approvalVO.setTaskId(taskList.get(i).getId().toString());
                                 approvalVO.setFlag("OK");
@@ -1399,11 +1402,11 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                             }
                         }
                         long startTime_2 = System.currentTimeMillis();
-                        if(taskApprovalVOS!=null && taskApprovalVOS.size()>=1){
+                        if (taskApprovalVOS != null && taskApprovalVOS.size() >= 1) {
                             this.batchCompleteApprovalTask(taskApprovalVOS);
                         }
-                        if(result.getData()!=null){
-                            String update="update u_entrust_info set entrust_pdf= '"+result.getData()+"' where id="+dto.getEntrustId();
+                        if (result.getData() != null) {
+                            String update = "update u_entrust_info set entrust_pdf= '" + result.getData() + "' where id=" + dto.getEntrustId();
                             jdbcTemplate.update(update);
                         }
                         long endTime_2 = System.currentTimeMillis();
@@ -1412,8 +1415,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     } else {
                         //修改重签状态为保存PDF失败
                         this.taskParallelService.update(Wrappers.<TaskParallel>lambdaUpdate()
-                            .set(TaskParallel::getEVisaContent, "重新保存PDF失败")
-                            .eq(TaskParallel::getProcessInstanceId, taskList.get(i).getProcessInstanceId()));
+                                .set(TaskParallel::getEVisaContent, "重新保存PDF失败")
+                                .eq(TaskParallel::getProcessInstanceId, taskList.get(i).getProcessInstanceId()));
                     }
                 }
             } catch (Exception e) {
@@ -1421,14 +1424,13 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());
             }
 
-        }else {
+        } else {
             throw new ServiceException("未获取到任务信息,操作失败!");
         }
     }
 
 
-
-    private R saveTrialSelfNodePdf(TrialResignDto dto,String trialId) {
+    private R saveTrialSelfNodePdf(TrialResignDto dto, String trialId) {
         //试验记录id
         String trialIds = dto.getTrialIds();
         TrialSelfInspectionRecord tRecord = trialSelfInspectionRecordMapper.selectById(trialIds);
@@ -1551,7 +1553,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 //                } else {
 //                    throw new ServiceException("开启并行流程失败");
 //                }
-                  taskParallelArray.add(new TaskParallel(vo.getProcessInstanceId(), SnowFlakeUtil.getId() + "", link.getFixedFlowLinkUser().toString(), link.getFixedFlowLinkUserName()));
+                taskParallelArray.add(new TaskParallel(vo.getProcessInstanceId(), SnowFlakeUtil.getId() + "", link.getFixedFlowLinkUser().toString(), link.getFixedFlowLinkUserName()));
             }
             //设置流程信息
             vo.setProcessDefinitionId(taskFlowId);
@@ -1661,8 +1663,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         try {
             System.out.println("----- 电签成功--------");
             //添加nodePdf的值
-            List<Map<String, Object>> mapList = jdbcTemplate.queryForList("select *,domain_url as url from m_table_file where is_deleted = 0 and type in (10,11,12) and tab_id = (select wbs_id from u_information_query WHERE id = + "+formDataId+")");
-            if(Func.isNotEmpty(mapList)&&mapList.size()>=1) {
+            List<Map<String, Object>> mapList = jdbcTemplate.queryForList("select *,domain_url as url from m_table_file where is_deleted = 0 and type in (10,11,12) and tab_id = (select wbs_id from u_information_query WHERE id = + " + formDataId + ")");
+            if (Func.isNotEmpty(mapList) && mapList.size() >= 1) {
                 String file_path = org.springblade.business.utils.FileUtils.getSysLocalFileUrl();
                 List<String> datainfo = new ArrayList<>();
                 datainfo.add(newFileUrl);
@@ -1685,7 +1687,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     nodePdfUrl = org.springblade.business.utils.FileUtils.getNetUrl(listPdf);
                 }
 
-            }else{
+            } else {
                 nodePdfUrl = newFileUrl;
             }
 
@@ -1744,7 +1746,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 //修改试验业务状态(已审批的情况下修改)
                 if (new Integer(2).equals(queryinfo.getType()) && ObjectUtil.isNotEmpty(queryinfo.getWbsId()) && status != 3) {
                     jdbcTemplate.execute("update u_trial_self_inspection_record set task_status = '已审批' where id = " + queryinfo.getWbsId());
-                    jdbcTemplate.execute("update u_entrust_info set status = 4 where id = (select entrust_id from u_trial_self_inspection_record where id = '" + queryinfo.getWbsId()+ "')");
+                    jdbcTemplate.execute("update u_entrust_info set status = 4 where id = (select entrust_id from u_trial_self_inspection_record where id = '" + queryinfo.getWbsId() + "')");
                 }
 
             }
@@ -1789,7 +1791,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             ArchiveProjectConfig archiveProjectConfig = archiveAutoClient.getByProjectIdOrNew(query.getProjectId());
 
             //测试阶段,必须打开项目配置才能同步wbs节点
-            if (archiveProjectConfig != null ) {
+            if (archiveProjectConfig != null) {
                 //废除
                 if (status == 0) {
                     delArchiveFileBusinessData(query.getProjectId(), query.getWbsId());
@@ -1904,104 +1906,106 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             archiveFileService.deleteLogic(ids);
         }
     }
-/*
-    @Override
-    public void reSigningEVisa(String taskIds, String contractId, String projectId,String header,HttpServletRequest request) {
-        List<Task> taskList = jdbcTemplate.query("select * from u_task where id in(" + taskIds + ")", new BeanPropertyRowMapper<>(Task.class));
-        if (taskList.size() > 0) {
-            List<String> dataIdList = taskList.stream().map(Task::getFormDataId).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
-            List<InformationQuery> informationQueryList = jdbcTemplate.query("select * from u_information_query where id in(" + StringUtils.join(dataIdList, ",") + ")", new BeanPropertyRowMapper<>(InformationQuery.class));
-            if (informationQueryList.size() > 0) {
-                List<Long> nodePKeyIdList = informationQueryList.stream().map(InformationQuery::getWbsId).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
-                if (nodePKeyIdList.size() > 0) {
-                    try {
-                      //  重新保存
-                        long startTime_1 = System.currentTimeMillis();
-                        R result = this.saveNodePdf( ,StringUtils.join(nodePKeyIdList, ","), contractId, projectId,header);
-                        long endTime_1 = System.currentTimeMillis();
-                        long executionTime_1 = endTime_1 - startTime_1;
-                        log.info("saveNodePdf执行时间:" + executionTime_1 + " 毫秒");
 
-                       // 重新电签
-                        if (result != null && "成功".equals(result.getData())) {
-
-                            List<TaskApprovalVO> taskApprovalVOS = new ArrayList<>();
-                           // 获取任务详情信息Map
-                            Set<String> processInstanceIds = taskList.stream().map(Task::getProcessInstanceId).collect(Collectors.toSet());
-                            Map<String, List<TaskParallel>> taskParallelGroupMap = new HashMap<>();
-                            if (processInstanceIds.size() > 0) {
-                                String resultIds = processInstanceIds.stream()
-                                        .map(id -> "'" + id + "'")
-                                        .collect(Collectors.joining(","));
-                                taskParallelGroupMap = jdbcTemplate.query("select parallel_process_instance_id,process_instance_id,e_visa_status,task_user,task_user_name,status 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;
-
-                            for (Task task : taskList) {
-                                List<TaskParallel> taskParallelList = finalTaskParallelGroupMap.get(task.getProcessInstanceId());
-                                for (TaskParallel taskParallel : taskParallelList) {
-                                    //待审批的不进行重签, 存在待审批,但是电签状态是失败的
-                                    if (!(new Integer(1)).equals(taskParallel.getStatus()) || (taskParallel.getEVisaStatus() != null && taskParallel.getEVisaStatus() == 99)) {
-                                        TaskApprovalVO approvalVO = new TaskApprovalVO();
-                                        approvalVO.setTaskId(task.getId().toString());
-                                        approvalVO.setFlag("OK");
-                                        approvalVO.setComment("重新发起电签");
-                                        approvalVO.setApprovalType(1);
-                                        approvalVO.setFormDataId(task.getFormDataId());
-                                        approvalVO.setParallelProcessInstanceId(taskParallel.getParallelProcessInstanceId());
-                                        approvalVO.setYsNickName(taskParallel.getTaskUserName());
-                                        approvalVO.setUserId(Long.parseLong(taskParallel.getTaskUser()));
-                                        taskApprovalVOS.add(approvalVO);
+    /*
+        @Override
+        public void reSigningEVisa(String taskIds, String contractId, String projectId,String header,HttpServletRequest request) {
+            List<Task> taskList = jdbcTemplate.query("select * from u_task where id in(" + taskIds + ")", new BeanPropertyRowMapper<>(Task.class));
+            if (taskList.size() > 0) {
+                List<String> dataIdList = taskList.stream().map(Task::getFormDataId).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
+                List<InformationQuery> informationQueryList = jdbcTemplate.query("select * from u_information_query where id in(" + StringUtils.join(dataIdList, ",") + ")", new BeanPropertyRowMapper<>(InformationQuery.class));
+                if (informationQueryList.size() > 0) {
+                    List<Long> nodePKeyIdList = informationQueryList.stream().map(InformationQuery::getWbsId).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
+                    if (nodePKeyIdList.size() > 0) {
+                        try {
+                          //  重新保存
+                            long startTime_1 = System.currentTimeMillis();
+                            R result = this.saveNodePdf( ,StringUtils.join(nodePKeyIdList, ","), contractId, projectId,header);
+                            long endTime_1 = System.currentTimeMillis();
+                            long executionTime_1 = endTime_1 - startTime_1;
+                            log.info("saveNodePdf执行时间:" + executionTime_1 + " 毫秒");
+
+                           // 重新电签
+                            if (result != null && "成功".equals(result.getData())) {
+
+                                List<TaskApprovalVO> taskApprovalVOS = new ArrayList<>();
+                               // 获取任务详情信息Map
+                                Set<String> processInstanceIds = taskList.stream().map(Task::getProcessInstanceId).collect(Collectors.toSet());
+                                Map<String, List<TaskParallel>> taskParallelGroupMap = new HashMap<>();
+                                if (processInstanceIds.size() > 0) {
+                                    String resultIds = processInstanceIds.stream()
+                                            .map(id -> "'" + id + "'")
+                                            .collect(Collectors.joining(","));
+                                    taskParallelGroupMap = jdbcTemplate.query("select parallel_process_instance_id,process_instance_id,e_visa_status,task_user,task_user_name,status 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;
+
+                                for (Task task : taskList) {
+                                    List<TaskParallel> taskParallelList = finalTaskParallelGroupMap.get(task.getProcessInstanceId());
+                                    for (TaskParallel taskParallel : taskParallelList) {
+                                        //待审批的不进行重签, 存在待审批,但是电签状态是失败的
+                                        if (!(new Integer(1)).equals(taskParallel.getStatus()) || (taskParallel.getEVisaStatus() != null && taskParallel.getEVisaStatus() == 99)) {
+                                            TaskApprovalVO approvalVO = new TaskApprovalVO();
+                                            approvalVO.setTaskId(task.getId().toString());
+                                            approvalVO.setFlag("OK");
+                                            approvalVO.setComment("重新发起电签");
+                                            approvalVO.setApprovalType(1);
+                                            approvalVO.setFormDataId(task.getFormDataId());
+                                            approvalVO.setParallelProcessInstanceId(taskParallel.getParallelProcessInstanceId());
+                                            approvalVO.setYsNickName(taskParallel.getTaskUserName());
+                                            approvalVO.setUserId(Long.parseLong(taskParallel.getTaskUser()));
+                                            taskApprovalVOS.add(approvalVO);
+                                        }
                                     }
                                 }
+                                long startTime_2 = System.currentTimeMillis();
+                                this.batchCompleteApprovalTask(taskApprovalVOS);
+                                long endTime_2 = System.currentTimeMillis();
+                                long executionTime_2 = endTime_2 - startTime_2;
+                                log.info("batchCompleteApprovalTask执行时间:" + executionTime_2 + " 毫秒");
+                            } else {
+                                throw new ServiceException("重新保存PDF信息失败");
                             }
-                            long startTime_2 = System.currentTimeMillis();
-                            this.batchCompleteApprovalTask(taskApprovalVOS);
-                            long endTime_2 = System.currentTimeMillis();
-                            long executionTime_2 = endTime_2 - startTime_2;
-                            log.info("batchCompleteApprovalTask执行时间:" + executionTime_2 + " 毫秒");
-                        } else {
-                            throw new ServiceException("重新保存PDF信息失败");
-                        }
 
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                        throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                            throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());
+                        }
                     }
                 }
             }
+            throw new ServiceException("未获取到任务信息,操作失败!");
+        }*/
+    @Override
+    public R reSigningEVisaStatus0(List<reSigningEVisaStatus> dtos, String header) throws Exception {
+        if (dtos.size() > 0) {
+            Set<Long> newIds = dtos.stream().map(reSigningEVisaStatus::getId).collect(Collectors.toSet());
+            //正在重刷的不允许再次重刷
+            informationQueryService.update(Wrappers.<InformationQuery>update().lambda()
+                    .set(InformationQuery::getSaveAgain, 0)
+                    .ne(InformationQuery::getSaveAgain, 1)
+                    .in(InformationQuery::getId, newIds));
         }
-        throw new ServiceException("未获取到任务信息,操作失败!");
-    }*/
-        @Override
-        public R reSigningEVisaStatus0(List<reSigningEVisaStatus> dtos, String header) throws Exception {
-         if(dtos.size()>0){
-             Set<Long> newIds = dtos.stream().map(reSigningEVisaStatus::getId).collect(Collectors.toSet());
-             //正在重刷的不允许再次重刷
-             informationQueryService.update(Wrappers.<InformationQuery>update().lambda()
-                     .set(InformationQuery::getSaveAgain, 0)
-                     .ne(InformationQuery::getSaveAgain, 1)
-                     .in(InformationQuery::getId, newIds));
-        }
-         return R.success("操作成功");
+        return R.success("操作成功");
     }
 
     @Override
     public void logSaveAgain(LogSaveAgainDto dto) throws Exception {
         List<ContractLog> contractLogList = jdbcTemplate.query("select * from u_contract_log where id in (" + dto.getLogIds() + ")", new BeanPropertyRowMapper<>(ContractLog.class));
-        if(contractLogList.size()>0){
+        if (contractLogList.size() > 0) {
             for (ContractLog contractLog : contractLogList) {
                 contractLogService.update(new LambdaUpdateWrapper<ContractLog>().eq(ContractLog::getId, contractLog.getId())
-                    .set(ContractLog::getEVisaPdfUrl, null)
-                    .set(ContractLog::getPdfUrl, null));
+                        .set(ContractLog::getEVisaPdfUrl, null)
+                        .set(ContractLog::getPdfUrl, null));
                 //excelTabClient.getTheContractLogBusinessData(dto.getLogPkeyId(), dto.getNodePrimaryKeyId(), contractLog.getRecordTime(), dto.getContractId(), contractLog.getCreateUser());
-                excelTabClient.getTheLogPdInfo(dto.getLogPkeyId(), dto.getNodePrimaryKeyId(), contractLog.getRecordTime(), dto.getContractId(),contractLog.getCreateUser());
+                excelTabClient.getTheLogPdInfo(dto.getLogPkeyId(), dto.getNodePrimaryKeyId(), contractLog.getRecordTime(), dto.getContractId(), contractLog.getCreateUser());
             }
         }
     }
 
+
     @Override
-    public void reSigningEVisa(String classify, String taskIds, String contractId, String projectId, Integer type, String header,HttpServletRequest request ) {
+    public void reSigningEVisa(String classify, String taskIds, String contractId, String projectId, Integer type, String header, HttpServletRequest request) {
         //查询任务信息
         List<Task> taskList = jdbcTemplate.query("select * from u_task where id in(" + taskIds + ")", new BeanPropertyRowMapper<>(Task.class));
         if (taskList.size() > 0) {
@@ -2023,17 +2027,35 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             try {
                 for (Task task : taskList) {
                     R result = new R();
-                    jdbcTemplate.execute("DELETE from u_task_batch where json_data like '%"+task.getId()+"%'");
+                    jdbcTemplate.execute("DELETE from u_task_batch where json_data like '%" + task.getId() + "%'");
                     boolean b = false;
+
+                    //是否恢复pdf
+                    Boolean isRestorePdf = false;
+                    //当前节点的电签pdf
+                    String eVisaPdfUrl = "";
+                    String pdfUrl = "";
                     if(type == 1){
+                        //当前节点的电签pdf
+                        InformationQuery byId = informationQueryService.getById(task.getFormDataId());
+                        if(byId != null){
+                            eVisaPdfUrl = byId.getEVisaPdfUrl();
+                            pdfUrl = byId.getPdfUrl();
+                        }
                          b = informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
                                 .eq(InformationQuery::getId, task.getFormDataId())
                                 .set(InformationQuery::getEVisaPdfUrl, null)
-//                                .set(InformationQuery::getPdfUrl, null)
+                                .set(InformationQuery::getPdfUrl, null)
                          );
                     }else {
                         if(task.getApprovalType()==3){
-                           b=contractLogService.update(new LambdaUpdateWrapper<ContractLog>()
+                            //当前节点的电签pdf
+                            ContractLog byId = contractLogService.getById(task.getFormDataId());
+                            if(byId != null){
+                                eVisaPdfUrl = byId.getEVisaPdfUrl();
+                            }
+
+                            b=contractLogService.update(new LambdaUpdateWrapper<ContractLog>()
                                .eq(ContractLog::getId,task.getFormDataId())
                                .set(ContractLog::getEVisaPdfUrl,null));
                            if(!b){
@@ -2041,9 +2063,14 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                                return;
                            }
                         }else {
+                            //当前节点的电签pdf
+                            InformationQuery byId = informationQueryService.getById(task.getFormDataId());
+                            if(byId != null){
+                                eVisaPdfUrl = byId.getEVisaPdfUrl();
+                            }
                             b = informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
-                                .eq(InformationQuery::getId, task.getFormDataId())
-                                .set(InformationQuery::getEVisaPdfUrl, null));
+                                    .eq(InformationQuery::getId, task.getFormDataId())
+                                    .set(InformationQuery::getEVisaPdfUrl, null));
                         }
 
                     }
@@ -2057,55 +2084,82 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                         //重新保存
                         long startTime_1 = System.currentTimeMillis();
                         //质检资料
-                        if(task.getApprovalType()==1 || task.getApprovalType()== 9){
-                            String sql="select type from u_information_query where id="+task.getFormDataId();
+                        if (task.getApprovalType() == 1 || task.getApprovalType() == 9) {
+                            String sql = "select type from u_information_query where id=" + task.getFormDataId();
                             Integer InformationType = jdbcTemplate.queryForObject(sql, new SingleColumnRowMapper<>(Integer.class));
-                            if(InformationType==1){
-                                result = this.saveNodePdf(typeMap.get(task.getFormDataId()), queryMap.get(task.getFormDataId()), contractId, projectId, header);
-                            }else {
-                                TrialResignDto dto=new TrialResignDto();
+                            if (InformationType == 1) {
+                                try {
+                                    result = this.saveNodePdf(typeMap.get(task.getFormDataId()), queryMap.get(task.getFormDataId()), contractId, projectId, header);
+                                    //恢复pdf
+                                    if(result.getCode()!=200){
+                                        isRestorePdf = true;
+                                    }
+                                } catch (Exception e) {
+                                    isRestorePdf = true;
+                                }
+                            } else {
+                                TrialResignDto dto = new TrialResignDto();
                                 dto.setType(1);
                                 dto.setProjectId(projectId);
                                 dto.setTrialIds(queryMap.get(task.getFormDataId()));
-                                result=this.saveTrialSelfNodePdf(dto,queryMap.get(task.getFormDataId()));
+                                result = this.saveTrialSelfNodePdf(dto, queryMap.get(task.getFormDataId()));
                             }
 
                         }
                         //日志资料
-                        if(task.getApprovalType()==3){
+                        if (task.getApprovalType() == 3) {
                             ContractLog contractLog = jdbcTemplate.queryForObject("select * from u_contract_log where id =" + task.getFormDataId(), new BeanPropertyRowMapper<>(ContractLog.class));
-                            result = excelTabClient.getTheContractLogBusinessData(contractLog.getTableId().toString(), contractLog.getWbsNodeId().toString(), contractLog.getRecordTime(), contractId,contractLog.getCreateUser());
+                            result = excelTabClient.getTheContractLogBusinessData(contractLog.getTableId().toString(), contractLog.getWbsNodeId().toString(), contractLog.getRecordTime(), contractId, contractLog.getCreateUser());
                         }
                         //委托单重签
-                        if(task.getApprovalType()==8){
-                            String sql="SELECT * from u_entrust_info where id=(select wbs_id from u_information_query where id="+task.getFormDataId()+")";
+                        if (task.getApprovalType() == 8) {
+                            String sql = "SELECT * from u_entrust_info where id=(select wbs_id from u_information_query where id=" + task.getFormDataId() + ")";
                             EntrustInfo info = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(EntrustInfo.class));
-                            ReSigningEntrustDto dto=new ReSigningEntrustDto(info.getId().toString(),task.getId().toString(),contractId,info.getNodeId(),2,1);
-                            result=excelTabClient.saveReEntrustTabData(dto,header);
-                            if(result.getCode()==200){
-                                if(result.getData()!=null){
-                                    informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
-                                        .eq(InformationQuery::getId, task.getFormDataId())
-                                        .set(InformationQuery::getPdfUrl,result.getData()));
+                            ReSigningEntrustDto dto = new ReSigningEntrustDto(info.getId().toString(), task.getId().toString(), contractId, info.getNodeId(), 2, 1);
+                            try {
+                                result=excelTabClient.saveReEntrustTabData(dto,header);
+                                if(result.getCode()==200){
+                                    if(result.getData()!=null){
+                                        informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                                .eq(InformationQuery::getId, task.getFormDataId())
+                                                .set(InformationQuery::getPdfUrl,result.getData()));
+                                    }
+                                }else{
+                                    //恢复pdf
+                                    isRestorePdf = true;
                                 }
+                            } catch (Exception e) {
+                                //恢复pdf
+                                isRestorePdf = true;
                             }
+
                         }
                         long endTime_1 = System.currentTimeMillis();
                         long executionTime_1 = endTime_1 - startTime_1;
                         log.info("saveNodePdf执行时间:" + executionTime_1 + " 毫秒");
-                    }else{
-                        if (!b){
+                    } else {
+                        if (!b) {
                             throw new ServiceException("清空电签PDF失败");
                         }
                         result.setData("成功");
                     }
+                    //恢复pdf 并且 恢复电签pdf
+                    if(isRestorePdf){
+                        informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                .eq(InformationQuery::getId, task.getFormDataId())
+                                .set(InformationQuery::getPdfUrl, pdfUrl)
+                                .set(InformationQuery::getEVisaPdfUrl, eVisaPdfUrl));
+                        continue;
+                    }
+
+
                     //重新电签
-                    if (result != null && ("成功".equals(result.getData())||200==result.getCode())) {
+                    if (result != null && ("成功".equals(result.getData()) || 200 == result.getCode())) {
                         List<TaskApprovalVO> taskApprovalVOS = new ArrayList<>();
                         List<TaskParallel> taskParallelList = finalTaskParallelGroupMap.get(task.getProcessInstanceId());
                         for (TaskParallel taskParallel : taskParallelList) {
                             //待审批的不进行重签, 存在待审批,但是电签状态是失败的
-                            if ((new Integer(2)).equals(taskParallel.getStatus()) || Func.isNotEmpty(taskParallel.getEVisaStatus()) || Func.isNotEmpty(taskParallel.getEVisaContent()) ) {
+                            if ((new Integer(2)).equals(taskParallel.getStatus()) || Func.isNotEmpty(taskParallel.getEVisaStatus()) || Func.isNotEmpty(taskParallel.getEVisaContent())) {
                                 TaskApprovalVO approvalVO = new TaskApprovalVO();
                                 approvalVO.setTaskId(task.getId().toString());
                                 approvalVO.setFlag("OK");
@@ -2119,13 +2173,58 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                             }
                         }
                         long startTime_2 = System.currentTimeMillis();
-                        if(taskApprovalVOS!=null && taskApprovalVOS.size()>=1){
-                            this.batchCompleteApprovalTask(taskApprovalVOS);
+                        if (taskApprovalVOS != null && taskApprovalVOS.size() >= 1) {
+                            boolean b1 = this.batchCompleteApprovalTask(taskApprovalVOS);
+                            //如果失败 恢复电签
+                            if (!b1) {
+                                if (type == 1) {
+                                    //当前节点的电签pdf
+                                    informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                            .eq(InformationQuery::getId, task.getFormDataId())
+                                            .set(InformationQuery::getEVisaPdfUrl, eVisaPdfUrl)
+                                    );
+                                } else {
+                                    if (task.getApprovalType() == 3) {
+                                        contractLogService.update(new LambdaUpdateWrapper<ContractLog>()
+                                                .eq(ContractLog::getId, task.getFormDataId())
+                                                .set(ContractLog::getEVisaPdfUrl, eVisaPdfUrl));
+                                        if (!b) {
+                                            jdbcTemplate.update("update u_task set is_deleted=1 where id=" + task.getId());
+                                            return;
+                                        }
+                                    } else {
+                                        informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                                .eq(InformationQuery::getId, task.getFormDataId())
+                                                .set(InformationQuery::getEVisaPdfUrl, eVisaPdfUrl));
+                                    }
+                                }
+                            }
                         }
                         long endTime_2 = System.currentTimeMillis();
                         long executionTime_2 = endTime_2 - startTime_2;
                         log.info("batchCompleteApprovalTask执行时间:" + executionTime_2 + " 毫秒");
                     } else {
+                        if (type == 1) {
+                            //当前节点的电签pdf
+                            informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                    .eq(InformationQuery::getId, task.getFormDataId())
+                                    .set(InformationQuery::getEVisaPdfUrl, eVisaPdfUrl)
+                            );
+                        } else {
+                            if (task.getApprovalType() == 3) {
+                                contractLogService.update(new LambdaUpdateWrapper<ContractLog>()
+                                        .eq(ContractLog::getId, task.getFormDataId())
+                                        .set(ContractLog::getEVisaPdfUrl, eVisaPdfUrl));
+                                if (!b) {
+                                    jdbcTemplate.update("update u_task set is_deleted=1 where id=" + task.getId());
+                                    return;
+                                }
+                            } else {
+                                informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                        .eq(InformationQuery::getId, task.getFormDataId())
+                                        .set(InformationQuery::getEVisaPdfUrl, eVisaPdfUrl));
+                            }
+                        }
                         //修改重签状态为保存PDF失败
                         this.taskParallelService.update(Wrappers.<TaskParallel>lambdaUpdate()
                                 .set(TaskParallel::getEVisaContent, "重新保存PDF失败")
@@ -2136,7 +2235,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 Long userId = AuthUtil.getUserId(request);
                 String userName = AuthUtil.getNickName(request);
                 //判断是否是超级管理员并且是泓创智诚下的部门
-                if(judgeRoleIdAndDeptId(userId)){
+                if (judgeRoleIdAndDeptId(userId)) {
                     //满足去除当前填报人的条件 去除当前任务的填报人中当前操作人的信息
                     removeUserAndName(taskIds, userId, userName);
                 }
@@ -2145,7 +2244,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());
             }
 
-        }else {
+        } else {
             throw new ServiceException("未获取到任务信息,操作失败!");
         }
     }
@@ -2156,32 +2255,31 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
     }
 
 
-
     /**
      * 返回true代表满足条件 是超级管理员并且部门是在泓创智诚下面的部门
      */
-    public boolean judgeRoleIdAndDeptId(Long userId ){
+    public boolean judgeRoleIdAndDeptId(Long userId) {
         try {
-            String sqlForUser = "select role_id ,dept_id from blade_user where id = "+userId;
+            String sqlForUser = "select role_id ,dept_id from blade_user where id = " + userId;
             User user = jdbcTemplate.queryForObject(sqlForUser, new BeanPropertyRowMapper<>(User.class));
-            String sqlforSkipDept = "select id from blade_dept where parent_id = "+HONGCHENG_DEPT_ID + " or id = "+HONGCHENG_DEPT_ID;
+            String sqlforSkipDept = "select id from blade_dept where parent_id = " + HONGCHENG_DEPT_ID + " or id = " + HONGCHENG_DEPT_ID;
             List<Dept> depts = jdbcTemplate.query(sqlforSkipDept, new BeanPropertyRowMapper<>(Dept.class));
             String roleId = user.getRoleId();
             String deptId = user.getDeptId();
-            if(roleId==null||deptId==null){
+            if (roleId == null || deptId == null) {
                 return true;
             }
             //既是超级管理员同时是泓创下面的部门才允许跳过填报人赋值
-            if(roleId!=null&&roleId.contains(SUPER_ADMIN_ROLE_ID)){
+            if (roleId != null && roleId.contains(SUPER_ADMIN_ROLE_ID)) {
                 Boolean flag = false;
                 for (Dept dept : depts) {
-                    if(deptId!=null&&deptId.contains(dept.getId().toString())){
+                    if (deptId != null && deptId.contains(dept.getId().toString())) {
                         flag = true;
                         return flag;
                     }
                 }
                 return flag;
-            }else {
+            } else {
                 return false;
             }
         } catch (DataAccessException e) {
@@ -2197,26 +2295,26 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         try {
             String[] split1 = taskIds.split(",");
             for (String taskId : split1) {
-                String sqlForInformationQuery = "select * from u_information_query where id = (select form_data_id from u_task where id =" +taskId+ ")";
+                String sqlForInformationQuery = "select * from u_information_query where id = (select form_data_id from u_task where id =" + taskId + ")";
                 InformationQuery informationQuery = jdbcTemplate.queryForObject(sqlForInformationQuery, new BeanPropertyRowMapper<>(InformationQuery.class));
                 String fileUserIdAndName = informationQuery.getFileUserIdAndName();
-                if (StringUtils.isNotEmpty(fileUserIdAndName) && fileUserIdAndName.contains(userId + "-" + userName)){
+                if (StringUtils.isNotEmpty(fileUserIdAndName) && fileUserIdAndName.contains(userId + "-" + userName)) {
                     String[] split = fileUserIdAndName.split(",");
-                    if(split != null && split.length > 0){
+                    if (split != null && split.length > 0) {
                         ArrayList<String> list = new ArrayList<>(Arrays.asList(split));
                         for (int i = 0; i < list.size(); i++) {
-                            if(list.get(i).contains(userId + "-" + userName)){
+                            if (list.get(i).contains(userId + "-" + userName)) {
                                 list.remove(i);
                             }
                         }
                         String fileUserIdAndNameNew = String.join(",", list);
-                        String sqlForUpdateInformationQuery = "update  u_information_query set file_user_id_and_name = '"+fileUserIdAndNameNew+"' where id = (select form_data_id from u_task where id =" +taskId+ ")";
+                        String sqlForUpdateInformationQuery = "update  u_information_query set file_user_id_and_name = '" + fileUserIdAndNameNew + "' where id = (select form_data_id from u_task where id =" + taskId + ")";
                         jdbcTemplate.execute(sqlForUpdateInformationQuery);
                     }
                 }
             }
         } catch (DataAccessException e) {
-           throw new RuntimeException("去除对应的填报人信息异常");
+            throw new RuntimeException("去除对应的填报人信息异常");
         }
     }
 
@@ -2224,7 +2322,43 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
     public Task getTaskByFormDataId(String formDataId) {
         return getOne(Wrappers.<Task>lambdaQuery()
                 .eq(Task::getIsDeleted, 0)
+                .in(Task::getStatus, 0,1, 2)
                 .eq(Task::getFormDataId, formDataId));
     }
 
+    @Override
+    public R reSigningEVisaByUserIds(String ids, String userIds) {
+        if (Func.isEmpty(ids) && ids == null) {
+            return R.fail("未获取到taskIds,操作失败!");
+        }
+        String ids2 = "";
+        if (Func.isEmpty(ids) && ids == null) {
+            ids2 = "'"+ids +"'";
+        } else {
+            String[] split = ids.split(",");
+            for (String id : split) {
+                ids2 += "'"+ id + "',";
+            }
+            ids2 = ids2.substring(0, ids2.length() - 1);
+        }
+
+        String sqlqu = "update u_information_query set status=2,e_visa_pdf_url='' where id in( " + ids + ") and is_deleted=0 ";
+        String sqlForTask = "update u_task set status=2 where form_data_id in( " + ids2 + ") and status in(1,2) and is_deleted=0 ";
+        String sqlForTaskPall = "UPDATE u_task_parallel a  set a.`status`=2 , a.e_visa_status=1 ,a.e_visa_content='电签成功' where a.process_instance_id in(select process_instance_id  from u_task b  where b.form_data_id in( " + ids2 + ") and b.status in(0,1,2) and b.is_deleted = 0)  and a.`status` in(0,1)";
+
+        String taskBtech = "insert into u_task_batch(id,task_parallel_id,json_data,create_user,create_dept,create_time,update_user,update_time,status,is_deleted,nick_name,sign_format,sign_type)  " +
+                " SELECT a.id,a.process_instance_id,json_object('approvalFileList',json_array(),'approvalType',b.approval_type,'comment','','flag','OK','formDataId',b.form_data_id,'parallelProcessInstanceId',a.parallel_process_instance_id,'pass',true,'taskId',b.id) as  json_data,a.task_user,a.create_dept,a.create_time,a.update_user,a.update_time,1 as status,0 as is_deleted,a.task_user_name as nick_name ,1 as sign_format,1 as sign_type from u_task_parallel a,u_task b where b.`status` in(1,2) and a.`status` in(2)  and   a.process_instance_id=b.process_instance_id " +
+                " and b.form_data_id in( " + ids2 + ") and a.parallel_process_instance_id not in(SELECT JSON_EXTRACT(c.json_data, '$.parallelProcessInstanceId') from u_task_batch c)";
+
+        if(userIds!=null && userIds.length()>=1){
+            taskBtech += " and b.task_user in("+userIds+")";
+            sqlForTaskPall += " and a.task_user in("+userIds+")";
+        }
+        jdbcTemplate.execute(sqlqu);
+        jdbcTemplate.execute(sqlForTask);
+        jdbcTemplate.execute(sqlForTaskPall);
+        jdbcTemplate.execute(taskBtech);
+
+        return R.success("操作成功");
+    }
 }

+ 0 - 152
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/Chek.java

@@ -1,152 +0,0 @@
-package org.springblade.evisa.controller;
-
-import io.swagger.annotations.Api;
-import lombok.AllArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springblade.business.vo.ScrSignInfoVO;
-import org.springblade.business.vo.TaskSignInfoVO;
-import org.springblade.common.utils.CommonUtil;
-import org.springblade.common.utils.SnowFlakeUtil;
-import org.springblade.core.oss.model.BladeFile;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.evisa.service.ScrDataService;
-import org.springblade.evisa.utils.FileUtils;
-import org.springblade.resource.feign.NewIOSSClient;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.StringRedisTemplate;
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.io.ByteArrayInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-/**
- * 清表基础数据表 控制器
- *
- * @author BladeX
- * @since 2022-05-18
- */
-@RestController
-@AllArgsConstructor
-@Api(value = "电签类", tags = "电签类接口")
-@Slf4j
-public class  Chek {
-
-    @Autowired
-    private StringRedisTemplate RedisTemplate;
-    @Autowired
-    private JdbcTemplate jdbcTemplate;
-    @Autowired
-    private NewIOSSClient newIOSSClient;
-    // 线程池
-    @Resource(name = "taskExecutor1")
-    private ThreadPoolExecutor executor;
-
-
-
-   // @Scheduled(cron = "0/10 * * * * ?")
-    public void SignInfo() {
-        // 质检SQL
-       // String sql = "select id,file_url as eVisaPdfUrl from u_archive_file where length(file_url)!=char_length(file_url) and file_name not in('封面.pdf','封面1.pdf','卷内目录.pdf','卷内目录1.pdf','背脊.pdf','背脊1.pdf','备考表.pdf','备考表1.pdf') and is_deleted<>10  and  contract_id in(1890322575534399490,1890328157624541186,1887771910584999937) and file_url is not null and file_url like '%.pdf%' LIMIT 30  ";
-        String sql = "select id,file_url as eVisaPdfUrl from u_archive_file where file_url like '%//卷内目录.pdf' and  file_url is not null and file_url like '%.pdf%' LIMIT 30  ";
-
-        List<ScrSignInfoVO> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ScrSignInfoVO.class));
-        if (query != null && query.size() >= 1 ) {
-            for (ScrSignInfoVO dataInfo : query) {
-                if (executor.getQueue().size()<=60 ) {
-                    Long nodeId = dataInfo.getId();
-                    Boolean aBoolean = RedisTemplate.hasKey("sign-" + nodeId);
-
-                    if (!aBoolean) {
-                        RedisTemplate.opsForValue().set("sign-" + nodeId, "1",3600, TimeUnit.SECONDS);
-                        CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
-                            try {
-                                /*===============执行批量任务===============*/
-                                signTaskBatch(dataInfo);
-                            } catch (Exception e) {
-                                String dsql = "update u_archive_file set is_deleted=9  where id="+nodeId;
-                                jdbcTemplate.execute(dsql);
-                                RedisTemplate.delete("sign-" +nodeId);
-                                e.printStackTrace();
-                            }
-                        }, executor);
-                    }
-                }
-            }
-        }
-        System.out.println("队列数量" + executor.getQueue().size());
-        System.out.println("活跃数量" + executor.getActiveCount());
-        System.out.println("总共数量" + executor.getTaskCount());
-        System.out.println("完成数量" + executor.getCompletedTaskCount());
-    }
-
-
-
-    public void signTaskBatch(ScrSignInfoVO taskApp) throws Exception {
-
-        String pdfurl  =taskApp.getEVisaPdfUrl();
-        Long id  =taskApp.getId();
-
-        InputStream inputStre =getOSSInputStream2(pdfurl);
-        String sysLocalFileUrl = FileUtils.getSysLocalFileUrl();
-        String filecode = SnowFlakeUtil.getId() + "";
-        String dataFileUrl = sysLocalFileUrl + "/pdf/" + filecode + ".pdf";
-
-
-        FileOutputStream fout = new FileOutputStream(dataFileUrl);
-        int bytesRead = 0;
-        byte[] buffer = new byte[8192];
-        while ((bytesRead = inputStre.read(buffer, 0, 8192)) != -1) {
-            fout.write(buffer, 0, bytesRead);
-        }
-        fout.close();
-
-        BladeFile bladeFile = this.newIOSSClient.uploadFile(SnowFlakeUtil.getId() + ".pdf", dataFileUrl);
-
-        if (bladeFile != null && Func.isNotEmpty(bladeFile.getLink())) {
-           String dsql = "update u_archive_file set file_url='"+bladeFile.getLink()+"' ,is_deleted=10  where id="+id;
-           jdbcTemplate.execute(dsql);
-            System.out.println("成功");
-            System.out.println(dsql);
-        }
-        RedisTemplate.delete("sign-" + taskApp.getId());
-    }
-
-    public static InputStream getOSSInputStream2(String urlStr) {
-        try {
-            //获取OSS文件流
-         //  String encodedUrl = URLEncoder.encode(urlStr, StandardCharsets.UTF_8.toString());
-
-            URL url = new URL(urlStr);
-            URLConnection conn = url.openConnection();
-            conn.setRequestProperty("User-Agent", "Mozilla/5.0");
-          //  conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
-            return conn.getInputStream();
-        } catch (Exception e) {
-            System.out.println("zw-----------");
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-
-/*    public static void main(String[] args) throws UnsupportedEncodingException {
-        String data ="https://xinan1.zos.ctyun.cn/huazheng2021/archivedFile/cover/6eae7ee55e6ca24a2cc819534715//卷内目录.pdf";
-
-        getOSSInputStream2(data);
-    }*/
-
-}

+ 6 - 5
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/ChekSignData.java

@@ -45,25 +45,26 @@ public class ChekSignData {
     @Resource(name = "taskExecutor1")
     private ThreadPoolExecutor executor;
 
-  //  @Scheduled(cron = "0/10 * * * * ?")
+    @Scheduled(cron = "0/10 * * * * ?")
     public void SignInfo() {
         // 质检SQL
-        String sql = "SELECT a.id ,a.e_visa_pdf_url,b.process_instance_id,a.contract_id,a.project_id,c.remark_type from u_information_query a ,u_task b ,m_project_info c where b.id=1903019571036553216 and c.id=a.project_id  and a.`status` in(1,2) and a.is_deleted=0 and a.e_visa_pdf_url is not null  and b.form_data_id = a.id and b.`status` in(2) ";
+        String sql = "SELECT a.id ,a.e_visa_pdf_url,b.process_instance_id,a.contract_id,a.project_id,c.remark_type from u_information_query a ,u_task b ,m_project_info c where  c.id=a.project_id  and a.`status` in(1,2) and a.is_deleted=0 and a.e_visa_pdf_url is not null  and b.form_data_id = a.id and b.`status` in(1,2) and a.chek_status=1 LIMIT 30";
 
         List<ScrSignInfoVO> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ScrSignInfoVO.class));
         if (query != null && query.size() >= 1 ) {
             for (ScrSignInfoVO dataInfo : query) {
-                if (executor.getQueue().size()<=6 ) {
+                if (executor.getQueue().size()<=30 ) {
                     Long nodeId = dataInfo.getId();
-                    Boolean aBoolean = RedisTemplate.hasKey("sign-" + nodeId);
+                    Boolean aBoolean = RedisTemplate.hasKey("chek-" + nodeId);
 
                     if (!aBoolean) {
-                        RedisTemplate.opsForValue().set("sign-" + nodeId, "1",3600, TimeUnit.SECONDS);
+                        RedisTemplate.opsForValue().set("chek-" + nodeId, "1",3600, TimeUnit.SECONDS);
                         CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
                             try {
                                 /*===============执行批量任务===============*/
                                 scrDataService.sctTaskBatch(dataInfo);
                             } catch (Exception e) {
+                                RedisTemplate.delete("chek-" + nodeId);
                                 e.printStackTrace();
                             }
                         }, executor);

+ 3 - 3
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/EVController.java

@@ -58,7 +58,7 @@ public class EVController {
     @Resource(name = "taskExecutor1")
     private ThreadPoolExecutor executor;
 
-    @Scheduled(cron = "0/10 * * * * ?")
+    //@Scheduled(cron = "0/10 * * * * ?")
     public void SignInfo() {
         //执行代码
 
@@ -74,8 +74,8 @@ public class EVController {
                 "sign_type as sigType ," +
                 "(select count(0) from u_task_parallel b INNER JOIN u_task c on b.process_instance_id = c.process_instance_id " +
                 "where c.id = JSON_UNQUOTE(JSON_EXTRACT(a.json_data, '$.taskId')) and b.is_deleted = 0 and (b.status = 1 or b.initiative = 1)) isSignature" +
-                " from u_task_batch a where is_deleted=0 GROUP BY JSON_EXTRACT(json_data, '$.formDataId'),sign_type ORDER BY sign_type DESC ";
-                //and JSON_UNQUOTE(JSON_EXTRACT(json_data,'$.taskId')) in(SELECT id from u_task where project_id =1792760669353865218 and is_deleted =0 and approval_type=1 )
+                " from u_task_batch a where is_deleted=0  GROUP BY JSON_EXTRACT(json_data, '$.formDataId'),sign_type ORDER BY sign_type DESC ";
+
         List<TaskSignInfoVO> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TaskSignInfoVO.class));
 
         if (query != null && query.size() >= 1) {

+ 0 - 99
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/testTaskInfo222.java

@@ -1,99 +0,0 @@
-package org.springblade.evisa.controller;
-
-import io.swagger.annotations.Api;
-import lombok.AllArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springblade.common.utils.SnowFlakeUtil;
-import org.springblade.core.launch.StartEventListener;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.resource.feign.NewIOSSClient;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.StringRedisTemplate;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-
-
-/**
- * 清表基础数据表 控制器
- *
- * @author BladeX
- * @since 2022-05-18
- */
-@RestController
-@AllArgsConstructor
-@Api(value = "电签类", tags = "电签类接口")
-@Slf4j
-public class testTaskInfo222 {
-
-    private final StringRedisTemplate RedisTemplate;
-
-    private final JdbcTemplate jdbcTemplate;
-
-    private final NewIOSSClient newIOSSClient;
-
-    // 线程池
-    @Resource(name = "archivePoolExecutor")
-    private ThreadPoolExecutor archExecutor;
-    @Autowired
-    private StartEventListener startEventListener;
-
-  //  @Scheduled(cron = "0/10 * * * * ?")
-    public void SignTaskBatchPng() {
-        //执行代码
-        log.info("分解pdf专图片");
-     
-      //  String sql = "select * from u_information_query where is_deleted=0 and  id=1614886382873305090";
-        String sql = "SELECT * from u_task22 where is_deleted=0 LIMIT 900" ;
-        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
-        System.out.println(mapList.size());
-
-
-        if (mapList != null && mapList.size() >= 1) {
-            for (Map<String, Object> dataInfo : mapList) {
-
-                String id=dataInfo.get("id")+"";
-                String ndid=dataInfo.get("form_data_id")+"";
-
-                if (archExecutor.getQueue().size() <= 1000) {
-                    Boolean aBoolean = RedisTemplate.hasKey("taskIdxx-" + id);
-                    if (!aBoolean) {
-                        RedisTemplate.opsForValue().setIfAbsent("taskIdxx-" + id, "1", 100, TimeUnit.SECONDS);
-                        CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
-                            try {
-                                signTaskBatchpngToHtml(id,ndid);
-                            } catch (Exception e) {
-                                e.printStackTrace();
-                            }
-                        }, archExecutor);
-                    }
-                }
-            }
-        }
-        System.out.println("队列数量_img" + archExecutor.getQueue().size());
-        System.out.println("活跃数量_img" + archExecutor.getActiveCount());
-        System.out.println("总共数量_img" + archExecutor.getTaskCount());
-        System.out.println("完成数量_img" + archExecutor.getCompletedTaskCount());
-    }
-
-    // 分解第一页的任务
-
-    public void signTaskBatchpngToHtml(String id,String ndid) {
-        //
-        String UPdate = "delete from  u_information_query_zhu where id='"+ndid+"'";
-        jdbcTemplate.execute(UPdate);
-
-        String UPdat2e = "update u_task22 set is_deleted=10 where id='"+id+"'";
-        jdbcTemplate.execute(UPdat2e);
-        RedisTemplate.delete("taskIdxx-" + id);
-    }
-
-}

+ 54 - 7
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVDataServiceImpl.java

@@ -101,6 +101,7 @@ public class EVDataServiceImpl implements EVDataService {
                 //添加电签策略
                 List<SealStrategyVO> strategyListByAXQ = getStrategyListByAXQ(taskApp, ids);
 
+
                 ids = ids.replaceAll("\\✹", "");
                 if (strategyListByAXQ == null || Func.isEmpty(strategyListByAXQ) || strategyListByAXQ.size() == 0) {
                     ids = ids.replaceAll("✹", "");
@@ -121,7 +122,8 @@ public class EVDataServiceImpl implements EVDataService {
                     SignBackPdfInfo(taskApp);
                     return;
                 }
-
+                // 保存电签策略
+                addSignatureDataByAXQZ(strategyListByAXQ, taskApp.getFormDataId(),taskApp.getRemarkType());
                 //调用签字逻辑
                 signTaskBatchByAXQZ(strategyListByAXQ, taskApp);
                 if (taskApp.getSigState() != 1) {
@@ -135,6 +137,7 @@ public class EVDataServiceImpl implements EVDataService {
             } else if (taskApp.getRemarkType().equals("2") || taskApp.getRemarkType().equals("3")) { //东方中讯
                 //添加电签策略
                 List<Map<String, Object>> strategyListByDFZX = getStrategyListByDFZX(taskApp, ids);
+                addSignatureDataByDFZX(strategyListByDFZX,taskApp.getFormDataId(),taskApp.getRemarkType());
                 //调用签字逻辑
                 String s = signTaskBatchByDFZX(strategyListByDFZX, fileUrl, taskApp.getSigType(),taskApp.getRemarkType(),taskApp.getContractId());
                 if (s.contains("sucess")) {
@@ -537,9 +540,9 @@ public class EVDataServiceImpl implements EVDataService {
             for (int i = 0; i < strArray.length; i++) {
                 List<Map<String, Object>> maps2 = null;
                 if (dqIds.length() > 0) {
-                    String sqlinfo = " SELECT * from ( SELECT a.id as keyWord,a.project_id,a.pyzbx ,a.pyzby,(SELECT acc_code from blade_user where id='" + strArray[i] + "' and is_deleted=0  ) as sealId from m_textdict_info a where  a.type =2 and a.id in (" + dqIds + ")  and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c  where c.contract_id=" + task.getContractId() + " and user_id=" + strArray[i] + " and c.is_deleted=0 ) ) x where x.sealId is not null ";
+                    String sqlinfo = " SELECT * from ( SELECT a.id as keyWord,a.project_id,a.pyzbx ,a.pyzby,(SELECT acc_code from blade_user where id='" + strArray[i] + "' and is_deleted=0  ) as sealId,'1' as type,'"+strArray[i]+"' as userId from m_textdict_info a where  a.type =2 and a.id in (" + dqIds + ")  and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c  where c.contract_id=" + task.getContractId() + " and user_id=" + strArray[i] + " and c.is_deleted=0 ) ) x where x.sealId is not null ";
                     if (task.getSigType() == 2) {
-                        sqlinfo = "SELECT a.id as keyWord,a.pyzbx,a.pyzby,b.certificate_number as sealId from m_textdict_info a ,m_sign_pfx_file b where a.sig_role_id = b.pfx_type and b.project_contract_role like '%" + task.getContractId() + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + dqIds + ")";
+                        sqlinfo = "SELECT a.id as keyWord,a.pyzbx,a.pyzby,b.certificate_number as sealId,'2' as type,'"+strArray[i]+"' as userId from m_textdict_info a ,m_sign_pfx_file b where a.sig_role_id = b.pfx_type and b.project_contract_role like '%" + task.getContractId() + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + dqIds + ")";
                         System.out.println("东方中讯--签章--" + sqlinfo);
                     } else {
                         System.out.println("东方中讯--签字--" + sqlinfo);
@@ -569,7 +572,7 @@ public class EVDataServiceImpl implements EVDataService {
                     }
                 }
                 if (signIds.length() > 0 && task.getSigType() != 2) {
-                    String sql = "SELECT * from ( SELECT a.conf_id as keyWord,0.0 as pyzbx ,0.0 as pyzby,(SELECT acc_code from blade_user where id = " + strArray[i] + " and is_deleted=0  ) as sealId " +
+                    String sql = "SELECT * from ( SELECT a.conf_id as keyWord,0.0 as pyzbx ,0.0 as pyzby,(SELECT acc_code from blade_user where id = " + strArray[i] + " and is_deleted=0  ) as sealId,'1' as type " +
                             "from m_sign_config_relation a where a.type = 1 and a.is_deleted = 0 and a.conf_id in (" + signIds + ") " +
                             "and a.relation_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c  where c.contract_id= " + task.getContractId() + " and user_id= " + strArray[i] + " and c.is_deleted=0 ) ) x where x.sealId is not null ";
                     List<Map<String, Object>> maps3 = jdbcTemplate.queryForList(sql);
@@ -592,6 +595,49 @@ public class EVDataServiceImpl implements EVDataService {
         return maps;
     }
 
+
+    //  添加电签策略 -- 保存流水信息
+    public void addSignatureDataByAXQZ(List<SealStrategyVO> strategyListByAXQ,String formDataId,String markType) {
+        System.out.println("www");
+        String deleteSql = "delete from m_sign_data where query_id = '" + formDataId + "' and user_id in( ";
+        String insertsql = "INSERT INTO m_sign_data (id, query_id, text_id, user_id, sign_time, type, img_url, sign_type) VALUES (?, ?, ?, ?, SYSDATE(), ?, ?, ?)";
+        List<Object[]> batchArgs = new ArrayList<>();
+        for (SealStrategyVO sealStrategyVO : strategyListByAXQ) {
+            long newPkId = SnowFlakeUtil.getId(); //主键Id
+            String type = "1";
+            if(sealStrategyVO.isCompanySeal()){
+                type = "2";
+            }
+            batchArgs.add(new Object[]{newPkId, formDataId, sealStrategyVO.getKeyword(), sealStrategyVO.getUserId(), type, sealStrategyVO.getImageUrl(), markType});
+            deleteSql+= sealStrategyVO.getUserId() +",";
+        }
+        // 添加更多数据...
+        jdbcTemplate.execute(deleteSql+"1=1)");
+        int[] updateCounts = jdbcTemplate.batchUpdate(insertsql, batchArgs);
+        System.out.println("123");
+    }
+
+    //  添加电签策略 -- 保存流水信息
+    public void addSignatureDataByDFZX(List<Map<String, Object>> strategyListByAXQ,String formDataId,String markType) {
+        System.out.println("www");
+        String deleteSql = "delete from m_sign_data where query_id = '" + formDataId + "' and user_id in( ";
+        String insertsql = "INSERT INTO m_sign_data (id, query_id, text_id, user_id, sign_time, type, img_url, sign_type) VALUES (?, ?, ?, ?, SYSDATE(), ?, ?, ?)";
+        List<Object[]> batchArgs = new ArrayList<>();
+        for (Map<String, Object> map : strategyListByAXQ) {
+            long newPkId = SnowFlakeUtil.getId(); //主键Id
+            String userId = map.get("userId")+"";
+            String type = map.get("type")+"";
+            batchArgs.add(new Object[]{newPkId, formDataId, map.get("keyWord"), userId, type, map.get("sealId"), markType});
+            deleteSql+=userId +",";
+         }
+        // 添加更多数据...
+        jdbcTemplate.execute(deleteSql+"1=1)");
+        int[] updateCounts = jdbcTemplate.batchUpdate(insertsql, batchArgs);
+        System.out.println("123");
+    }
+
+
+
     // 添加电签策略 -- 安心签
     public List<SealStrategyVO> getStrategyListByAXQ(TaskSignInfoVO task, String ids) {
         // 获取任务所有的人签字的信息
@@ -620,9 +666,9 @@ public class EVDataServiceImpl implements EVDataService {
                 String userId =strArray[i];
                 List<Map<String, Object>> maps2 = null;
                 if (dqIds.length() > 0) {
-                    String sqlinfo = "SELECT * from ( SELECT DISTINCT a.id,a.pyzbx ,a.pyzby,a.project_id,(SELECT signature_file_url from m_sign_pfx_file where is_register=1 and certificate_user_id='" + userId + "' and is_deleted=0  ) as signature_file_url, (SELECT wide from m_sign_pfx_file where is_register=1 and certificate_user_id='" + userId + "' and is_deleted=0  ) as wide ,(SELECT high from m_sign_pfx_file where is_register=1 and certificate_user_id='" + userId + "' and is_deleted=0  ) as high from m_textdict_info a where  a.type =2 and a.id in (" + dqIds + ") and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c  where c.contract_id=" + task.getContractId() + " and user_id=" + userId + " and c.is_deleted=0 ) ) x where x.signature_file_url is not null ";
+                    String sqlinfo = "SELECT * from ( SELECT DISTINCT a.id,a.pyzbx ,a.pyzby,a.project_id,(SELECT signature_file_url from m_sign_pfx_file where is_register=1 and certificate_user_id='" + userId + "' and is_deleted=0  ) as signature_file_url, (SELECT wide from m_sign_pfx_file where is_register=1 and certificate_user_id='" + userId + "' and is_deleted=0  ) as wide ,(SELECT high from m_sign_pfx_file where is_register=1 and certificate_user_id='" + userId + "' and is_deleted=0  ) as high ,'"+userId+"' as userId from m_textdict_info a where  a.type =2 and a.id in (" + dqIds + ") and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c  where c.contract_id=" + task.getContractId() + " and user_id=" + userId + " and c.is_deleted=0 ) ) x where x.signature_file_url is not null ";
                     if (task.getSigType() == 2) {
-                        sqlinfo = "SELECT a.id,a.pyzbx,a.pyzby,b.signature_file_url,b.id as sfId,a.project_id,b.certificate_password,b.certificate_user_name,b.certificate_number ,b.wide,b.high from m_textdict_info a ,m_sign_pfx_file b where a.sig_role_id = b.pfx_type and b.project_contract_role like '%" + task.getContractId() + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + dqIds + ") ";
+                        sqlinfo = "SELECT a.id,a.pyzbx,a.pyzby,b.signature_file_url,b.id as sfId,a.project_id,b.certificate_password,b.certificate_user_name,b.certificate_number ,b.wide,b.high,'321987456' as userId from m_textdict_info a ,m_sign_pfx_file b where a.sig_role_id = b.pfx_type and b.project_contract_role like '%" + task.getContractId() + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + dqIds + ") ";
                         System.out.println("安心签--签章--=" + sqlinfo);
                     } else {
                         System.out.println("安心签--签字--=" + sqlinfo);
@@ -697,6 +743,7 @@ public class EVDataServiceImpl implements EVDataService {
                             vo.setHeight(eVisaConfig.get("high") + "");
                             vo.setWidth(eVisaConfig.get("wide") + "");
                             vo.setProjectId(eVisaConfig.get("project_id") + "");
+                            vo.setUserId(eVisaConfig.get("userId") + "");
                         } else if (task.getSigType() == 2) {
                             vo.setSealCode(EVisaConstant.SIGN_SEAL_CODE + eVisaConfig.get("sfId"));
                             vo.setSealPassword(eVisaConfig.get("certificate_password") + "");
@@ -711,6 +758,7 @@ public class EVDataServiceImpl implements EVDataService {
                             vo.setHeight(eVisaConfig.get("high") + "");
                             vo.setWidth(eVisaConfig.get("wide") + "");
                             vo.setProjectId(eVisaConfig.get("project_id") + "");
+                            vo.setUserId(eVisaConfig.get("userId") + "");
                         }
                         sealStrategyVOS.add(vo);
                     }
@@ -817,7 +865,6 @@ public class EVDataServiceImpl implements EVDataService {
     public void signTaskBatchByAXQZ(List<SealStrategyVO> list, TaskSignInfoVO taskApp) {
 
         String pdfUrl = Func.notNull(taskApp.getLastFilePdfUrl()) ? taskApp.getLastFilePdfUrl() : taskApp.getSignPdfUrl();
-
         if (Func.isEmpty(pdfUrl) || list == null) {
             taskApp.setLastFilePdfUrl(pdfUrl);
         }

+ 211 - 21
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/ScrDataServiceImpl.java

@@ -7,12 +7,16 @@ import org.apache.pdfbox.pdmodel.common.PDRectangle;
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
 import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget;
 import org.springblade.business.vo.ScrSignInfoVO;
+import org.springblade.business.vo.TaskSignInfoVO;
 import org.springblade.common.utils.CommonUtil;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.CollectionUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.evisa.service.ScrDataService;
 import org.springblade.evisa.utils.PdfAddimgUtil;
 import org.springblade.evisa.vo.SignKeyVO;
 import org.springblade.manager.vo.PDFIndexInfo;
+import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
 
@@ -25,7 +29,7 @@ import java.util.stream.Collectors;
 public class ScrDataServiceImpl implements ScrDataService {
 
     private final JdbcTemplate jdbcTemplate;
-
+    private final StringRedisTemplate RedisTemplate;
     // 主流程
     @Override
     public void sctTaskBatch(ScrSignInfoVO taskApp) throws Exception {
@@ -34,9 +38,6 @@ public class ScrDataServiceImpl implements ScrDataService {
     }
 
 
-
-
-
     /**
      * 电签检查
      */
@@ -55,16 +56,29 @@ public class ScrDataServiceImpl implements ScrDataService {
         List<String> positions = pdfSignIds.getEVisaConfigList();
         Map<String, String> dataMap = pdfSignIds.getDataMap();
 
-        List<String> sucess = new ArrayList<>();
+        List<String> sucessUser = new ArrayList<>();
+        List<String> sucessCompan = new ArrayList<>();
         String ids = String.join(",", positions);
-        List<Map<String, Object>> strategyListByDFZX = getStrategyListByDFZX(taskApp, ids);
+        ids = ids.replaceAll("✹", "");
+        String remarkType = taskApp.getRemarkType();
+        List<Map<String, Object>> strategyListByDFZX = new ArrayList<>();
+        if(remarkType.equals("1")){
+            strategyListByDFZX = getStrategyListByAXQ(taskApp, ids);
+        } else if (remarkType.equals("2") || remarkType.equals("3")) {
+            strategyListByDFZX = getStrategyListByDFZX(taskApp, ids);
+        }
+
         if(strategyListByDFZX==null || strategyListByDFZX.size()==0){
 
-            System.out.println("为获取到签字的关键字");
+            String sql2 = "UPDATE u_information_query set chek_status=10 where id='"+taskApp.getId()+"'";
+            jdbcTemplate.execute(sql2);
+
+            RedisTemplate.delete("chek-" + taskApp.getId());
+            System.out.println(taskApp.getProcessInstanceId()+"-"+"总共:" );
             return;
         }
 
- /*       positions = strategyListByDFZX.stream().map(map -> map.get("keyWord").toString()).collect(Collectors.toList());
+        positions = strategyListByDFZX.stream().map(map -> map.get("keyWord").toString()).collect(Collectors.toList());
         String keyWord = String.join(",", positions);
         List<PDFIndexInfo> pdfIndexInfo = PdfAddimgUtil.findKeywordPostions(pdfData, keyWord);
 
@@ -110,11 +124,27 @@ public class ScrDataServiceImpl implements ScrDataService {
 
                             List<Map<String, Object>> mapList = newMap.get(pkeyid);
                             String keyData = dataMap.get(pkeyid);
+                            String userId="";
+                            String type="";
                             if (mapList != null && mapList.size() >= 0) {
                                 Map<String, Object> map = mapList.get(0);
                                 Float pyzbx = Func.toFloat(map.get("pyzbx"));
                                 Float pyzby = Func.toFloat(map.get("pyzby"));
-                                if(taskApp.getRemarkType().equals("2")){ //东方中讯
+                                 type = map.get("type")+"";
+                                userId = map.get("userId")+"";
+                                if(taskApp.getRemarkType().equals("3")){ //东方中讯
+                                    if(type.equals("1")){ //个人签字
+                                        keyw = keyw + pyzbx - 20;
+                                        keyh = keyh + pyzby ;
+
+                                    }else if(type.equals("2")){
+                                        keyw = keyw + pyzbx -21;
+                                        keyh = keyh + pyzby-16;
+                                        if(keyData.indexOf("||")>0){
+                                            keyw += 10;
+                                        }
+                                    }
+                                }else if(taskApp.getRemarkType().equals("2")){ //东方中讯
                                     if(imgH>=100){ //个人签字
                                         keyw = keyw + pyzbx - 20;
                                         keyh = keyh + pyzby - 15;
@@ -130,8 +160,14 @@ public class ScrDataServiceImpl implements ScrDataService {
                                     keyh = keyh + pyzby;
                                 }
                             }
+                            System.out.println("type="+type+" imgX:" + "keyid="+pkeyid+"imgX:" + imgX + " keyw:" + keyw + " imgY:" + imgY + " keyh:" + keyh+"-imgH-"+imgH);
                             if (Math.abs(imgX - keyw) <= threshold && Math.abs(imgY - keyh) <= threshold) {
-                                sucess.add(pkeyid);
+                                if(type.equals("1")){ //个人
+                                    sucessUser.add(pkeyid);
+                                }
+                                if(type.equals("2")){ //企业章
+                                    sucessCompan.add(pkeyid);
+                                }
                                 System.out.println("keyid="+pkeyid+"imgX:" + imgX + " keyw:" + keyw + " imgY:" + imgY + " keyh:" + keyh+"-imgH-"+imgH);
                                 break;
                             }
@@ -140,32 +176,186 @@ public class ScrDataServiceImpl implements ScrDataService {
                 }
             }
         }
-        Set<String> differentElements = new HashSet<>(positions);
-        // 使用retainAll方法来移除两个集合中相同的元素,留下不同的元素
-        differentElements.removeAll(sucess);
 
-        System.out.println(taskApp.getId() +"-"+"总共:" + positions.size() + "-剩下-" + differentElements.size());*/
+        boolean isSign = false;
+        //判断章是否签完
+        List<String> companList = strategyListByDFZX.stream().filter(item -> item.get("type").equals("2")).map(map -> map.get("keyWord").toString()).collect(Collectors.toList());
+        if(companList!=null && companList.size()>0){
+            Set<String> differentElements = new HashSet<>(companList);
+            differentElements.removeAll(sucessCompan);
+            if(differentElements==null || differentElements.size()==0){
+                isSign = true ;
+            }
+            System.out.println(taskApp.getId() +"-"+"章总共:" + companList.size() + "-剩下-" + differentElements.size());
+        }else{
+            isSign = true ;
+        }
+
+
+        //判断个人是否签完
+        List<String> userList = strategyListByDFZX.stream().filter(item -> item.get("type").equals("1")).map(map -> map.get("keyWord").toString()).collect(Collectors.toList());
+        Map<String, String> dataUserMap = new HashMap<>(dataMap);
+
+        if(sucessUser!=null && sucessUser.size()>0 && isSign){
+            for(String user:sucessUser){
+                for(String mapkey:dataMap.keySet()){
+                    String mapval = dataMap.get(mapkey);
+                    if(mapval.contains(user)){
+                        dataUserMap.remove(mapkey) ;
+                    }
+                }
+            }
+            if(dataUserMap.keySet()==null || dataUserMap.keySet().size()==0){
+                isSign = true ;
+            }else{
+                isSign = false ;
+            }
+            System.out.println(taskApp.getId() +"-"+"个人总共:" + sucessUser.size() + "-剩下-" +dataUserMap.keySet().size());
+        }
+
+
+        if( isSign){
+            String sql2 = "UPDATE u_information_query set chek_status=2 where id='"+taskApp.getId()+"'";
+            jdbcTemplate.execute(sql2);
+        }else{
+            String sql2 = "UPDATE u_information_query set chek_status=3 where id='"+taskApp.getId()+"'";
+            jdbcTemplate.execute(sql2);
+        }
+        RedisTemplate.delete("chek-" + taskApp.getId());
+      //  System.out.println(taskApp.getProcessInstanceId()+"-"+"总共:" );
+      //  System.out.println(taskApp.getId() +"-"+"总共:" + positions.size() + "-剩下-" + differentElements.size());
     }
 
 
+
+    // 添加电签策略 -- 安心签
+    public List<Map<String, Object>> getStrategyListByAXQ(ScrSignInfoVO task, String ids) {
+        String sql = "select task_user,count(1) as total,initiative,status,(select  count(1) from u_task_parallel where process_instance_id = '" + task.getProcessInstanceId() + "' and initiative=2 and status=2) as pCount from u_task_parallel where process_instance_id = '" + task.getProcessInstanceId() + "'";
+        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
+        ArrayList<String> strArray = new ArrayList();
+        int total = 0;
+        int pCount = 0;
+        if (mapList != null && mapList.size() >= 1) {
+            for (int i = 0; i < mapList.size(); i++) {
+                Map<String, Object> map = mapList.get(i);
+                if(i==0){
+                    total = Func.toInt(map.get("total"));
+                    pCount = Func.toInt(map.get("pCount"));
+                }
+                if(map.get("initiative").equals("2") && map.get("status").equals("2")){
+                    strArray.add(map.get("task_user").toString());
+                }
+            }
+        }
+
+
+        List<Map<String, Object>> maps = new ArrayList<>();
+        String[] split = ids.split(",");
+        StringBuilder dqIds = new StringBuilder();
+        StringBuilder signIds = new StringBuilder();
+        for (String id : split) {
+            if (id != null && id.contains("✹")) {
+                signIds.append(id.substring(1)).append( ",");
+            } else {
+                dqIds.append(id).append( ",");
+            }
+        }
+        if (dqIds.length()>0) {
+            dqIds.deleteCharAt(dqIds.length()-1);
+        }
+        if (signIds.length()>0) {
+            signIds.deleteCharAt(signIds.length()-1);
+        }
+        if(strArray!=null && strArray.size()>0) {
+            for (int i = 0; i < strArray.size(); i++) {
+                List<Map<String, Object>> maps2 = null;
+                if (dqIds.length() > 0) {
+                    String sqlinfo = " SELECT * from ( SELECT a.id as keyWord,a.project_id,a.pyzbx ,a.pyzby,(SELECT acc_code from blade_user where id='" + strArray.get(i) + "' and is_deleted=0  ) as sealId from m_textdict_info a where  a.type =2 and a.id in (" + dqIds + ")  and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c  where c.contract_id=" + task.getContractId() + " and user_id=" + strArray.get(i) + " and c.is_deleted=0 ) ) x where x.sealId is not null ";
+                    if (total==pCount) {
+                        sqlinfo = "SELECT a.id as keyWord,a.pyzbx,a.pyzby,b.certificate_number as sealId from m_textdict_info a ,m_sign_pfx_file b where a.sig_role_id = b.pfx_type and b.project_contract_role like '%" + task.getContractId() + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + dqIds + ")";
+                        System.out.println("东方中讯--签章--" + sqlinfo);
+                    } else {
+                        System.out.println("东方中讯--签字--" + sqlinfo);
+                    }
+                    maps2 = jdbcTemplate.queryForList(sqlinfo);
+                    maps2 = jdbcTemplate.queryForList(sqlinfo);
+                }
+                if(CollectionUtil.isNotEmpty(maps2)) {
+                    Map<String, List<Map<String, Object>>> peopleByAge = maps2.stream()
+                            .collect(Collectors.groupingBy(hada -> (Func.toStr(hada.get("keyWord")))));
+                    for (String keyId : peopleByAge.keySet()) {
+                        int exId = 0;
+                        List<Map<String, Object>> keyList = peopleByAge.get(keyId);
+                        if (keyList != null && keyList.size() == 1) {
+                            maps.addAll(keyList);
+                            exId = 1;
+                        } else if (keyList != null && keyList.size() >= 2) {
+                            for (Map<String, Object> datax : keyList) {
+                                if ((datax.get("project_id") + "").equals(task.getProjectId())) {
+                                    maps.add(datax);
+                                    exId = 1;
+                                }
+                            }
+                        }
+                        if (exId == 0) {
+                            maps.add(keyList.get(0));
+                        }
+                    }
+                }
+             /*   if (signIds.length() > 0 && task.getSigType() != 2) {
+                    String sql = "SELECT * from ( SELECT a.conf_id as keyWord,0.0 as pyzbx ,0.0 as pyzby,(SELECT acc_code from blade_user where id = " + strArray[i] + " and is_deleted=0  ) as sealId " +
+                            "from m_sign_config_relation a where a.type = 1 and a.is_deleted = 0 and a.conf_id in (" + signIds + ") " +
+                            "and a.relation_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c  where c.contract_id= " + task.getContractId() + " and user_id= " + strArray[i] + " and c.is_deleted=0 ) ) x where x.sealId is not null ";
+                    List<Map<String, Object>> maps3 = jdbcTemplate.queryForList(sql);
+                    System.out.println("东方中讯--签字--key =" + sql);
+                    if (!maps3.isEmpty()) {
+                        Map<String, List<Map<String, Object>>> peopleByAge = maps2.stream()
+                                .collect(Collectors.groupingBy(hada -> (Func.toStr(hada.get("keyWord")))));
+                        for (String keyId : peopleByAge.keySet()) {
+                            List<Map<String, Object>> keyList = peopleByAge.get(keyId);
+                            if (keyList != null && !keyList.isEmpty()) {
+                                Map<String, Object> map = keyList.get(0);
+                                map.put("keyWord", "✹" + map.get("keyWord"));
+                                maps.add(map);
+                            }
+                        }
+                    }
+                }*/
+            }
+        }
+        return maps;
+    }
+
     // 添加电签策略 -- 东方中讯
     public List<Map<String, Object>> getStrategyListByDFZX(ScrSignInfoVO taskApp, String ids) {
         List<Map<String, Object>> maps = new ArrayList<>();
         List<Map<String, Object>> maps2 = new ArrayList<>();
-        String sql = "select * from u_task_parallel where process_instance_id = '" + taskApp.getProcessInstanceId() + "' and initiative=2 and status=2";
+     //   String sql = "select * from u_task_parallel where process_instance_id = '" + taskApp.getProcessInstanceId() + "' and initiative=2 and status=2";
+
+        String sql = "select task_user,initiative,status,(select  count(1) from u_task_parallel where process_instance_id = '" + taskApp.getProcessInstanceId() + "' and initiative=2 and status=2) as pCount from u_task_parallel where process_instance_id = '" + taskApp.getProcessInstanceId() + "'";
         List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
+
+        int total = mapList.size();
+        int pCount = 0;
+
         if (mapList != null && mapList.size() > 0) {
             for (Map<String, Object> task : mapList) {
                 String taskUserId = Func.toStr(task.get("task_user"));
-                String sqlinfo = " SELECT * from ( SELECT a.id as keyWord,a.project_id,a.pyzbx ,a.pyzby,(SELECT acc_code from blade_user where id='" + taskUserId + "' and is_deleted=0  ) as sealId from m_textdict_info a where  a.type =2 and a.id in (" + ids + ")  and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c  where c.contract_id=" + taskApp.getContractId() + " and user_id=" + taskUserId + " and c.is_deleted=0 ) ) x where x.sealId is not null ";
-                System.out.println("扫描-签字-sql=" + sqlinfo);
-                List<Map<String, Object>> maps3 = jdbcTemplate.queryForList(sqlinfo);
-                maps2.addAll(maps3);
+                String initiative = Func.toStr(task.get("initiative"));
+                String status = Func.toStr(task.get("status"));
+                if(initiative.equals("2") && status.equals("2")) {
+                    String sqlinfo = " SELECT * from ( SELECT a.id as keyWord,a.project_id,a.pyzbx ,a.pyzby,(SELECT acc_code from blade_user where id='" + taskUserId + "' and is_deleted=0  ) as sealId,'" + taskUserId + "' as userId,'1' as type from m_textdict_info a where  a.type =2 and a.id in (" + ids + ")  and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c  where c.contract_id=" + taskApp.getContractId() + " and user_id=" + taskUserId + " and c.is_deleted=0 ) ) x where x.sealId is not null ";
+                    System.out.println("扫描-签字-sql=" + sqlinfo);
+                    List<Map<String, Object>> maps3 = jdbcTemplate.queryForList(sqlinfo);
+                    maps2.addAll(maps3);
+                }
             }
+            pCount = Func.toInt(mapList.get(0).get("pCount"));
+
         }
         // 添加章
-        if (taskApp.getStatus().equals("2")) {
-            String sqlinfo = "SELECT a.id as keyWord,a.pyzbx,a.pyzby,b.certificate_number as sealId from m_textdict_info a ,m_sign_pfx_file b where a.sig_role_id = b.pfx_type and b.project_contract_role like '%" + taskApp.getContractId() + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + ids + ")";
+        if (total==pCount) {
+            String sqlinfo = "SELECT a.id as keyWord,a.pyzbx,a.pyzby,b.certificate_number as sealId,'2' as type from m_textdict_info a ,m_sign_pfx_file b where a.sig_role_id = b.pfx_type and b.project_contract_role like '%" + taskApp.getContractId() + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + ids + ")";
             System.out.println("扫描-签章-sql=" + sqlinfo);
             List<Map<String, Object>> maps3 = jdbcTemplate.queryForList(sqlinfo);
             if (mapList != null && mapList.size() > 0) {

+ 75 - 11
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/utils/PdfAddimgUtil.java

@@ -8,6 +8,7 @@ import com.itextpdf.text.pdf.*;
 import com.itextpdf.text.pdf.parser.*;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.text.PDFTextStripper;
+import org.springblade.business.vo.TaskSignInfoVO;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.core.tool.utils.Func;
@@ -21,6 +22,8 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
 public class PdfAddimgUtil {
@@ -392,26 +395,26 @@ public class PdfAddimgUtil {
     }
 
 
-    public static SignKeyVO getPdfSignIds(String pdfUrl) {
-        SignKeyVO signKeyVO = new SignKeyVO();
+    public static SignKeyVO  getPdfSignIds(String pdfUrl) {
         List<String> eVisaConfigList = new ArrayList<>();
         Map<String,String> dataMap = new HashMap<>();
-        InputStream inputStream;
+        SignKeyVO signKeyVO = new SignKeyVO();
         try  {
-            if(pdfUrl.indexOf("http")>=0){
-                inputStream = CommonUtil.getOSSInputStream(pdfUrl);
-            }else{
-                inputStream = new FileInputStream(new File(pdfUrl));
-            }
+            InputStream inputStream = CommonUtil.getOSSInputStream(pdfUrl);
             PDDocument document = PDDocument.load(inputStream);
             PDFTextStripper stripper = new PDFTextStripper();
             String text = stripper.getText(document);
             String[] lines = text.split("[ \\n]+");
+
+            Pattern pattern = Pattern.compile("(\\d{4}[年-]\\d{2}[月-]\\d{2}日?)");
+
             for(int k=0;k<lines.length;k++){
                 String textStr = lines[k];
-                if(textStr.indexOf("*")>=0){
+                int index = textStr.indexOf("*");
+                if(index>=0 && textStr.lastIndexOf("*")+1 < textStr.length() && textStr.charAt(index+1) != '✹'){
                     textStr = textStr.substring(textStr.lastIndexOf("*")+1,textStr.length());
                 }
+
                 String[] textS = Func.toStrArray("\\|\\|",textStr);
                 for(String txt : textS){
                     for (int i = 0; i < txt.length(); i++) {
@@ -419,21 +422,82 @@ public class PdfAddimgUtil {
                             txt=txt.substring(0,i);
                         }
                     }
-                    if (txt.length() >= 15 && Func.isNumeric(txt)) {
+                    if (txt.length() >= 15 && Func.isNumeric(txt)||(Func.isNumeric(txt)&&txt.length()==8&&txt.startsWith("123"))) {
+                        eVisaConfigList.add(txt);
+                        dataMap.put(txt,textStr);
+                    }
+                }
+
+                textS = Func.toStrArray("\\*",textStr);
+                for(String txt : textS){
+                    for (int i = 0; i < txt.length(); i++) {
+                        if (!Character.isDigit(txt.charAt(i))) {
+                            txt=txt.substring(0,i);
+                        }
+                    }
+                    if (txt.length() >= 15 && Func.isNumeric(txt)||(Func.isNumeric(txt)&&txt.length()==8&&txt.startsWith("123"))) {
                         eVisaConfigList.add(txt);
                         dataMap.put(txt,textStr);
                     }
                 }
+
+                // 特殊处理
+                if(textStr.indexOf("1")>=0){
+                    String txt = textStr.substring(textStr.indexOf("1"));
+                    if (txt.length() >= 15 && Func.isNumeric(txt)||(Func.isNumeric(txt)&&txt.length()==8&&txt.startsWith("123"))) {
+                        System.out.println(txt);
+                        eVisaConfigList.add(txt);
+                        dataMap.put(txt,textStr);
+                    }
+                }
+                if (textStr.contains("✹") && textStr.indexOf("✹") + 1 < textStr.length()) {
+                    String textString = textStr.substring(textStr.indexOf("✹") + 1);
+                    if (textString.contains("||✹")) {
+                        String[] textS1 = Func.toStrArray("\\|\\|✹",textString);
+                        for(String txt : textS1){
+                            for (int i = 0; i < txt.length(); i++) {
+                                if (!Character.isDigit(txt.charAt(i))) {
+                                    txt=txt.substring(0,i);
+                                }
+                            }
+                            if (txt.length() >= 15 && Func.isNumeric(txt)||(Func.isNumeric(txt)&&txt.length()==8&&txt.startsWith("123"))) {
+                                eVisaConfigList.add("✹" + txt);
+                            }
+                        }
+                    }
+                    if (textString.contains("*✹")) {
+                        String[] textS1 = Func.toStrArray("\\*✹",textString);
+                        for(String txt : textS1){
+                            for (int i = 0; i < txt.length(); i++) {
+                                if (!Character.isDigit(txt.charAt(i))) {
+                                    txt=txt.substring(0,i);
+                                }
+                            }
+                            if (txt.length() >= 15 && Func.isNumeric(txt)||(Func.isNumeric(txt)&&txt.length()==8&&txt.startsWith("123"))) {
+                                eVisaConfigList.add("✹" + txt);
+                            }
+                        }
+                    }
+                    if(textString.startsWith("1")){
+                        if (textString.length() >= 15 && Func.isNumeric(textString)) {
+                            eVisaConfigList.add("✹" + textString);
+                        }
+                    }
+                }
             }
 
+
             List<String> unique = eVisaConfigList.stream().distinct().collect(Collectors.toList());
             document.close();
+
             signKeyVO.setEVisaConfigList(unique);
             signKeyVO.setDataMap(dataMap);
             return signKeyVO;
         }catch (Exception e){
             e.printStackTrace();
-            return null;
+            System.out.println("pdf大小为0");
+            return signKeyVO;
         }
     }
+
 }

+ 2 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreeContractClientImpl.java

@@ -497,8 +497,8 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
 
 
     @Override
-    public List<WbsTreeContract> queryListByPIds(List<Long> pIds) {
-        return wbsTreeContractService.queryListByPIds(pIds);
+    public List<WbsTreeContract> queryListByPIds(List<Long> pIds, Integer classify) {
+        return wbsTreeContractService.queryListByPIds(pIds, classify);
     }
 
     @Override

+ 5 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ArchiveTreeContractMapper.java

@@ -61,7 +61,7 @@ public interface ArchiveTreeContractMapper extends BaseMapper<ArchiveTreeContrac
 
 
     List<ArchiveTreeContractVO2> lazyTree2(@Param("tenantId") String tenantId, @Param("parentId") Long parentId, @Param("projectId") Long projectId
-            , @Param("code") String code, @Param("contractId") String contractId);
+            , @Param("code") String code, @Param("contractId") String contractId, @Param("extType") Integer extType);
 
     /**
      * 归档树不带文件数量
@@ -180,11 +180,14 @@ public interface ArchiveTreeContractMapper extends BaseMapper<ArchiveTreeContrac
 
     List<TrialSelfInspectionRecordFileVO> getAllTrialRecordFile(@Param("ids") List<Long> recordIds);
 
-    List<TrialClassificationConfiguration> getAllThreeTestNode();
+    List<TrialClassificationConfiguration> getAllThreeTestNode(@Param("contractId") Long contractId);
 
     List<TrialDetectionData> getAllTrialTestRecord(@Param("contractId") Long contractId);
 
     List<ArchiveTreeContract> getOutNodes(@Param("projectId")Long projectId);
 
     List<ArchiveTreeContract> getOutNodesByOutIds(@Param("projectId")Long projectId,@Param("ids") List<String> outIds);
+
+    Integer selectExtTypeByParentId(@Param("projectId")Long projectId,
+                                    @Param("parentId") Long parentId);
 }

+ 59 - 11
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ArchiveTreeContractMapper.xml

@@ -172,9 +172,9 @@
         <result column="reviewer" property="reviewer"/>
         <result column="specification" property="specification"/>
         <result column="archive_name_suffix" property="archiveNameSuffix"/>
-        <!--        <result column="tree_number" property="treeNumber"/>-->
-        <association property="treeNumber" javaType="java.lang.Integer" select="selectFileNumber"
-                     column="{id=id,projectId=project_id,code=code,contractId=contract_id,extType=ext_type}"/>
+        <result column="tree_number" property="treeNumber"/>
+<!--        <association property="treeNumber" javaType="java.lang.Integer" select="selectFileNumber"-->
+<!--                     column="{id=id,projectId=project_id,code=code,contractId=contract_id,extType=ext_type}"/>-->
     </resultMap>
 
 
@@ -272,11 +272,45 @@
         d.specification,
         d.archive_name_suffix,
         d.contract_id,
-        d.project_id,
-        #{code} as code,
+        IFNULL(SUM(file_counts.count), 0) AS tree_number,
         (SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_archive_tree_contract WHERE parent_id = d.id and is_deleted = 0 and project_id = #{projectId}) AS "has_children"
         FROM
         m_archive_tree_contract d
+        LEFT JOIN (
+            -- 合并两个统计查询
+            SELECT
+                a.id,
+                a.ancestors,
+                SUM(b.count) AS count
+            FROM
+                m_archive_tree_contract a
+            INNER JOIN (
+                SELECT node_id AS id, COUNT(*) AS count
+                FROM u_archive_file
+                WHERE project_id = #{projectId}
+                AND is_deleted = 0
+                AND (is_auto_file IS NULL OR is_auto_file != 1)
+                GROUP BY node_id
+                <if test="extType > 0">
+                    UNION ALL
+
+                    SELECT node_ext_id AS id, COUNT(*) AS count
+                    FROM u_archive_file
+                    WHERE project_id = #{projectId}
+                    AND is_deleted = 0
+                    AND (is_auto_file IS NULL OR is_auto_file != 1)
+                    GROUP BY node_ext_id
+                </if>
+            ) b ON b.id = a.id
+            WHERE
+                a.is_deleted = 0
+                <if test="code!=null and code!=''">
+                    AND (a.tree_code = #{code} or a.tree_code = #{contractId} or a.parent_id = 0)
+                </if>
+            GROUP BY
+                a.id
+        ) file_counts ON file_counts.id = d.id
+        OR file_counts.ancestors like concat(d.ancestors,',',d.id,'%')
         WHERE
         d.parent_id = #{parentId} AND d.is_deleted = 0 and project_id = #{projectId}
         <if test="tenantId!=null and tenantId!=''">
@@ -285,6 +319,8 @@
         <if test="code!=null and code!=''">
             AND (d.tree_code = #{code} or d.tree_code = #{contractId} or d.parent_id = 0)
         </if>
+        GROUP BY
+        d.id
         ORDER BY d.tree_sort, d.sort
     </select>
     <!-- 归档数不带文件数量 -->
@@ -955,12 +991,21 @@
     </select>
     <select id="getAllThreeTestNode"
             resultType="org.springblade.manager.entity.TrialClassificationConfiguration">
-        select *
-        from m_trial_classification_configuration
-        where is_deleted = 0 and parent_id in
-            (
-                select id from m_trial_classification_configuration where is_deleted = 0 and parent_id = 0 and node_type in (1,2)
-                )
+        SELECT
+            *
+        FROM
+            m_trial_classification_configuration b
+        WHERE
+            is_deleted = 0
+          AND STATUS = 1
+            <if test="contractId == null">
+                and contract_id is null
+            </if>
+            <if test="contractId != null and contractId != ''">
+                and (contract_id is null OR (contract_id = #{contractId}))
+            </if>
+        ORDER BY
+            sort
     </select>
     <select id="getAllTrialTestRecord" resultType="org.springblade.business.entity.TrialDetectionData">
         select *
@@ -980,4 +1025,7 @@
             #{id}
         </foreach>
     </select>
+    <select id="selectExtTypeByParentId" resultType="java.lang.Integer">
+        select count(0) from m_archive_tree_contract where project_id = #{projectId} and ext_type = 2 and is_deleted = 0 and FIND_IN_SET(#{parentId},ancestors)
+    </select>
 </mapper>

+ 1 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ExcelTabMapper.xml

@@ -56,6 +56,7 @@
         dept.name,
         dept.file_type,
         dept.tab_type,
+        dept.tab_id,
         info.table_owner as tableOwner,
         (
         SELECT

+ 1 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ProjectInfoMapper.xml

@@ -28,6 +28,7 @@
         <result column="project_subgrade" property="projectSubgrade"/>
         <result column="project_remark" property="projectRemark"/>
         <result column="state" property="state"/>
+        <result column="ms_time" property="msTime"/>
         <result column="is_open_sign" property="isOpenSign"/>
         <result column="reference_wbs_template_id" property="referenceWbsTemplateId"/>
         <result column="reference_wbs_template_type" property="referenceWbsTemplateType"/>

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

@@ -98,10 +98,10 @@ public interface IWbsTreeContractService extends BaseService<WbsTreeContract> {
 
     Integer findIsExistTreeNode(List<String> ids);
 
-    List<WbsTreeContract> queryListByPIds(List<Long> pIds);
 
     List<APIWbsContractSubdivisionVo> getWbsContractSubdivision(String contractId);
 
+    List<WbsTreeContract> queryListByPIds(List<Long> pIds, Integer classify);
     ResponseEntity<Resource> exportTree(Long contractId, HttpServletResponse response) throws IOException, InvalidFormatException;
 
     R importPartitionCode(MultipartFile file);

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

@@ -196,7 +196,10 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
 			tenantId = StringPool.EMPTY;
 		}
 		if(type != null && type == 1){
-			return ForestNodeMergerEx.merge(baseMapper.lazyTree2(tenantId, parentId,projectId,getAuthCode(contractId),getAuthContractId(contractId)));
+			//当前节点子节点是否存在ext_type = 2 的数据
+			Integer extType = baseMapper.selectExtTypeByParentId(projectId,parentId);
+
+			return ForestNodeMergerEx.merge(baseMapper.lazyTree2(tenantId, parentId,projectId,getAuthCode(contractId),getAuthContractId(contractId), extType));
 		}
 		return ForestNodeMergerEx.merge(baseMapper.lazyTree3(tenantId, parentId,projectId,getAuthCode(contractId),getAuthContractId(contractId)));
 	}

+ 62 - 56
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractSyncImpl.java

@@ -24,6 +24,7 @@ import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.utils.CollectionUtil;
 import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.manager.entity.*;
 import org.springblade.manager.enums.AssociationTypeEnum;
 import org.springblade.manager.enums.StorageTypeEnum;
@@ -1045,7 +1046,7 @@ public class ArchiveTreeContractSyncImpl {
             //循环试验节点
             for (ArchiveSyncTrialVO vo : trialVOS) {
                 //把节点转换为档案节点,挂载到同步节点下
-                ArchiveTreeContract trialNode = createTypeNode(vo.getNodeName(), archiveTreeContract);
+                ArchiveTreeContract trialNode = createTypeNode(vo.getNodeName(),vo.getSort(), archiveTreeContract);
                 addNode.add(trialNode);
                 //获取出节点下面的报告,并转换为档案文件
                 List<TrialSelfInspectionRecord> files = recordsMap.get(vo.getPKeyId());
@@ -1054,7 +1055,7 @@ public class ArchiveTreeContractSyncImpl {
                 }
                 //挂载到子节点下
                 List<ArchiveFile> newArchiveFileList = files.stream().map(file -> {
-                    ArchiveFile archiveFile = trialFileCovertArchiveFile(file, trialNode);
+                    ArchiveFile archiveFile = trialFileCovertArchiveFile(file, trialNode, contractInfo);
                     return archiveFile;
                 }).collect(Collectors.toList());
                 addFile.addAll(newArchiveFileList);
@@ -1064,7 +1065,7 @@ public class ArchiveTreeContractSyncImpl {
         /**单独处理外委和第三方报告 */
         if (contractTrialType.contains("98")){
             //获取所有的外委和第三方节点
-            List<TrialClassificationConfiguration> threeTestNodes = archiveTreeContractMapper.getAllThreeTestNode();
+            List<TrialClassificationConfiguration> threeTestNodes = archiveTreeContractMapper.getAllThreeTestNode(contractId);
             //获取出合同段所有的检测报告
             List<TrialDetectionData> dataList = archiveTreeContractMapper.getAllTrialTestRecord(contractId);
             //检测报告,按照节点分组
@@ -1072,7 +1073,7 @@ public class ArchiveTreeContractSyncImpl {
             //循环所有节点
             for (TrialClassificationConfiguration vo : threeTestNodes) {
                 //把节点转换为档案节点,挂载到同步节点下
-                ArchiveTreeContract trialNode = createTypeNode(vo.getNodeName(), archiveTreeContract);
+                ArchiveTreeContract trialNode = createTypeNode(vo.getNodeName(),vo.getNodeType() == 1 ?  vo.getSort() : vo.getSort() + 100, archiveTreeContract);
                 addNode.add(trialNode);
                 //获取出节点下面的报告,并转换为档案文件
                 List<TrialDetectionData> files = dataMap.get(vo.getId());
@@ -1087,51 +1088,51 @@ public class ArchiveTreeContractSyncImpl {
                 addFile.addAll(newArchiveFileList);
             }
         }
-
+        //暂时先不做
         /**单独处理原材料资质证书 */
-        if (contractTrialType.contains("99")){
-            //获取所有的原材节点
-            List<ArchiveSyncTrialVO> trialVOS = trialsMap.get(52);
-            if (CollectionUtil.isNotEmpty(trialVOS)){
-                //查询出整个系统的附件,设计问题
-                Map<String, Attach> maps = jdbcTemplate.query("select link,original_name from blade_attach", new BeanPropertyRowMapper<>(Attach.class)).stream().collect(Collectors.toMap(Attach::getLink, Attach -> Attach, (obj1, obj2) -> obj1));
-                //获取出所有节点id
-                List<Long> nodeIds = trialVOS.stream().map(l -> l.getPKeyId()).collect(Collectors.toList());
-                //根据节点id,查询出所有的报告id
-                List<Long> recordIds = records.stream().filter(l -> nodeIds.contains(l.getNodeId())).map(l -> l.getId()).collect(Collectors.toList());
-                //根据报告id,查询出所有的报告附件
-                List<TrialSelfInspectionRecordFileVO> fileVOS = archiveTreeContractMapper.getAllTrialRecordFile(recordIds);
-                //报告附件按照节点id分组
-                Map<Long, List<TrialSelfInspectionRecordFileVO>> fileMap = fileVOS.stream().collect(Collectors.groupingBy(l -> l.getNodeId()));
-                //循环原材节点
-                for (ArchiveSyncTrialVO vo : trialVOS) {
-                    //把节点转换为档案节点,挂载到同步节点下
-                    ArchiveTreeContract trialNode = createTypeNode(vo.getNodeName(), archiveTreeContract);
-                    addNode.add(trialNode);
-                    //获取出节点下面的报告下面的附件,并转换为档案文件
-                    List<TrialSelfInspectionRecordFileVO> files = fileMap.get(vo.getPKeyId());
-                    if (CollectionUtil.isEmpty(files)){
-                        continue;
-                    }
-                    //上个开发太懒,敷衍了事,重新设置附件相关值
-                    for (TrialSelfInspectionRecordFileVO file : files) {
-                        Attach attach = maps.get(file.getUrl());
-                        if (attach != null){
-                            file.setFileName(attach.getOriginalName());
-                            file.setCreateTime(attach.getCreateTime());
-                        }
-                    }
-                    //挂载到子节点下
-                    List<ArchiveFile> newArchiveFileList = files.stream().map(file -> {
-                        ArchiveFile archiveFile = trialFileCovertArchiveFile2(file, trialNode);
-                        return archiveFile;
-                    }).collect(Collectors.toList());
-                    addFile.addAll(newArchiveFileList);
-                }
-
-            }
-
-        }
+//        if (contractTrialType.contains("99")){
+//            //获取所有的原材节点
+//            List<ArchiveSyncTrialVO> trialVOS = trialsMap.get(52);
+//            if (CollectionUtil.isNotEmpty(trialVOS)){
+//                //查询出整个系统的附件,设计问题
+//                Map<String, Attach> maps = jdbcTemplate.query("select link,original_name from blade_attach", new BeanPropertyRowMapper<>(Attach.class)).stream().collect(Collectors.toMap(Attach::getLink, Attach -> Attach, (obj1, obj2) -> obj1));
+//                //获取出所有节点id
+//                List<Long> nodeIds = trialVOS.stream().map(l -> l.getPKeyId()).collect(Collectors.toList());
+//                //根据节点id,查询出所有的报告id
+//                List<Long> recordIds = records.stream().filter(l -> nodeIds.contains(l.getNodeId())).map(l -> l.getId()).collect(Collectors.toList());
+//                //根据报告id,查询出所有的报告附件
+//                List<TrialSelfInspectionRecordFileVO> fileVOS = archiveTreeContractMapper.getAllTrialRecordFile(recordIds);
+//                //报告附件按照节点id分组
+//                Map<Long, List<TrialSelfInspectionRecordFileVO>> fileMap = fileVOS.stream().collect(Collectors.groupingBy(l -> l.getNodeId()));
+//                //循环原材节点
+//                for (ArchiveSyncTrialVO vo : trialVOS) {
+//                    //把节点转换为档案节点,挂载到同步节点下
+//                    ArchiveTreeContract trialNode = createTypeNode(vo.getNodeName(), archiveTreeContract);
+//                    addNode.add(trialNode);
+//                    //获取出节点下面的报告下面的附件,并转换为档案文件
+//                    List<TrialSelfInspectionRecordFileVO> files = fileMap.get(vo.getPKeyId());
+//                    if (CollectionUtil.isEmpty(files)){
+//                        continue;
+//                    }
+//                    //上个开发太懒,敷衍了事,重新设置附件相关值
+//                    for (TrialSelfInspectionRecordFileVO file : files) {
+//                        Attach attach = maps.get(file.getUrl());
+//                        if (attach != null){
+//                            file.setFileName(attach.getOriginalName());
+//                            file.setCreateTime(attach.getCreateTime());
+//                        }
+//                    }
+//                    //挂载到子节点下
+//                    List<ArchiveFile> newArchiveFileList = files.stream().map(file -> {
+//                        ArchiveFile archiveFile = trialFileCovertArchiveFile2(file, trialNode);
+//                        return archiveFile;
+//                    }).collect(Collectors.toList());
+//                    addFile.addAll(newArchiveFileList);
+//                }
+//
+//            }
+//
+//        }
         if (addNode.size() > 0){
             addNode.stream().forEach(l->l.setTenantId(tenantId));
             archiveTreeContractMapper.batchInsertArchiveTreeContract(addNode);
@@ -1186,7 +1187,7 @@ public class ArchiveTreeContractSyncImpl {
                 throw new ServiceException("日志存在字典中未配置的类型,请检查后再同步");
             }
             //生成子节点
-            ArchiveTreeContract logNode = createTypeNode(typeName, archiveTreeContract);
+            ArchiveTreeContract logNode = createTypeNode(typeName, 0,archiveTreeContract);
             /** 如果到时候修改需求,只显示有日志的,则下面文件存在再add*/
             addNode.add(logNode);
             //然后再从分组中获取,如果存在值则转换为档案文件
@@ -1268,7 +1269,7 @@ public class ArchiveTreeContractSyncImpl {
         //循环下级节点
         for (ImageClassificationConfig imageType : imageTypes) {
             //把分类生成为影像资料的下级节点
-            ArchiveTreeContract imageNode = createTypeNode(imageType.getClassfName(),archiveTreeContract);
+            ArchiveTreeContract imageNode = createTypeNode(imageType.getClassfName(), 0, archiveTreeContract);
             addNode.add(imageNode);
             //如果当前分类下存在文件,则根据类型生成树,还是日期
 //            List<ImageClassificationFileDTO> files = imageMap.get(imageType.getId());
@@ -1529,7 +1530,8 @@ public class ArchiveTreeContractSyncImpl {
         archiveFile.setContractId(String.valueOf(parentNode.getContractId()));
         archiveFile.setNodeId(parentNode.getId()+"");
         archiveFile.setFileNumber(vo.getReportNo());
-        archiveFile.setFileName(vo.getMaterialName()+vo.getSpecificationModel());
+        //规格型号 + 试验名称
+        archiveFile.setFileName(StringUtil.isNotBlank(vo.getSpecificationModel()) ? vo.getSpecificationModel() + vo.getMaterialName() : vo.getMaterialName());
         if (vo.getReportDate() != null) {
             archiveFile.setFileTime(new SimpleDateFormat("yyyy-MM-dd").format(vo.getReportDate()));
         }
@@ -1539,7 +1541,8 @@ public class ArchiveTreeContractSyncImpl {
         archiveFile.setIsApproval(0);
         archiveFile.setIsCertification(1);
         archiveFile.setIsNeedCertification(0);
-        archiveFile.setDutyUser(vo.getUserName());
+        //责任人 - 委托单位名称
+        archiveFile.setDutyUser(vo.getEntrustCompany());
         archiveFile.setCreateUser(vo.getCreateUser());
         archiveFile.setStatus(0);
         archiveFile.setIsDeleted(0);
@@ -1562,7 +1565,7 @@ public class ArchiveTreeContractSyncImpl {
     /**
      * 质检试验资料 转换为 档案文件
      */
-    private ArchiveFile trialFileCovertArchiveFile(TrialSelfInspectionRecord vo,ArchiveTreeContract parentNode)
+    private ArchiveFile trialFileCovertArchiveFile(TrialSelfInspectionRecord vo,ArchiveTreeContract parentNode, ContractInfo contractInfo)
     {
         ArchiveFile archiveFile = new ArchiveFile();
         archiveFile.setId(SnowFlakeUtil.getId());
@@ -1570,7 +1573,8 @@ public class ArchiveTreeContractSyncImpl {
         archiveFile.setContractId(String.valueOf(parentNode.getContractId()));
         archiveFile.setNodeId(parentNode.getId()+"");
         archiveFile.setFileNumber(vo.getReportNo());
-        archiveFile.setFileName(StringUtils.isNotBlank(vo.getSpecificationModel())?vo.getSpecificationModel():vo.getTrialProjectName());
+        //规格型号 + 试验名称
+        archiveFile.setFileName(StringUtils.isNotBlank(vo.getSpecificationModel()) ? vo.getSpecificationModel() + vo.getTrialProjectName() : vo.getTrialProjectName());
         if (vo.getReportDate() != null) {
             archiveFile.setFileTime(new SimpleDateFormat("yyyy-MM-dd").format(vo.getReportDate()));
         }
@@ -1580,7 +1584,8 @@ public class ArchiveTreeContractSyncImpl {
         archiveFile.setIsApproval(0);
         archiveFile.setIsCertification(1);
         archiveFile.setIsNeedCertification(0);
-        archiveFile.setDutyUser(vo.getTrialUserName());
+        //当前合同段单位名称 施工单位 / 监理单位
+        archiveFile.setDutyUser(contractInfo.getContractType() == 1 ? contractInfo.getConstructionUnitName() : contractInfo.getSupervisionUnitName());
         archiveFile.setCreateUser(vo.getCreateUser());
         archiveFile.setStatus(0);
         archiveFile.setIsDeleted(0);
@@ -1683,7 +1688,7 @@ public class ArchiveTreeContractSyncImpl {
      * 档案同步质检影像资料时,为影像资料-日志资料   节点下级创建分类节点
      * 传入分类名称
      */
-    public ArchiveTreeContract createTypeNode(String nodeName,ArchiveTreeContract archiveTreeContract){
+    public ArchiveTreeContract createTypeNode(String nodeName, Integer sort,ArchiveTreeContract archiveTreeContract){
         ArchiveTreeContract archiveTreeContractTemp = new ArchiveTreeContract();
         //设置基本信息
         archiveTreeContractTemp.setId(SnowFlakeUtil.getId());
@@ -1695,6 +1700,7 @@ public class ArchiveTreeContractSyncImpl {
         archiveTreeContractTemp.setNodeName(nodeName);
         archiveTreeContractTemp.setNodeType(1);
         archiveTreeContractTemp.setFullName(nodeName);
+        archiveTreeContractTemp.setSort(sort);
         archiveTreeContractTemp.setStatus(1);
         archiveTreeContractTemp.setIsDeleted(0);
         //设置关联

+ 16 - 10
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -2284,16 +2284,22 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                         dateFlag=false;
                     }
                 }
-                if(dateFlag){
-                   if(!dateKeyNames.isEmpty()){
-                       for (int i = 0; i < dateKeyNames.size(); i++) {
-                           firstDate=DataInfo.get(dateKeyNames.get(i)).toString();
-                           firstDate=convertToYMD(firstDate);
-                           if(StringUtils.isNotEmpty(firstDate)){
-                               break;
-                           }
-                       }
-                   }
+                try {
+                    if(dateFlag){
+                        if(!dateKeyNames.isEmpty()){
+                            for (int i = 0; i < dateKeyNames.size(); i++) {
+                                if(DataInfo.get(dateKeyNames.get(i))!=null){
+                                    firstDate=DataInfo.get(dateKeyNames.get(i)).toString();
+                                    firstDate=convertToYMD(firstDate);
+                                    if(StringUtils.isNotEmpty(firstDate)){
+                                        break;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
                 }
             }
             Elements trs = table.select("tr");

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

@@ -117,7 +117,7 @@ public class FormulaDaoImpl implements IFormulaDao {
     @Override
     public Function<Long, MeterApproveOpinion> getApproveOpinionFc() {
         return  periodId-> {
-            List<MeterApproveOpinion> beans = this.jdbcTemplate.query("select b.* from u_task  a join s_meter_approve_opinion b on a.id=b.task_id where  a.form_data_id="+periodId, new BeanPropertyRowMapper<>(MeterApproveOpinion.class));
+            List<MeterApproveOpinion> beans = this.jdbcTemplate.query("select b.* from u_task  a join s_meter_approve_opinion b on a.id=b.task_id where  b.is_deleted=0 and a.is_deleted=0 and a.`status` in(0,1,2) and  a.form_data_id="+periodId, new BeanPropertyRowMapper<>(MeterApproveOpinion.class));
             if(beans.size()>0){
                 return beans.get(0);
             }

+ 11 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -5534,9 +5534,17 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         }
     }
     @Override
-    public List<WbsTreeContract> queryListByPIds(List<Long> pIds) {
-        return baseMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery()
+    public List<WbsTreeContract> queryListByPIds(List<Long> pIds, Integer classify) {
+        LambdaQueryWrapper<WbsTreeContract> eq = Wrappers.<WbsTreeContract>lambdaQuery()
                 .in(WbsTreeContract::getPId, pIds)
-                .eq(WbsTreeContract::getIsDeleted, 0));
+                .isNotNull(WbsTreeContract::getHtmlUrl)
+                .eq(WbsTreeContract::getIsDeleted, 0);
+        if(Objects.equals(1,classify)){
+            eq.in(WbsTreeContract::getTableOwner, 1,2,3);
+        }
+        if(Objects.equals(2,classify)){
+            eq.in(WbsTreeContract::getTableOwner, 4,5,6);
+        }
+        return baseMapper.selectList(eq);
     }
 }

+ 7 - 0
blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.xml

@@ -145,6 +145,8 @@
             query.pdf_url,
             query.e_visa_pdf_url,
             query.task_id,
+            query.chek_status,
+            query.check_desc,
             query.sj_record_ids
         FROM
             (
@@ -165,6 +167,8 @@
                 iq.pdf_url,
                 iq.e_visa_pdf_url,
                 iq.wbs_id,
+                iq.chek_status,
+                iq.check_desc,
                 t.id AS task_id,
                 iq.sj_record_ids
             FROM
@@ -216,6 +220,9 @@
                 <if test="query.firstTitle == null or query.firstTitle == ''">
                     AND iq.type != 3
                 </if>
+                <if test="query.chekStatus != null and query.chekStatus != ''">
+                    AND iq.chek_status = #{query.chekStatus}
+                </if>
                 <if test="query.wbsIds != null">
                     AND iq.wbs_id IN
                     <foreach collection="query.wbsIds" item="wbsIdc" open="(" separator="," close=")">

+ 5 - 1
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@@ -1938,6 +1938,10 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
             vo.setTaskStatus(vo.getStatus().toString());
         }
 
+        if (vo.getChekStatus() != null) {
+            vo.setChekStatus(vo.getChekStatus());
+        }
+
         long startTime = System.currentTimeMillis();
         List<InformationQuery> result = new ArrayList<>();
         List<List<String>> partition = Lists.partition(vo.getWbsIds(), 500);
@@ -2225,7 +2229,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
                     eVisaFailedInfo = taskPa.getEVisaContent();
                 }
             }
-            vo.setWaitingUserList(taskPa.getTaskUserName(), taskPa.getEVisaStatus());
+            vo.setWaitingUserList(taskPa.getTaskUserName(), taskPa.getEVisaStatus(), taskPa.getTaskUser());
             vo.setEVisaFailedInfo(eVisaFailedInfo);
         }
     }