Browse Source

Merge branch 'refs/heads/dev' into feature-save-lihb-20250827

# Conflicts:
#	blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java
LHB 1 month ago
parent
commit
3586bb5ee4
60 changed files with 2383 additions and 1027 deletions
  1. 17 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/FindAndReplaceDto1.java
  2. 12 1
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ArchiveFile.java
  3. 7 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/InformationQuery.java
  4. 14 7
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/WbsTreeContractStatistics.java
  5. 8 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ArchiveFileClient.java
  6. 3 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/WbsTreeContractStatisticsClient.java
  7. 45 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/ChekPdfPaceVo.java
  8. 8 3
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/InformationQueryVO.java
  9. 4 1
      blade-service-api/blade-e-visa-api/src/main/java/org/springblade/evisa/vo/SealStrategyVO.java
  10. 11 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/MoveNodeDTO.java
  11. 4 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/Album.java
  12. 36 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/AlbumImages.java
  13. 5 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/ProjectInfo.java
  14. 22 6
      blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveFileController.java
  15. 1 1
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java
  16. 45 2
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  17. 24 4
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java
  18. 103 0
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ArchiveFileClientImpl.java
  19. 15 5
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/WbsTreeContractStatisticsClientImpl.java
  20. 2 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.java
  21. 9 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.xml
  22. 7 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.java
  23. 22 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml
  24. 2 2
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/WbsTreeContractStatisticsMapper.xml
  25. 8 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/IInformationQueryService.java
  26. 3 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITaskService.java
  27. 1 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/IWbsTreeContractStatisticsService.java
  28. 60 50
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ArchiveFileServiceImpl.java
  29. 35 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java
  30. 256 219
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java
  31. 41 6
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java
  32. 94 9
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/WbsTreeContractStatisticsServiceImpl.java
  33. 0 152
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/Chek.java
  34. 6 5
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/ChekSignData.java
  35. 3 3
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/EVController.java
  36. 0 99
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/testTaskInfo222.java
  37. 54 7
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVDataServiceImpl.java
  38. 211 21
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/ScrDataServiceImpl.java
  39. 75 11
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/utils/PdfAddimgUtil.java
  40. 434 219
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/AlbumController.java
  41. 14 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeContractController.java
  42. 3 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ExcelTabClientImpl.java
  43. 23 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/AlbumImagesMapper.java
  44. 21 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/AlbumImagesMapper.xml
  45. 1 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ExcelTabMapper.xml
  46. 1 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ProjectInfoMapper.xml
  47. 8 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.java
  48. 28 7
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml
  49. 17 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/AlbumImagesService.java
  50. 2 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IAlbumService.java
  51. 7 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java
  52. 30 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/AlbumImagesServiceImpl.java
  53. 9 10
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/AlbumServiceImpl.java
  54. 148 69
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractSyncImpl.java
  55. 25 12
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java
  56. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaDaoImpl.java
  57. 54 10
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java
  58. 272 79
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java
  59. 7 0
      blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.xml
  60. 5 1
      blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

+ 17 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/FindAndReplaceDto1.java

@@ -0,0 +1,17 @@
+package org.springblade.business.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springblade.archive.dto.FindAndReplaceDto;
+import org.springblade.business.entity.ArchiveFile;
+
+import java.util.List;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class FindAndReplaceDto1 {
+    private FindAndReplaceDto dto;
+    private List<ArchiveFile> list;
+}

+ 12 - 1
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ArchiveFile.java

@@ -304,6 +304,11 @@ public class ArchiveFile extends BaseEntity {
      */
     @ApiModelProperty("u_image_classification_file_id表中的主键id")
     private Long uImageClassificationFileId;
+    /**
+     * m_album表中的主键id
+     */
+    @ApiModelProperty("u_image_classification_file_id表中的主键id")
+    private Long mAlbumId;
 
     /**
      * 归档文件储存类型,可看代码枚举
@@ -331,6 +336,8 @@ public class ArchiveFile extends BaseEntity {
     private String outId;
 
     private String sortNum;
+
+    private String remark;
     @ApiModelProperty("是否锁定 1已锁定")
     private Integer isLock;
 
@@ -448,6 +455,10 @@ public class ArchiveFile extends BaseEntity {
             this.fileTime = "";
             return;
         }
-        this.fileTime = fileTime.replaceAll("[^0-9]", "");
+        if (fileTime.contains("~")) {
+            this.fileTime = fileTime;
+        } else {
+            this.fileTime = fileTime.replaceAll("[^0-9]", "");
+        }
     }
 }

+ 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;
+
 }

+ 14 - 7
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/WbsTreeContractStatistics.java

@@ -63,38 +63,38 @@ public class WbsTreeContractStatistics implements Serializable {
      * 叶子节点数量
      */
     @ApiModelProperty(value = "叶子节点数量")
-    private Integer leafNum = 0;
+    private Integer leafNum;
 
     /**
      * 已填报数量
      */
     @ApiModelProperty(value = "已填报数量")
-    private Integer fillNum = 0;
+    private Integer fillNum;
     /**
      * 待审批数量
      */
     @ApiModelProperty(value = "待审批数量")
-    private Integer approveNum = 0;
+    private Integer approveNum;
     /**
      * 已审批数量
      */
     @ApiModelProperty(value = "已审批数量")
-    private Integer completeNum = 0;
+    private Integer completeNum;
     /**
      * 已填报数量(监理)
      */
     @ApiModelProperty(value = "已填报数量(监理)")
-    private Integer jlFillNum = 0;
+    private Integer jlFillNum;
     /**
      * 待审批数量(监理)
      */
     @ApiModelProperty(value = "待审批数量(监理)")
-    private Integer jlApproveNum = 0;
+    private Integer jlApproveNum;
     /**
      * 已审批数量(监理)
      */
     @ApiModelProperty(value = "已审批数量(监理)")
-    private Integer jlCompleteNum = 0;
+    private Integer jlCompleteNum;
 
     @DateTimeFormat(
             pattern = "yyyy-MM-dd HH:mm:ss"
@@ -133,6 +133,13 @@ public class WbsTreeContractStatistics implements Serializable {
             this.ancestors = ancestors == null ? "" : ancestors;
             this.status = 1;
             this.isLeaf = 1;
+            this.fillNum = 0;
+            this.approveNum = 0;
+            this.completeNum = 0;
+            this.jlFillNum = 0;
+            this.jlApproveNum = 0;
+            this.jlCompleteNum = 0;
+            this.leafNum = 0;
         }
     }
 

+ 8 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ArchiveFileClient.java

@@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import org.springblade.archive.dto.FindAndReplaceDto;
 import org.springblade.archive.dto.SendsWebSocketArchiveDTO;
+import org.springblade.business.dto.FindAndReplaceDto1;
 import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.vo.ArchiveFileVO;
 import org.springblade.common.constant.BusinessConstant;
@@ -167,4 +169,10 @@ public interface ArchiveFileClient {
 
     @PostMapping(API_PREFIX + "/getArchiveFileByArchiveIds")
     List<ArchiveFile> getArchiveFileByArchiveIds(@RequestParam String archiveIds);
+
+    @PostMapping(API_PREFIX + "/findAndReplace")
+    boolean findAndReplace(@RequestBody FindAndReplaceDto1 dto1);
+
+    @PostMapping(API_PREFIX + "/getAllArchiveFileByIds")
+    List<ArchiveFile> getAllArchiveFileByIds(@RequestBody List<String> strList);
 }

+ 3 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/WbsTreeContractStatisticsClient.java

@@ -45,4 +45,7 @@ public interface WbsTreeContractStatisticsClient {
     @GetMapping(API_PREFIX + "/statisticsContract")
     void statisticsContract(@RequestParam Long contractId);
 
+    @GetMapping(API_PREFIX + "/updateAncestors")
+    void updateAncestors(@RequestParam String ids);
+
 }

+ 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;
     //坐标签章结束 ======================================
 
     /**

+ 11 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/MoveNodeDTO.java

@@ -0,0 +1,11 @@
+package org.springblade.manager.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class MoveNodeDTO {
+    private List<Long> leftPkeyIds;
+    private Long rightPkeyId;
+}

+ 4 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/Album.java

@@ -61,6 +61,10 @@ public class Album extends BaseEntity {
 	*/
 		private String groupNumber;
 	/**
+	* 起止编号
+	*/
+		private String codes;
+	/**
 	* 开始日期
 	*/
 		private String startDate;

+ 36 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/AlbumImages.java

@@ -0,0 +1,36 @@
+package org.springblade.manager.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * 相册与照片关联关系表
+ * @TableName m_album_images
+ */
+@TableName(value ="m_album_images")
+@Data
+public class AlbumImages {
+    /**
+     * id
+     */
+    @TableId
+    private Long id;
+
+    /**
+     * 相册表id
+     */
+    private Long albumId;
+
+    /**
+     * 照片表id
+     */
+    private Long imageId;
+    /**
+     * 照片表id
+     */
+    @TableField(exist = false)
+    private String imagesUrl;
+
+}

+ 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;
 }

+ 22 - 6
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveFileController.java

@@ -10,9 +10,12 @@ import io.swagger.annotations.*;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
 import org.apache.commons.lang.StringUtils;
+import org.springblade.archive.dto.FindAndReplaceDto;
+import org.springblade.archive.entity.ArchivesAuto;
 import org.springblade.archive.service.IArchivesAutoService;
 import org.springblade.archive.utils.FileUtils;
 import org.springblade.archive.vo.ArchiveDataVo;
+import org.springblade.business.dto.FindAndReplaceDto1;
 import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.feign.ArchiveFileClient;
 import org.springblade.business.feign.MetadataClassificationClient;
@@ -65,6 +68,7 @@ public class ArchiveFileController extends BladeController {
     private final MetadataClassificationClient metadataClassificationClient;
     private final IArchivesAutoService autoService;
     private final CommonFileClient commonFileClient;
+
     /**
      * 上传文件
      *
@@ -99,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());
@@ -156,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);
             }
 
@@ -185,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) {
@@ -422,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) {
@@ -459,6 +464,17 @@ public class ArchiveFileController extends BladeController {
             //数据入库
             autoService.sendFileToEArchives(v);
         }
-        return  R.success("操作成功");
+        return R.success("操作成功");
+    }
+
+
+
+   @PostMapping("/findAndReplace")
+    @ApiOperationSupport(order = 12)
+    @ApiOperation(value = "查找并替换", notes = "传入ids")
+    public R findAndReplace(@RequestBody FindAndReplaceDto dto){
+        List<ArchiveFile> archiveFiles = archiveFileClient.getAllArchiveFileByIds(Func.toStrList(dto.getIds()));
+        FindAndReplaceDto1 dto1 = new FindAndReplaceDto1(dto, archiveFiles);
+        return R.status(archiveFileClient.findAndReplace(dto1));
     }
 }

+ 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);

+ 45 - 2
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -222,7 +222,7 @@ public class InformationWriteQueryController extends BladeController {
         String sgSuffix="";
         String jlSuffix="";
         if(queryList.size()>0){
-            String sql1="Select sg_suffix,jl_suffix from m_project_info where id="+queryList.get(0).getProjectId()+" and is_deleted=0";
+            String sql1="Select sg_suffix,jl_suffix,template_type from m_project_info where id="+queryList.get(0).getProjectId()+" and is_deleted=0";
             List<ProjectInfo> projectInfos = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(ProjectInfo.class));
             if(projectInfos.size()>0){
                 sgSuffix=projectInfos.get(0).getSgSuffix()==null?"":projectInfos.get(0).getSgSuffix();
@@ -238,7 +238,11 @@ public class InformationWriteQueryController extends BladeController {
                     if (nameRuleList != null && nameRuleList.getData() != null && !nameRuleList.getData().isEmpty()) {
                         nameRule = String.join("-", nameRuleList.getData());
                     }
-                    result  = nodeBaseInfoServiceClient.getNameRuleByRule(nameRule, contract.getPKeyId()+"");
+                    if(projectInfos.get(0)!=null&&projectInfos.get(0).getTemplateType()==2){
+                        result  = nodeBaseInfoServiceClient.getNameRuleByRule(nameRule, contract.getPKeyId()+"");
+                    }else {
+                        result=wbsParamClient.createFileTitle(contract);
+                    }
                 }else {
                     result=nodeNameMap.get(query.getId());
                     //同时修改工程划分节点命名规则
@@ -272,6 +276,7 @@ public class InformationWriteQueryController extends BladeController {
         return R.status(this.informationQueryService.updateBatchById(queryList));
     }
 
+
     public List<String> getNameRuleByPkeyId(Long pKeyId, Long projectId) {
         NameRuleVo vo = new NameRuleVo();
         String sql2="select * from m_wbs_param where node_id="+pKeyId+" and type=200"+" and is_deleted=0 and k='FILE_TITLE'";
@@ -5274,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);
+    }
 }

+ 24 - 4
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"));
@@ -165,14 +172,16 @@ public class TaskController extends BladeController {
     /**
      * 批量审批详情
      */
-    @GetMapping("/batch-approval-parameter")
+    @PostMapping("/batch-approval-parameter")
     @ApiOperationSupport(order = 11)
     @ApiOperation(value = "批量页详情")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "formDataId", value = "数据源", required = true),
             @ApiImplicitParam(name = "approvalType", value = "上报类型", required = true)
     })
-    public R<List<TaskApprovalVO>> getBatchApprovalTaskParameter(@RequestParam String formDataId, @RequestParam String approvalType) {
+    public R<List<TaskApprovalVO>> getBatchApprovalTaskParameter(@RequestBody BatchTaskVO vo) {
+        String formDataId = vo.getFormDataId();
+        String approvalType = vo.getApprovalType();
         List<String> longs = Func.toStrList(formDataId);
         List<String> apptype = Func.toStrList(approvalType);
         List<TaskApprovalVO> taskApprovalVOList = new ArrayList<>();
@@ -2220,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);
+    }
+
 }

+ 103 - 0
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ArchiveFileClientImpl.java

@@ -8,7 +8,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
+import org.springblade.archive.dto.FindAndReplaceDto;
+import org.springblade.archive.entity.ArchivesAuto;
 import org.springblade.archive.vo.ArchivesAutoVO;
+import org.springblade.business.dto.FindAndReplaceDto1;
 import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.feign.ArchiveFileClient;
 import org.springblade.business.mapper.ArchiveFileMapper;
@@ -16,6 +19,7 @@ import org.springblade.business.service.IArchiveFileService;
 import org.springblade.business.service.ITaskService;
 import org.springblade.business.vo.ArchiveFileVO;
 import org.springblade.common.utils.FileUtils;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.enums.StorageTypeEnum;
 import org.springblade.manager.feign.ContractClient;
@@ -25,6 +29,8 @@ import org.springframework.web.bind.annotation.RestController;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.function.Function;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
 
@@ -352,4 +358,101 @@ public class ArchiveFileClientImpl implements ArchiveFileClient {
         return iArchiveFileService.getArchiveFileByArchivesId(archiveIds,null);
     }
 
+    @Override
+    public boolean findAndReplace(FindAndReplaceDto1 dto1) {
+        List<ArchiveFile> archiveFiles = dto1.getList();
+        FindAndReplaceDto dto = dto1.getDto();
+        List<ArchiveFile> updates = new ArrayList<>();
+
+        for (ArchiveFile archiveFile : archiveFiles) {
+            String originalName = archiveFile.getFileName();
+            if (StringUtils.isEmpty(originalName) || StringUtils.isEmpty(dto.getQuery())) {
+                continue;
+            }
+
+            if (!originalName.contains(dto.getQuery())) {
+                continue;
+            }
+
+            String newName = processFileName(originalName, dto);
+            if (!originalName.equals(newName)) {
+                ArchiveFile update = new ArchiveFile();
+                update.setId(archiveFile.getId());
+                update.setFileName(newName);
+                updates.add(update);
+            }
+        }
+
+        if (!updates.isEmpty()) {
+            return iArchiveFileService.updateBatchById(updates);
+        }
+        return true;
+    }
+
+    private String processFileName(String fileName, FindAndReplaceDto dto) {
+        String query = dto.getQuery();
+        String replace = dto.getReplace();
+
+        switch (dto.getType()) {
+            case 1: // 在指定位置插入
+                return handleInsertAtPosition(fileName, query, replace, dto.getPosition());
+
+            case 2: // 普通替换
+                return handleReplace(fileName, query, replace, false);
+
+            default: // 删除匹配内容
+                return handleReplace(fileName, query, "", true);
+        }
+    }
+
+    private String handleInsertAtPosition(String fileName, String query, String replace, Integer position) {
+        if (position == null) {
+            return fileName; // 没有指定位置时保持原样
+        }
+
+        StringBuilder sb = new StringBuilder();
+        int lastIndex = 0;
+        int index = fileName.indexOf(query);
+
+        while (index != -1) {
+            // 添加未处理部分
+            sb.append(fileName, lastIndex, index);
+
+            // 根据位置插入内容
+            switch (position) {
+                case 1: // 在查询内容前插入
+                    sb.append(replace).append(query);
+                    break;
+                case 2: // 在查询内容后插入
+                    sb.append(query).append(replace);
+                    break;
+                default:
+                    throw new ServiceException("请选择正确的定位条件");
+            }
+
+            lastIndex = index + query.length();
+            index = fileName.indexOf(query, lastIndex);
+        }
+
+        // 添加剩余部分
+        sb.append(fileName.substring(lastIndex));
+        return sb.toString();
+    }
+
+    private String handleReplace(String fileName, String query, String replacement, boolean isLiteral) {
+        if (isLiteral) {
+            // 字面量替换(避免正则表达式特殊字符问题)
+            return fileName.replace(query, replacement);
+        } else {
+            // 使用正则表达式替换,需要转义特殊字符
+            String escapedQuery = Pattern.quote(query); // 自动转义所有特殊字符
+            return fileName.replaceAll(escapedQuery, Matcher.quoteReplacement(replacement));
+        }
+    }
+
+    @Override
+    public List<ArchiveFile> getAllArchiveFileByIds(List<String> strList) {
+        return fileMapper.getAllArchiveFileByIds(strList);
+    }
+
 }

+ 15 - 5
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/WbsTreeContractStatisticsClientImpl.java

@@ -9,6 +9,7 @@ import org.springblade.business.feign.WbsTreeContractStatisticsClient;
 import org.springblade.business.mapper.InformationQueryMapper;
 import org.springblade.business.service.IWbsTreeContractStatisticsService;
 import org.springblade.business.service.impl.WbsTreeContractStatisticsServiceImpl;
+import org.springblade.common.utils.SystemUtils;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
@@ -36,29 +37,32 @@ public class WbsTreeContractStatisticsClientImpl implements WbsTreeContractStati
 
     @Scheduled(cron = "0/30 * * * * ?")
     public void updateInformationQueryStatus() {
+        if (!SystemUtils.isLinux()) {
+            return;
+        }
         Map<String, String> map = new HashMap<>();
-        List<String> queryIds = redisTemplate.opsForList().range(INFORMATION_QUERY_STATUS_STATISTICS_KEY, 0, 100);
+        List<String> queryIds = redisTemplate.opsForList().range(INFORMATION_QUERY_STATUS_STATISTICS_KEY, 0, 1000);
         if (queryIds != null && !queryIds.isEmpty()) {
             String ids = queryIds.stream().distinct().collect(Collectors.joining(","));
-            List<InformationQuery> queryList = jdbcTemplate.query("select wbs_id, classify, contract_id from u_information_query where id in ( " + ids +" ) and is_deleted = 0 group by contract_id,wbs_id,classify",
+            List<InformationQuery> queryList = jdbcTemplate.query("select id,wbs_id, classify, contract_id from u_information_query where id in ( " + ids +" ) and is_deleted = 0 group by contract_id,wbs_id,classify",
                     new BeanPropertyRowMapper<>(InformationQuery.class));
             if (!queryList.isEmpty()) {
                 for (InformationQuery query : queryList) {
                     if (map.containsKey(query.getWbsId() + "," + query.getContractId() + "," + query.getClassify())) {
-                        redisTemplate.opsForList().remove("blade:statistics:information_query_statistics_key", 1, query.getId() + "");
                         continue;
                     }
                     try {
                         wbsTreeContractStatisticsService.updateInformationNumber(query.getWbsId(), query.getClassify(), query.getContractId());
                         map.put(query.getWbsId() + "," + query.getContractId() + "," + query.getClassify(), "");
-                        redisTemplate.opsForList().remove("blade:statistics:information_query_statistics_key", 1, query.getId() + "");
                     } catch (Exception e) {
-                        redisTemplate.opsForList().remove("blade:statistics:information_query_statistics_key", 1, query.getId() + "");
                         redisTemplate.opsForList().rightPush("blade:statistics:information_query_statistics_key", query.getId() + "");
                         log.error("updateInformationQueryStatus wbsId = {}, contractId = {}, classify = {}", query.getWbsId(), query.getContractId(), query.getClassify() , e);
                     }
                 }
             }
+            for (String queryId : queryIds) {
+                redisTemplate.opsForList().remove("blade:statistics:information_query_statistics_key", 1, queryId);
+            }
         }
     }
 
@@ -160,4 +164,10 @@ public class WbsTreeContractStatisticsClientImpl implements WbsTreeContractStati
     public void statisticsContract(Long contractId) {
         wbsTreeContractStatisticsService.statisticsContract(contractId);
     }
+
+    @Override
+    @Async
+    public void updateAncestors(String ids) {
+        wbsTreeContractStatisticsService.updateAncestors(ids);
+    }
 }

+ 2 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.java

@@ -120,4 +120,6 @@ public interface ArchiveFileMapper extends BaseMapper<ArchiveFile> {
      * @return
      */
     Map<String, BigDecimal> getAllArchiveAutoByContractTypeSummary(@Param("projectId") Long projectId);
+
+    List<ArchiveFile> getAllArchiveFileByIds(@Param("strList") List<String> strList);
 }

+ 9 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.xml

@@ -554,4 +554,13 @@
       ) a
 
     </select>
+    <select id="getAllArchiveFileByIds" resultType="org.springblade.business.entity.ArchiveFile">
+        select * from u_archive_file where is_deleted = 0
+        <if test="strList != null and strList != ''">
+            and id in
+            <foreach collection="strList" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </if>
+    </select>
 </mapper>

+ 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>

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

@@ -28,14 +28,14 @@
     <update id="updateLeafNum">
         UPDATE m_wbs_tree_contract_statistics a INNER JOIN (
                 select  b.id, COUNT(c.id) AS leaf_num, sum(c.fill_num) as fill_num, sum(c.approve_num) as approve_num, sum(c.complete_num) as complete_num, sum(c.jl_fill_num) as jl_fill_num, sum(c.jl_approve_num) as jl_approve_num, sum(c.jl_complete_num) as jl_complete_num
-                FROM m_wbs_tree_contract_statistics b INNER JOIN m_wbs_tree_contract_statistics c  ON c.contract_id = b.contract_id AND c.is_leaf = 1 AND c.is_deleted = 0  AND c.status = 1 AND c.ancestors LIKE CONCAT(b.ancestors, ',', b.id, '%')
+                FROM m_wbs_tree_contract_statistics b INNER JOIN m_wbs_tree_contract_statistics c  ON c.contract_id = b.contract_id AND c.leaf_num = 0 AND c.is_deleted = 0  AND c.status = 1 AND c.ancestors LIKE CONCAT(b.ancestors, ',', b.id, '%')
                 WHERE b.id IN (
                     <foreach collection="ids" item="item" separator=",">
                         #{item}
                     </foreach>
                     ) GROUP BY b.id
             ) AS t ON a.id = t.id
-        SET a.leaf_num = t.leaf_num, a.fill_num = t.fill_num,a.approve_num = t.approve_num, a.complete_num = t.complete_num, a.jl_fill_num =t.jl_fill_num, a.jl_approve_num = t.jl_approve_num, a.jl_complete_num = t.jl_complete_num;
+        SET a.leaf_num = t.leaf_num, a.fill_num = t.fill_num,a.approve_num = t.approve_num, a.complete_num = t.complete_num, a.jl_fill_num =t.jl_fill_num, a.jl_approve_num = t.jl_approve_num, a.jl_complete_num = t.jl_complete_num, a.is_leaf = if(t.leaf_num > 0, 0, 1);
     </update>
     <select id="getByIdOnLock" resultMap="ResultMap">
         select <include refid="includeSql"/> from m_wbs_tree_contract_statistics where id = #{id} for update

+ 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);
+
 }

+ 3 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/ITaskService.java

@@ -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);
 }

+ 1 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/IWbsTreeContractStatisticsService.java

@@ -12,5 +12,6 @@ public interface IWbsTreeContractStatisticsService extends IService<WbsTreeContr
     Boolean updateIsDeleted(Long id, Integer isDeleted);
     void statisticsContract(Long contractId);
 
+    void updateAncestors(String ids);
     void sync();
 }

+ 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;
+        }
     }
 
 }

+ 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;
+    }
 }

+ 256 - 219
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")) {
@@ -627,9 +628,9 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         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);
                             }
                         }
@@ -671,7 +672,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     }
                 }
                 this.taskBatchService.saveBatch(taskList);
-            }else if (taskAppr.getFlag().equals("NO")){ //废除
+            } 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);
@@ -768,7 +769,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
     }
 
 
-   // @Scheduled(cron = "0/20 * * * * ?")
+    // @Scheduled(cron = "0/20 * * * * ?")
    /* public void SignInfo() throws InterruptedException {
         //执行代码
         logger.debug("扫描开始");
@@ -1119,7 +1120,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 +1142,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 +1159,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 +1189,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 +1217,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());
             }
 
-        }else {
+        } else {
             throw new ServiceException("未获取到任务信息,操作失败!");
         }
     }
@@ -1245,13 +1246,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 +1261,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 +1277,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 +1291,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 +1317,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 e.printStackTrace();
                 throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());
             }
-        }else {
+        } else {
             throw new ServiceException("未获取到任务信息,操作失败!");
         }
 
@@ -1327,10 +1328,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 +1340,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 +1349,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 +1370,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 +1386,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 +1400,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 +1413,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 +1422,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 +1551,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 +1661,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 +1685,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     nodePdfUrl = org.springblade.business.utils.FileUtils.getNetUrl(listPdf);
                 }
 
-            }else{
+            } else {
                 nodePdfUrl = newFileUrl;
             }
 
@@ -1744,7 +1744,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 +1789,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 +1904,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,27 +2025,27 @@ 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){
-                         b = informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
-                                .eq(InformationQuery::getId, task.getFormDataId())
-                                .set(InformationQuery::getEVisaPdfUrl, null)
+                    if (type == 1) {
+                        b = informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                        .eq(InformationQuery::getId, task.getFormDataId())
+                                        .set(InformationQuery::getEVisaPdfUrl, null)
 //                                .set(InformationQuery::getPdfUrl, null)
-                         );
-                    }else {
-                        if(task.getApprovalType()==3){
-                           b=contractLogService.update(new LambdaUpdateWrapper<ContractLog>()
-                               .eq(ContractLog::getId,task.getFormDataId())
-                               .set(ContractLog::getEVisaPdfUrl,null));
-                           if(!b){
-                               jdbcTemplate.update("update u_task set is_deleted=1 where id="+task.getId());
-                               return;
-                           }
-                        }else {
+                        );
+                    } else {
+                        if (task.getApprovalType() == 3) {
+                            b = contractLogService.update(new LambdaUpdateWrapper<ContractLog>()
+                                    .eq(ContractLog::getId, task.getFormDataId())
+                                    .set(ContractLog::getEVisaPdfUrl, null));
+                            if (!b) {
+                                jdbcTemplate.update("update u_task set is_deleted=1 where id=" + task.getId());
+                                return;
+                            }
+                        } else {
                             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 +2059,55 @@ 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){
+                            if (InformationType == 1) {
                                 result = this.saveNodePdf(typeMap.get(task.getFormDataId()), queryMap.get(task.getFormDataId()), contractId, projectId, header);
-                            }else {
-                                TrialResignDto dto=new TrialResignDto();
+                            } 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){
+                            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()));
+                                            .eq(InformationQuery::getId, task.getFormDataId())
+                                            .set(InformationQuery::getPdfUrl, result.getData()));
                                 }
                             }
                         }
                         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("成功");
                     }
                     //重新电签
-                    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,7 +2121,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();
@@ -2136,7 +2138,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 +2147,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());
             }
 
-        }else {
+        } else {
             throw new ServiceException("未获取到任务信息,操作失败!");
         }
     }
@@ -2156,32 +2158,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 +2198,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 +2225,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("操作成功");
+    }
 }

+ 41 - 6
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -1144,7 +1144,12 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             //------初始编号信息------
             this.initBuildNumber(dto);
         }
+        String tableIds = dto.getTableIds();
+        if (ObjectUtil.isNotEmpty(dto.getId())) {
+            dto.setTableIds(null);
+        }
         this.saveOrUpdate(dto);
+        dto.setTableIds(tableIds);
         if (ObjectUtil.isNotEmpty(dto.getId())) {
             //------获取最新试验记录------
             TrialSelfInspectionRecord obj = baseMapper.selectById(dto.getId());
@@ -1198,6 +1203,35 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
         }
         return dto.getId().toString();
     }
+    private String saveTrialRecordTableIds(TrialSelfInspectionRecord obj, String tableIds , boolean isRecord){
+        if (obj.getTableIds() ==  null || obj.getTableIds().trim().isEmpty()) {
+            return tableIds;
+        }
+        List<WbsTreePrivate> query = jdbcTemplate.query("select * from m_wbs_tree_private where p_key_id in (" + obj.getTableIds() + ")", new BeanPropertyRowMapper<>(WbsTreePrivate.class));
+        List<String> recordIds = new ArrayList<>();
+        List<String> reportIds = new ArrayList<>();
+        for (WbsTreePrivate treePrivate : query) {
+            Integer type = treePrivate.getTableType();
+            if (type == null) {
+                continue;
+            }
+            if (type == 1 || type == 9) {
+                recordIds.add(treePrivate.getPKeyId() + "");
+            } else if (type == 2 || type == 10) {
+                reportIds.add(treePrivate.getPKeyId() + "");
+            }
+        }
+        if (isRecord) {
+            if (!reportIds.isEmpty()) {
+                tableIds = tableIds + "," + String.join(",", reportIds);
+            }
+        } else {
+            if (!recordIds.isEmpty()) {
+                tableIds = tableIds + "," + String.join(",", recordIds);
+            }
+        }
+        return tableIds;
+    }
 
     /**
      * 取到传入的表单中的报告编号或者记录编号 修改记录表中相应字段的值
@@ -1396,14 +1430,15 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             String updateSql = null;
             if (recordDataTable && !reportDataTable) {
                 //单独保存记录表 查询报告单pdf是否有值 如果有值就合并 合并存到pdf_url
-                updateSql = getUpdateSql(dto, pdfURL, listPdf, snowId, "report_pdf_url", 1, "record_pdf_url");
-
+                String tableIds = saveTrialRecordTableIds(obj, dto.getTableIds(), true);
+                updateSql = getUpdateSql(dto, pdfURL, listPdf, snowId, "report_pdf_url", 1, "record_pdf_url", tableIds);
             } else if (!recordDataTable && reportDataTable) {
                 //单独保存报告表 查询记录表pdf是否有值 如果有值就合并 合并存到pdf_url
-                updateSql = getUpdateSql(dto, pdfURL, listPdf, snowId, "record_pdf_url", 2, "report_pdf_url");
+                String tableIds = saveTrialRecordTableIds(obj, dto.getTableIds(), false);
+                updateSql = getUpdateSql(dto, pdfURL, listPdf, snowId, "record_pdf_url", 2, "report_pdf_url", tableIds);
             } else {
                 //一起保存的数据  只改变pdf_url
-                this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate().set(TrialSelfInspectionRecord::getPdfUrl, pdfURL).set(TrialSelfInspectionRecord::getTaskStatus, "未上报").eq(TrialSelfInspectionRecord::getId, dto.getId()));
+                this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate().set(TrialSelfInspectionRecord::getTableIds, dto.getTableIds()).set(TrialSelfInspectionRecord::getPdfUrl, pdfURL).set(TrialSelfInspectionRecord::getTaskStatus, "未上报").eq(TrialSelfInspectionRecord::getId, dto.getId()));
             }
             if (ObjectUtil.isNotEmpty(updateSql)) {
                 jdbcTemplate.execute(updateSql);
@@ -1415,7 +1450,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
     }
 
     @NotNull
-    private String getUpdateSql(TrialSelfInspectionRecordDTO dto, String pdfURL, String listPdf, Long snowId, String param1, int type, String param2) {
+    private String getUpdateSql(TrialSelfInspectionRecordDTO dto, String pdfURL, String listPdf, Long snowId, String param1, int type, String param2, String tableIds) {
         String updateSql;
         String sqlForAntherPDF = "SELECT " + param1 + " from u_trial_self_inspection_record where id =  " + dto.getId() + " and is_deleted = 0";
         String AntherPDFUrl = jdbcTemplate.queryForObject(sqlForAntherPDF, new SingleColumnRowMapper<String>(String.class));
@@ -1428,7 +1463,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             }
 
             BladeFile bladeFile = this.newIOSSClient.uploadFile(snowId + ".pdf", listPdf);
-            updateSql = "update u_trial_self_inspection_record set pdf_url = '" + bladeFile.getLink() + "'," + param2 + "= '" + pdfURL + "' ,task_status='未上报' where id='" + dto.getId() + "'";
+            updateSql = "update u_trial_self_inspection_record set pdf_url = '" + bladeFile.getLink() + "'," + param2 + "= '" + pdfURL + "' ,task_status='未上报', table_ids = '" + tableIds +"' where id='" + dto.getId() + "'";
             //合并后更新queryInfo表的pdfurl
             String updateForQurtyInfo = "update u_information_query set pdf_url ='" + bladeFile.getLink() + "' where classify='" + dto.getType() + "' and  wbs_id='" + dto.getId() + "' and contract_id ='" + dto.getContractId() + "' ";
             jdbcTemplate.execute(updateForQurtyInfo);

+ 94 - 9
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/WbsTreeContractStatisticsServiceImpl.java

@@ -222,13 +222,7 @@ public class WbsTreeContractStatisticsServiceImpl extends ServiceImpl<WbsTreeCon
     }
 
     private void updateStatusAndIsDeleted(Long contractId) {
-        List<WbsTreeContractStatistics> query = jdbcTemplate.query("SELECT a.id,b.status,b.is_deleted from m_wbs_tree_contract_statistics a LEFT JOIN m_wbs_tree_contract b on a.id = b.p_key_id WHERE (a.status != b.status OR a.is_deleted != b.is_deleted) AND b.p_key_id IS NOT NULl and a.contract_id = " + contractId,
-                new BeanPropertyRowMapper<>(WbsTreeContractStatistics.class));
-        if (query.isEmpty()) {
-            return;
-        }
-        List<WbsTreeContractStatistics> list = query.stream().filter(item -> item.getStatus() != null && item.getIsDeleted() != null).collect(Collectors.toList());
-        this.updateBatchById(list);
+        jdbcTemplate.execute("update  m_wbs_tree_contract_statistics a LEFT JOIN m_wbs_tree_contract b on a.id = b.p_key_id  set a.status = ifnull(b.status, a.status) , a.is_deleted = IFNULL(b.is_deleted,a.is_deleted) WHERE (a.status != b.status OR a.is_deleted != b.is_deleted) AND b.p_key_id IS NOT NULl and a.contract_id = " + contractId);
     }
 
     public Boolean updateLeafNum(String ids) {
@@ -240,6 +234,92 @@ public class WbsTreeContractStatisticsServiceImpl extends ServiceImpl<WbsTreeCon
         return true;
     }
 
+    @Override
+    public void updateAncestors(String ids) {
+        if (!StringUtil.hasText(ids)) {
+            return;
+        }
+        String[] split = ids.split(",");
+        if (split.length == 0) {
+            return;
+        }
+        Map<Long, Long> map = new HashMap<>();
+        {
+            ids = Arrays.stream(split).filter(StringUtil::isNumeric).distinct().collect(Collectors.joining(","));
+            List<WbsTreeContract> query = jdbcTemplate.query("SELECT id,p_key_id,p_id,parent_id FROM m_wbs_tree_contract WHERE is_deleted = 0 and type = 1 and p_key_id in (" + String.join(",", ids) + ")", new BeanPropertyRowMapper<>(WbsTreeContract.class));
+            if (query.isEmpty()) {
+                return;
+            }
+            // 只更新父级节点
+            Map<Long, List<WbsTreeContract>> childrenMap = query.stream().collect(Collectors.groupingBy(WbsTreeContract::getPId));
+            for (WbsTreeContract wbsTreeContract : query) {
+                List<WbsTreeContract> list = childrenMap.get(wbsTreeContract.getPKeyId());
+                if (list == null) {
+                    // 更新当前节点 parent ancestors字段
+                    map.put(wbsTreeContract.getPKeyId(), wbsTreeContract.getPId());
+                }
+            }
+        }
+        if (map.isEmpty()) {
+            return;
+        }
+        List<WbsTreeContractStatistics> wbsTreeContractStatistics = this.listByIds(map.keySet());
+        List<WbsTreeContractStatistics> parentList = this.listByIds(map.values());
+        Map<Long, WbsTreeContractStatistics> parentMap = parentList.stream().collect(Collectors.toMap(WbsTreeContractStatistics::getId, item -> item));
+        List<WbsTreeContractStatistics> updateList = new ArrayList<>();
+        List<String> sqlList = new ArrayList<>();
+        for (WbsTreeContractStatistics statistics : wbsTreeContractStatistics) {
+            Long parentId = map.get(statistics.getId());
+            WbsTreeContractStatistics update = new WbsTreeContractStatistics();
+            update.setId(statistics.getId());
+            if (parentId == null) {
+                update.setParentId(0L);
+                update.setAncestors("0");
+                updateList.add(update);
+                continue;
+            }
+            WbsTreeContractStatistics parent = parentMap.get(parentId);
+            if (parent == null) {
+                update.setParentId(0L);
+                update.setAncestors("0");
+                updateList.add(update);
+                continue;
+            }
+            update.setParentId(parent.getId());
+            update.setAncestors(parent.getAncestors() + "," + parent.getId());
+            updateList.add(update);
+            WbsTreeContractStatistics temp = new WbsTreeContractStatistics();
+            temp.setId(statistics.getParentId());
+            temp.setAncestors(statistics.getAncestors());
+            parentMap.put(statistics.getParentId(), temp);
+            String oldAncestors = statistics.getAncestors() + "," + statistics.getId();
+            String newAncestors = update.getAncestors() + "," + statistics.getId();
+            String sql = "UPDATE m_wbs_tree_contract_statistics SET ancestors = replace(ancestors, '" + oldAncestors + "', '" + newAncestors + "') WHERE is_deleted = 0 and status = 1 and ancestors like '"
+                    + oldAncestors + "%' and contract_id = " + statistics.getContractId();
+            sqlList.add(sql);
+        }
+        Set<Long> parentIds = new HashSet<>();
+        parentMap.values().forEach(item -> {
+            parentIds.add(item.getId());
+            String ancestors = item.getAncestors();
+            if (ancestors != null && !ancestors.isEmpty()) {
+                String[] split1 = ancestors.split(",");
+                for (String s : split1) {
+                    if (StringUtil.isNumeric(s)) {
+                        parentIds.add(Long.parseLong(s));
+                    }
+                }
+            }
+        });
+        this.updateBatchById(updateList);
+        for (String s : sqlList) {
+            jdbcTemplate.update(s);
+        }
+        if (!parentIds.isEmpty()) {
+            this.baseMapper.updateLeafNum(parentIds);
+        }
+    }
+
     public void createWbsTreeContractStatisticsParent(WbsTreeContract wbsTreeContract, WbsTreeContractStatistics wbsTreeContractStatistics, List<WbsTreeContractStatistics> wbsTreeContractStatisticsList) {
         if (wbsTreeContract.getParentId() == null || wbsTreeContract.getParentId() <= 0) {
             wbsTreeContractStatistics.setParentId(0L);
@@ -253,6 +333,7 @@ public class WbsTreeContractStatisticsServiceImpl extends ServiceImpl<WbsTreeCon
                 return;
             }
             parent = createWbsTreeContractStatistics(wbsTreeContractParent);
+            parent.setIsLeaf(0);
             createWbsTreeContractStatisticsParent(wbsTreeContractParent, parent, wbsTreeContractStatisticsList);
             wbsTreeContractStatisticsList.add(parent);
         } else {
@@ -260,20 +341,24 @@ public class WbsTreeContractStatisticsServiceImpl extends ServiceImpl<WbsTreeCon
                 wbsTreeContractStatistics.setParentId(parent.getId());
                 wbsTreeContractStatistics.setAncestors(parent.getAncestors() + "," + parent.getId());
             }
+            if (parent.getIsLeaf() == 1) {
+                this.update(Wrappers.<WbsTreeContractStatistics>lambdaUpdate().eq(WbsTreeContractStatistics::getId, parent.getId()).set(WbsTreeContractStatistics::getIsLeaf, 0));
+            }
         }
     }
 
     public void createWbsTreeContractStatisticsChildren(WbsTreeContract wbsTreeContract, WbsTreeContractStatistics wbsTreeContractStatistics, List<WbsTreeContractStatistics> wbsTreeContractStatisticsList) {
         List<WbsTreeContract> wbsTreeContracts =  jdbcTemplate.query("select * from m_wbs_tree_contract where is_deleted = 0 and type = 1 and contract_id = ? and p_id = ?",
                 new Object[]{wbsTreeContract.getContractId(), wbsTreeContract.getPKeyId()}, new BeanPropertyRowMapper<>(WbsTreeContract.class));
-        if (wbsTreeContracts == null || wbsTreeContracts.isEmpty()) {
+        if (wbsTreeContracts.isEmpty()) {
             wbsTreeContractStatistics.setIsLeaf(1);
             wbsTreeContractStatistics.setLeafNum(0);
             return;
         }
+        wbsTreeContractStatistics.setIsLeaf(0);
         wbsTreeContracts.forEach(item -> {
             WbsTreeContractStatistics statistics = createWbsTreeContractStatistics(item);
-            createWbsTreeContractStatisticsChildren(item, wbsTreeContractStatistics, wbsTreeContractStatisticsList);
+            createWbsTreeContractStatisticsChildren(item, statistics, wbsTreeContractStatisticsList);
             statistics.setAncestors(wbsTreeContractStatistics.getAncestors() + "," + wbsTreeContractStatistics.getId());
             statistics.setParentId(wbsTreeContractStatistics.getId());
             wbsTreeContractStatisticsList.add(statistics);

+ 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;
         }
     }
+
 }

+ 434 - 219
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/AlbumController.java

@@ -26,6 +26,7 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
+
 import javax.validation.Valid;
 
 import org.apache.poi.ss.usermodel.*;
@@ -42,15 +43,14 @@ import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.IoUtil;
-import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.core.tool.utils.*;
 import org.springblade.manager.dto.AlbumDTO;
 import org.springblade.manager.dto.AlbumDTO1;
+import org.springblade.manager.entity.AlbumImages;
 import org.springblade.manager.entity.ExcelTab;
 import org.springblade.manager.feign.ExcelTabClient;
 import org.springblade.manager.feign.ImageClassificationConfigClient;
+import org.springblade.manager.service.AlbumImagesService;
 import org.springblade.manager.utils.FileUtils;
 import org.springblade.resource.feign.CommonFileClient;
 import org.springblade.resource.feign.NewIOSSClient;
@@ -77,7 +77,7 @@ import java.util.HashMap;
 import java.util.List;
 
 /**
- *  控制器
+ * 控制器
  *
  * @author BladeX
  * @since 2025-07-15
@@ -88,37 +88,39 @@ import java.util.List;
 @Api(value = "", tags = "接口")
 public class AlbumController extends BladeController {
 
-	private final IAlbumService albumService;
+    private final IAlbumService albumService;
+
+    private final NewIOSSClient newIOSSClient;
 
-	private final NewIOSSClient newIOSSClient;
+    private final ExcelTabClient excelTabClient;
 
-	private final ExcelTabClient excelTabClient;
+    private final ImageClassificationFileClient imageClassificationFileClient;
 
-	private final ImageClassificationFileClient imageClassificationFileClient;
+    private final CommonFileClient commonFileClient;
 
-	private final CommonFileClient commonFileClient;
+    private final AlbumImagesService albumImagesService;
 
-	/**
-	 * 详情
-	 */
-	@GetMapping("/detail")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "详情", notes = "传入album")
-	public R<AlbumVO> detail(Album album) {
-		Album detail = albumService.getOne(Condition.getQueryWrapper(album));
-		return R.data(AlbumWrapper.build().entityVO(detail));
-	}
+    /**
+     * 详情
+     */
+    @GetMapping("/detail")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "详情", notes = "传入album")
+    public R<AlbumVO> detail(Album album) {
+        Album detail = albumService.getOne(Condition.getQueryWrapper(album));
+        return R.data(AlbumWrapper.build().entityVO(detail));
+    }
 
-	/**
-	 * 分页 
-	 */
-	@PostMapping("/page")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "分页", notes = "传入album")
-	public R<IPage<AlbumVO>> page(Long projectId,Long contractId,Query query) {
-		IPage<AlbumVO> pages = albumService.selectPage1(projectId,contractId,Condition.getPage(query));
-		return R.data(pages);
-	}
+    /**
+     * 分页
+     */
+    @PostMapping("/page")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "分页", notes = "传入album")
+    public R<IPage<AlbumVO>> page(Long projectId, Long contractId, Query query) {
+        IPage<AlbumVO> pages = albumService.selectPage1(projectId, contractId, Condition.getPage(query));
+        return R.data(pages);
+    }
 
 
 //	/**
@@ -132,54 +134,55 @@ public class AlbumController extends BladeController {
 //		return R.data(pages);
 //	}
 
-	/**
-	 * 新增 
-	 */
-	@PostMapping("/save")
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "新增", notes = "传入album")
-	public R save(@Valid @RequestBody AlbumDTO albumDTO) {
-		if(albumDTO.getMargePdfUrls().isEmpty()){
-			throw new ServiceException("相册不能为空");
-		}
-		List<String>uris=new ArrayList<>();
-		HashMap<String, Long> map = new HashMap<>();
-		for (AlbumDTO1 margePdfUrl : albumDTO.getMargePdfUrls()) {
-			String imageUrl = margePdfUrl.getImageUrl();
-			String[] urlss = imageUrl.split(",");
-			for (String string : urlss) {
-				map.put(string,margePdfUrl.getId());
-				uris.add(string);
-			}
-		}
-		if(uris.isEmpty()){
-			throw new ServiceException("相册不能为空");
-		}
-		Album album=new Album();
-		BeanUtil.copy(albumDTO,album);
-		String dateValue = albumDTO.getDateValue();
-		String[] strings = dateValue.split("~");
-		album.setStartDate(strings[0]);
-		album.setEndDate(strings[1]);
-		//获取固定表格
-		ExcelTab excelTab = this.excelTabClient.getById("1950465427890794498"); //影像资料模板
-		String file_path = null;
-		if (SystemUtils.isWindows()) {
-			file_path = "C:\\pdfFiles\\";
-			File file = new File(file_path);
-			if (!file.exists()) {
-				file.mkdirs();
-			}
-		}
-		if (SystemUtils.isLinux()) {
-			file_path = "/home/pdfFiles";
-			File file = new File(file_path);
-			if (!file.exists()) {
-				file.mkdirs();
-			}
-		}
-		if (excelTab != null) {
-			//获取数据
+    /**
+     * 新增
+     */
+    @PostMapping("/save")
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "新增", notes = "传入album")
+    public R save(@Valid @RequestBody AlbumDTO albumDTO) {
+        if (albumDTO.getMargePdfUrls().isEmpty()) {
+            throw new ServiceException("相册不能为空");
+        }
+        List<String> uris = new ArrayList<>();
+        HashMap<String, Long> map = new HashMap<>();
+        for (AlbumDTO1 margePdfUrl : albumDTO.getMargePdfUrls()) {
+            String imageUrl = margePdfUrl.getImageUrl();
+            String[] urlss = imageUrl.split(",");
+            for (String string : urlss) {
+                map.put(string, margePdfUrl.getId());
+                uris.add(string);
+            }
+        }
+        if (uris.isEmpty()) {
+            throw new ServiceException("相册不能为空");
+        }
+        Album album = new Album();
+        BeanUtil.copy(albumDTO, album);
+        album.setId(SnowFlakeUtil.getId());
+        String dateValue = albumDTO.getDateValue();
+        String[] strings = dateValue.split("~");
+        album.setStartDate(strings[0]);
+        album.setEndDate(strings[1]);
+        //获取固定表格
+        ExcelTab excelTab = this.excelTabClient.getById("1950465427890794498"); //影像资料模板
+        String file_path = null;
+        if (SystemUtils.isWindows()) {
+            file_path = "C:\\pdfFiles\\";
+            File file = new File(file_path);
+            if (!file.exists()) {
+                file.mkdirs();
+            }
+        }
+        if (SystemUtils.isLinux()) {
+            file_path = "/home/pdfFiles";
+            File file = new File(file_path);
+            if (!file.exists()) {
+                file.mkdirs();
+            }
+        }
+        if (excelTab != null) {
+            //获取数据
 //			try {
 //					//需要删除的本地文件集合
 //					List<String> removeList = new ArrayList<>();
@@ -294,139 +297,349 @@ public class AlbumController extends BladeController {
 //			} catch (Exception e) {
 //				e.printStackTrace();
 //			}
-			try {
-				//需要删除的本地文件集合
-				List<String> removeList = new ArrayList<>();
-				//获取模板文件流
-				InputStream modInput = null;
-				FileInputStream excelFileInput = null;
-				FileOutputStream outputStream = null;
-				Workbook workbook = null;
-
-				List<String> pdfFileList = new ArrayList<>();
-				//两个图片一组
-				List<List<String>> groupUrls = CommonUtil.getBatchSize(uris, 2);
-				for (List<String> urls : groupUrls) {
-					try {
-						//创建模板Workbook
-						modInput = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
-						if (modInput != null) {
-							workbook = WorkbookFactory.create(modInput);
-							for (int i = 0, l = urls.size(); i < l; i++) {
-								try {
-									CreationHelper helper = workbook.getCreationHelper();
-									Sheet sheet = workbook.getSheetAt(0);
-									Drawing<?> drawing = sheet.createDrawingPatriarch();
-									ClientAnchor anchor = helper.createClientAnchor();
-									Long id = map.get(urls.get(i));
-									ImageClassificationFile file = imageClassificationFileClient.getImageClassificationFileById(id);
-
-									//获取文件流
-									byte[] bytes = CommonUtil.InputStreamToBytes(CommonUtil.getOSSInputStream(urls.get(i)));
-									if (bytes[0] == 82 && bytes[1] == 73 && bytes[2] == 70) {
-										bytes = CommonUtil.webpToPngBytes(CommonUtil.getOSSInputStream(urls.get(i)));
-									}
-									//压缩文件大小
-									byte[] byteNew = FileUtils.compressImage(bytes);
-									//创建图片
-									Picture picture = drawing.createPicture(anchor, workbook.addPicture(byteNew, Workbook.PICTURE_TYPE_PNG));
-									picture.resize();
-
-									//图片定位
-									FileUtils.imageOrientation(sheet, anchor, i == 1 ? new DataVO(0, 8) : new DataVO(0, 3));
-
-									//定位其它信息
-									int baseRow = i == 0 ? 0 : 5; // 第一组在0-4行,第二组在5-9行
-
-									// 分组号 (C列,索引2)
-									sheet.getRow(baseRow ).getCell(3).setCellValue(albumDTO.getGroupNumber() != null ? albumDTO.getGroupNumber() : "");
-									// 照片编号 (C列,索引2)
-									sheet.getRow(baseRow + 1).getCell(3).setCellValue(file.getPhotoCode() != null ? file.getPhotoCode() : "");
-									// 摄影者 (C列,索引2)
-									sheet.getRow(baseRow + 2).getCell(3).setCellValue(file.getShootingUser() != null ? file.getShootingUser() : "");
-									// 拍摄时间 (C列,索引2)
-									sheet.getRow(baseRow + 3).getCell(3).setCellValue(file.getShootingTime() != null ?
-											DateUtil.format(file.getShootingTime(), "yyyy-MM-dd") : "");
-									// 照片说明 (A列,索引0)
-									String a=albumDTO.getImagesName()!=null?albumDTO.getImagesName():"";
-									String b=file.getTextContent() != null ? file.getTextContent() : "";
-									sheet.getRow(baseRow+4).getCell(1).setCellValue(a+b);
-
-								} catch (Exception e) {
-									e.printStackTrace();
-								}
-							}
-							String locationFile = file_path + SnowFlakeUtil.getId() + ".xlsx";
-							outputStream = new FileOutputStream(locationFile);
-							//记录文件删除
-							removeList.add(locationFile);
-							//生成一份新的excel
-							workbook.write(outputStream);
-							//将excel转PDF
-							File excelFile = new File(locationFile);
-							excelFileInput = new FileInputStream(excelFile);
-							MultipartFile files = new MockMultipartFile("file", excelFile.getName(), "text/plain", IOUtils.toByteArray(excelFileInput));
-							NewBladeFile bladeFile = this.commonFileClient.excelToPdf(files);
-							if (bladeFile != null) {
-								pdfFileList.add(bladeFile.getPdfUrl());
-							}
-						}
-					} catch (Exception e) {
-						e.printStackTrace();
-					} finally {
-						if (outputStream != null) {
-							IoUtil.closeQuietly(outputStream);
-						}
-						if (modInput != null) {
-							IoUtil.closeQuietly(modInput);
-						}
-						if (excelFileInput != null) {
-							IoUtil.closeQuietly(excelFileInput);
-						}
-						if (workbook != null) {
-							IoUtil.closeQuietly(workbook);
-						}
-					}
-				}
-
-				//合并pdf并上传
-				String mergeName = SnowFlakeUtil.getId() + ".pdf";
-				String mergeUrl = file_path + mergeName;
-				FileUtils.mergePdfPublicMethods(pdfFileList, mergeUrl);
-				//记录文件删除
-				removeList.add(mergeUrl);
-				//上传
-				BladeFile bladeFile = this.newIOSSClient.uploadFile(mergeName, mergeUrl);
-				if (bladeFile != null) {
-					album.setImagesPdf(bladeFile.getLink());
-				}
-
-				if (removeList.size() > 0) {
-					//删除本地文件
-					CommonUtil.removeFile(removeList);
-				}
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-		}
-		return R.status(albumService.save(album));
-	}
-
-	/**
-	 * 修改 
-	 */
-	@PostMapping("/update")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "修改", notes = "传入album")
-	public R update(@Valid @RequestBody AlbumDTO albumDTO) {
-		Album album=new Album();
-		BeanUtil.copy(albumDTO,album);
-		String dateValue = albumDTO.getDateValue();
-		String[] strings = dateValue.split("~");
-		album.setStartDate(strings[0]);
-		album.setEndDate(strings[1]);
-		return R.status(albumService.updateById(album));
-	}
+            try {
+                //需要删除的本地文件集合
+                List<String> removeList = new ArrayList<>();
+                //获取模板文件流
+                InputStream modInput = null;
+                FileInputStream excelFileInput = null;
+                FileOutputStream outputStream = null;
+                Workbook workbook = null;
+
+                List<String> pdfFileList = new ArrayList<>();
+                //两个图片一组
+                List<List<String>> groupUrls = CommonUtil.getBatchSize(uris, 2);
+                for (List<String> urls : groupUrls) {
+                    try {
+                        //创建模板Workbook
+                        modInput = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
+                        if (modInput != null) {
+                            workbook = WorkbookFactory.create(modInput);
+                            for (int i = 0, l = urls.size(); i < l; i++) {
+                                try {
+                                    CreationHelper helper = workbook.getCreationHelper();
+                                    Sheet sheet = workbook.getSheetAt(0);
+                                    Drawing<?> drawing = sheet.createDrawingPatriarch();
+                                    ClientAnchor anchor = helper.createClientAnchor();
+                                    Long id = map.get(urls.get(i));
+                                    ImageClassificationFile file = imageClassificationFileClient.getImageClassificationFileById(id);
+
+                                    //获取文件流
+                                    byte[] bytes = CommonUtil.InputStreamToBytes(CommonUtil.getOSSInputStream(urls.get(i)));
+                                    if (bytes[0] == 82 && bytes[1] == 73 && bytes[2] == 70) {
+                                        bytes = CommonUtil.webpToPngBytes(CommonUtil.getOSSInputStream(urls.get(i)));
+                                    }
+                                    //压缩文件大小
+                                    byte[] byteNew = FileUtils.compressImage(bytes);
+                                    //创建图片
+                                    Picture picture = drawing.createPicture(anchor, workbook.addPicture(byteNew, Workbook.PICTURE_TYPE_PNG));
+                                    picture.resize();
+
+                                    //图片定位
+                                    FileUtils.imageOrientation(sheet, anchor, i == 1 ? new DataVO(0, 8) : new DataVO(0, 3));
+
+                                    //定位其它信息
+                                    int baseRow = i == 0 ? 0 : 5; // 第一组在0-4行,第二组在5-9行
+
+                                    // 分组号 (C列,索引2)
+                                    sheet.getRow(baseRow).getCell(3).setCellValue(albumDTO.getGroupNumber() != null ? albumDTO.getGroupNumber() : "");
+                                    // 照片编号 (C列,索引2)
+                                    sheet.getRow(baseRow + 1).getCell(3).setCellValue(file.getPhotoCode() != null ? file.getPhotoCode() : "");
+                                    // 摄影者 (C列,索引2)
+                                    sheet.getRow(baseRow + 2).getCell(3).setCellValue(file.getShootingUser() != null ? file.getShootingUser() : "");
+                                    // 拍摄时间 (C列,索引2)
+                                    sheet.getRow(baseRow + 3).getCell(3).setCellValue(file.getShootingTime() != null ?
+                                            DateUtil.format(file.getShootingTime(), "yyyy-MM-dd") : "");
+                                    // 照片说明 (A列,索引0)
+                                    String a = albumDTO.getImagesName() != null ? albumDTO.getImagesName() : "";
+                                    String b = file.getTextContent() != null ? file.getTextContent() : "";
+                                    sheet.getRow(baseRow + 4).getCell(1).setCellValue(a + b);
+
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                }
+                            }
+                            String locationFile = file_path + SnowFlakeUtil.getId() + ".xlsx";
+                            outputStream = new FileOutputStream(locationFile);
+                            //记录文件删除
+                            removeList.add(locationFile);
+                            //生成一份新的excel
+                            workbook.write(outputStream);
+                            //将excel转PDF
+                            File excelFile = new File(locationFile);
+                            excelFileInput = new FileInputStream(excelFile);
+                            MultipartFile files = new MockMultipartFile("file", excelFile.getName(), "text/plain", IOUtils.toByteArray(excelFileInput));
+                            NewBladeFile bladeFile = this.commonFileClient.excelToPdf(files);
+                            if (bladeFile != null) {
+                                pdfFileList.add(bladeFile.getPdfUrl());
+                            }
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    } finally {
+                        if (outputStream != null) {
+                            IoUtil.closeQuietly(outputStream);
+                        }
+                        if (modInput != null) {
+                            IoUtil.closeQuietly(modInput);
+                        }
+                        if (excelFileInput != null) {
+                            IoUtil.closeQuietly(excelFileInput);
+                        }
+                        if (workbook != null) {
+                            IoUtil.closeQuietly(workbook);
+                        }
+                    }
+                }
+
+                //合并pdf并上传
+                String mergeName = SnowFlakeUtil.getId() + ".pdf";
+                String mergeUrl = file_path + mergeName;
+                FileUtils.mergePdfPublicMethods(pdfFileList, mergeUrl);
+                //记录文件删除
+                removeList.add(mergeUrl);
+                //上传
+                BladeFile bladeFile = this.newIOSSClient.uploadFile(mergeName, mergeUrl);
+                if (bladeFile != null) {
+                    album.setImagesPdf(bladeFile.getLink());
+                }
+
+                if (removeList.size() > 0) {
+                    //删除本地文件
+                    CommonUtil.removeFile(removeList);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        //添加相册与照片的关联关系 用于编辑时重新生成pdf
+        List<AlbumImages> albumImages = new ArrayList<>();
+        albumDTO.getMargePdfUrls().forEach(f -> {
+            AlbumImages albumImage = new AlbumImages();
+            albumImage.setId(SnowFlakeUtil.getId());
+            albumImage.setAlbumId(album.getId());
+            albumImage.setImageId(f.getId());
+            albumImages.add(albumImage);
+        });
+        albumImagesService.saveBatch(albumImages);
+
+        return R.status(albumService.save(album));
+    }
+
+    /**
+     * 修改
+     */
+    @PostMapping("/update")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "修改", notes = "传入album")
+    public R update(@Valid @RequestBody AlbumDTO albumDTO) {
+
+        //查询关联关系
+        List<ImageClassificationFile> list = albumImagesService.selectImageUrlByAlbumId(albumDTO.getId());
+        if (CollectionUtil.isNotEmpty(list)) {
+            //可能存在一条数据多张照片的情况
+            List<ImageClassificationFile> images = new ArrayList<>();
+            list.forEach(f -> {
+                //多个照片
+                if (f.getImageUrl().contains(",")) {
+                    String[] split = f.getImageUrl().split(",");
+                    for (String imageUrl : split) {
+                        ImageClassificationFile file = BeanUtil.copyProperties(f, ImageClassificationFile.class);
+                        file.setImageUrl(imageUrl);
+                        images.add(file);
+                    }
+                } else {
+                    images.add(f);
+                }
+            });
+
+            //旧pdf地址
+            String imagesPdf = albumDTO.getImagesPdf();
+
+            //获取起止编码
+            String codes = albumDTO.getCodes();
+            //初始值
+            Integer startInt = null, endInt = null, middleInt = null;
+            //图片计算值 最终值
+
+            if (StringUtils.isBlank(codes)) {
+                startInt = 1;
+            } else if (codes.contains("~")) {
+                String[] split = codes.split("~");
+                try {
+                    startInt = Integer.valueOf(split[0]);
+                    endInt = Integer.valueOf(split[1]);
+                } catch (NumberFormatException e) {
+                    throw new ServiceException("无法识别的数字");
+                }
+            } else {
+                try {
+                    startInt = Integer.valueOf(codes);
+                } catch (NumberFormatException e) {
+                    throw new ServiceException("无法识别的数字");
+                }
+            }
+            int count = startInt;
+
+            //重新生成pdf 并设置起止编号
+            //获取固定表格
+            //影像资料模板
+            ExcelTab excelTab = this.excelTabClient.getById("1950465427890794498");
+            String file_path = null;
+            if (SystemUtils.isWindows()) {
+                file_path = "C:\\pdfFiles\\";
+                File file = new File(file_path);
+                if (!file.exists()) {
+                    file.mkdirs();
+                }
+            }
+            Album album = new Album();
+            BeanUtil.copy(albumDTO, album);
+            String dateValue = albumDTO.getDateValue();
+            String[] strings = dateValue.split("~");
+            album.setStartDate(strings[0]);
+            album.setEndDate(strings[1]);
+            if (SystemUtils.isLinux()) {
+                file_path = "/home/pdfFiles";
+                File file = new File(file_path);
+                if (!file.exists()) {
+                    file.mkdirs();
+                }
+            }
+            if (excelTab != null) {
+                try {
+                    //需要删除的本地文件集合
+                    List<String> removeList = new ArrayList<>();
+                    //获取模板文件流
+                    InputStream modInput = null;
+                    FileInputStream excelFileInput = null;
+                    FileOutputStream outputStream = null;
+                    Workbook workbook = null;
+
+                    List<String> pdfFileList = new ArrayList<>();
+                    List<List<ImageClassificationFile>> batchSize = CommonUtil.getBatchSize(images, 2);
+
+
+                    for (List<ImageClassificationFile> imageClassificationFiles : batchSize) {
+                        try {
+                            //创建模板Workbook
+                            modInput = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
+                            if (modInput != null) {
+                                workbook = WorkbookFactory.create(modInput);
+
+                                //一个pdf 两个图片
+                                int i = 0;
+                                for (ImageClassificationFile file : imageClassificationFiles) {
+                                    try {
+                                        CreationHelper helper = workbook.getCreationHelper();
+                                        Sheet sheet = workbook.getSheetAt(0);
+                                        Drawing<?> drawing = sheet.createDrawingPatriarch();
+                                        ClientAnchor anchor = helper.createClientAnchor();
+                                        //获取文件流
+                                        byte[] bytes = CommonUtil.InputStreamToBytes(CommonUtil.getOSSInputStream(file.getImageUrl()));
+                                        if (bytes[0] == 82 && bytes[1] == 73 && bytes[2] == 70) {
+                                            bytes = CommonUtil.webpToPngBytes(CommonUtil.getOSSInputStream(file.getImageUrl()));
+                                        }
+                                        //压缩文件大小
+                                        byte[] byteNew = FileUtils.compressImage(bytes);
+                                        //创建图片
+                                        Picture picture = drawing.createPicture(anchor, workbook.addPicture(byteNew, Workbook.PICTURE_TYPE_PNG));
+                                        picture.resize();
+
+                                        //图片定位
+                                        FileUtils.imageOrientation(sheet, anchor, i == 1 ? new DataVO(0, 8) : new DataVO(0, 3));
+                                        //定位其它信息
+                                        int baseRow = i == 0 ? 0 : 5; // 第一组在0-4行,第二组在5-9行
+                                        // 分组号 (C列,索引2)
+                                        sheet.getRow(baseRow).getCell(3).setCellValue(albumDTO.getGroupNumber() != null ? albumDTO.getGroupNumber() : "");
+                                        // 照片编号 (C列,索引2)
+                                        sheet.getRow(baseRow + 1).getCell(3).setCellValue(endInt != null && count > endInt ? "" : count + "");
+                                        // 摄影者 (C列,索引2)
+                                        sheet.getRow(baseRow + 2).getCell(3).setCellValue(file.getShootingUser() != null ? file.getShootingUser() : "");
+                                        // 拍摄时间 (C列,索引2)
+                                        sheet.getRow(baseRow + 3).getCell(3).setCellValue(file.getShootingTime() != null ?
+                                                DateUtil.format(file.getShootingTime(), "yyyy-MM-dd") : "");
+                                        // 照片说明 (A列,索引0)
+                                        String a = albumDTO.getImagesName() != null ? albumDTO.getImagesName() : "";
+                                        String b = file.getTextContent() != null ? file.getTextContent() : "";
+                                        sheet.getRow(baseRow + 4).getCell(1).setCellValue(a + b);
+                                        i++;
+
+                                        if (endInt != null && count > endInt) {
+                                            middleInt = count - 1;
+                                        } else {
+                                            count++;
+                                        }
+                                    } catch (Exception e) {
+                                        e.printStackTrace();
+                                    }
+                                }
+                                String locationFile = file_path + SnowFlakeUtil.getId() + ".xlsx";
+                                outputStream = new FileOutputStream(locationFile);
+                                //记录文件删除
+                                removeList.add(locationFile);
+                                //生成一份新的excel
+                                workbook.write(outputStream);
+                                //将excel转PDF
+                                File excelFile = new File(locationFile);
+                                excelFileInput = new FileInputStream(excelFile);
+                                MultipartFile files = new MockMultipartFile("file", excelFile.getName(), "text/plain", IOUtils.toByteArray(excelFileInput));
+                                NewBladeFile bladeFile = this.commonFileClient.excelToPdf(files);
+                                if (bladeFile != null) {
+                                    pdfFileList.add(bladeFile.getPdfUrl());
+                                }
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        } finally {
+                            if (outputStream != null) {
+                                IoUtil.closeQuietly(outputStream);
+                            }
+                            if (modInput != null) {
+                                IoUtil.closeQuietly(modInput);
+                            }
+                            if (excelFileInput != null) {
+                                IoUtil.closeQuietly(excelFileInput);
+                            }
+                            if (workbook != null) {
+                                IoUtil.closeQuietly(workbook);
+                            }
+                        }
+                    }
+                    //合并pdf并上传
+                    String mergeName = SnowFlakeUtil.getId() + ".pdf";
+                    String mergeUrl = file_path + mergeName;
+                    FileUtils.mergePdfPublicMethods(pdfFileList, mergeUrl);
+                    //记录文件删除
+                    removeList.add(mergeUrl);
+                    //上传
+                    BladeFile bladeFile = this.newIOSSClient.uploadFile(mergeName, mergeUrl);
+                    if (bladeFile != null) {
+                        album.setImagesPdf(bladeFile.getLink());
+                        //删除旧pdf
+                        if (StringUtils.isNotBlank(imagesPdf)) {
+                            String pdfName = imagesPdf.split("upload")[1];
+                            this.newIOSSClient.removeFile("upload" + pdfName);
+                        }
+                    }
+                    if (removeList.size() > 0) {
+                        //删除本地文件
+                        CommonUtil.removeFile(removeList);
+                    }
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+            }
+            if (middleInt != null) {
+                album.setCodes(startInt + "~" + middleInt);
+            } else {
+                album.setCodes(startInt + "~" + (count - 1));
+            }
+            return R.status(albumService.updateById(album));
+        }
+        throw new ServiceException("相册不能为空");
+    }
 
 //	/**
 //	 * 新增或修改
@@ -438,7 +651,7 @@ public class AlbumController extends BladeController {
 //		return R.status(albumService.saveOrUpdate(album));
 //	}
 
-	
+
 //	/**
 //	 * 删除
 //	 */
@@ -450,13 +663,15 @@ public class AlbumController extends BladeController {
 //	}
 
 
+    @PostMapping("/remove")
+    @ApiOperationSupport(order = 7)
+    @ApiOperation(value = "逻辑删除", notes = "传入ids")
+    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam Long id) {
+        //同时删除关联关系
+        albumImagesService.remove(Wrappers.<AlbumImages>lambdaQuery()
+                .eq(AlbumImages::getAlbumId, id));
+        return R.status(albumService.removeById(id));
+    }
 
-	@PostMapping("/remove")
-	@ApiOperationSupport(order = 7)
-	@ApiOperation(value = "逻辑删除", notes = "传入ids")
-	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam Long id) {
-		return R.status(albumService.removeById(id));
-	}
 
-	
 }

+ 14 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeContractController.java

@@ -38,6 +38,7 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.IoUtil;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.core.tool.utils.ResourceUtil;
+import org.springblade.manager.dto.MoveNodeDTO;
 import org.springblade.manager.dto.TableSortDTO;
 import org.springblade.manager.dto.WbsTreeContractDTO2;
 import org.springblade.manager.entity.*;
@@ -158,8 +159,7 @@ public class WbsTreeContractController extends BladeController {
     @ApiOperationSupport(order = 31)
     @ApiOperation(value = "导入工程划分树", notes = "传入MultipartFile")
     public R importTree(@RequestParam("file") MultipartFile file, @RequestParam Long pkeyId) throws IOException {
-        iWbsTreeContractService.importTree(file,pkeyId);
-        return R.success("操作成功");
+        return iWbsTreeContractService.importTree(file,pkeyId);
     }
 
     @GetMapping("/getIsImport")
@@ -868,7 +868,19 @@ public class WbsTreeContractController extends BladeController {
         return iWbsTreeContractService.exportTree(contractId,response);
     }
 
+    @GetMapping("/getSiblingWbsContract")
+    @ApiOperation(value = "获取同一层级的所有节点节点")
+    @ApiOperationSupport(order = 32)
+    public R <List<WbsTreeContract>> getSiblingWbsContract(@RequestParam Long pKeyId){
+        return iWbsTreeContractService.getSiblingWbsContract(pKeyId);
+    }
 
+    @PostMapping("/moveNode")
+    @ApiOperation(value = "跨节点移动")
+    @ApiOperationSupport(order = 33)
+    public R moveNode (@RequestBody MoveNodeDTO dto){
+        return iWbsTreeContractService.moveNode(dto);
+    }
 
 
 

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

@@ -92,6 +92,9 @@ public class ExcelTabClientImpl implements ExcelTabClient {
         dataArray = excelTabService.addLoadDataInfo(dataArray);
         dataArray = putIfAbsent(dataArray);
         List<TableInfo> tableInfoList = this.excelTabService.getTableInfoListTrial(dataArray, tabIds);
+        for (TableInfo tableInfo : tableInfoList) {
+            tableInfo.setTestGroupId(dto.getId()+"");
+        }
         try {
             //试验特殊处理
             RandomNumberHolder.setTrialSelfInspectionRecordGroupId(dto.getId());

+ 23 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/AlbumImagesMapper.java

@@ -0,0 +1,23 @@
+package org.springblade.manager.mapper;
+
+import org.apache.ibatis.annotations.Param;
+import org.springblade.business.entity.ImageClassificationFile;
+import org.springblade.manager.entity.AlbumImages;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.List;
+
+/**
+* @author LHB
+* @description 针对表【m_album_images(相册与照片关联关系表)】的数据库操作Mapper
+* @createDate 2025-08-21 14:28:24
+* @Entity generator.domain.UAlbumImages
+*/
+public interface AlbumImagesMapper extends BaseMapper<AlbumImages> {
+
+    List<ImageClassificationFile> selectImageUrlByAlbumId(@Param("id") Long id);
+}
+
+
+
+

+ 21 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/AlbumImagesMapper.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.manager.mapper.AlbumImagesMapper">
+
+    <resultMap id="BaseResultMap" type="org.springblade.manager.entity.AlbumImages">
+            <id property="id" column="id" />
+            <result property="albumId" column="album_id" />
+            <result property="imageId" column="image_id" />
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,album_id,image_id
+    </sql>
+    <select id="selectImageUrlByAlbumId" resultType="org.springblade.business.entity.ImageClassificationFile">
+        select b.* from m_album_images a
+        left join u_image_classification_file b on a.image_id = b.id
+        where a.album_id = #{id} and b.image_url is not null and b.is_deleted = 0
+    </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"/>

+ 8 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.java

@@ -176,6 +176,13 @@ public interface WbsTreeContractMapper extends EasyBaseMapper<WbsTreeContract> {
 
     void updatePartitionCodeByPKyId(@Param("wbsTreeContract") WbsTreeContract wbsTreeContract);
 
-    Integer findIsExistTreeNode(List<String> ids);
+    List<WbsTreeContract> getSiblingWbsContract(@Param("pKeyId") Long pKeyId);
 
+    List<WbsTreeContract> getWbsTreeContractsByPKeyIds(@Param("pKeyIds") List<Long> pKeyIds);
+
+    List<WbsTreeContract> getChildWbsTreeContracts(@Param("pKeyId") Long pKeyId);
+
+    void updateAncestorsPid(@Param("ancestorsPId") String ancestorsPId, @Param("ancestors") String ancestors,@Param("pKeyId")Long pKeyId);
+
+    void updateWbsTreeAncestors(@Param("contract")WbsTreeContract contract);
 }

+ 28 - 7
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml

@@ -843,6 +843,14 @@
             WHERE p_key_id = #{wbsTreeContract.pKeyId}
         </if>
     </update>
+    <update id="updateAncestorsPid">
+        UPDATE m_wbs_tree_contract
+        SET ancestors_p_id = #{ancestorsPId},ancestors = #{ancestors}
+        WHERE p_key_id = #{pKeyId}
+    </update>
+    <update id="updateWbsTreeAncestors">
+        update m_wbs_tree_contract set p_id = #{contract.pId},parent_id=#{contract.parentId},ancestors_p_id = #{contract.ancestorsPId},ancestors = #{contract.ancestors} where p_key_id = #{contract.pKeyId}
+    </update>
 
     <select id="selectQueryValueLikeNodeName" resultMap="ResultMap">
         select *
@@ -980,6 +988,15 @@
           AND wtc.wbs_id = #{wbsId}
           AND wtc.is_deleted = 0;
     </select>
+    <select id="findIsExistTreeNode" resultType="java.lang.Integer">
+        SELECT count(0) FROM `m_wbs_tree_contract` a
+        left join m_wbs_tree_private b on a.is_type_private_pid = b.p_key_id
+        where a.p_key_id in
+          <foreach collection="list" item="item" open="(" close=")" separator=",">
+              #{item}
+          </foreach>
+        and (b.p_key_id is null or b.is_deleted = 1)
+    </select>
     <select id="selectListForcheckAllNodeDate" resultType="org.springblade.manager.entity.WbsTreeContract">
         select * from m_wbs_tree_contract where
        <if test="projectId!=null and projectId!=''">
@@ -1039,14 +1056,18 @@
           </foreach>
 
     </select>
-    <select id="findIsExistTreeNode" resultType="java.lang.Integer">
-        SELECT count(0) FROM `m_wbs_tree_contract` a
-        left join m_wbs_tree_private b on a.is_type_private_pid = b.p_key_id
-        where a.p_key_id in
-        <foreach collection="list" item="item" open="(" close=")" separator=",">
-            #{item}
+    <select id="getSiblingWbsContract" resultType="org.springblade.manager.entity.WbsTreeContract">
+        select * from m_wbs_tree_contract where p_id= (select p_id from m_wbs_tree_contract where p_key_id=#{pKeyId}) and is_deleted=0;
+    </select>
+    <select id="getWbsTreeContractsByPKeyIds" resultType="org.springblade.manager.entity.WbsTreeContract">
+        select p_key_id,parent_id,p_id,ancestors,ancestors_p_id from m_wbs_tree_contract where p_key_id in (
+        <foreach collection="pKeyIds" item="pkeyId" separator=",">
+            #{pkeyId}
         </foreach>
-        and (b.p_key_id is null or b.is_deleted = 1)
+        ) and is_deleted=0
+    </select>
+    <select id="getChildWbsTreeContracts" resultType="org.springblade.manager.entity.WbsTreeContract">
+        select p_key_id,ancestors,ancestors_p_id from m_wbs_tree_contract where ancestors_p_id like #{pKeyId}  and is_deleted=0
     </select>
 
 </mapper>

+ 17 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/AlbumImagesService.java

@@ -0,0 +1,17 @@
+package org.springblade.manager.service;
+
+import org.springblade.business.entity.ImageClassificationFile;
+import org.springblade.manager.entity.AlbumImages;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+* @author LHB
+* @description 针对表【m_album_images(相册与照片关联关系表)】的数据库操作Service
+* @createDate 2025-08-21 14:28:24
+*/
+public interface AlbumImagesService extends IService<AlbumImages> {
+
+    List<ImageClassificationFile> selectImageUrlByAlbumId(Long id);
+}

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

@@ -16,6 +16,7 @@
  */
 package org.springblade.manager.service;
 
+import org.springblade.manager.dto.AlbumDTO;
 import org.springblade.manager.entity.Album;
 import org.springblade.manager.vo.AlbumVO;
 import org.springblade.core.mp.base.BaseService;
@@ -40,4 +41,5 @@ public interface IAlbumService extends BaseService<Album> {
 
 
 	IPage<AlbumVO> selectPage1(Long projectId, Long contractId, IPage<AlbumVO> page);
+
 }

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

@@ -4,6 +4,7 @@ import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.springblade.business.dto.EKeyDto;
 import org.springblade.core.mp.base.BaseService;
 import org.springblade.core.tool.api.R;
+import org.springblade.manager.dto.MoveNodeDTO;
 import org.springblade.manager.dto.RangeInfo;
 import org.springblade.manager.dto.WbsTreeContractDTO;
 import org.springblade.manager.dto.WbsTreeContractDTO2;
@@ -95,6 +96,9 @@ public interface IWbsTreeContractService extends BaseService<WbsTreeContract> {
 
     boolean checkNodeAllDate(WbsTreeContract contract);
 
+    Integer findIsExistTreeNode(List<String> ids);
+
+
     List<APIWbsContractSubdivisionVo> getWbsContractSubdivision(String contractId);
 
     List<WbsTreeContract> queryListByPIds(List<Long> pIds, Integer classify);
@@ -106,5 +110,7 @@ public interface IWbsTreeContractService extends BaseService<WbsTreeContract> {
 
     R getImportProgress(Long projectId, Long contractId);
 
-    Integer findIsExistTreeNode(List<String> ids);
+    R<List<WbsTreeContract>> getSiblingWbsContract(Long pKeyId);
+
+    R moveNode(MoveNodeDTO dto);
 }

+ 30 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/AlbumImagesServiceImpl.java

@@ -0,0 +1,30 @@
+package org.springblade.manager.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.business.entity.ImageClassificationFile;
+import org.springblade.manager.entity.AlbumImages;
+import org.springblade.manager.service.AlbumImagesService;
+import org.springblade.manager.mapper.AlbumImagesMapper;
+import org.springframework.stereotype.Service;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+* @author LHB
+* @description 针对表【m_album_images(相册与照片关联关系表)】的数据库操作Service实现
+* @createDate 2025-08-21 14:28:24
+*/
+@Service
+public class AlbumImagesServiceImpl extends ServiceImpl<AlbumImagesMapper, AlbumImages>
+    implements AlbumImagesService {
+
+    @Override
+    public List<ImageClassificationFile> selectImageUrlByAlbumId(Long id) {
+        return baseMapper.selectImageUrlByAlbumId(id);
+    }
+}
+
+
+
+

+ 9 - 10
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/AlbumServiceImpl.java

@@ -28,7 +28,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import java.util.List;
 
 /**
- *  服务实现类
+ * 服务实现类
  *
  * @author BladeX
  * @since 2025-07-15
@@ -41,14 +41,13 @@ public class AlbumServiceImpl extends BaseServiceImpl<AlbumMapper, Album> implem
 //		return page.setRecords(baseMapper.selectAlbumPage(page, album));
 //	}
 
-	@Override
-	public IPage<AlbumVO> selectPage1(Long projectId, Long contractId, IPage<AlbumVO> page) {
-		Long count = baseMapper.selectCount(new LambdaQueryWrapper<>(Album.class).eq(Album::getProjectId, projectId).eq(Album::getContractId, contractId));
-		page.setTotal(count);
-		List<AlbumVO> albumVOS = baseMapper.selectAlbumPages(projectId, contractId, (page.getCurrent()-1)*page.getSize(),page.getSize());
-		page.setRecords(albumVOS);
-		return page;
-	}
-
+    @Override
+    public IPage<AlbumVO> selectPage1(Long projectId, Long contractId, IPage<AlbumVO> page) {
+        Long count = baseMapper.selectCount(new LambdaQueryWrapper<>(Album.class).eq(Album::getProjectId, projectId).eq(Album::getContractId, contractId));
+        page.setTotal(count);
+        List<AlbumVO> albumVOS = baseMapper.selectAlbumPages(projectId, contractId, (page.getCurrent() - 1) * page.getSize(), page.getSize());
+        page.setRecords(albumVOS);
+        return page;
+    }
 
 }

+ 148 - 69
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractSyncImpl.java

@@ -28,6 +28,7 @@ import org.springblade.manager.entity.*;
 import org.springblade.manager.enums.AssociationTypeEnum;
 import org.springblade.manager.enums.StorageTypeEnum;
 import org.springblade.manager.enums.TreeStructureEnum;
+import org.springblade.manager.mapper.AlbumMapper;
 import org.springblade.manager.mapper.ArchiveTreeContractMapper;
 import org.springblade.manager.service.*;
 import org.springblade.manager.utils.ForestNodeMerger;
@@ -84,6 +85,8 @@ public class ArchiveTreeContractSyncImpl {
 
     private final CommonFileClient commonFileClient;
 
+    private final AlbumMapper albumMapper;
+    private final AlbumImagesService albumImagesService;
 
 
     /**
@@ -1238,12 +1241,24 @@ public class ArchiveTreeContractSyncImpl {
             keyMap.put(vo.getPKeyId(),vo);
         }
 
-        //获取合同下声像资料所有文件
-        List<ImageClassificationFileDTO> imageClassificationFileList = imageClassificationFileClient.getImageClassificationFileListByContractId(contractId);
-        if (CollectionUtil.isEmpty(imageClassificationFileList)){
+
+        //调整为查询相册
+        List<Album> albumsList = albumMapper.selectList(Wrappers.<Album>lambdaQuery()
+                .eq(Album::getContractId, contractId)
+                .isNotNull(Album::getImagesPdf));
+        if (CollectionUtil.isEmpty(albumsList)){
             throw new ServiceException("当前合同段下没有声像资料");
         }
-        Map<Long, List<ImageClassificationFileDTO>> imageMap = imageClassificationFileList.stream().collect(Collectors.groupingBy(l -> l.getClassifyId()));
+        Map<Long, List<Album>> albumMap = albumsList.stream().collect(Collectors.groupingBy(Album::getClassifyId));
+
+
+        //获取合同下声像资料所有文件
+//        List<ImageClassificationFileDTO> imageClassificationFileList = imageClassificationFileClient.getImageClassificationFileListByContractId(contractId);
+//        if (CollectionUtil.isEmpty(imageClassificationFileList)){
+//            throw new ServiceException("当前合同段下没有声像资料");
+//        }
+//        Map<Long, List<ImageClassificationFileDTO>> imageMap = imageClassificationFileList.stream().collect(Collectors.groupingBy(l -> l.getClassifyId()));
+
 
         //获取声像资料分类,生成声像资料下级节点
         List<ImageClassificationConfig> imageTypes = imageClassificationConfigService.selectByContractType(contractId,contractInfo.getContractType());
@@ -1256,75 +1271,86 @@ public class ArchiveTreeContractSyncImpl {
             ArchiveTreeContract imageNode = createTypeNode(imageType.getClassfName(),archiveTreeContract);
             addNode.add(imageNode);
             //如果当前分类下存在文件,则根据类型生成树,还是日期
-            List<ImageClassificationFileDTO> files = imageMap.get(imageType.getId());
-            if (CollectionUtil.isEmpty(files)){
-                continue;
-            }
-            if (imageType.getStorageDirectoryFormat() == 1){
-                /**部位存储,获取分类下面的文件,只生成必要的树,没有则跳过 */
-                //获取出文件对应的WBS节点,查询出所有节点
-                List<Long> wbsPIds = files.stream().filter(l-> l.getWbsId() != null).map(l -> l.getWbsId()).distinct().collect(Collectors.toList());
-                Set<Long> wbsIds = new HashSet<>();
-                for (Long wbsId : wbsPIds) {
-                    ArchiveSyncWbsVO vo = keyMap.get(wbsId);
-                    if (vo != null){
-                        wbsIds.add(vo.getId());
-                        String[] ids = vo.getAncestors().split(",");
-                        for (String id : ids) {
-                            wbsIds.add(Long.valueOf(id));
-                        }
-                    }
-                }
-                List<ArchiveSyncWbsVO> currentNodes = new ArrayList<>();
-                for (Long wbsId : wbsIds) {
-                    ArchiveSyncWbsVO vo = keyMap.get(wbsId);
-                    if (vo != null) {
-                        vo.setChildren(null);
-                        currentNodes.add(vo);
-                    }
-                }
-                ArchiveSyncWbsVO root = ForestNodeMerger.merge(currentNodes).stream()
-                        .filter(f -> f.getParentId() == 0L).collect(Collectors.toList()).get(0);
-                //从根节点递归,递归过程中,同步生成档案树, 并且生成档案树id和wbsPid的映射,后面单独为文件设置
-                List<ArchiveTreeContract> currentTypeAdd = new ArrayList<>();
-                recursionCreateArchiveTree(root,currentTypeAdd,imageNode);
-                //转换影像文件为档案文件,并挂到档案树下面
-                Map<Long, Long> wbsPidMapArchiveId = currentTypeAdd.stream().collect(Collectors.toMap(l -> l.getExtKeyId(), l -> l.getId()));
-                addNode.addAll(currentTypeAdd);
-                List<ArchiveFile> newArchiveFileList = files.stream().map(file -> {
-                    ArchiveFile archiveFile = imageFileCovertArchiveFile(file, wbsPidMapArchiveId);
-                    return archiveFile;
-                }).collect(Collectors.toList());
-                addFile.addAll(newArchiveFileList);
-                log.info("同步声像文件树-"+imageType.getClassfName()+": 节点"+currentNodes.size()+"个,节点下文件"+files.size()+"个");
-
-            }else if (imageType.getStorageDirectoryFormat() == 2){
-                /**日期存储,获取分类下面的文件,获取出所有的年,生成年节点,文件归到年节点下 */
-                //文件按照年份分组
-                Map<Integer, List<ImageClassificationFileDTO>> yearMap = files.stream().collect(Collectors.groupingBy(l -> l.getShootingTime().getYear()));
-                List<Integer> years = yearMap.keySet().stream().sorted().collect(Collectors.toList());
-                for (Integer year : years) {
-                    //生成年份节点,并添加进集合
-                    ArchiveTreeContract dateNode = createImageDateNode(imageNode, year);
-                    addNode.add(dateNode);
-                    //把文件设置进指定年份下
-                    List<ImageClassificationFileDTO> fileDTOS = yearMap.get(year);
-                    Map<Long, Long> wbsPidMapArchiveId = new HashMap<>();
-                    for (ImageClassificationFileDTO fileDTO : fileDTOS) {
-                        wbsPidMapArchiveId.put(fileDTO.getWbsId(),dateNode.getId());
-                    }
-                    List<ArchiveFile> newArchiveFileList = fileDTOS.stream().map(file -> {
-                        ArchiveFile archiveFile = imageFileCovertArchiveFile(file, wbsPidMapArchiveId);
-                        return archiveFile;
-                    }).collect(Collectors.toList());
-                    addFile.addAll(newArchiveFileList);
+//            List<ImageClassificationFileDTO> files = imageMap.get(imageType.getId());
 
-                }
-            }else {
-                log.error("同步声像文件:影像资料存储类型不在范围中");
+            List<Album> albums = albumMap.get(imageType.getId());
+
+            if (CollectionUtil.isEmpty(albums)){
                 continue;
             }
 
+            //直接点转文件
+
+            List<ArchiveFile> newArchiveFileList = albums.stream().map(album -> {
+                ArchiveFile archiveFile = albumCovertArchiveFile(album, imageNode.getId());
+                return archiveFile;
+            }).collect(Collectors.toList());
+
+            addFile.addAll(newArchiveFileList);
+//            if (imageType.getStorageDirectoryFormat() == 1){
+//                /**部位存储,获取分类下面的文件,只生成必要的树,没有则跳过 */
+//                //获取出文件对应的WBS节点,查询出所有节点
+//                List<Long> wbsPIds = files.stream().filter(l-> l.getWbsId() != null).map(l -> l.getWbsId()).distinct().collect(Collectors.toList());
+//                Set<Long> wbsIds = new HashSet<>();
+//                for (Long wbsId : wbsPIds) {
+//                    ArchiveSyncWbsVO vo = keyMap.get(wbsId);
+//                    if (vo != null){
+//                        wbsIds.add(vo.getId());
+//                        String[] ids = vo.getAncestors().split(",");
+//                        for (String id : ids) {
+//                            wbsIds.add(Long.valueOf(id));
+//                        }
+//                    }
+//                }
+//                List<ArchiveSyncWbsVO> currentNodes = new ArrayList<>();
+//                for (Long wbsId : wbsIds) {
+//                    ArchiveSyncWbsVO vo = keyMap.get(wbsId);
+//                    if (vo != null) {
+//                        vo.setChildren(null);
+//                        currentNodes.add(vo);
+//                    }
+//                }
+//                ArchiveSyncWbsVO root = ForestNodeMerger.merge(currentNodes).stream()
+//                        .filter(f -> f.getParentId() == 0L).collect(Collectors.toList()).get(0);
+//                //从根节点递归,递归过程中,同步生成档案树, 并且生成档案树id和wbsPid的映射,后面单独为文件设置
+//                List<ArchiveTreeContract> currentTypeAdd = new ArrayList<>();
+//                recursionCreateArchiveTree(root,currentTypeAdd,imageNode);
+//                //转换影像文件为档案文件,并挂到档案树下面
+//                Map<Long, Long> wbsPidMapArchiveId = currentTypeAdd.stream().collect(Collectors.toMap(l -> l.getExtKeyId(), l -> l.getId()));
+//                addNode.addAll(currentTypeAdd);
+//                List<ArchiveFile> newArchiveFileList = files.stream().map(file -> {
+//                    ArchiveFile archiveFile = imageFileCovertArchiveFile(file, wbsPidMapArchiveId);
+//                    return archiveFile;
+//                }).collect(Collectors.toList());
+//                addFile.addAll(newArchiveFileList);
+//                log.info("同步声像文件树-"+imageType.getClassfName()+": 节点"+currentNodes.size()+"个,节点下文件"+files.size()+"个");
+//
+//            }else if (imageType.getStorageDirectoryFormat() == 2){
+//                /**日期存储,获取分类下面的文件,获取出所有的年,生成年节点,文件归到年节点下 */
+//                //文件按照年份分组
+//                Map<Integer, List<ImageClassificationFileDTO>> yearMap = files.stream().collect(Collectors.groupingBy(l -> l.getShootingTime().getYear()));
+//                List<Integer> years = yearMap.keySet().stream().sorted().collect(Collectors.toList());
+//                for (Integer year : years) {
+//                    //生成年份节点,并添加进集合
+//                    ArchiveTreeContract dateNode = createImageDateNode(imageNode, year);
+//                    addNode.add(dateNode);
+//                    //把文件设置进指定年份下
+//                    List<ImageClassificationFileDTO> fileDTOS = yearMap.get(year);
+//                    Map<Long, Long> wbsPidMapArchiveId = new HashMap<>();
+//                    for (ImageClassificationFileDTO fileDTO : fileDTOS) {
+//                        wbsPidMapArchiveId.put(fileDTO.getWbsId(),dateNode.getId());
+//                    }
+//                    List<ArchiveFile> newArchiveFileList = fileDTOS.stream().map(file -> {
+//                        ArchiveFile archiveFile = imageFileCovertArchiveFile(file, wbsPidMapArchiveId);
+//                        return archiveFile;
+//                    }).collect(Collectors.toList());
+//                    addFile.addAll(newArchiveFileList);
+//
+//                }
+//            }else {
+//                log.error("同步声像文件:影像资料存储类型不在范围中");
+//                continue;
+//            }
         }
         if (addNode.size() > 0){
             addNode.stream().forEach(l->l.setTenantId(tenantId));
@@ -1336,6 +1362,59 @@ public class ArchiveTreeContractSyncImpl {
 
     }
 
+    private ArchiveFile albumCovertArchiveFile(Album file, Long id) {
+        ArchiveFile archiveFile = new ArchiveFile();
+        archiveFile.setId(SnowFlakeUtil.getId());
+        archiveFile.setProjectId(String.valueOf(file.getProjectId()));
+        archiveFile.setContractId(String.valueOf(file.getContractId()));
+        archiveFile.setNodeId(String.valueOf(id));
+        //标题
+        archiveFile.setFileName(file.getImagesName());
+        //时间
+        archiveFile.setFileTime(file.getStartDate().replaceAll("-","") + "~" + file.getEndDate().replaceAll("-",""));
+        archiveFile.setFileUrl(file.getImagesPdf());
+        archiveFile.setPdfFileUrl(file.getImagesPdf());
+        //文件页数  根据关联照片判断
+        long count = albumImagesService.count(Wrappers.<AlbumImages>lambdaQuery().eq(AlbumImages::getAlbumId, file.getId()));
+        //2张照片为一页
+        archiveFile.setFilePage((int) Math.ceil((double) count / 2));
+        archiveFile.setIsApproval(0);
+        archiveFile.setIsCertification(1);
+        archiveFile.setIsNeedCertification(0);
+        //责任者-主要拍摄者
+        archiveFile.setDutyUser(file.getPhotographer());
+        archiveFile.setCreateUser(file.getCreateUser());
+        archiveFile.setCreateDept(file.getCreateDept());
+        archiveFile.setCreateTime(file.getCreateTime());
+        archiveFile.setUpdateUser(file.getUpdateUser());
+        archiveFile.setUpdateTime(file.getUpdateTime());
+        archiveFile.setStatus(0);
+        archiveFile.setIsDeleted(0);
+        //文件类型 1 视频 2 照片
+        archiveFile.setFileType(2L);
+        //文件编号-分组号
+        archiveFile.setFileNumber(file.getGroupNumber());
+        //备注-起止编号
+        archiveFile.setRemark(file.getCodes());
+
+        // 创建 LocalDateTime 时间爱你
+        LocalDateTime localDateTime = new Date().toInstant()
+                .atZone(ZoneId.systemDefault())
+                .toLocalDateTime();
+        archiveFile.setFtime(localDateTime);
+        archiveFile.setUtime(localDateTime);
+        archiveFile.setSort(0);
+
+        archiveFile.setSourceType(1);
+        archiveFile.setIsElement(0);
+        archiveFile.setRectification(0);
+        //关联id
+        archiveFile.setMAlbumId(file.getId());
+        archiveFile.setArchiveFileStorageType(StorageTypeEnum.SOUND_IMAGE.getCode());
+        archiveFile.setDateName(DateFormatUtils.format(file.getCreateTime(), "yyyyMMdd"));
+        return archiveFile;
+    }
+
 
     /**
      * 质检影像资料 转换为 档案文件

+ 25 - 12
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");
@@ -2795,6 +2801,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
         List<Map<String, Object>> list = new ArrayList<>();
         Map<String, Object> reData = new HashMap<>();
+        Map<String, Object> reData1 = new HashMap<>();
         WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
                 .select(WbsTreePrivate::getInitTableName, WbsTreePrivate::getHtmlUrl, WbsTreePrivate::getPKeyId, WbsTreePrivate::getProjectId, WbsTreePrivate::getParentId, WbsTreePrivate::getTableType)
                 .eq(WbsTreePrivate::getPKeyId, pkeyId));
@@ -2954,7 +2961,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             Elements sgName = doc.select("el-input[placeholderxx~=施工单位.*]");
             Elements wtName = doc.select("el-input[placeholderxx~=委托单位.*]");
             Elements htdName = doc.select("el-input[placeholderxx~=合同段/工区.*]");
-
             ContractInfo contractInfo = jdbcTemplate.query("select construction_unit_name,supervision_unit_name,contract_name,laboratory_name,is_test_record from m_contract_info where id = " + contractId, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
             if (contractInfo != null) {
                 //承包单位
@@ -3061,7 +3067,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                         }
                     }
                 }
-
+                reData1=new HashMap<>(reData);
                 if (dataIn.size() >= 1) {
                     Map<String, Object> mysqlData = dataIn.get(0);
                     for (String key : mysqlData.keySet()) {
@@ -3190,6 +3196,13 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 }
             }
         }
+        if(reData1.size()>0){
+            for (Map.Entry<String, Object> entry : reData1.entrySet()) {
+                if(reData.containsKey(entry.getKey())){
+                    reData.put(entry.getKey(), entry.getValue());
+                }
+            }
+        }
         list.add(reData);
         return list;
     }

+ 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);
             }

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

@@ -1261,7 +1261,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             checkTable = op.get().getInitTableName();
         }
         for (FormData fd : tec.formDataList) {
-            if(fd.getCode().equals("m_20220928144828_1575014563634479104:key_24")){
+            if(fd.getCode().equals("m_20230423154304_1650042591250481152:key_42")){
                 System.out.println("111");
             }
             if (fd.verify()) {
@@ -5295,20 +5295,40 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                 }else{
                     int max = 0;
                     do {
-                        Matcher m = RegexUtils.matcher(FC_REG + "(ifelse)\\(([^)]+)\\)", f);
+                        // 修改正则表达式,使用非贪婪匹配来处理嵌套情况
+                        Matcher m = RegexUtils.matcher(FC_REG + "(ifelse)\\(((?:[^()]++|\\([^()]*\\))*?)\\)", f);
+                        boolean found = false;
+
                         while (m.find()) {
+                            found = true;
                             String el = m.group();
-                            String pstr = el.replaceAll("^" + FC_REG + "ifelse\\(", "").replaceAll("\\)$", "");
-                            String[] pa = pstr.split(",");
-                            if (pa.length == 3) {
-                                Object data = Expression.parse(pa[0] + "?" + pa[1] + ":" + pa[2]).calculate(createCurrentMap(el, tec));
-                                f = f.replace(el, putDataWithKey(data, tec));
-                            } else {
-                                f = f.replace(el, "参数格式错误");
-                            }
 
+                            try {
+                                // 提取括号内的内容(去掉外层的ifelse())
+                                String content = el.replaceFirst("^" + FC_REG + "ifelse\\(", "").replaceFirst("\\)$", "");
+
+                                // 解析参数,处理嵌套逗号(在括号内的逗号不应该作为分隔符)
+                                List<String> pa = parseParameters(content);
+
+                                if (pa.size() == 3) {
+                                    Map<String, Object> currentMap = createCurrentMap(el, tec);
+                                    String string = pa.get(0) + "?" + pa.get(1) + ":" + pa.get(2);
+                                    Expression parse = Expression.parse(string);
+                                    Object data = parse.calculate(currentMap);
+                                    f = f.replace(el, putDataWithKey(data, tec));
+                                } else {
+                                    f = f.replace(el, "参数格式错误");
+                                }
+                            } catch (Exception e) {
+                                f = f.replace(el, "解析错误");
+                            }
                         }
+
                         max++;
+                        // 如果没有找到匹配项,提前退出循环
+                        if (!found) {
+                            break;
+                        }
                     } while (f.contains("ifelse") && max < 20);
                 }
             }
@@ -5347,6 +5367,30 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         }
     }
 
+    // 添加参数解析方法,处理嵌套逗号
+    private List<String> parseParameters(String content) {
+        List<String> params = new ArrayList<>();
+        int depth = 0;
+        int start = 0;
+
+        for (int i = 0; i < content.length(); i++) {
+            char c = content.charAt(i);
+            if (c == '(') {
+                depth++;
+            } else if (c == ')') {
+                depth--;
+            } else if (c == ',' && depth == 0) {
+                // 只有在最外层才分割参数
+                params.add(content.substring(start, i).trim());
+                start = i + 1;
+            }
+        }
+        // 添加最后一个参数
+        params.add(content.substring(start).trim());
+
+        return params;
+    }
+
     /**
      * 符号替换
      * @param s1

+ 272 - 79
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -2,6 +2,7 @@ package org.springblade.manager.service.impl;
 
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONUtil;
+import cn.hutool.system.SystemUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -72,6 +73,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.ByteArrayResource;
 import org.springframework.core.io.Resource;
 import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.http.ContentDisposition;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
@@ -95,12 +97,15 @@ import java.math.BigInteger;
 import java.math.MathContext;
 import java.math.RoundingMode;
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.rmi.ServerException;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.function.Function;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 
 @Service
@@ -127,6 +132,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
     private final WbsFormElementMapper wbsFormElementMapper;
     private final TrialCyAccessoriesClient trialCyAccessoriesClient;
     private final WbsTreeContractStatisticsClient wbsTreeContractStatisticsClient;
+    private final FormulaDataBlockMapper formulaDataBlockMapper;
 
 
 
@@ -2766,6 +2772,15 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
             for (int i = 2; i <= sheet.getLastRowNum(); i++) {
                 Row row = sheet.getRow(i);
                 if (row == null) continue;
+                if(StringUtils.isEmpty(getCellValue(row.getCell(1)))){
+                    throw new ServerException("单位工程类型名称不能为空");
+                }
+                if(StringUtils.isEmpty(getCellValue(row.getCell(3)))){
+                    throw new ServerException("单位工程名称不能为空");
+                }
+                if(StringUtils.isEmpty(getCellValue(row.getCell(5)))){
+                    throw new ServerException("分部工程名称不能为空");
+                }
                 // 获取每一列的值
                 String unitCode = getCellValue(row.getCell(0)); // A列:单位工程编号
                 String unitName = getCellValue(row.getCell(1)); // B列:单位工程名称
@@ -3189,14 +3204,15 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
 
                     }
                 }
-                bladeRedis.setEx("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId(), "100%",5L);
             } catch (Exception e) {
                 bladeRedis.del("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId());
             }finally {
                 bladeRedis.del("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId());
             }
+            bladeRedis.setEx("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId(), "100",7L);
             return R.success("新增了" + insertList.size() + "个节点" + "," + String.join(",", updateList) + "节点编号已被修改");
         } catch (IOException e) {
+            bladeRedis.del("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId());
             return R.fail("文件处理失败: " + e.getMessage());
         }
     }
@@ -3250,6 +3266,11 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         return true;
     }
 
+    @Override
+    public Integer findIsExistTreeNode(List<String> ids) {
+        return 0;
+    }
+
 
     /**
      * 展开所有合并单元格并将值填充到每个单元格
@@ -4480,7 +4501,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         String templatePath = "/mnt/sdc/Users/hongchuangyanfa/Desktop/excel/gcdcTemplate.xlsx";
         //String templatePath = "C:\\upload\\excel\\gcdc.xlsx";
         // 查询数据
-        String sql = "select * from m_wbs_tree_contract where contract_id = " + contractId +
+        String sql = "select *,CONCAT(ancestors_p_id, ',', p_key_id) AS ancestors_p_id from m_wbs_tree_contract where contract_id = " + contractId +
                 " and is_deleted = 0 and type = 1 and node_type != 6 and p_id != 0";
         List<WbsTreeContract> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
 
@@ -4504,8 +4525,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                 .collect(Collectors.toMap(
                         WbsTreeContract::getPKeyId,
                         unit -> list.stream()
-                                .filter(item -> item.getAncestors() != null &&
-                                        item.getAncestors().contains(unit.getPKeyId().toString()))
+                                .filter(item -> item.getAncestorsPId() != null &&
+                                        item.getAncestorsPId().contains(unit.getPKeyId().toString()))
                                 .collect(Collectors.toList())
                 ));
 
@@ -4513,15 +4534,17 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         for (Map.Entry<Long, List<WbsTreeContract>> entry : unitProjectMap.entrySet()) {
             Long unitId = entry.getKey();
             List<WbsTreeContract> unitProjects = entry.getValue();
-
-            // 获取单位工程名称
-            String unitName = unitProjects.stream()
-                    .filter(item -> item.getPKeyId().equals(unitId))
-                    .findFirst()
-                    .map(WbsTreeContract::getNodeName)
-                    .orElse("未知单位工程");
+            String sql1="Select * from m_wbs_tree_contract where p_key_id="+unitId;
+            WbsTreeContract unitNode=jdbcTemplate.queryForObject(sql1,new BeanPropertyRowMapper<>(WbsTreeContract.class));
+            unitProjects.add(unitNode);
+//            // 获取单位工程名称
+//            String unitName = unitProjects.stream()
+//                    .filter(item -> item.getPKeyId().equals(unitId))
+//                    .findFirst()
+//                    .map(WbsTreeContract::getNodeName)
+//                    .orElse("未知单位工程");
             // 创建安全的sheet名称
-            String safeUnitName = unitName.replaceAll("[\\\\/*\\[\\]:?]", "_");
+            String safeUnitName = unitNode.getNodeName().replaceAll("[\\\\/*\\[\\]:?]", "_");
             if (safeUnitName.length() > 31) {
                 safeUnitName = safeUnitName.substring(0, 31);
             }
@@ -4547,8 +4570,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         }
 
          //保存文件到本地(本地测试放开,正式环境不需要)
-//         String outputPath = "C:\\upload\\excel\\111.xlsx";
-//        saveWorkbookToFile(workbook, outputPath);
+         //String outputPath = "C:\\upload\\excel\\111.xlsx";
+         //saveWorkbookToFile(workbook, outputPath);
 
         // 同时返回给浏览器下载
         ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@@ -4558,13 +4581,12 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         ByteArrayResource resource = new ByteArrayResource(outputStream.toByteArray());
 
 
-        // 对中文文件名进行URL编码
-        String filename = "划分导出(请勿修改隐藏列).xlsx";
-        String encodedFilename = URLEncoder.encode(filename, "UTF-8")
-                .replaceAll("\\+", "%20"); // 替换+号为%20,确保兼容性
-
+        // 设置响应头
+        String fileName = "工程划分(请勿删除或修隐藏列).xlsx";
+        String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString())
+                .replaceAll("\\+", "%20");
         return ResponseEntity.ok()
-                .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + encodedFilename + "\"; filename*=utf-8''" + encodedFilename)
+                .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=" + encodedFileName)
                 .contentType(MediaType.APPLICATION_OCTET_STREAM)
                 .contentLength(resource.contentLength())
                 .body(resource);
@@ -4595,6 +4617,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         List<WbsTreeContract> wbsTreeContractList = new ArrayList<>();
         int totalCount = 0;
         int successCount = 0;
+        Map<Long, String>map=new HashMap<>();
         try (InputStream inputStream = file.getInputStream();
              XSSFWorkbook workbook = new XSSFWorkbook(inputStream)) {
 
@@ -4618,13 +4641,16 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                         if (isValidCell(pkeyCell) && isValidCell(codeCell)) {
                             String pkeyId = getCellValue(pkeyCell);
                             String partitionCode = getCellValue(codeCell);
-
+                            if(map.containsKey(Long.parseLong(pkeyId))){
+                                continue;
+                            }
                             if (StringUtils.isNotBlank(pkeyId) && StringUtils.isNotBlank(partitionCode)) {
                                 totalCount++;
                                 WbsTreeContract wbsTreeContract = new WbsTreeContract();
                                 wbsTreeContract.setPKeyId(Long.parseLong(pkeyId.trim()));
                                 wbsTreeContract.setPartitionCode(partitionCode.trim());
                                 wbsTreeContractList.add(wbsTreeContract);
+                                map.put(wbsTreeContract.getPKeyId(),wbsTreeContract.getPartitionCode());
                                 successCount++;
                             }
                         }
@@ -4649,29 +4675,111 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         return R.status(false);
     }
 
+
     @Override
     public Boolean getIsImport(Long projectId, Long contractId) {
-        Object o = bladeRedis.get("import:projectId:" + projectId + "contractId:" + contractId);
-        if(o!=null){
-            return true;
-        }else {
+        try {
+            Object o = bladeRedis.get("import:projectId:" + projectId + "contractId:" + contractId);
+            if(o!=null){
+                if(Double.parseDouble(o.toString())>=100){
+                    bladeRedis.del("import:projectId:" + projectId + "contractId:" + contractId);
+                    return false;
+                }
+                return true;
+            }else {
+                return false;
+            }
+        }catch (Exception e){
             return false;
         }
     }
 
     @Override
     public R getImportProgress(Long projectId, Long contractId) {
-        Object o = bladeRedis.get("import:projectId:" + projectId + "contractId:" + contractId);
-        if(o!=null){
-            return R.data(o.toString());
-        }else {
+        try {
+            Object o = bladeRedis.get("import:projectId:" + projectId + "contractId:" + contractId);
+            if(o!=null){
+                if(Double.parseDouble(o.toString())>=100){
+                    bladeRedis.del("import:projectId:" + projectId + "contractId:" + contractId);
+                    return R.data("100");
+                }
+                return R.data(o.toString());
+            }else {
+                return R.data("0");
+            }
+        }catch (Exception e){
             return R.data("0");
         }
     }
 
+
+
     @Override
-    public Integer findIsExistTreeNode(List<String> ids) {
-        return baseMapper.findIsExistTreeNode(ids);
+    public R<List<WbsTreeContract>> getSiblingWbsContract(Long pKeyId) {
+        return  R.data(wbsTreeContractMapper.getSiblingWbsContract(pKeyId));
+    }
+
+    @Override
+    public R moveNode(MoveNodeDTO dto) {
+        if(dto.getLeftPkeyIds().isEmpty()){
+            throw new ServiceException("请选择需要移动的节点");
+        }
+        if(dto.getRightPkeyId()==null){
+            throw new ServiceException("请选择要移动到哪个节点");
+        }
+        List<WbsTreeContract> list= wbsTreeContractMapper.getWbsTreeContractsByPKeyIds(dto.getLeftPkeyIds());
+        WbsTreeContract moveFatherNode = this.getById(list.get(0).getPId());
+        WbsTreeContract fatherContract = this.getById(dto.getRightPkeyId());
+
+        String sql="SELECT * from m_formula_data_block WHERE sw_id = "+moveFatherNode.getId()+" and contract_id ="+moveFatherNode.getContractId()+" and  type =0";
+        List<FormulaDataBlock> formulaDataBlocks1 = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(FormulaDataBlock.class));
+
+        String sql1="SELECT * from m_formula_data_block WHERE sw_id = "+fatherContract.getId()+" and contract_id ="+fatherContract.getContractId()+" and  type =0";
+        List<FormulaDataBlock> formulaDataBlocks2 = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(FormulaDataBlock.class));
+        List<ElementBlock> elementBlocks1=new ArrayList<>();
+        List<ElementBlock> elementBlocks2=new ArrayList<>();
+        if(formulaDataBlocks2.size()>0){
+            if(formulaDataBlocks1.size()>0){
+                elementBlocks1= JSON.parseArray(formulaDataBlocks1.get(0).getVal(), ElementBlock.class);
+                elementBlocks2= JSON.parseArray(formulaDataBlocks2.get(0).getVal(), ElementBlock.class);
+                elementBlocks2.addAll(elementBlocks1);
+                formulaDataBlocks2.get(0).setVal(JSON.toJSONString(elementBlocks2));
+                formulaDataBlockMapper.updateById(formulaDataBlocks2.get(0));
+            }
+        }else {
+            if(formulaDataBlocks1.size()>0){
+                elementBlocks1= JSON.parseArray(formulaDataBlocks1.get(0).getVal(), ElementBlock.class);
+                FormulaDataBlock insert = new FormulaDataBlock();
+                insert.setContractId(Long.parseLong(fatherContract.getContractId()));
+                insert.setType(0);
+                insert.setSwId(fatherContract.getId());
+                insert.setVal(JSON.toJSONString(elementBlocks1));
+                formulaDataBlockMapper.insert(insert);
+            }
+        }
+        for (WbsTreeContract contract : list) {
+            String oldancestorsPId = contract.getAncestorsPId();
+            String oldancestors = contract.getAncestors();
+            contract.setPId(fatherContract.getPKeyId());
+            contract.setParentId(fatherContract.getId());
+            contract.setAncestorsPId(fatherContract.getAncestorsPId()+","+contract.getPId());
+            contract.setAncestors(fatherContract.getAncestors());
+            //查出当前节点所有子节点。
+            List<WbsTreeContract> childContracts = wbsTreeContractMapper.getChildWbsTreeContracts(contract.getPKeyId());
+            if(!childContracts.isEmpty()){
+                for (WbsTreeContract childContract : childContracts) {
+                    String ancestorsPId =  childContract.getAncestorsPId();
+                    ancestorsPId=ancestorsPId.replace(oldancestorsPId,contract.getAncestorsPId());
+                    String ancestors = childContract.getAncestors();
+                    ancestors=ancestors.replace(oldancestors,contract.getAncestors());
+                    wbsTreeContractMapper.updateAncestorsPid(ancestorsPId,ancestors,childContract.getPKeyId());
+                }
+            }
+            this.wbsTreeContractMapper.updateWbsTreeAncestors(contract);
+        }
+        String ids = dto.getLeftPkeyIds().stream().map(id -> id + "").collect(Collectors.joining(","));
+        this.wbsTreeContractStatisticsClient.updateAncestors(ids);
+        return R.success("操作成功");
     }
 
     /**
@@ -4795,13 +4903,14 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
             Row row = sheet.createRow(rowNum);
 
             // 解析祖级节点
-            String[] ancestors = leafNode.getAncestors().split(",");
+            String[] ancestors = leafNode.getAncestorsPId().split(",");
 
             // 转换为 List<Long>
             List<Long> ancestorIds = Arrays.stream(ancestors)
                     .map(Long::parseLong)
                     .collect(Collectors.toList());
 
+            ancestorIds.add(leafNode.getPKeyId());
             // 根据叶子节点类型填充各级工程数据
             fillEngineeringDataByLeafType(row, unitProjects, ancestorIds, mergeMap, rowNum, centerStyle, leafNode.getNodeType());
 
@@ -4816,6 +4925,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
     private List<WbsTreeContract> findLeafNodesByPriority(List<WbsTreeContract> projects) {
         // 按照节点类型优先级:子分项(5) -> 分项(4) -> 子分部(3) -> 分部(2) -> 单位工程(18)
         List<WbsTreeContract> leafNodes = new ArrayList<>();
+        Set<Long> ancestorIds= new HashSet<>();
 
         // 1. 先找子分项工程 (节点类型5)
         leafNodes = projects.stream()
@@ -4823,39 +4933,90 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                 .collect(Collectors.toList());
 
         if (!leafNodes.isEmpty()) {
-            return leafNodes;
+            sortLeafNodes(leafNodes);
         }
+        ancestorIds= leafNodes.stream()
+                .map(WbsTreeContract::getAncestorsPId)
+                .filter(Objects::nonNull)
+                .flatMap(ancestors -> Arrays.stream(ancestors.split(",")))
+                .map(String::trim)
+                .filter(id -> !id.isEmpty())
+                .map(Long::parseLong)
+                .collect(Collectors.toSet());
 
         // 2. 如果没有子分项,找分项工程 (节点类型4)
-        leafNodes = projects.stream()
-                .filter(item -> item.getNodeType() == 4)
+        Set<Long> finalAncestorIds = ancestorIds;
+        List<WbsTreeContract> items=projects.stream()
+                .filter(item -> item.getNodeType() == 4 && !finalAncestorIds.contains(item.getPKeyId()))
                 .collect(Collectors.toList());
-
-        if (!leafNodes.isEmpty()) {
-            return leafNodes;
-        }
+        if(!items.isEmpty()&&items.size()>0){
+            leafNodes.addAll(items);
+        }
+        ancestorIds = leafNodes.stream()
+                .map(WbsTreeContract::getAncestorsPId)
+                .filter(Objects::nonNull)
+                .flatMap(ancestors -> Arrays.stream(ancestors.split(",")))
+                .map(String::trim)
+                .filter(id -> !id.isEmpty())
+                .map(Long::parseLong)
+                .collect(Collectors.toSet());
 
         // 3. 如果没有分项,找子分部工程 (节点类型3)
-        leafNodes = projects.stream()
-                .filter(item -> item.getNodeType() == 3)
+        Set<Long> finalAncestorIds1 = ancestorIds;
+        List<WbsTreeContract> subDivisional = projects.stream()
+                .filter(item -> item.getNodeType() == 3&& !finalAncestorIds1.contains(item.getPKeyId()))
                 .collect(Collectors.toList());
-
-        if (!leafNodes.isEmpty()) {
-            return leafNodes;
-        }
-
+        if(!subDivisional.isEmpty()&&subDivisional.size()>0){
+            leafNodes.addAll(subDivisional);
+        }
+        ancestorIds = leafNodes.stream()
+                .map(WbsTreeContract::getAncestorsPId)
+                .filter(Objects::nonNull)
+                .flatMap(ancestors -> Arrays.stream(ancestors.split(",")))
+                .map(String::trim)
+                .filter(id -> !id.isEmpty())
+                .map(Long::parseLong)
+                .collect(Collectors.toSet());
+        Set<Long> finalAncestorIds2 = ancestorIds;
         // 4. 如果没有子分部,找分部工程 (节点类型2)
-        leafNodes = projects.stream()
-                .filter(item -> item.getNodeType() == 2)
+        List<WbsTreeContract> divisional = projects.stream()
+                .filter(item -> item.getNodeType() == 2&& !finalAncestorIds2.contains(item.getPKeyId()))
                 .collect(Collectors.toList());
+        if(!divisional.isEmpty()&&divisional.size()>0){
+            leafNodes.addAll(divisional);
+        }
+        ancestorIds = leafNodes.stream()
+                .map(WbsTreeContract::getAncestorsPId)
+                .filter(Objects::nonNull)
+                .flatMap(ancestors -> Arrays.stream(ancestors.split(",")))
+                .map(String::trim)
+                .filter(id -> !id.isEmpty())
+                .map(Long::parseLong)
+                .collect(Collectors.toSet());
+        Set<Long> finalAncestorIds3 = ancestorIds;
 
-        if (!leafNodes.isEmpty()) {
-            return leafNodes;
+        // 5. 最后找单位工程 (节点类型18)
+        List<WbsTreeContract> unit = projects.stream()
+                .filter(item -> item.getNodeType() == 18&&!finalAncestorIds3.contains(item.getPKeyId()))
+                .collect(Collectors.toList());
+        if(!unit.isEmpty()&&unit.size()>0){
+            leafNodes.addAll(unit);
         }
+        return sortLeafNodes(leafNodes);
+    }
 
-        // 5. 最后找单位工程 (节点类型18)
-        return projects.stream()
-                .filter(item -> item.getNodeType() == 18)
+    // 排序方法:先按pId排序,pId相同则按sort排序(null值排在最后)
+    private List<WbsTreeContract> sortLeafNodes(List<WbsTreeContract> nodes) {
+        return nodes.stream()
+                .sorted(Comparator
+                        .comparing(WbsTreeContract::getPId)
+                        .thenComparing(
+                                Comparator.comparing(
+                                        WbsTreeContract::getSort,
+                                        Comparator.nullsLast(Comparator.naturalOrder())
+                                )
+                        )
+                )
                 .collect(Collectors.toList());
     }
 
@@ -5005,8 +5166,11 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         mergeMap.get(col).add(new CellRangeAddress(rowNum, rowNum, col, col));
     }
 
+
+
     // 应用合并单元格 - 添加居中样式参数
     private void applyMergedRegions(Sheet sheet, Map<Integer, List<CellRangeAddress>> mergeMap, CellStyle centerStyle) {
+
         // 使用Set来记录已经合并的区域,避免重复合并
         Set<String> mergedRegions = new HashSet<>();
 
@@ -5112,7 +5276,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                     } else {
                         // 值不同,合并之前的区域
                         if (mergeStart < mergeEnd) {
-                            mergeSingleColumnIfNotExists(sheet, col, mergeStart, mergeEnd, centerStyle, mergedRegions);
+                            mergeSingleColumnIfNotExists(sheet, col, mergeStart, mergeEnd, centerStyle, mergedRegions,false);
                         }
                         // 开始新的合并区域
                         mergeStart = rowNum;
@@ -5123,48 +5287,77 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
 
                 // 合并最后一段区域
                 if (mergeStart < mergeEnd) {
-                    mergeSingleColumnIfNotExists(sheet, col, mergeStart, mergeEnd, centerStyle, mergedRegions);
+                    mergeSingleColumnIfNotExists(sheet, col, mergeStart, mergeEnd, centerStyle, mergedRegions,false);
                 }
             }
         }
     }
 
-    // 合并名称列和对应的划分编码列(检查是否已存在)
+    // 在合并名称列和对应编码列时,需要清空被合并单元格的值,只保留第一个单元格的值
     private void mergeNameAndCodeColumns(Sheet sheet, int nameCol, int startRow, int endRow, CellStyle centerStyle, Set<String> mergedRegions) {
         // 合并名称列
-        mergeSingleColumnIfNotExists(sheet, nameCol, startRow, endRow, centerStyle, mergedRegions);
+        mergeSingleColumnIfNotExists(sheet, nameCol, startRow, endRow, centerStyle, mergedRegions, true);
 
         // 合并对应的划分编码列
         int codeCol = getCorrespondingCodeColumn(nameCol);
         if (codeCol != -1) {
-            mergeSingleColumnIfNotExists(sheet, codeCol, startRow, endRow, centerStyle, mergedRegions);
+            mergeSingleColumnIfNotExists(sheet, codeCol, startRow, endRow, centerStyle, mergedRegions, true);
         }
     }
 
-    // 合并单列并设置样式(检查是否已存在)
-    private void mergeSingleColumnIfNotExists(Sheet sheet, int col, int startRow, int endRow, CellStyle style, Set<String> mergedRegions) {
-        String regionKey = col + ":" + startRow + ":" + endRow;
-
-        if (!mergedRegions.contains(regionKey)) {
-            CellRangeAddress mergedRegion = new CellRangeAddress(startRow, endRow, col, col);
-
-            // 检查是否已经存在相同的合并区域
-            boolean alreadyExists = false;
-            for (int i = 0; i < sheet.getNumMergedRegions(); i++) {
-                CellRangeAddress existingRegion = sheet.getMergedRegion(i);
-                if (existingRegion.getFirstColumn() == col &&
-                        existingRegion.getFirstRow() == startRow &&
-                        existingRegion.getLastRow() == endRow) {
-                    alreadyExists = true;
-                    break;
+    // 合并单列并设置样式(添加clearValues参数来控制是否清空被合并单元格的值)
+    private void mergeSingleColumnIfNotExists(Sheet sheet, int col, int startRow, int endRow, CellStyle style,
+                                              Set<String> mergedRegions, boolean clearValues) {
+        try {
+            String regionKey = col + ":" + startRow + ":" + endRow;
+
+            if (!mergedRegions.contains(regionKey)) {
+                CellRangeAddress mergedRegion = new CellRangeAddress(startRow, endRow, col, col);
+
+                // 检查是否已经存在相同的合并区域
+                boolean alreadyExists = false;
+                for (int i = 0; i < sheet.getNumMergedRegions(); i++) {
+                    CellRangeAddress existingRegion = sheet.getMergedRegion(i);
+                    if (existingRegion.getFirstColumn() == col &&
+                            existingRegion.getFirstRow() == startRow &&
+                            existingRegion.getLastRow() == endRow) {
+                        alreadyExists = true;
+                        break;
+                    }
                 }
-            }
 
-            if (!alreadyExists) {
-                sheet.addMergedRegion(mergedRegion);
-                setMergedRegionStyle(sheet, mergedRegion, style);
-                mergedRegions.add(regionKey);
+                if (!alreadyExists) {
+                    // 如果需要清空值,保留第一个单元格的值,清空其他单元格的值
+                    if (clearValues && startRow < endRow) {
+                        // 获取第一个单元格的值
+                        Row firstRow = sheet.getRow(startRow);
+                        Cell firstCell = firstRow != null ? firstRow.getCell(col) : null;
+                        String firstValue = firstCell != null ? getCellStringValue(firstCell) : "";
+
+                        // 清空被合并区域中其他单元格的值
+                        for (int rowNum = startRow + 1; rowNum <= endRow; rowNum++) {
+                            Row row = sheet.getRow(rowNum);
+                            if (row != null) {
+                                Cell cell = row.getCell(col);
+                                if (cell != null) {
+                                    cell.setCellValue(""); // 清空值
+                                }
+                            }
+                        }
+
+                        // 确保第一个单元格有正确的值(防止被意外清空)
+                        if (firstCell != null) {
+                            firstCell.setCellValue(firstValue);
+                        }
+                    }
+
+                    sheet.addMergedRegion(mergedRegion);
+                    setMergedRegionStyle(sheet, mergedRegion, style);
+                    mergedRegions.add(regionKey);
+                }
             }
+        } catch (Exception e) {
+            e.printStackTrace();
         }
     }
 

+ 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);
         }
     }