Explorar el Código

Merge branch 'dev' of http://219.151.181.73:3000/zhuwei/bladex into dev

lvy hace 4 días
padre
commit
0fd666aed5
Se han modificado 66 ficheros con 3443 adiciones y 366 borrados
  1. 13 0
      blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/dto/SaveVolumeDto.java
  2. 10 0
      blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/dto/SaveVolumeDto1.java
  3. 21 15
      blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/entity/ArchivesAuto.java
  4. 8 0
      blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/feign/ArchiveAutoClient.java
  5. 20 0
      blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/vo/ArchiveExaminingVo.java
  6. 14 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/VolumeDto1.java
  7. 13 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/VolumeDto2.java
  8. 13 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/VolumeDto3.java
  9. 18 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/VolumeDto4.java
  10. 10 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ArchiveFile.java
  11. 5 2
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ArchiveFileClient.java
  12. 4 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/MetadataClassificationClient.java
  13. 7 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/WbsFormElement.java
  14. 10 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ContractClient.java
  15. 7 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/SaveUserInfoByProjectClient.java
  16. 59 0
      blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/dto/ExcelUserTemp.java
  17. 32 0
      blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/dto/ImportPorjectInfoDTO.java
  18. 19 0
      blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/dto/ImportUserLog.java
  19. 58 0
      blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/dto/UserImporterNew.java
  20. 5 0
      blade-service/blade-archive/pom.xml
  21. 14 9
      blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveExaminingReportController.java
  22. 22 4
      blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchivesAutoController.java
  23. 5 0
      blade-service/blade-archive/src/main/java/org/springblade/archive/feign/ArchiveAutoClientImpl.java
  24. 9 4
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/IArchivesAutoService.java
  25. 6 6
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveAutoPdfServiceImpl.java
  26. 534 144
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveExaminingReportImpl.java
  27. 2 2
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveOfflineVersionInfoServiceImpl.java
  28. 287 102
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java
  29. 49 0
      blade-service/blade-archive/src/main/java/org/springblade/archive/utils/ClamAVClientScanner.java
  30. 97 0
      blade-service/blade-archive/src/main/java/org/springblade/archive/utils/FileAnalysisResult.java
  31. 352 0
      blade-service/blade-archive/src/main/java/org/springblade/archive/utils/FileFormatSecurityChecker.java
  32. 33 0
      blade-service/blade-archive/src/main/java/org/springblade/archive/utils/RemoteFileExtension.java
  33. 306 0
      blade-service/blade-archive/src/main/java/org/springblade/archive/utils/RemoteFileMD5Calculator.java
  34. 114 0
      blade-service/blade-archive/src/main/java/org/springblade/archive/utils/RemoteFileSecurityChecker.java
  35. 25 0
      blade-service/blade-business/src/main/java/org/springblade/business/controller/ArchiveFileController.java
  36. 2 1
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  37. 5 0
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ArchiveFileClientImpl.java
  38. 2 0
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ContractLogClientImpl.java
  39. 7 0
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/MetadataClassificationClientImpl.java
  40. 8 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/IArchiveFileService.java
  41. 3 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/IMetadataClassificationService.java
  42. 129 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ArchiveFileServiceImpl.java
  43. 4 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/MetadataClassificationServiceImpl.java
  44. 10 14
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/CustomFunction.java
  45. 13 0
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/FormulaUtils.java
  46. 38 19
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java
  47. 8 16
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/NodeBaseInfoController.java
  48. 20 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ContractClientImpl.java
  49. 29 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/SaveUserInfoByProjectClientImpl.java
  50. 4 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/formula/KeyMapper.java
  51. 2 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.java
  52. 10 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.xml
  53. 3 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ProjectInfoMapper.java
  54. 9 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ProjectInfoMapper.xml
  55. 3 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeMapper.xml
  56. 2 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IContractInfoService.java
  57. 5 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IProjectInfoService.java
  58. 5 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java
  59. 25 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java
  60. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java
  61. 14 4
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ProjectInfoServiceImpl.java
  62. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsParamServiceImpl.java
  63. 20 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsSynchronousServiceImpl.java
  64. 37 5
      blade-service/blade-user/src/main/java/org/springblade/system/user/controller/UserController.java
  65. 3 0
      blade-service/blade-user/src/main/java/org/springblade/system/user/service/IUserService.java
  66. 820 14
      blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

+ 13 - 0
blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/dto/SaveVolumeDto.java

@@ -0,0 +1,13 @@
+package org.springblade.archive.dto;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class SaveVolumeDto {
+    private String archiveId;
+    private String archiveName;
+    private List<SaveVolumeDto1> list=new ArrayList<>();
+}

+ 10 - 0
blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/dto/SaveVolumeDto1.java

@@ -0,0 +1,10 @@
+package org.springblade.archive.dto;
+
+import lombok.Data;
+
+@Data
+public class SaveVolumeDto1 {
+    private Long id;
+    private String archiveName;
+    private String fileIds;
+}

+ 21 - 15
blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/entity/ArchivesAuto.java

@@ -80,13 +80,13 @@ public class ArchivesAuto extends BaseEntity {
     /**
      * 文件起始时间
      */
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime startDate;
+    //@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMdd")
+    private String startDate;
     /**
      * 文件结束时间
      */
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime endDate;
+    //@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMdd")
+    private String endDate;
     /**
      * 保管期限(单位/年)
      */
@@ -192,6 +192,12 @@ public class ArchivesAuto extends BaseEntity {
 
     @ApiModelProperty("案卷操作(0:无,1:正在并卷,2:正在重组,3:等待重组(拆卷完成后),-1:并卷失败,-2:重组失败)")
     private Integer actionType;
+
+    @ApiModelProperty("分卷ID,逗号分隔")
+    private String volumeIds;
+    @ApiModelProperty("是否是分卷0否 1是 2是子分卷")
+    private Integer isVolume;
+
     //是否是影音
     public boolean isMedia() {
         return (this.getCarrierType() != null &&
@@ -210,17 +216,17 @@ public class ArchivesAuto extends BaseEntity {
         BeanUtils.copyProperties(autoVo, this);
 
         // 2. 手动处理类型不兼容的字段
-        // Date -> LocalDateTime 转换
-        if (autoVo.getStartDate() != null) {
-            this.setStartDate(autoVo.getStartDate().toInstant()
-                    .atZone(ZoneId.systemDefault())
-                    .toLocalDateTime());
-        }
-        if (autoVo.getEndDate() != null) {
-            this.setEndDate(autoVo.getEndDate().toInstant()
-                    .atZone(ZoneId.systemDefault())
-                    .toLocalDateTime());
-        }
+         //Date -> LocalDateTime 转换
+//        if (autoVo.getStartDate() != null) {
+//            this.setStartDate(autoVo.getStartDate().toInstant()
+//                    .atZone(ZoneId.systemDefault())
+//                    .toLocalDateTime());
+//        }
+//        if (autoVo.getEndDate() != null) {
+//            this.setEndDate(autoVo.getEndDate().toInstant()
+//                    .atZone(ZoneId.systemDefault())
+//                    .toLocalDateTime());
+//        }
         if (autoVo.getReviewDate() != null) {
             this.setReviewDate(autoVo.getReviewDate().toInstant()
                     .atZone(ZoneId.systemDefault())

+ 8 - 0
blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/feign/ArchiveAutoClient.java

@@ -49,5 +49,13 @@ public interface ArchiveAutoClient {
     @PostMapping(API_PREFIX + "/removeArchivesByNodeIds")
     void removeArchivesByNodeIds(@RequestBody List<Long> ids);
 
+    /**
+     * 根据ID获取档案案卷
+     * @param id
+     * @return
+     */
+    @PostMapping(API_PREFIX + "/getArchiveById")
+    ArchivesAuto getArchiveById(@RequestParam Long id);
+
 
 }

+ 20 - 0
blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/vo/ArchiveExaminingVo.java

@@ -12,6 +12,8 @@ import lombok.Data;
 public class ArchiveExaminingVo {
     @ApiModelProperty("项目ID")
     private Long projectId;
+    @ApiModelProperty("合同段ID")
+    private Long contractId;
 
     @ApiModelProperty("报告ID")
     private Long reportId;
@@ -19,12 +21,30 @@ public class ArchiveExaminingVo {
     @ApiModelProperty("真实性")
     private String authenticity;
 
+    @ApiModelProperty("真实性-检测项")
+    private String authenticityList;
+
     @ApiModelProperty("完整性")
     private String integrality;
 
+    @ApiModelProperty("完整性-检测项")
+    private String integralityList;
+
     @ApiModelProperty("可用性")
     private String usability;
 
+    @ApiModelProperty("可用性-检测项")
+    private String usabilityList;
+
     @ApiModelProperty("安全性")
     private String security;
+
+    @ApiModelProperty("安全性-检测项")
+    private String securityList;
+
+    @ApiModelProperty("节点")
+    private String nodeIds;
+
+    @ApiModelProperty("文件")
+    private String fileIds;
 }

+ 14 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/VolumeDto1.java

@@ -0,0 +1,14 @@
+package org.springblade.business.dto;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class VolumeDto1 {
+    private Long id;
+    private String name;
+    private Integer total;
+    private List<VolumeDto2> list;
+}

+ 13 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/VolumeDto2.java

@@ -0,0 +1,13 @@
+package org.springblade.business.dto;
+
+import lombok.Data;
+
+@Data
+public class VolumeDto2 {
+    private Long id;
+    private String fileNumber;
+    private String fileName;
+    private String fileTime;
+    private String dutyUser;
+    private Integer filePage;
+}

+ 13 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/VolumeDto3.java

@@ -0,0 +1,13 @@
+package org.springblade.business.dto;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+@Data
+public class VolumeDto3 {
+    private Long id;
+    private String name;
+    private Integer total;
+    private List<VolumeDto4> list=new ArrayList<>();
+}

+ 18 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/VolumeDto4.java

@@ -0,0 +1,18 @@
+package org.springblade.business.dto;
+
+import io.swagger.models.auth.In;
+import lombok.Data;
+
+@Data
+public class VolumeDto4 {
+    private Long id;
+    private String fileNumber;
+    private String fileName;
+    private String fileTime;
+    private String dutyUser;
+    private Integer filePage;
+    //是否已被分卷 0否 1是
+    private Integer isCheck=0;
+
+    private Long archiveId;
+}

+ 10 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ArchiveFile.java

@@ -342,6 +342,16 @@ public class ArchiveFile extends BaseEntity {
     @ApiModelProperty("是否锁定 1已锁定")
     private Integer isLock;
 
+
+    private String fileMd5;
+    private String pdfMd5;
+
+    @ApiModelProperty("旧案卷ID")
+    private Long oldArchiveId;
+
+    @ApiModelProperty("是否分卷0否1是")
+    private Integer isVolume;
+
     public void fromExternal(ArchiveFileVo vo) {
         if (vo == null) {
             return;

+ 5 - 2
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ArchiveFileClient.java

@@ -180,9 +180,12 @@ public interface ArchiveFileClient {
     @PostMapping(API_PREFIX + "/getAllArchiveFileByIds")
     List<ArchiveFile> getAllArchiveFileByIds(@RequestBody List<String> strList);
 
+    @PostMapping(API_PREFIX + "/selectMaxSortByContractId")
+    Integer selectMaxSortByContractId(@RequestParam Long contractId);
+
     @PostMapping(API_PREFIX + "/saveBatchArchiveFile")
     void saveBatchArchiveFile(@RequestBody List<ArchiveFile> list);
 
-    @PostMapping(API_PREFIX + "/selectMaxSortByContractId")
-    Integer selectMaxSortByContractId(@RequestParam Long contractId);
+    @PostMapping(API_PREFIX + "/getArchiveFileById")
+    ArchiveFile getArchiveFileById(@RequestParam Long fileId);
 }

+ 4 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/MetadataClassificationClient.java

@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -32,4 +33,7 @@ public interface MetadataClassificationClient {
 
     @PostMapping(API_PREFIX + "/createMetadataFiles")
     boolean createMetadataFiles(@RequestBody List<Long> fileId);
+
+    @PostMapping(API_PREFIX + "/getMetadaFileByFileId")
+    List<HashMap<String, Object>> getMetadaFileByFileId(Long id);
 }

+ 7 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/WbsFormElement.java

@@ -77,4 +77,11 @@ public class WbsFormElement extends BaseEntity {
      */
     @ApiModelProperty(value = "exid")
     private Long exid;
+
+    /**
+     * 是否辅助(1-是,0-不是)
+     */
+    @ApiModelProperty(value = "是否辅助(1-是,0-不是)")
+    private Integer assist;
+
 }

+ 10 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ContractClient.java

@@ -4,6 +4,7 @@ package org.springblade.manager.feign;
 import org.springblade.core.tool.api.R;
 import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
 import org.springblade.manager.entity.ContractInfo;
+import org.springblade.manager.entity.ProjectInfo;
 import org.springblade.manager.vo.RoleSignPfxUserVO3;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.transaction.annotation.Transactional;
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
+import java.util.Set;
 
 import static org.springblade.core.launch.constant.AppConstant.APPLICATION_NAME_PREFIX;
 
@@ -80,4 +82,12 @@ public interface ContractClient {
     @GetMapping(API_PREFIX+"/findAllUserAndRoleList")
     RoleSignPfxUserVO3 findAllUserAndRoleList(@RequestParam Long contractId, @RequestParam(required = false) Long roleId);
 
+    @PostMapping(API_PREFIX+"/queryProjectList")
+    List<ProjectInfo> queryProjectList(@RequestBody Set<String> projectId);
+
+    @PostMapping(API_PREFIX+"/queryProjectIds")
+    List<String> queryProjectIds(@RequestBody Set<String> projectId);
+
+    @GetMapping(API_PREFIX+"/queryContractNamesListByProjectId")
+    List<ContractInfo> queryContractNamesListByProjectId(@RequestParam String projectId);
 }

+ 7 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/SaveUserInfoByProjectClient.java

@@ -23,6 +23,8 @@ public interface SaveUserInfoByProjectClient {
     String SEARCH_USER_INFO_AND_PROJECT_BY_USER_IDS = "/api/manager/searchUserInfoAndProjectByUserIds";
     String QUERY_USER_CONTRACT_ROLE = "/api/manager/queryUserContractRole";
     String SAVE_INFO_RELATION = "/api/manager/saveInfoRelation";
+    String INSERT_USER_INFO_BATCH = "/api/manager/insertUserInfoBatch";
+    String UPDATE_USER_INFO_BATCH = "/api/manager/updateUserInfoBatch";
 
     @PostMapping(QUERY_USER_CONTRACT_ROLE)
     List<JSONObject> queryUserContractRole(@RequestBody List<Long> userIds, @RequestParam String contractId);
@@ -51,4 +53,9 @@ public interface SaveUserInfoByProjectClient {
     @PostMapping(SAVE_INFO_RELATION)
     void saveInfoRelation(@RequestParam Long userId, @RequestParam Long projectId, @RequestParam Long contractId, @RequestParam Long roleId);
 
+    @PostMapping(INSERT_USER_INFO_BATCH)
+    void insertUserInfoBatch(@RequestBody List<SaveUserInfoByProjectDTO>list);
+
+    @PostMapping(UPDATE_USER_INFO_BATCH)
+    void updateUserInfoBatch(@RequestBody List<SaveUserInfoByProjectDTO> updateUserInfoByProjectList);
 }

+ 59 - 0
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/dto/ExcelUserTemp.java

@@ -0,0 +1,59 @@
+package org.springblade.system.user.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+@Data
+public class ExcelUserTemp {
+    // A列:登录账号 → index=0
+    @ExcelProperty(index = 0)
+    private String account;
+
+    // B列:登录密码 → index=1
+    @ExcelProperty(index = 1)
+    private String password;
+
+    // C列:用户姓名 → index=2
+    @ExcelProperty(index = 2)
+    private String realName;
+
+    // D列:用户平台 → index=3
+    @ExcelProperty(index = 3)
+    private String userType;
+
+    // E列:手机号码 → index=4
+    @ExcelProperty(index = 4)
+    private String phone;
+
+    // F列:身份证号码 → index=5
+    @ExcelProperty(index = 5)
+    private String idNumber;
+
+    // G列:所属部门 → index=6
+    @ExcelProperty(index = 6)
+    private String deptName;
+
+    // H列:电签信息 → index=7
+    @ExcelProperty(index = 7)
+    private String accCode;
+
+    // I列:项目id → index=8
+    @ExcelProperty(index = 8)
+    private String projectId;
+
+    // J列:合同段名称/编号 → index=9
+    @ExcelProperty(index = 9)
+    private String contractInfo;
+
+    // K列:所属方 → index=10
+    @ExcelProperty(index = 10)
+    private String owner;
+
+    // L列:岗位名称 → index=11
+    @ExcelProperty(index = 11)
+    private String roleName;
+
+    // M列:登录状态 → index=12
+    @ExcelProperty(index = 12)
+    private String status;
+}

+ 32 - 0
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/dto/ImportPorjectInfoDTO.java

@@ -0,0 +1,32 @@
+package org.springblade.system.user.dto;
+
+import lombok.Data;
+
+@Data
+public class ImportPorjectInfoDTO{
+    /**
+     * 项目id
+     */
+    private String projectId;
+
+    /**
+     * 合同段名称/编号
+     */
+    private String contractInfo;
+
+    /**
+     * 所属方(1业主方 2监理方 3施工方)
+     */
+    private String owner;
+
+    /**
+     * 岗位名称(中文匹配)
+     */
+    private String roleName;
+
+    private Integer status=0;
+
+    private Long contractId;
+
+    private Long roleId;
+}

+ 19 - 0
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/dto/ImportUserLog.java

@@ -0,0 +1,19 @@
+package org.springblade.system.user.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class ImportUserLog {
+    private Long id;
+    private String account;
+    private String name;
+    private String message;
+    private String importTime;
+    private Long importId;
+    private Long importUser;
+    private String filePath;
+}

+ 58 - 0
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/dto/UserImporterNew.java

@@ -0,0 +1,58 @@
+package org.springblade.system.user.dto;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Data
+public class UserImporterNew {
+    /**
+     * 登录账号
+     */
+    private String account;
+    /**
+     * 登录密码
+     */
+    private String password;
+
+    /**
+     * 用户姓名
+     */
+    private String realName;
+
+    /**
+     * 用户平台
+     */
+    private String userType;
+
+    /**
+     * 手机号码
+     */
+    private String phone;
+
+    /**
+     * 身份证号码
+     */
+    private String idNumber;
+
+    /**
+     * 所属部门(中文名称)
+     */
+    private String deptName;
+
+    /**
+     * 电签信息(东方中迅电签码)
+     */
+    private String accCode;
+    /**
+     * 登录状态(允许为空,默认为是)
+     */
+    private String status;
+
+    private Long deptId;
+
+    private List<ImportPorjectInfoDTO> projectInfoList=new ArrayList<>();
+}

+ 5 - 0
blade-service/blade-archive/pom.xml

@@ -161,6 +161,11 @@
             <artifactId>pdfbox</artifactId>
             <version>2.0.24</version>
         </dependency>
+        <dependency>
+            <groupId>xyz.capybara</groupId>
+            <artifactId>clamav-client</artifactId>
+            <version>2.1.2</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 14 - 9
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveExaminingReportController.java

@@ -1,26 +1,22 @@
 package org.springblade.archive.controller;
 
+import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.itextpdf.text.DocumentException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
-import lombok.extern.java.Log;
 import org.springblade.archive.entity.ArchiveExaminingReport;
 import org.springblade.archive.service.IArchiveExaminingReportService;
 import org.springblade.archive.vo.ArchiveExaminingVo;
 import org.springblade.common.utils.SnowFlakeUtil;
-import org.springblade.core.oss.model.BladeFile;
+import org.springblade.core.redis.cache.BladeRedis;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.evisa.feign.EVisaClient;
 import org.springblade.evisa.vo.CertBeanVO;
-import org.springblade.resource.feign.NewIOSSClient;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
 import java.time.LocalDateTime;
@@ -41,6 +37,9 @@ public class ArchiveExaminingReportController {
 
     private final EVisaClient eVisaClient;
 
+    private final BladeRedis bladeRedis;
+
+    private final static String REDIS_STR = "blade-archive-examining:";
     @GetMapping("test")
     public String test() throws DocumentException, IOException {
 //        BladeFile bladeFile = iossClient.uploadFile("124456sdf", "D:\\develop\\test\\test1.pdf");
@@ -82,9 +81,9 @@ public class ArchiveExaminingReportController {
         return R.data(-1);
     }
 
-    @GetMapping("/getExamining")
+    @PostMapping("/getExamining")
     @ApiOperation(value = "档案四性检测")
-    public R getExamining(ArchiveExaminingVo vo) throws InterruptedException, IOException, DocumentException {
+    public R getExamining(@RequestBody ArchiveExaminingVo vo) throws InterruptedException, IOException, DocumentException {
 
         //如果id为0则为一键检测,不为0则有报告正在进行
         if (vo.getReportId() == 0) {
@@ -98,6 +97,12 @@ public class ArchiveExaminingReportController {
             report.setCreateTime(new Date());
             report.setProjectId(vo.getProjectId());
             archiveExaminingReportService.save(report);
+            //添加缓存
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.set("status",1);
+            jsonObject.set("number",0);
+            jsonObject.set("success",0);
+            bladeRedis.setEx(REDIS_STR + id,jsonObject,300L);
             //调用四性检测方法
             archiveExaminingReportService.getExamining(vo, id);
             //调用socket,每隔3秒检测当前报告状态然后推送

+ 22 - 4
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchivesAutoController.java

@@ -33,10 +33,7 @@ import org.apache.commons.lang.StringUtils;
 import org.apache.http.message.BasicNameValuePair;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.usermodel.*;
-import org.springblade.archive.dto.ArchiveWarningDTO;
-import org.springblade.archive.dto.AutoOCRDTO;
-import org.springblade.archive.dto.FindAndReplaceDto;
-import org.springblade.archive.dto.SaveApplyDTO;
+import org.springblade.archive.dto.*;
 import org.springblade.archive.entity.ArchiveConclusion;
 import org.springblade.archive.entity.ExpertInspection;
 import org.springblade.archive.service.IArchiveAutoPdfService;
@@ -1332,4 +1329,25 @@ public class ArchivesAutoController extends BladeController {
 		return R.data(archivesAutoService.jointNomination(Arrays.asList(authId.split(","))));
 	}
 
+	@PostMapping("/saveVolume")
+	@ApiOperationSupport(order = 45)
+	@ApiOperation(value = "保存档案分卷文件")
+	public R saveVolume(@RequestBody SaveVolumeDto dto){
+		return R.success(archivesAutoService.saveVolume(dto));
+	}
+	@PostMapping("/removeVolume")
+	@ApiOperationSupport(order = 46)
+	@ApiOperation(value = "删除案卷分卷")
+	public R removeVolume(Long archiveId,Long volumeId){
+		return R.status(archivesAutoService.removeVolume(archiveId,volumeId));
+	}
+
+	@PostMapping("/backVolume")
+	@ApiOperationSupport(order = 47)
+	@ApiOperation(value = "案卷分卷文件回退")
+	public R backVolume(Long fileId){
+		return R.status(archivesAutoService.backVolume(fileId));
+	}
+
+
 }

+ 5 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/feign/ArchiveAutoClientImpl.java

@@ -74,4 +74,9 @@ public class ArchiveAutoClientImpl implements ArchiveAutoClient {
 
         archivesAutoService.reomoveArchiveAndFile(archiveIds);
     }
+
+    @Override
+    public ArchivesAuto getArchiveById(Long id) {
+        return archivesAutoService.getById(id);
+    }
 }

+ 9 - 4
blade-service/blade-archive/src/main/java/org/springblade/archive/service/IArchivesAutoService.java

@@ -17,10 +17,7 @@
 package org.springblade.archive.service;
 
 
-import org.springblade.archive.dto.ArchiveWarningDTO;
-import org.springblade.archive.dto.FindAndReplaceDto;
-import org.springblade.archive.dto.JiLinQueryDto;
-import org.springblade.archive.dto.SaveApplyDTO;
+import org.springblade.archive.dto.*;
 import org.springblade.archive.entity.ArchiveConclusion;
 import org.springblade.archive.entity.ArchivesAuto;
 import org.springblade.archive.entity.ExpertInspection;
@@ -194,4 +191,12 @@ public interface IArchivesAutoService extends BaseService<ArchivesAuto> {
 
 
     String jointNomination(List<String> authId);
+
+	Boolean updateArchivePage(List<Long>archiveIds);
+
+	String saveVolume(SaveVolumeDto dto);
+
+	boolean removeVolume(Long archiveId, Long volumeId);
+
+	boolean backVolume(Long fileId);
 }

+ 6 - 6
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveAutoPdfServiceImpl.java

@@ -158,8 +158,8 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
         archivesAuto.setKeywords("主题词");
         archivesAuto.setReviewer("审核人");
         archivesAuto.setReviewDate(LocalDateTime.now());
-        archivesAuto.setStartDate(LocalDateTime.now());
-        archivesAuto.setEndDate(LocalDateTime.now());
+        //archivesAuto.setStartDate(LocalDateTime.now());
+        //archivesAuto.setEndDate(LocalDateTime.now());
         archivesAuto.setStorageLocation("存放位置");
         archivesAuto.setIsArchive(0);
         archivesAuto.setRemark("备注");
@@ -883,14 +883,14 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
         if (!minDate.isEmpty() && !minDate.equals("null") ) {
             LocalDateTime localDateTime = FormulaUtil.parseStringToLocalDateTime(minDate, "yyyyMMdd");
             if (localDateTime != null) {
-                archive.setStartDate(localDateTime);
+                archive.setStartDate(localDateTime.toString());
             }
 
         }
         if (!maxDate.isEmpty() && !maxDate.equals("null") ) {
             LocalDateTime localDateTime = FormulaUtil.parseStringToLocalDateTime(maxDate, "yyyyMMdd");
             if (localDateTime != null) {
-                archive.setEndDate(localDateTime);
+                archive.setEndDate(localDateTime.toString());
             }
         }
 
@@ -904,11 +904,11 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
         }
 
         if (archive.getStartDate() != null) {
-            archivesAutoMap.put("startDate", FormulaUtil.formatLocalDateTime(archive.getStartDate(), "yyyyMMdd"));
+            archivesAutoMap.put("startDate", archive.getStartDate());
         }
 
         if (archive.getEndDate() != null) {
-            archivesAutoMap.put("endDate", FormulaUtil.formatLocalDateTime(archive.getEndDate(), "yyyyMMdd"));
+            archivesAutoMap.put("endDate", archive.getEndDate());
         }
 
         Map<String, Object> variables = new HashMap<>();

+ 534 - 144
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveExaminingReportImpl.java

@@ -1,45 +1,55 @@
 package org.springblade.archive.service.impl;
 
-import com.alibaba.fastjson.JSON;
-import com.aliyun.oss.OSSClient;
+import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.itextpdf.text.*;
 import com.itextpdf.text.pdf.BaseFont;
 import com.itextpdf.text.pdf.PdfPCell;
 import com.itextpdf.text.pdf.PdfPTable;
 import com.itextpdf.text.pdf.PdfWriter;
 import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import lombok.var;
 import org.apache.commons.lang.StringUtils;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.HttpHead;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
 import org.springblade.archive.entity.ArchiveExaminingReport;
 import org.springblade.archive.entity.ArchiveExaminingReportDetail;
 import org.springblade.archive.mapper.ArchiveExaminingReportMapper;
 import org.springblade.archive.service.IArchiveExaminingReportDetailService;
 import org.springblade.archive.service.IArchiveExaminingReportService;
 import org.springblade.archive.socket.WebSocketServer;
-import org.springblade.archive.utils.FileUtils;
+import org.springblade.archive.utils.*;
 import org.springblade.archive.vo.ArchiveExaminingSocketVo;
 import org.springblade.archive.vo.ArchiveExaminingVo;
+import org.springblade.archive.vo.ArchivesAutoVO;
 import org.springblade.business.entity.ArchiveFile;
+import org.springblade.business.entity.MetadataClassification;
 import org.springblade.business.feign.ArchiveFileClient;
+import org.springblade.business.feign.MetadataClassificationClient;
 import org.springblade.common.constant.ArchiveConstant;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.oss.model.BladeFile;
-import org.springblade.core.secure.BladeUser;
-import org.springblade.core.secure.utils.AuthUtil;
-import org.springblade.core.secure.utils.SecureUtil;
+import org.springblade.core.redis.cache.BladeRedis;
+import org.springblade.core.tool.utils.CollectionUtil;
 import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.evisa.feign.EVisaClient;
 import org.springblade.evisa.vo.CertBeanVO;
+import org.springblade.manager.entity.ArchiveTreeContract;
+import org.springblade.manager.feign.ArchiveTreeContractClient;
 import org.springblade.resource.feign.NewIOSSClient;
-import org.springblade.resource.feign.NewISmsClient;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
-import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.util.*;
 import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @Param
@@ -47,6 +57,7 @@ import java.util.List;
  * @Date 2023/4/20 17:36
  **/
 @Service
+@Slf4j
 @AllArgsConstructor
 public class ArchiveExaminingReportImpl extends BaseServiceImpl<ArchiveExaminingReportMapper, ArchiveExaminingReport> implements IArchiveExaminingReportService {
     private final WebSocketServer webSocketServer;
@@ -59,6 +70,15 @@ public class ArchiveExaminingReportImpl extends BaseServiceImpl<ArchiveExamining
 
     private final EVisaClient eVisaClient;
 
+    private final ArchivesAutoServiceImpl archivesAutoService;
+
+    private final ArchiveTreeContractClient archiveTreeContractClient;
+    private final MetadataClassificationClient metadataClassificationClient;
+
+    private final BladeRedis bladeRedis;
+
+    private final static String REDIS_STR = "blade-archive-examining:";
+
     /**
      * 推送状态到前端
      *
@@ -74,14 +94,18 @@ public class ArchiveExaminingReportImpl extends BaseServiceImpl<ArchiveExamining
             Thread.sleep(4000L);
             //判断报告状态
             ArchiveExaminingReport report = this.getById(id);
-            Integer reportStatus = report.getStatus();
-            Integer detailStatus = report.getReportDetailStatus();
-            //判断详情状态
+            statusR = report.getStatus();
 
-            if (reportStatus != statusR || detailStatus != statusD) {
-                webSocketServer.sendMessagesToArchive(userId + "", "true");
-                statusR = reportStatus;
-                statusD = detailStatus;
+            List<ArchiveExaminingReportDetail> list = detailService.list(Wrappers.<ArchiveExaminingReportDetail>lambdaQuery().eq(ArchiveExaminingReportDetail::getReportId, id));
+            //判断详情状态
+            JSONObject json = bladeRedis.get(REDIS_STR + id);
+            if(json == null){
+               break;
+            }
+            json.set("list",list);
+            webSocketServer.sendMessagesToArchive(userId + "", json.toString());
+            if(json.getInt("status") == 5){
+                break;
             }
         } while (statusR != 4);
 
@@ -95,141 +119,486 @@ public class ArchiveExaminingReportImpl extends BaseServiceImpl<ArchiveExamining
     @Async
     @Override
     public void getExamining(ArchiveExaminingVo vo, Long id) throws InterruptedException, DocumentException, IOException {
-        ArchiveExaminingReport report = new ArchiveExaminingReport();
-        report.setId(id);
-        report.setStatus(2);
-        this.updateById(report);
-        //获取项目中所有档案文件的工序资料pdfUrl
-        List<ArchiveFile> files = archiveFileClient.getAllPdfFileUrlByProjectIdAndFileType(vo.getProjectId());
-        //不合格对象
-        List<Map<String, String>> mapList = new ArrayList<>();
-        int unqualifiedCount = 0;
-        //检测中
-        //真实性
-        if (StringUtils.isNotBlank(vo.getAuthenticity()) && "1".equals(vo.getAuthenticity())) {
-            //检测项目下所有工序资料PDF签章有效性
-            for (ArchiveFile file : files) {
-                if (StringUtils.isNotBlank(file.getPdfFileUrl())) {
-                    CertBeanVO cb = eVisaClient.onlineCheckSeal(file.getPdfFileUrl());
-                    if (cb == null) {
+        try {
+            ArchiveExaminingReport report = new ArchiveExaminingReport();
+            report.setId(id);
+            report.setStatus(2);
+            this.updateById(report);
+
+            //优化 获取权限表示码
+            String authCode = archiveTreeContractClient.getAuthCode(vo.getContractId());
+            //封装查询参数查询
+            ArchivesAutoVO queryVo = new ArchivesAutoVO();
+            queryVo.setProjectId(vo.getProjectId());
+            queryVo.setContractId(vo.getContractId());
+            queryVo.setCurrent(1);
+            queryVo.setSize(999999999);
+            queryVo.setIsArchive(1);
+            queryVo.setAuthCode(authCode);
+            //多个节点查询数据
+            String nodeIds = vo.getNodeIds();
+            Set<String> collect = new HashSet<>();
+            if(StringUtils.isNotEmpty(nodeIds)){
+                for (String s : nodeIds.split(",")) {
+                    queryVo.setNodeIds(s);
+                    //封装参数查询组卷列表
+                    IPage<ArchivesAutoVO> page = archivesAutoService.selectArchivesAutoFilePage(queryVo);
+                    List<ArchivesAutoVO> records = page.getRecords();
+                    if(CollectionUtil.isNotEmpty(records)){
+                        collect.addAll(records.stream().map(ArchivesAutoVO::getId).map(String::valueOf).collect(Collectors.toSet()));
+                    }
+                }
+            }
+            //选中的指定文件也加入进来
+            if(StringUtils.isNotEmpty(vo.getFileIds())){
+                Set<String> collect1 = Arrays.stream(vo.getFileIds().split(",")).collect(Collectors.toSet());
+                collect.addAll(collect1);
+            }
+            List<ArchiveFile> files = new ArrayList<>();
+            if(CollectionUtil.isNotEmpty(collect)){
+                //类型转换
+                List<String> strings = new ArrayList<>(collect);
+                //根据组件id查询文件数据
+                files = archiveFileClient.getAllArchiveFileByArchiveIds(strings);
+            }
+            //文件类型范围
+            List<String> strings = new ArrayList<>();
+            strings.add("pdf");
+            strings.add("dwg");
+            strings.add("jpg");
+            strings.add("png");
+            //不合格对象
+            List<Map<String, String>> mapList = new ArrayList<>();
+            //1-1 电签验证
+            int unqualifiedCount = 0;
+            //1-2 一致性检测
+            int consistency = 0;
+            //1-5 对设定值域的元数据项值域符合度检测
+            int metadataCompliance = 0;
+            //1-6 对元数据项数据重复性检测
+            int metadataRepeat = 0;
+            //1-8 信息包一致性检测
+            int infoConsistency = 0;
+            //2-3 对元数据项完整性检测
+            int metadataComplete = 0;
+            //2-4 对元数据项必填项
+            int metadataRequiredField = 0;
+
+            //3-1 文件格式
+            int fileType = 0;
+            //3-2 文件是否能够访问
+            int fileIsAccess = 0;
+            //3-5 信息包加密
+            int infoEncryption = 0;
+            //4-1 病毒检测
+            int virusDetection = 0;
+            //4-3 病毒安装
+            int virusInstall = 0;
+
+            //检测中 文件为空,不允许检测
+            if(CollectionUtil.isNotEmpty(files)){
+                Map<Integer,String> storageTypeMap = new HashMap<>();
+                storageTypeMap.put(1,"a");
+                storageTypeMap.put(2,"b");
+                storageTypeMap.put(3,"c");
+                storageTypeMap.put(4,"d");
+                storageTypeMap.put(5,"e");
+                storageTypeMap.put(7,"f");
+                storageTypeMap.put(6,"g");
+                storageTypeMap.put(8,"h");
+                storageTypeMap.put(9,"i");
+                //获取nodeId 查询节点信息
+                Map<String, List<ArchiveFile>> collect2 = files.stream().collect(Collectors.groupingBy(ArchiveFile::getNodeId));
+                List<Long> collect11 = collect2.keySet().stream().map(String::trim).filter(s -> !s.isEmpty()).map(Long::valueOf).collect(Collectors.toList());
+                List<ArchiveTreeContract> archiveTreeContractListByList = archiveTreeContractClient.getArchiveTreeContractListByList(collect11);
+                //获取所有的元数据配置项
+                List<MetadataClassification> metadataClassification = metadataClassificationClient.getMetadataClassification();
+                //组装数据,节点与元数据配置型的映射关系
+                HashMap<Long, List<MetadataClassification>> longStringHashMap = new HashMap<>();
+                if(CollectionUtil.isNotEmpty(metadataClassification)){
+                    archiveTreeContractListByList.forEach(f -> {
+                        if(f.getStorageType() == null){
+                            return;
+                        }
+                        List<MetadataClassification> collect1 = metadataClassification.stream().filter(e -> StringUtils.isNotEmpty(e.getFileStorageType()) && e.getFileStorageType().contains(storageTypeMap.get(f.getStorageType()))).collect(Collectors.toList());
+                        longStringHashMap.put(f.getId(),collect1);
+                    });
+                }
+                //开始检测
+                JSONObject json = bladeRedis.get(REDIS_STR + id);
+                if(json == null){
+                    json = new JSONObject();
+                    json.set("success",0);
+                }
+                json.set("number",files.size());
+                json.set("status",2);
+                bladeRedis.setEx(REDIS_STR + id,json,300L);
+                for (ArchiveFile file : files) {
+                    json = bladeRedis.get(REDIS_STR + id);
+                    if(json == null){
+                        json = new JSONObject();
+                        json.set("success",0);
+                        json.set("status",2);
+                        json.set("number",files.size());
+                    }
+
+
+                    //当前文件父节点对应的元数据配置项
+                    List<MetadataClassification> metadataClassifications = longStringHashMap.get(Long.valueOf(file.getNodeId()));
+                    //获取文件元数据项
+                    List<HashMap<String, Object>> list = metadataClassificationClient.getMetadaFileByFileId(file.getId());
+                    //优先检查文件是否可读
+                    if(StringUtils.isEmpty(file.getPdfFileUrl())
+                            || !validateWithHead(file.getPdfFileUrl())
+                            || StringUtils.isEmpty(file.getFileUrl())
+                            || !validateWithHead(file.getFileUrl())){
                         Map<String, String> map = new HashMap<>();
-                        map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对固化信息有效性检测");
+                        map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对电子档案内容数据的可读性检测");
                         map.put("unqualifiedObject", file.getFileName());
                         mapList.add(map);
-                        unqualifiedCount++;
+                        fileIsAccess++;
+                        json.set("success",json.getInt("success") + 1);
+                        bladeRedis.setEx(REDIS_STR + id,json,300L);
+                        continue;
+                    }
+                    //真实性
+                    log.info("{}正在检测真实性",file.getFileName());
+                    if (StringUtils.isNotBlank(vo.getAuthenticity()) && "1".equals(vo.getAuthenticity())) {
+                        //获取文件数字摘要
+                        RemoteFileMD5Calculator.MD5Result fileUrL = RemoteFileMD5Calculator.getRemoteFileMD5FromHeaders(file.getFileUrl());
+                        RemoteFileMD5Calculator.MD5Result pdfFileUrl = RemoteFileMD5Calculator.getRemoteFileMD5FromHeaders(file.getPdfFileUrl());
+                        String fileMd5 = fileUrL.getMd5Hash();
+                        String pdfMd5 = pdfFileUrl.getMd5Hash();
+                        if(vo.getAuthenticityList().contains("1")){
+                            //检测项目下所有工序资料PDF签章有效性
+                            CertBeanVO cb = eVisaClient.onlineCheckSeal(file.getPdfFileUrl());
+                            //数字摘要判断和电签
+                            if (cb == null || !file.getFileMd5().equals(fileMd5) || !file.getPdfMd5().equals(pdfMd5)) {
+                                Map<String, String> map = new HashMap<>();
+                                map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对固化信息有效性检测");
+                                map.put("unqualifiedObject", file.getFileName());
+                                mapList.add(map);
+                                unqualifiedCount++;
+                            }
+                        }
+                        if(vo.getAuthenticityList().contains("2")){
+                            if (!file.getFileMd5().equals(fileMd5) || !file.getPdfMd5().equals(pdfMd5)) {
+                                Map<String, String> map = new HashMap<>();
+                                map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对固化信息有效性检测");
+                                map.put("unqualifiedObject", file.getFileName());
+                                mapList.add(map);
+                                consistency++;
+                            }
+                        }
+                        if(vo.getAuthenticityList().contains("3")){}
+                        if(vo.getAuthenticityList().contains("4")){}
+                        if(vo.getAuthenticityList().contains("5")){
+                            //获取元数据
+                            if(CollectionUtil.isEmpty(list) ){
+                                Map<String, String> map = new HashMap<>();
+                                map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对设定值域的元数据项值域符合度检测");
+                                map.put("unqualifiedObject", file.getFileName());
+                                mapList.add(map);
+                                metadataCompliance++;
+                            }
+
+                        }
+                        if(vo.getAuthenticityList().contains("6")){
+                            //获取元数据
+                            if(CollectionUtil.isEmpty(list)){
+                                Map<String, String> map = new HashMap<>();
+                                map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项数据重复性检测");
+                                map.put("unqualifiedObject", file.getFileName());
+                                mapList.add(map);
+                                metadataRepeat++;
+                            }else{
+                                List<String> data = new ArrayList<>();
+                                HashMap<String, Object> stringObjectHashMap = list.get(0);
+                                for (MetadataClassification classification : metadataClassifications) {
+                                    String fieldKey = classification.getFieldKey();
+                                    data.add(stringObjectHashMap.get(fieldKey).toString());
+                                }
+                                HashSet<String> strings1 = new HashSet<>(data);
+                                //存在重复数据
+                                if(data.size() != strings1.size()){
+                                    Map<String, String> map = new HashMap<>();
+                                    map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项数据重复性检测");
+                                    map.put("unqualifiedObject", file.getFileName());
+                                    mapList.add(map);
+                                    metadataRepeat++;
+                                }
+                            }
+
+                        }
+                        if(vo.getAuthenticityList().contains("7")){}
+                        if(vo.getAuthenticityList().contains("8")){
+                            if(!file.getFileMd5().equals(fileMd5) || !file.getPdfMd5().equals(pdfMd5)){
+                                Map<String, String> map = new HashMap<>();
+                                map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对固化信息有效性检测");
+                                map.put("unqualifiedObject", file.getFileName());
+                                mapList.add(map);
+                                infoConsistency++;
+                            }
+                        }
+                        if(vo.getAuthenticityList().contains("9")){}
+                        if(vo.getAuthenticityList().contains("10")){}
+                        report.setReportDetailStatus(1);
+                        this.updateById(report);
+                    }
+                    //完整性
+                    log.info("{}正在检测完整性",file.getFileName());
+                    if (StringUtils.isNotBlank(vo.getIntegrality()) && "1".equals(vo.getIntegrality())) {
+                        if(vo.getIntegralityList().contains("1")){}
+                        if(vo.getIntegralityList().contains("2")){}
+                        if(vo.getIntegralityList().contains("3")){
+                            //获取元数据
+                            if(CollectionUtil.isEmpty(list)){
+                                Map<String, String> map = new HashMap<>();
+                                map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项完整性检测");
+                                map.put("unqualifiedObject", file.getFileName());
+                                mapList.add(map);
+                                metadataComplete++;
+                            }else{
+                                //元数据
+                                HashMap<String, Object> stringObjectHashMap = list.get(0);
+                                //元数据项
+                                List<String> collect1 = metadataClassifications.stream().map(MetadataClassification::getFieldKey).collect(Collectors.toList());
+                                Set<String> strings2 = stringObjectHashMap.keySet();
+                                //元数据项是否缺失
+                                if(!strings2.containsAll(collect1)){
+                                    Map<String, String> map = new HashMap<>();
+                                    map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项完整性检测");
+                                    map.put("unqualifiedObject", file.getFileName());
+                                    mapList.add(map);
+                                    metadataComplete++;
+                                }
+                            }
+                        }
+                        if(vo.getIntegralityList().contains("4")){
+                            //获取元数据
+                            if(CollectionUtil.isEmpty(list)){
+                                Map<String, String> map = new HashMap<>();
+                                map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据必填项检测");
+                                map.put("unqualifiedObject", file.getFileName());
+                                mapList.add(map);
+                                metadataRequiredField++;
+                            }else{
+                                //元数据
+                                HashMap<String, Object> stringObjectHashMap = list.get(0);
+                                //元数据项-必选项
+                                List<String> collect1 = metadataClassifications.stream().filter(f -> f.getMandatoryType() == 1).map(MetadataClassification::getFieldKey).collect(Collectors.toList());
+                                for (String s : collect1) {
+                                    Object o = stringObjectHashMap.get(s);
+                                    //必选项没有值
+                                    if(o == null){
+                                        Map<String, String> map = new HashMap<>();
+                                        map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据必填项检测");
+                                        map.put("unqualifiedObject", file.getFileName());
+                                        mapList.add(map);
+                                        metadataRequiredField++;
+                                        break;
+                                    }
+                                }
+                            }
+
+                        }
+                        if(vo.getIntegralityList().contains("5")){}
+                        if(vo.getIntegralityList().contains("6")){}
+                        if(vo.getIntegralityList().contains("7")){}
+                        if(vo.getIntegralityList().contains("8")){}
+                        report.setReportDetailStatus(2);
+                        this.updateById(report);
                     }
+                    //可用性
+                    log.info("{}正在检测可用性",file.getFileName());
+                    if (StringUtils.isNotBlank(vo.getUsability()) && "1".equals(vo.getUsability())) {
+                        if(vo.getUsabilityList().contains("1")){
+                            //获取文件后缀,后缀为
+                            String fileExtensionFromUrl = RemoteFileExtension.getFileExtensionFromUrl(file.getPdfFileUrl());
+                            if(StringUtils.isEmpty(fileExtensionFromUrl) || !strings.contains(fileExtensionFromUrl)){
+                                Map<String, String> map = new HashMap<>();
+                                map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对电子文件格式检测");
+                                map.put("unqualifiedObject", file.getFileName());
+                                mapList.add(map);
+                                fileType++;
+                            }
+
+                        }
+                        //3-2 放在最开始
+                        if(vo.getUsabilityList().contains("3")){
+
+                        }
+                        if(vo.getUsabilityList().contains("4")){
+
+                        }
+                        if(vo.getUsabilityList().contains("5")){
+                            //文件加密压缩认证
+                            FileAnalysisResult fileAnalysisResult = null;
+                            try {
+                                fileAnalysisResult = RemoteFileSecurityChecker.analyzeRemoteFile(file.getFileUrl());
+                            } catch (IOException e) {}
+                            //是否使用公共压缩算法 是否加密
+                            if(fileAnalysisResult == null){
+                                Map<String, String> map = new HashMap<>();
+                                map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项数据重复性检测");
+                                map.put("unqualifiedObject", file.getFileName());
+                                mapList.add(map);
+                                infoEncryption++;
+                            }
+                        }
+                        if(vo.getUsabilityList().contains("6")){}
+                        report.setReportDetailStatus(3);
+                        this.updateById(report);
+                    }
+                    //安全性
+                    log.info("{}正在检测安全性",file.getFileName());
+                    if (StringUtils.isNotBlank(vo.getSecurity()) && "1".equals(vo.getSecurity())) {
+                        if(vo.getSecurityList().contains("1")){
+                            if(!ClamAVClientScanner.checkHealth() || !ClamAVClientScanner.scanRemoteFile(file.getPdfFileUrl())){
+                                Map<String, String> map = new HashMap<>();
+                                map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对电子文件格式检测");
+                                map.put("unqualifiedObject", file.getFileName());
+                                mapList.add(map);
+                                virusDetection++;
+                            }
+                        }
+                        if(vo.getSecurityList().contains("2")){}
+                        if(vo.getSecurityList().contains("3")){
+                            if(!ClamAVClientScanner.checkHealth()){
+                                Map<String, String> map = new HashMap<>();
+                                map.put("examiningItem", ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对电子文件格式检测");
+                                map.put("unqualifiedObject", file.getFileName());
+                                mapList.add(map);
+                                virusInstall++;
+                            }
+                        }
+                        if(vo.getSecurityList().contains("4")){}
+                        report.setReportDetailStatus(4);
+                        this.updateById(report);
+                    }
+
+                    json.set("success",json.getInt("success") + 1);
+                    bladeRedis.setEx(REDIS_STR + id,json,300L);
+                    log.info("{}检测完成",file.getFileName());
                 }
             }
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对固化信息有效性检测", unqualifiedCount, unqualifiedCount == 0 ? "无" : "详见附件", unqualifiedCount == 0 ? 0 : 1));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项数据长度检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项数据类型、格式检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对设定值域的元数据项值域符合度检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对档号规范性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对内容数据的电子属性一致性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项数据重复性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据是否关联内容数据检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对信息包目录结构规范性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对信息包一致性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对电子档案封装包规范性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对电子档案封装包电子前面有效性检测", 0, "无", 0));
-            report.setReportDetailStatus(1);
-            this.updateById(report);
-        }
-        if (StringUtils.isNotBlank(vo.getIntegrality()) && "1".equals(vo.getIntegrality())) {
-            Thread.sleep(5000L);
-            //完整性
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_INTEGRALITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对总件数相符性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_INTEGRALITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对总字节数相符性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_INTEGRALITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项完整性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_INTEGRALITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据必填著录项目检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_INTEGRALITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对过程信息完整性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_INTEGRALITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对连续性元数据项检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_INTEGRALITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对内容数据完整性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_INTEGRALITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对附件数据完整性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_INTEGRALITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对归档范围检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_INTEGRALITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对信息包元数据完整性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_INTEGRALITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对信息包内容数据完整性检测", 0, "无", 0));
-            report.setReportDetailStatus(2);
-            this.updateById(report);
-        }
-        //可用性
-        if (StringUtils.isNotBlank(vo.getUsability()) && "1".equals(vo.getUsability())) {
-            Thread.sleep(5000L);
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_USABILITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对信息包中元数据的可读性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_USABILITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对目标数据库中的元数据可访问下检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_USABILITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对内容数据格式检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_USABILITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对内容数据的可读性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_USABILITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对内容数据格式长期可用性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_USABILITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对软硬件环境合规性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_USABILITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对信息包中包含的内容数据格式合规性检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_USABILITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对备份数据可恢复性检测", 0, "无", 0));
-            report.setReportDetailStatus(3);
+            JSONObject json = bladeRedis.get(REDIS_STR + id);
+            if(json == null){
+                json = new JSONObject();
+                json.set("number",files.size());
+                json.set("success",files.size());
+            }
+            json.set("status",3);
+            bladeRedis.setEx(REDIS_STR + id,json,300L);
+            //可用性
+            if(StringUtils.isNotBlank(vo.getUsability()) && "1".equals(vo.getUsability())){
+                if(vo.getUsabilityList().contains("1")){
+                    detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_USABILITY,
+                            ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对电子文件格式检测", fileType, fileType == 0 ? "无" : "详见附件", fileType == 0 ? 0 : 1));
+                }
+                if(vo.getUsabilityList().contains("2")){
+                    detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_USABILITY,
+                            ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对电子档案内容数据的可读性检测", fileIsAccess, fileIsAccess == 0 ? "无" : "详见附件", fileIsAccess == 0 ? 0 : 1));
+                }
+                if(vo.getUsabilityList().contains("3")){
+                    detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_USABILITY,
+                            ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对目标数据库中的元数据可访问性检测", 0, "无", 0));
+                }
+                if(vo.getUsabilityList().contains("4")){
+                    detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_USABILITY,
+                            ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对信息包中元数据可读性检测", 0, "无", 0));
+                }
+                if(vo.getUsabilityList().contains("5")){
+                    detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_USABILITY,
+                            ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对信息包中包含的内容数据合规性检测", infoEncryption, infoEncryption == 0 ? "无" : "详见附件", infoEncryption == 0 ? 0 : 1));
+                }
+            }
+            //真实性
+            if (StringUtils.isNotBlank(vo.getAuthenticity()) && "1".equals(vo.getAuthenticity())) {
+                if(vo.getAuthenticityList().contains("1")){
+                    detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
+                            ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对固化信息有效性检测", unqualifiedCount, unqualifiedCount == 0 ? "无" : "详见附件", unqualifiedCount == 0 ? 0 : 1));
+                }
+                if(vo.getAuthenticityList().contains("2")){
+                    detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
+                            ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对电子文件内容一致性检测", consistency, consistency == 0 ? "无" : "详见附件", consistency == 0 ? 0 : 1));
+                }
+                if(vo.getAuthenticityList().contains("5")){
+                    detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
+                            ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对设定值域的元数据项值域符合度检测", metadataCompliance, metadataCompliance == 0 ? "无" : "详见附件", metadataCompliance == 0 ? 0 : 1));
+                }
+                if(vo.getAuthenticityList().contains("6")){
+                    detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
+                            ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项数据重复性检测", metadataRepeat, metadataRepeat == 0 ? "无" : "详见附件", metadataRepeat == 0 ? 0 : 1));
+                }
+                if(vo.getAuthenticityList().contains("8")){
+                    detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_AUTHENTICITY,
+                            ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对信息包一致性检测", infoConsistency, infoConsistency == 0 ? "无" : "详见附件", infoConsistency == 0 ? 0 : 1));
+                }
+            }
+            //完整信
+            if (StringUtils.isNotBlank(vo.getIntegrality()) && "1".equals(vo.getIntegrality())) {
+                if(vo.getIntegralityList().contains("3")){
+                    detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_INTEGRALITY,
+                            ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据项完整性检测",  metadataComplete, metadataComplete == 0 ? "无" : "详见附件", metadataComplete == 0 ? 0 : 1));
+                }
+                if(vo.getIntegralityList().contains("4")){
+                    detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_INTEGRALITY,
+                            ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对元数据必填项检测", metadataRequiredField, metadataRequiredField == 0 ? "无" : "详见附件", metadataRequiredField == 0 ? 0 : 1));
+                }
+            }
+            //安全性
+            if (StringUtils.isNotBlank(vo.getSecurity()) && "1".equals(vo.getSecurity())) {
+                if(vo.getSecurityList().contains("1")){
+                    detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_SECURITY,
+                            ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对病毒感染检测", virusDetection, virusDetection == 0 ? "无" : "详见附件", virusDetection == 0 ? 0 : 1));
+                }
+                if(vo.getSecurityList().contains("3")){
+                    detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_SECURITY,
+                            ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对系统环境中是否安装杀毒软件检测", virusInstall, virusInstall == 0 ? "无" : "详见附件", virusInstall == 0 ? 0 : 1));
+                }
+            }
+
+            //生成报告,生成PDF
+            report.setStatus(3);
             this.updateById(report);
-        }
-        //安全性
-        if (StringUtils.isNotBlank(vo.getSecurity()) && "1".equals(vo.getSecurity())) {
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_SECURITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对系统环境中是否安装杀毒软件检测", 0, "无", 0));
-            detailService.save(new ArchiveExaminingReportDetail(vo.getProjectId(), id, ArchiveConstant.ARCHIVE_EXAMINING_SECURITY,
-                    ArchiveConstant.ARCHIVE_EXAMINING_STANDARD + "对病毒感染检测", 0, "无", 0));
-            report.setReportDetailStatus(4);
+            String url = this.generateReportPdf(id);
+            //生成附件PDF
+            if (mapList.size() > 0) {
+                String detailPdf = this.generateReportDetailPdf(mapList);
+                List<String> PdfUrls = new ArrayList<>();
+                PdfUrls.add(url);
+                PdfUrls.add(detailPdf);
+                String localUrl = FileUtils.getSysLocalFileUrl() + "/archiveExaminingPdf/123.pdf";
+                //合并pdf
+                FileUtils.mergePdfPublicMethods(PdfUrls, localUrl);
+                BladeFile bladeFile = iossClient.uploadFile("123.pdf", localUrl);
+                report.setReportPdfUrl(bladeFile.getLink());
+            } else {
+                report.setReportPdfUrl(url);
+            }
+            //完成
+            report.setStatus(4);
+
+            json = bladeRedis.get(REDIS_STR + id);
+            if(json == null){
+                json = new JSONObject();
+                json.set("number",files.size());
+                json.set("success",files.size());
+            }
+            json.set("status",4);
+            bladeRedis.setEx(REDIS_STR + id,json,300L);
             this.updateById(report);
+        } catch (Exception e) {
+            e.printStackTrace();
+            JSONObject json = bladeRedis.get(REDIS_STR + id);
+            if(json == null){
+                json = new JSONObject();
+            }
+            json.set("status",5);
+            json.set("error",e.getMessage());
+            bladeRedis.setEx(REDIS_STR + id,json,300L);
         }
-        Thread.sleep(3000L);
-        //生成报告,生成PDF
-        report.setStatus(3);
-        this.updateById(report);
-        String url = this.generateReportPdf(id);
-        //生成附件PDF
-        if (mapList.size() > 0) {
-            String detailPdf = this.generateReportDetailPdf(mapList);
-            List<String> PdfUrls = new ArrayList<>();
-            PdfUrls.add(url);
-            PdfUrls.add(detailPdf);
-            String localUrl = "/www/wwwroot/Users/hongchuangyanfa/Desktop/archiveExaminingPdf/123.pdf";
-//            String localUrl = "D:\\develop\\test\\123.pdf";
-            //合并pdf
-            FileUtils.mergePdfPublicMethods(PdfUrls, localUrl);
-            BladeFile bladeFile = iossClient.uploadFile("123.pdf", localUrl);
-            report.setReportPdfUrl(bladeFile.getLink());
-        } else {
-            report.setReportPdfUrl(url);
-        }
-        Thread.sleep(5000L);
-        //完成
-        report.setStatus(4);
-        this.updateById(report);
     }
 
     /**
@@ -256,11 +625,11 @@ public class ArchiveExaminingReportImpl extends BaseServiceImpl<ArchiveExamining
      * 生成检测报告PDF
      */
     private String generateReportPdf(Long id) throws DocumentException, IOException {
+
         int high = 20;
         int widthPercentage = 100;
         String uuid = StringUtil.randomUUID();
-        String localUrl = "/www/wwwroot/Users/hongchuangyanfa/Desktop/archiveExaminingPdf/";
-//        String localUrl = "D:\\develop\\test\\";
+        String localUrl = FileUtils.getSysLocalFileUrl() + "/archiveExaminingPdf/";
         //新建一个pdf文档对象,前一个参数是纸张大小,后四个为边距
         Document document = new Document(PageSize.A4, 5, 5, 30, 30);
         //建立一个书写器
@@ -422,4 +791,25 @@ public class ArchiveExaminingReportImpl extends BaseServiceImpl<ArchiveExamining
         }
         return pdfPCell;
     }
+
+    public static boolean validateWithHead(String fileUrl) {
+        try (CloseableHttpClient client = HttpClients.createDefault()) {
+            HttpHead request = new HttpHead(fileUrl);
+
+            // 设置超时配置
+            RequestConfig config = RequestConfig.custom()
+                    .setConnectTimeout(5000)
+                    .setSocketTimeout(5000)
+                    .build();
+            request.setConfig(config);
+
+            try (var response = client.execute(request)) {
+                int statusCode = response.getStatusLine().getStatusCode();
+                return statusCode >= 200 && statusCode < 300;
+            }
+        } catch (Exception e) {
+            System.out.println("验证失败: " + e.getMessage());
+            return false;
+        }
+    }
 }

+ 2 - 2
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveOfflineVersionInfoServiceImpl.java

@@ -449,8 +449,8 @@ public class ArchiveOfflineVersionInfoServiceImpl extends BaseServiceImpl<Archiv
                     pstm.setString(12, auto.getAllFilePdf() == null ? "" : auto.getAllFilePdf());
                     pstm.setLong(13, auto.getFileSize() == null ? 0L : auto.getFileSize());
                     pstm.setString(14, auto.getTreeSort() == null ? "" : auto.getTreeSort());
-                    pstm.setString(15, auto.getStartDate() == null ? "" : auto.getStartDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-                    pstm.setString(16, auto.getEndDate() == null ? "" : auto.getEndDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                    pstm.setString(15, auto.getStartDate() == null ? "" : auto.getStartDate());
+                    pstm.setString(16, auto.getEndDate() == null ? "" : auto.getEndDate());
                     pstm.setString(17, auto.getSecretLevel());
 
                     //添加批处理

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

@@ -39,6 +39,13 @@ import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 
+import org.apache.pdfbox.cos.COSName;
+import org.apache.pdfbox.io.MemoryUsageSetting;
+import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.PDPage;
+import org.apache.pdfbox.pdmodel.PDResources;
+import org.apache.pdfbox.pdmodel.graphics.PDXObject;
+import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
 import org.springblade.archive.dto.*;
 import org.springblade.archive.entity.*;
 import org.springblade.archive.mapper.ArchiveConclusionMapper;
@@ -53,7 +60,6 @@ import org.springblade.business.feign.ArchiveFileClient;
 import org.springblade.business.feign.MetadataClassificationClient;
 import org.springblade.business.feign.TaskClient;
 import org.springblade.common.utils.CommonUtil;
-import org.springblade.common.utils.DeepSeekClient;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.common.utils.SystemUtils;
 import org.springblade.core.log.exception.ServiceException;
@@ -65,8 +71,10 @@ import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.FileUtil;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.manager.entity.*;
 import org.springblade.manager.feign.ArchiveTreeContractClient;
 import org.springblade.manager.feign.ContractClient;
@@ -74,6 +82,7 @@ import org.springblade.manager.feign.ProjectClient;
 import org.springblade.manager.vo.ArchiveTreeContractVO2;
 import org.springblade.resource.feign.CommonFileClient;
 import org.springblade.resource.feign.NewIOSSClient;
+import org.springblade.system.cache.ParamCache;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
 import org.springblade.system.user.entity.User;
@@ -89,18 +98,21 @@ import org.springframework.transaction.annotation.Transactional;
 
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.math.BigDecimal;
 import java.net.URL;
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.rmi.ServerException;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.List;
@@ -677,6 +689,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		List<DictBiz> sheetSourceList = this.iDictBizClient.getList("security_level", "notRoot").getData();
 		List<DictBiz> sheetSourceList1 = this.iDictBizClient.getList("storage_period", "notRoot").getData();
 
+		// 定义目标格式的 DateTimeFormatter
+		DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");
 		pageVoList.forEach(vos -> {
 			if (StringUtils.isNotEmpty(vos.getSecretLevel())) {
 				sheetSourceList.forEach(source -> {
@@ -1717,6 +1731,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		archiveAutoPdfService.buildArchiveFrontPdfs(archivesAuto.getProjectId(), archivesAuto, waitArchiveFiles, true);
 		//生成页码
 		builtFilePageNo(archivesAuto, waitArchiveFiles);
+		archivesAuto.setColourStatus(0);
+		baseMapper.updateById(archivesAuto);
 		archiveFileClient.updateArchiveFile(waitArchiveFiles);
 	}
 
@@ -4858,7 +4874,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		for (ArchivesAutoVO4 v : value) {
 			ArchivesAuto auto = new ArchivesAuto();
 			if (config.getIndexType() == null || config.getIndexType() == 0) {
-				v.setFileNumber(v.getFileNumberPrefix() + "-" + i);
+				v.setFileNumber(v.getFileNumberPrefix() + "—" + i);
+
 			} else {
 				String prefix = v.getFileNumberPrefix();
 				int index = i; // 编号从 startNumber 开始
@@ -4871,7 +4888,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 				// 使用 %0xd 格式化数字,x 表示总长度
 				String formattedIndex = String.format("%0" + numLength + "d", index);
 				// 设置最终档号
-				v.setFileNumber(prefix + "-" + formattedIndex);
+				v.setFileNumber(prefix + "" + formattedIndex);
 			}
 			auto.setId(v.getId());
 			auto.setFileNumber(v.getFileNumber());
@@ -5364,9 +5381,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 	@Override
 	@Async
 	public Boolean atuoOCR(List<Long> idsList) throws Exception {
-		String url="/mnt/sdc/AutoPdf/";
-		//String url="D:\\AutoPdf\\";
-		//List<Long> idsList=Func.toLongList(ids);
+		//String url="/mnt/sdc/AutoPdf/";
+		String url="D:\\AutoPdf\\";
 		List<ArchivesAuto> archivesAutoList = this.list(new LambdaQueryWrapper<ArchivesAuto>().in(ArchivesAuto::getId, idsList));
 		this.update(Wrappers.<ArchivesAuto>lambdaUpdate().set(ArchivesAuto::getColourStatus, 2).in(ArchivesAuto::getId, idsList));
 		for (ArchivesAuto auto : archivesAutoList) {
@@ -5387,61 +5403,46 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 				if(b){
 					System.out.println("开始识别:"+filePath);
 					List<String> list = extractTextFromPDF(filePath);
+					System.out.println("识别完成:"+list);
 					if(!list.isEmpty()){
 						StringBuilder fileName=new StringBuilder();
 						for (String result : list) {
-							System.out.println("识别结果:"+result);
-							result=result.replaceAll("\\s+", "");
 							if(result.contains("档号")){
 								String fileNum=result.replace("档号","").replace(":","").replace(":","");
 								auto.setFileNumber(fileNum);
 							}else if(result.contains("立卷单位")){
-								String unit=result.replace("立卷单位","").replace(":","").replace(":","").replaceAll("_","");
+								String unit=result.replace("立卷单位","").replace(":","").replace(":","");
 								auto.setUnit(unit);
-							}else if (result.contains("起止日期")) {
-								String time=result.replace("起止日期","").replace(":","").replace(":","").replaceAll("_","");
+							} else if (result.contains("起止日期")) {
+								String time=result.replace("起止日期","").replace(":","").replace(":","");
 								if(result.contains("~")){
-									LocalDateTime[] localDateTimes = convertDateRange(time, "~");
-									auto.setStartDate(localDateTimes[0]);
-									auto.setEndDate(localDateTimes[1]);
+									String[] split = time.split("~");
+									auto.setStartDate(split[0]);
+									auto.setEndDate(split[1]);
 								} else if (result.contains("-")) {
-									LocalDateTime[] localDateTimes = convertDateRange(time, "-");
-									auto.setStartDate(localDateTimes[0]);
-									auto.setEndDate(localDateTimes[1]);
+									String[] split = time.split("-");
+									auto.setStartDate(split[0]);
+									auto.setEndDate(split[1]);
 								} else if (result.contains("~")) {
-									LocalDateTime[] localDateTimes = convertDateRange(time, "~");
-									auto.setStartDate(localDateTimes[0]);
-									auto.setEndDate(localDateTimes[1]);
+									String[] split = time.split("~");
+									auto.setStartDate(split[0]);
+									auto.setEndDate(split[1]);
 								}
 							} else if (result.contains("保管期限")||result.contains("保管限期")) {
-								String storageTime=result.replace("保管期限","").replace("保管限期","").replace(":","").replace(":","").replaceAll("_","");
-								if(StringUtils.isNotEmpty(storageTime)){
-									if("10年".equals(storageTime)){
-										auto.setStorageTime("1");
-									} else if("30年".equals(storageTime)){
-										auto.setStorageTime("2");
-									} else{
-										auto.setStorageTime("3");
-									}
-								}
+								String storageTime=result.replace("保管期限","").replace("保管限期","").replace(":","").replace(":","");
+								auto.setStorageTime(storageTime);
 							} else if (result.contains("密1")||result.contains("密级")) {
-								String secretLevel=result.replace("密1","").replace("密级","").replaceAll("_","");
+								String secretLevel=result.replace("密1","").replace("密级","");
 								auto.setSecretLevel(secretLevel);
 							} else {
-								if(StringUtils.isNotEmpty(result)){
-									fileName.append(result);
-									System.out.println("文件题名识别结果:"+fileName);
-								}
+								fileName.append(result);
 							}
 						}
-						System.out.println("文件题名最终结果:===================="+fileName);
-						if(StringUtils.isNotEmpty(fileName.toString())){
-							auto.setName(fileName.toString().replace("密级","").replace("级密",""));
-						}
+						auto.setName(fileName.toString());
 					}
 				}
 			}catch (Exception e){
-				e.printStackTrace();
+
 			}finally {
 				FileUtils.removeFile(filePath);
 				String updateSql="update u_archives_auto set colour_status=1 where id="+auto.getId();
@@ -5453,85 +5454,103 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 	}
 
 	public static LocalDateTime[] convertDateRange(String dateRange,String split) {
-		try {
-			String[] dates = dateRange.split(split);
+		String[] dates = dateRange.split(split);
 
-			DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
+		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
 
-			LocalDate startLocalDate = LocalDate.parse(dates[0], formatter);
-			LocalDate endLocalDate = LocalDate.parse(dates[1], formatter);
+		LocalDate startLocalDate = LocalDate.parse(dates[0], formatter);
+		LocalDate endLocalDate = LocalDate.parse(dates[1], formatter);
 
-			LocalDateTime startDateTime = startLocalDate.atStartOfDay(); // 00:00:00
-			LocalDateTime endDateTime = endLocalDate.atStartOfDay();; // 00:00:00
+		LocalDateTime startDateTime = startLocalDate.atStartOfDay(); // 00:00:00
+		LocalDateTime endDateTime = endLocalDate.atStartOfDay();; // 00:00:00
 
-			return new LocalDateTime[]{startDateTime, endDateTime};
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return new LocalDateTime[]{null, null};
+		return new LocalDateTime[]{startDateTime, endDateTime};
+	}
+	// 自定义实体类(与 JSON 结构匹配)
+	static class OcrResponse {
+		private String status;
+		private String message;
+		private List<String> lines;
+
+		public String getStatus() { return status; }
+		public void setStatus(String status) { this.status = status; }
+		public String getMessage() { return message; }
+		public void setMessage(String message) { this.message = message; }
+		public List<String> getLines() { return lines; }
+		public void setLines(List<String> lines) { this.lines = lines; }
 	}
 
 	public List<String> extractTextFromPDF(String pdfFilePath) throws IOException, InterruptedException {
-		//String PYTHON_SCRIPT_PATH = "C:\\Users\\hc01\\AppData\\Local\\Programs\\Python\\Python310\\Python\\pdfTextExtractorWindows.py";
-		//String PYTHON_INTERPRETER = "C:\\Users\\hc01\\AppData\\Local\\Programs\\Python\\Python310\\python.exe";
-		System.out.println("进入识别1");
-		String PYTHON_SCRIPT_PATH = "/www/wwwlogs/python/pdfTextExtractorWindows.py";
-		String PYTHON_INTERPRETER = "python3";
-		String[] command = {
-				PYTHON_INTERPRETER,
-				PYTHON_SCRIPT_PATH,
-				pdfFilePath
-		};
+		// 1. 配置路径(确保正确)
+		String PYTHON_SCRIPT_PATH = "C:\\Users\\hc01\\AppData\\Local\\Programs\\Python\\Python310\\Python\\pdf.py";
+		String PYTHON_INTERPRETER = "C:\\Users\\hc01\\AppData\\Local\\Programs\\Python\\Python310\\python.exe";
+
+		// 2. 构建命令
+		String[] command = {PYTHON_INTERPRETER, PYTHON_SCRIPT_PATH, pdfFilePath};
 
+		// 3. 执行进程(分离输出流)
 		Process process = new ProcessBuilder(command)
-				.redirectErrorStream(true)
+				.redirectErrorStream(false)
 				.start();
-		System.out.println("进入识别2");
-		// 读取Python输出
-		StringBuilder output = new StringBuilder();
-		try (InputStream inputStream = process.getInputStream();
-			 BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"))) {
 
+		// 4. 读取 JSON 结果(stdout)
+		StringBuilder jsonOutput = new StringBuilder();
+		try (BufferedReader reader = new BufferedReader(
+				new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8))) {
 			String line;
 			while ((line = reader.readLine()) != null) {
-				output.append(line);
+				jsonOutput.append(line.trim()); // 去除多余空格/换行
 			}
 		}
-		System.out.println("进入识别3");
+
+		// 5. 读取错误日志(stderr,用于调试)
+		StringBuilder errorOutput = new StringBuilder();
+		try (BufferedReader errorReader = new BufferedReader(
+				new InputStreamReader(process.getErrorStream(), StandardCharsets.UTF_8))) {
+			String line;
+			while ((line = errorReader.readLine()) != null) {
+				errorOutput.append(line).append("\n");
+			}
+		}
+
+		// 6. 检查进程退出码
 		int exitCode = process.waitFor();
 		if (exitCode != 0) {
-			System.out.println("进入识别4");
-			throw new RuntimeException("Python脚本执行失败,退出码: " + exitCode + ", 输出: " + output.toString());
-		}
-
-		// -------------------------- 关键修改:提取纯JSON部分 --------------------------
-		String rawOutput = output.toString();
-		// 找到JSON的起始位置(第一个'{')和结束位置(最后一个'}')
-		int jsonStart = rawOutput.indexOf('{');
-		int jsonEnd = rawOutput.lastIndexOf('}');
-		System.out.println("进入识别5");
-		if (jsonStart == -1 || jsonEnd == -1 || jsonStart >= jsonEnd) {
-			System.out.println("进入识别6");
-			throw new RuntimeException("无法提取有效的JSON结果,原始输出: " + rawOutput);
-		}
-		// 截取纯JSON字符串
-		String jsonStr = rawOutput.substring(jsonStart, jsonEnd + 1);
-		System.out.println("进入识别7");
-		// 解析清理后的JSON
+			throw new RuntimeException(
+					"Python脚本执行失败(退出码:" + exitCode + ")\n" +
+							"错误日志:" + errorOutput.toString() + "\n" +
+							"标准输出:" + jsonOutput.toString()
+			);
+		}
+
+		// 7. 解析 JSON(核心修复:用实体类直接解析)
+		String jsonStr = jsonOutput.toString();
+		if (jsonStr.isEmpty()) {
+			throw new RuntimeException("Python脚本未输出任何结果(JSON 为空)");
+		}
+
+		// 提取纯 JSON 字符串(过滤可能的前缀日志)
+		int jsonStart = jsonStr.indexOf('{');
+		int jsonEnd = jsonStr.lastIndexOf('}');
+		if (jsonStart == -1 || jsonEnd == -1) {
+			throw new RuntimeException(
+					"无法提取JSON结果,原始输出:" + jsonStr + "\n" +
+							"Python错误日志:" + errorOutput.toString()
+			);
+		}
+		jsonStr = jsonStr.substring(jsonStart, jsonEnd + 1);
+
+		// 直接解析为实体类,避免 Map 转换问题
 		Gson gson = new Gson();
-		Type type = new TypeToken<Map<String, Object>>(){}.getType();
-		Map<String, Object> resultMap = gson.fromJson(jsonStr, type);
-
-		if (!"success".equals(resultMap.get("status"))) {
-			System.out.println("进入识别8");
-			String message = (String) resultMap.get("message");
-			throw new RuntimeException("处理PDF失败: " + (message != null ? message : "未知错误"));
-		}
-		System.out.println("进入识别9");
-		Type listType = new TypeToken<List<String>>(){}.getType();
-		List< String> result = gson.fromJson(gson.toJson(resultMap.get("lines")), listType);
-		System.out.println(result);
-		return result;
+		OcrResponse ocrResponse = gson.fromJson(jsonStr, OcrResponse.class);
+
+		// 8. 校验结果状态
+		if (!"success".equals(ocrResponse.getStatus())) {
+			throw new RuntimeException("PDF处理失败: " + ocrResponse.getMessage() + "\nPython日志:" + errorOutput.toString());
+		}
+
+		// 9. 返回 List<String>(直接从实体类获取)
+		return ocrResponse.getLines();
 	}
 
 	@Scheduled(fixedDelay = 1000 * 60 * 10)
@@ -5565,7 +5584,6 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 			}
 		});
 	}
-
 	@Override
 	public String jointNomination(List<String> authId) {
 		StringBuilder sb = new StringBuilder();
@@ -5624,6 +5642,173 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		}
 		return sb.toString();
 	}
+
+	@Override
+	public Boolean updateArchivePage(List<Long> archiveIds) {
+		for (Long archiveId : archiveIds) {
+			ArchivesAuto archivesAuto = this.getById(archiveId);
+			List<ArchiveFile> files = archiveFileClient.getArchiveFileByArchivesId(archiveId+"", "");
+			if(!files.isEmpty()){
+				archivesAuto.setFileN(files.size());
+				archivesAuto.setPageN(files.stream().mapToInt(ArchiveFile::getFilePage).sum());
+				archivesAuto.setColourStatus(2);
+				baseMapper.updateById(archivesAuto);
+			}
+		}
+		return true;
+	}
+
+	@Override
+	public String saveVolume(SaveVolumeDto dto) {
+		List<Long>updateIds=new ArrayList<>();
+		ArchivesAuto archivesAuto = this.getById(dto.getArchiveId());
+		archivesAuto.setName(dto.getArchiveName());
+		updateIds.add(archivesAuto.getId());
+		if(!dto.getList().isEmpty()){
+			archivesAuto.setIsVolume(1);
+			int x=1;
+			if(archivesAuto.getAutoFileSort()==null){
+				archivesAuto.setAutoFileSort(0);
+			}
+			for (SaveVolumeDto1 saveVolumeDto1 : dto.getList()) {
+				Long archiveId;
+				if(saveVolumeDto1.getId()==null){
+					ArchivesAuto auto = new ArchivesAuto();
+					BeanUtil.copy(archivesAuto,auto);
+					auto.setId(SnowFlakeUtil.getId());
+					auto.setName(saveVolumeDto1.getArchiveName());
+					auto.setIsVolume(2);
+					String treeSort = archivesAuto.getTreeSort();
+					if (treeSort == null) {
+						auto.setTreeSort("");
+					} else {
+						// 确保字符串至少有2位
+						if (treeSort.length() >= 2) {
+							// 截取最后两位
+							String lastTwoDigits = treeSort.substring(treeSort.length() - 2);
+							try {
+								// 转换为数字并加上x
+								int lastNumber = Integer.parseInt(lastTwoDigits);
+								int newNumber = lastNumber + x;
+								// 格式化为两位数字符串
+								String newLastDigits = String.format("%02d", newNumber);
+								// 替换最后两位
+								String newTreeSort = treeSort.substring(0, treeSort.length() - 2) + newLastDigits;
+								auto.setTreeSort(newTreeSort);
+							} catch (NumberFormatException e) {
+								// 如果转换失败,保持原值
+								auto.setTreeSort(treeSort);
+							}
+						} else {
+							// 如果字符串长度不足2位,直接加上x
+							try {
+								int number = Integer.parseInt(treeSort) + x;
+								auto.setTreeSort(String.valueOf(number));
+							} catch (NumberFormatException e) {
+								auto.setTreeSort(treeSort);
+							}
+						}
+					}
+					if(archivesAuto.getAutoFileSort()!=null){
+						auto.setAutoFileSort(archivesAuto.getAutoFileSort()+x);
+					}else {
+						auto.setAutoFileSort(x);
+					}
+					auto.setCreateTime(null);
+					x++;
+					archiveId= auto.getId();
+					baseMapper.insert(auto);
+				}else {
+					archiveId=saveVolumeDto1.getId();
+					ArchivesAuto auto = this.getById(archiveId);
+					auto.setName(saveVolumeDto1.getArchiveName());
+					baseMapper.updateById(auto);
+					String update="update u_archive_file set archive_id=old_archive_id,old_archive_id=null,is_volume = 0 where archive_id="+archiveId;
+					jdbcTemplate.update(update);
+				}
+				updateIds.add(archiveId);
+				String update = "UPDATE u_archive_file SET archive_id = ?, old_archive_id = ?, is_volume = 1 WHERE id IN (" + saveVolumeDto1.getFileIds() + ")";
+				jdbcTemplate.update(update, archiveId, dto.getArchiveId());
+				String volumeIds = archivesAuto.getVolumeIds();
+				if(StringUtils.isEmpty(volumeIds)){
+					volumeIds="";
+				}
+				archivesAuto.setVolumeIds(volumeIds+archiveId+",");
+				List<ArchiveFile> files1 = archiveFileClient.getArchiveFileByArchivesId(archiveId + "", "");
+				if(!files1.isEmpty()){
+					List<Integer> sorts = files1.stream()
+							.map(file -> Optional.ofNullable(file.getSort()).orElse(0))
+							.sorted()
+							.collect(Collectors.toList());
+					List<Integer> sorts1 = files1.stream()
+							.map(file -> Optional.ofNullable(file.getArchiveSort()).orElse(0))
+							.sorted()
+							.collect(Collectors.toList());
+					String[] fileIds = saveVolumeDto1.getFileIds().split(",");
+					if(sorts.size()==fileIds.length){
+						if(fileIds.length>0){
+							for (int i = 0; i < fileIds.length; i++) {
+								String updateSql = "UPDATE u_archive_file SET sort = ? ,archive_sort=? WHERE id = ?";
+								jdbcTemplate.update(updateSql, sorts.get(i), sorts1.get(i),fileIds[i]);
+							}
+						}
+					}
+				}
+			}
+			archivesAuto.setVolumeIds(archivesAuto.getVolumeIds().substring(0,archivesAuto.getVolumeIds().length()-1));
+		}
+		baseMapper.updateById(archivesAuto);
+		this.updateArchivePage(updateIds);
+		return "操作成功";
+	}
+
+	@Override
+	public boolean removeVolume(Long archiveId, Long volumeId) {
+		ArchivesAuto auto = this.getById(archiveId);
+		if(auto.getIsVolume()==1&&StringUtils.isNotEmpty(auto.getVolumeIds())){
+			String volumeIds = auto.getVolumeIds();
+			String[] archivesAutoIds = volumeIds.split(",");
+			if(archivesAutoIds.length<=1){
+				throw new ServiceException("不能删除所有的分卷");
+			}
+			if(auto.getVolumeIds().contains(volumeId+"")){
+				if(auto.getVolumeIds().endsWith(volumeId+"")){
+					auto.setVolumeIds(auto.getVolumeIds().replace(volumeId+"",""));
+				}else {
+					auto.setVolumeIds(auto.getVolumeIds().replace(volumeId+",",""));
+				}
+				if(auto.getVolumeIds().startsWith(",")){
+					auto.setVolumeIds(auto.getVolumeIds().substring(1));
+				}
+				if(auto.getVolumeIds().endsWith(",")){
+					auto.setVolumeIds(auto.getVolumeIds().substring(0,auto.getVolumeIds().length()-1));
+				}
+				String update = "UPDATE u_archive_file SET archive_id = ?, old_archive_id = null, is_volume = 0 WHERE archive_id = ?";
+				jdbcTemplate.update(update, archiveId, volumeId);
+			}
+			baseMapper.updateById(auto);
+			this.deleteLogic(Arrays.asList(volumeId));
+			this.updateArchivePage(Arrays.asList(archiveId,volumeId));
+		}
+		return true;
+	}
+
+	@Override
+	public boolean backVolume(Long fileId){
+		ArchiveFile archiveFile = archiveFileClient.getArchiveFileById(fileId);
+		Long id=archiveFile.getArchiveId();
+		List<ArchiveFile> files = archiveFileClient.getArchiveFileByArchivesId(archiveFile.getArchiveId()+"","");
+		if(files.size()<=1){
+			throw new ServiceException("回退失败");
+		}
+		if(archiveFile.getOldArchiveId()!=null){
+			archiveFile.setArchiveId(archiveFile.getOldArchiveId());
+			archiveFile.setIsVolume(0);
+			archiveFileClient.updateById2(archiveFile);
+			this.updateArchivePage(Arrays.asList(id,archiveFile.getArchiveId()));
+		}
+		return true;
+	}
 }
 
 

+ 49 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/utils/ClamAVClientScanner.java

@@ -0,0 +1,49 @@
+package org.springblade.archive.utils;
+
+import xyz.capybara.clamav.ClamavClient;
+import xyz.capybara.clamav.commands.scan.result.ScanResult;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+/**
+ * 病毒检测类
+ * @author LHB
+ */
+public class ClamAVClientScanner {
+    private final static String IP = "192.168.0.109";
+    private final static Integer PORT = 3310;
+
+    public static boolean scanRemoteFile(String fileUrl) throws IOException {
+        // 创建ClamAV客户端,默认连接本地3310端口
+        ClamavClient client = new ClamavClient(IP, PORT);
+        // 从远程URL下载文件
+        URL url = new URL(fileUrl);
+        try (InputStream inputStream = url.openStream()) {
+            // 扫描输入流
+            ScanResult result = client.scan(inputStream);
+
+            // 根据结果类型判断
+            if (result instanceof ScanResult.OK) {
+                return true;
+            } else if (result instanceof ScanResult.VirusFound) {
+                return false;
+            } else {
+                return false;
+            }
+        }
+    }
+
+    public static boolean checkHealth() {
+        ClamavClient client = new ClamavClient(IP, PORT);
+        try {
+            client.ping();
+            System.out.println("ClamAV服务正常运行");
+            return true;
+        } catch (Exception e) {
+            System.err.println("ClamAV服务不可用: " + e.getMessage());
+            return false;
+        }
+    }
+}

+ 97 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/utils/FileAnalysisResult.java

@@ -0,0 +1,97 @@
+package org.springblade.archive.utils;
+
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+@Data
+public class FileAnalysisResult {
+    private String filePath;
+    private String remoteUrl;
+    private String format;
+    private String compressionAlgorithm;
+    private Boolean standardCompression;
+    private Set<String> nonStandardAlgorithms = new HashSet<>();
+    private Boolean encrypted;
+    private String encryptionType;
+    private List<String> issues = new ArrayList<>();
+    private long fileSize;
+    private String downloadStatus;
+
+    public FileAnalysisResult(String filePath) {
+        this.filePath = filePath;
+    }
+
+    // Getter和Setter方法
+    public void setRemoteUrl(String remoteUrl) { this.remoteUrl = remoteUrl; }
+    public void setFormat(String format) { this.format = format; }
+    public void setCompressionAlgorithm(String algorithm) { this.compressionAlgorithm = algorithm; }
+    public void setStandardCompression(boolean standard) { this.standardCompression = standard; }
+    public void setNonStandardAlgorithms(Set<String> algorithms) { this.nonStandardAlgorithms = algorithms; }
+    public void setEncrypted(boolean encrypted) { this.encrypted = encrypted; }
+    public void setEncryptionType(String encryptionType) { this.encryptionType = encryptionType; }
+    public void setFileSize(long fileSize) { this.fileSize = fileSize; }
+    public void setDownloadStatus(String status) { this.downloadStatus = status; }
+    public void addIssue(String issue) { this.issues.add(issue); }
+
+    public void printReport() {
+        System.out.println("=== 远程文件安全分析报告 ===");
+        if (remoteUrl != null) {
+            System.out.println("远程URL: " + remoteUrl);
+        }
+        System.out.println("本地临时文件: " + filePath);
+
+        if (downloadStatus != null) {
+            System.out.println("下载状态: " + downloadStatus);
+        }
+
+        if (fileSize > 0) {
+            System.out.println("文件大小: " + (fileSize / 1024) + " KB");
+        }
+
+        if (format != null) {
+            System.out.println("格式: " + format);
+            System.out.println("压缩算法: " + compressionAlgorithm);
+            System.out.println("使用标准压缩: " + (standardCompression ? "是" : "否"));
+
+            if (!standardCompression && !nonStandardAlgorithms.isEmpty()) {
+                System.out.println("非标准压缩算法:");
+                for (String algo : nonStandardAlgorithms) {
+                    System.out.println("  - " + algo);
+                }
+            }
+
+            System.out.println("是否加密: " + (encrypted ? "是" : "否"));
+            if (encrypted && encryptionType != null) {
+                System.out.println("加密类型: " + encryptionType);
+            }
+        }
+
+        if (!issues.isEmpty()) {
+            System.out.println("问题详情:");
+            for (String issue : issues) {
+                System.out.println("  ⚠️ " + issue);
+            }
+        }
+
+        System.out.println("\n安全评估: " + getSecurityAssessment());
+        System.out.println("=================================\n");
+    }
+
+    public String getSecurityAssessment() {
+        if (!standardCompression) {
+            return "❌ 高风险 - 发现非标准压缩算法";
+        }
+        if (encrypted) {
+            return "⚠️ 中风险 - 文件已加密";
+        }
+        if (!issues.isEmpty()) {
+            return "⚠️ 注意 - 存在潜在安全问题";
+        }
+        return "✅ 安全 - 文件使用标准压缩且未加密";
+    }
+}

+ 352 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/utils/FileFormatSecurityChecker.java

@@ -0,0 +1,352 @@
+package org.springblade.archive.utils;
+import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+public class FileFormatSecurityChecker {
+
+    // PDF相关常量
+    private static final byte[] PDF_HEADER = "%PDF".getBytes();
+    private static final String[] PDF_STANDARD_FILTERS = {
+            "FlateDecode", "LZWDecode", "ASCII85Decode", "ASCIIHexDecode",
+            "RunLengthDecode", "CCITTFaxDecode", "DCTDecode", "JBIG2Decode"
+    };
+
+    public static FileAnalysisResult analyzeFile(String filePath) throws IOException {
+        File file = new File(filePath);
+        if (!file.exists()) {
+            throw new FileNotFoundException("文件不存在: " + filePath);
+        }
+
+        String filename = file.getName().toLowerCase();
+        FileAnalysisResult result = new FileAnalysisResult(filePath);
+
+        if (filename.endsWith(".pdf")) {
+            return analyzePdf(file, result);
+        } else if (filename.endsWith(".xlsx")) {
+            return analyzeXlsx(file, result);
+        } else if (filename.endsWith(".png")) {
+            return analyzePng(file, result);
+        } else if (filename.endsWith(".jpg") || filename.endsWith(".jpeg")) {
+            return analyzeJpeg(file, result);
+        } else {
+            result.addIssue("不支持的文件格式");
+            return result;
+        }
+    }
+
+    // PDF文件分析
+    private static FileAnalysisResult analyzePdf(File file, FileAnalysisResult result) throws IOException {
+        result.setFormat("PDF");
+
+        byte[] fileContent = Files.readAllBytes(file.toPath());
+        String content = new String(fileContent, "ISO-8859-1");
+
+        // 1. 检查加密
+        boolean isEncrypted = checkPdfEncryption(content);
+        result.setEncrypted(isEncrypted);
+
+        // 2. 检查压缩算法
+        CompressionAnalysis compressionAnalysis = checkPdfCompression(content);
+        result.setCompressionAlgorithm(compressionAnalysis.getAlgorithm());
+        result.setStandardCompression(compressionAnalysis.isStandard());
+        result.setNonStandardAlgorithms(compressionAnalysis.getNonStandardAlgorithms());
+
+        // 3. 检查其他安全问题
+        checkPdfSecurity(content, result);
+
+        return result;
+    }
+
+    private static boolean checkPdfEncryption(String pdfContent) {
+        // 检查加密字典
+        return pdfContent.contains("/Encrypt") ||
+                pdfContent.contains("/Filter/Standard") ||
+                pdfContent.contains("/CFM/") ||
+                pdfContent.contains("/StmF/") ||
+                pdfContent.contains("/StrF/");
+    }
+
+    private static CompressionAnalysis checkPdfCompression(String pdfContent) {
+        CompressionAnalysis analysis = new CompressionAnalysis();
+        Set<String> foundAlgorithms = new HashSet<>();
+        Set<String> nonStandardAlgorithms = new HashSet<>();
+
+        // 查找所有使用的压缩过滤器
+        String[] lines = pdfContent.split("\n");
+        for (String line : lines) {
+            if (line.contains("/Filter")) {
+                // 提取过滤器名称
+                for (String filter : PDF_STANDARD_FILTERS) {
+                    if (line.contains(filter)) {
+                        foundAlgorithms.add(filter);
+                    }
+                }
+
+                // 检查非标准过滤器
+                if (line.contains("/Filter") && !containsStandardFilter(line)) {
+                    // 提取可能的非标准过滤器名称
+                    String[] parts = line.split("/");
+                    for (String part : parts) {
+                        if (part.trim().length() > 3 && !part.trim().equals("Filter")) {
+                            boolean isStandard = false;
+                            for (String stdFilter : PDF_STANDARD_FILTERS) {
+                                if (part.contains(stdFilter.replace("Decode", ""))) {
+                                    isStandard = true;
+                                    break;
+                                }
+                            }
+                            if (!isStandard) {
+                                nonStandardAlgorithms.add(part.trim());
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        // 设置结果
+        if (!foundAlgorithms.isEmpty()) {
+            analysis.setAlgorithm(String.join(", ", foundAlgorithms));
+        } else {
+            analysis.setAlgorithm("未压缩或未知压缩");
+        }
+
+        analysis.setStandard(nonStandardAlgorithms.isEmpty());
+        analysis.setNonStandardAlgorithms(nonStandardAlgorithms);
+
+        return analysis;
+    }
+
+    private static boolean containsStandardFilter(String line) {
+        for (String filter : PDF_STANDARD_FILTERS) {
+            if (line.contains(filter)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private static void checkPdfSecurity(String pdfContent, FileAnalysisResult result) {
+        // 检查JavaScript(可能的安全风险)
+        if (pdfContent.contains("/JavaScript") || pdfContent.contains("/JS")) {
+            result.addIssue("包含JavaScript代码");
+        }
+
+        // 检查外部引用
+        if (pdfContent.contains("/Launch") || pdfContent.contains("/URI")) {
+            result.addIssue("包含外部引用或启动动作");
+        }
+    }
+
+    // XLSX文件分析
+    private static FileAnalysisResult analyzeXlsx(File file, FileAnalysisResult result) throws IOException {
+        result.setFormat("XLSX");
+
+        try (ZipFile zipFile = new ZipFile(file)) {
+            Enumeration<? extends ZipEntry> entries = zipFile.entries();
+
+            // 1. 检查加密
+            boolean isEncrypted = checkXlsxEncryption(zipFile);
+            result.setEncrypted(isEncrypted);
+
+            // 2. 检查压缩算法
+            CompressionAnalysis compressionAnalysis = checkXlsxCompression(zipFile);
+            result.setCompressionAlgorithm(compressionAnalysis.getAlgorithm());
+            result.setStandardCompression(compressionAnalysis.isStandard());
+            result.setNonStandardAlgorithms(compressionAnalysis.getNonStandardAlgorithms());
+
+            // 3. 检查其他安全问题
+            checkXlsxSecurity(zipFile, result);
+        }
+
+        return result;
+    }
+
+    private static boolean checkXlsxEncryption(ZipFile zipFile) {
+        return zipFile.getEntry("EncryptedPackage") != null ||
+                zipFile.getEntry("EncryptionInfo") != null ||
+                zipFile.getEntry("encryption") != null;
+    }
+
+    private static CompressionAnalysis checkXlsxCompression(ZipFile zipFile) {
+        CompressionAnalysis analysis = new CompressionAnalysis();
+        Set<String> nonStandardAlgorithms = new HashSet<>();
+
+        Enumeration<? extends ZipEntry> entries = zipFile.entries();
+        while (entries.hasMoreElements()) {
+            ZipEntry entry = entries.nextElement();
+            int method = entry.getMethod();
+
+            // ZIP标准压缩方法
+            if (method != ZipEntry.STORED && method != ZipEntry.DEFLATED) {
+                nonStandardAlgorithms.add("ZIP压缩方法: " + method);
+            }
+        }
+
+        analysis.setAlgorithm("DEFLATE (标准ZIP压缩)");
+        analysis.setStandard(nonStandardAlgorithms.isEmpty());
+        analysis.setNonStandardAlgorithms(nonStandardAlgorithms);
+
+        return analysis;
+    }
+
+    private static void checkXlsxSecurity(ZipFile zipFile, FileAnalysisResult result) {
+        // 检查宏
+        if (zipFile.getEntry("xl/vbaProject.bin") != null) {
+            result.addIssue("包含VBA宏");
+        }
+
+        // 检查外部链接
+        try {
+            ZipEntry externalLinks = zipFile.getEntry("xl/externalLinks/");
+            if (externalLinks != null) {
+                result.addIssue("包含外部链接");
+            }
+        } catch (Exception e) {
+            // 忽略
+        }
+    }
+
+    // PNG文件分析
+    private static FileAnalysisResult analyzePng(File file, FileAnalysisResult result) throws IOException {
+        result.setFormat("PNG");
+        result.setEncrypted(false); // PNG不支持加密
+
+        byte[] data = Files.readAllBytes(file.toPath());
+
+        // 1. 检查文件头
+        if (!isValidPngHeader(data)) {
+            result.addIssue("无效的PNG文件头");
+            return result;
+        }
+
+        // 2. 检查压缩算法
+        CompressionAnalysis compressionAnalysis = checkPngCompression(data);
+        result.setCompressionAlgorithm(compressionAnalysis.getAlgorithm());
+        result.setStandardCompression(compressionAnalysis.isStandard());
+        result.setNonStandardAlgorithms(compressionAnalysis.getNonStandardAlgorithms());
+
+        return result;
+    }
+
+    private static boolean isValidPngHeader(byte[] data) {
+        // PNG文件头: 89 50 4E 47 0D 0A 1A 0A
+        return data.length >= 8 &&
+                data[0] == (byte)0x89 &&
+                data[1] == 0x50 &&
+                data[2] == 0x4E &&
+                data[3] == 0x47 &&
+                data[4] == 0x0D &&
+                data[5] == 0x0A &&
+                data[6] == 0x1A &&
+                data[7] == 0x0A;
+    }
+
+    private static CompressionAnalysis checkPngCompression(byte[] data) {
+        CompressionAnalysis analysis = new CompressionAnalysis();
+
+        // 在IHDR块后查找压缩方法
+        // PNG压缩方法位于第12个字节(从0开始),但需要找到IDAT块
+        for (int i = 8; i < data.length - 4; i++) {
+            // 查找IDAT块
+            if (data[i] == 'I' && data[i+1] == 'D' && data[i+2] == 'A' && data[i+3] == 'T') {
+                // IDAT块中的压缩方法通常是DEFLATE
+                // PNG标准只允许使用DEFLATE压缩
+                analysis.setAlgorithm("DEFLATE");
+                analysis.setStandard(true);
+                return analysis;
+            }
+        }
+
+        // 如果找不到IDAT块,检查是否有非标准块
+        analysis.setAlgorithm("未知");
+        analysis.setStandard(false);
+        analysis.addNonStandardAlgorithm("无法识别标准压缩块");
+
+        return analysis;
+    }
+
+    // JPEG文件分析
+    private static FileAnalysisResult analyzeJpeg(File file, FileAnalysisResult result) throws IOException {
+        result.setFormat("JPEG");
+        result.setEncrypted(false); // JPEG不支持加密
+
+        byte[] data = Files.readAllBytes(file.toPath());
+
+        // 1. 检查文件头
+        if (!isValidJpegHeader(data)) {
+            result.addIssue("无效的JPEG文件头");
+            return result;
+        }
+
+        // 2. 检查压缩算法
+        CompressionAnalysis compressionAnalysis = checkJpegCompression(data);
+        result.setCompressionAlgorithm(compressionAnalysis.getAlgorithm());
+        result.setStandardCompression(compressionAnalysis.isStandard());
+        result.setNonStandardAlgorithms(compressionAnalysis.getNonStandardAlgorithms());
+
+        return result;
+    }
+
+    private static boolean isValidJpegHeader(byte[] data) {
+        // JPEG文件头: FF D8
+        return data.length >= 2 &&
+                data[0] == (byte)0xFF &&
+                data[1] == (byte)0xD8;
+    }
+
+    private static CompressionAnalysis checkJpegCompression(byte[] data) {
+        CompressionAnalysis analysis = new CompressionAnalysis();
+
+        // JPEG使用标准的DCT和Huffman编码
+        // 检查是否有非标准标记
+        Set<String> nonStandardAlgorithms = new HashSet<>();
+
+        for (int i = 0; i < data.length - 1; i++) {
+            if (data[i] == (byte)0xFF) {
+                int marker = data[i + 1] & 0xFF;
+
+                // 检查非标准或保留的标记
+                if (marker >= 0x02 && marker <= 0xBF && marker != 0x00) {
+                    // 这些是标准标记范围,但某些特定值可能表示非标准扩展
+                    if (marker == 0xFF || marker == 0x00) {
+                        // 无效标记
+                        nonStandardAlgorithms.add("无效JPEG标记: 0x" + Integer.toHexString(marker));
+                    }
+                }
+            }
+        }
+
+        analysis.setAlgorithm("DCT + Huffman (标准JPEG压缩)");
+        analysis.setStandard(nonStandardAlgorithms.isEmpty());
+        analysis.setNonStandardAlgorithms(nonStandardAlgorithms);
+
+        return analysis;
+    }
+}
+
+// 压缩分析结果类
+class CompressionAnalysis {
+    private String algorithm;
+    private boolean isStandard;
+    private Set<String> nonStandardAlgorithms = new HashSet<>();
+
+    // getter和setter方法
+    public String getAlgorithm() { return algorithm; }
+    public void setAlgorithm(String algorithm) { this.algorithm = algorithm; }
+
+    public boolean isStandard() { return isStandard; }
+    public void setStandard(boolean standard) { isStandard = standard; }
+
+    public Set<String> getNonStandardAlgorithms() { return nonStandardAlgorithms; }
+    public void setNonStandardAlgorithms(Set<String> nonStandardAlgorithms) {
+        this.nonStandardAlgorithms = nonStandardAlgorithms;
+    }
+    public void addNonStandardAlgorithm(String algorithm) {
+        this.nonStandardAlgorithms.add(algorithm);
+    }
+}

+ 33 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/utils/RemoteFileExtension.java

@@ -0,0 +1,33 @@
+package org.springblade.archive.utils;
+
+import java.net.URL;
+import java.nio.file.Paths;
+
+/**
+ * @author LHB
+ */
+public class RemoteFileExtension {
+    public static String getFileExtensionFromUrl(String fileUrl) {
+        try {
+            URL url = new URL(fileUrl);
+            String path = url.getPath();
+
+            // 处理可能包含查询参数的情况
+            int questionMarkIndex = path.indexOf('?');
+            if (questionMarkIndex != -1) {
+                path = path.substring(0, questionMarkIndex);
+            }
+
+            // 使用 Paths 获取文件名并提取后缀
+            String fileName = Paths.get(path).getFileName().toString();
+
+            int lastDotIndex = fileName.lastIndexOf('.');
+            if (lastDotIndex > 0 && lastDotIndex < fileName.length() - 1) {
+                return fileName.substring(lastDotIndex + 1).toLowerCase();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "";
+    }
+}

+ 306 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/utils/RemoteFileMD5Calculator.java

@@ -0,0 +1,306 @@
+package org.springblade.archive.utils;
+
+import lombok.Data;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class RemoteFileMD5Calculator {
+
+    private static final int BUFFER_SIZE = 64 * 1024; // 64KB
+    private static final int CONNECT_TIMEOUT = 10000; // 10秒
+    private static final int READ_TIMEOUT = 30000; // 30秒
+
+    /**
+     * 下载远程文件并计算MD5
+     */
+    public static MD5Result calculateRemoteFileMD5(String fileUrl) {
+        return calculateRemoteFileMD5(fileUrl, null);
+    }
+
+    public static MD5Result calculateRemoteFileMD5(String fileUrl, ProgressListener progressListener) {
+        HttpURLConnection connection = null;
+        InputStream inputStream = null;
+
+        try {
+            URL url = new URL(fileUrl);
+            connection = (HttpURLConnection) url.openConnection();
+            connection.setRequestMethod("GET");
+            connection.setConnectTimeout(CONNECT_TIMEOUT);
+            connection.setReadTimeout(READ_TIMEOUT);
+
+            // 设置请求头
+            connection.setRequestProperty("User-Agent",
+                    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36");
+
+            int responseCode = connection.getResponseCode();
+            if (responseCode != HttpURLConnection.HTTP_OK) {
+                return new MD5Result(null, false, "HTTP错误: " + responseCode + " - " + connection.getResponseMessage(),0);
+            }
+
+            long contentLength = connection.getContentLengthLong();
+            String contentType = connection.getContentType();
+
+            System.out.println("开始下载文件: " + fileUrl);
+            System.out.println("文件大小: " + formatFileSize(contentLength));
+            System.out.println("Content-Type: " + contentType);
+
+            inputStream = connection.getInputStream();
+            MessageDigest md = MessageDigest.getInstance("MD5");
+
+            byte[] buffer = new byte[BUFFER_SIZE];
+            int bytesRead;
+            long totalBytesRead = 0;
+            long lastProgressUpdate = 0;
+
+            if (progressListener != null) {
+                progressListener.onStart(contentLength);
+            }
+
+            while ((bytesRead = inputStream.read(buffer)) != -1) {
+                md.update(buffer, 0, bytesRead);
+                totalBytesRead += bytesRead;
+
+                // 更新进度
+                if (progressListener != null) {
+                    long currentTime = System.currentTimeMillis();
+                    if (totalBytesRead - lastProgressUpdate >= 1024 * 1024 || // 每1MB更新一次
+                            totalBytesRead == contentLength) {
+
+                        double progress = contentLength > 0 ?
+                                (double) totalBytesRead / contentLength * 100 : 0;
+                        long elapsedTime = currentTime - progressListener.getStartTime();
+                        double speed = elapsedTime > 0 ?
+                                (double) totalBytesRead / elapsedTime * 1000 : 0;
+
+                        progressListener.onProgress(totalBytesRead, contentLength, progress, speed);
+                        lastProgressUpdate = totalBytesRead;
+                    }
+                }
+            }
+
+            byte[] digest = md.digest();
+            String md5Hash = bytesToHex(digest);
+
+            if (progressListener != null) {
+                progressListener.onComplete(md5Hash, totalBytesRead);
+            }
+
+            return new MD5Result(md5Hash, true, "下载并计算成功", contentLength);
+
+        } catch (Exception e) {
+            return new MD5Result(null, false, "错误: " + e.getMessage(), 0);
+        } finally {
+            if (inputStream != null) {
+                try {
+                    inputStream.close();
+                } catch (IOException e) {
+                    System.err.println("关闭输入流时出错: " + e.getMessage());
+                }
+            }
+            if (connection != null) {
+                connection.disconnect();
+            }
+        }
+    }
+
+    /**
+     * 获取远程文件的MD5(如果服务器提供ETag或Content-MD5头部)
+     */
+    public static MD5Result getRemoteFileMD5FromHeaders(String fileUrl) {
+        HttpURLConnection connection = null;
+
+        try {
+            URL url = new URL(fileUrl);
+            connection = (HttpURLConnection) url.openConnection();
+            connection.setRequestMethod("HEAD"); // 只请求头部信息
+            connection.setConnectTimeout(CONNECT_TIMEOUT);
+            connection.setReadTimeout(READ_TIMEOUT);
+
+            connection.setRequestProperty("User-Agent",
+                    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36");
+
+            int responseCode = connection.getResponseCode();
+            if (responseCode != HttpURLConnection.HTTP_OK) {
+                return new MD5Result(null, false,
+                        "HTTP错误: " + responseCode + " - " + connection.getResponseMessage());
+            }
+
+            // 检查常见的MD5相关头部
+            String etag = connection.getHeaderField("ETag");
+            String contentMD5 = connection.getHeaderField("Content-MD5");
+            String contentLength = connection.getHeaderField("Content-Length");
+
+            System.out.println("ETag: " + etag);
+            System.out.println("Content-MD5: " + contentMD5);
+            System.out.println("Content-Length: " + contentLength);
+
+            // 尝试从ETag提取MD5(常见格式:"md5-hash" 或 "md5-hash-extra")
+            if (etag != null) {
+                // 移除引号
+                etag = etag.replace("\"", "");
+
+                // 检查是否是MD5格式(32位十六进制)
+                if (etag.matches("[a-fA-F0-9]{32}")) {
+                    return new MD5Result(etag.toLowerCase(), true,
+                            "从ETag头部获取", Long.parseLong(contentLength != null ? contentLength : "0"));
+                }
+
+                // 检查是否包含MD5(如:"5d41402abc4b2a76b9719d911017c592-gzip")
+                if (etag.length() >= 32) {
+                    String possibleMD5 = etag.substring(0, 32);
+                    if (possibleMD5.matches("[a-fA-F0-9]{32}")) {
+                        return new MD5Result(possibleMD5.toLowerCase(), true,
+                                "从ETag提取", Long.parseLong(contentLength != null ? contentLength : "0"));
+                    }
+                }
+            }
+
+            // 直接使用Content-MD5(需要Base64解码)
+            if (contentMD5 != null) {
+                try {
+                    byte[] md5Bytes = java.util.Base64.getDecoder().decode(contentMD5);
+                    String md5Hash = bytesToHex(md5Bytes);
+                    return new MD5Result(md5Hash, true,
+                            "从Content-MD5头部获取", Long.parseLong(contentLength != null ? contentLength : "0"));
+                } catch (IllegalArgumentException e) {
+                    System.out.println("Content-MD5 Base64解码失败: " + e.getMessage());
+                }
+            }
+
+            return new MD5Result(null, false,
+                    "服务器未提供MD5信息", Long.parseLong(contentLength != null ? contentLength : "0"));
+
+        } catch (Exception e) {
+            return new MD5Result(null, false, "错误: " + e.getMessage(), 0);
+        } finally {
+            if (connection != null) {
+                connection.disconnect();
+            }
+        }
+    }
+
+    /**
+     * 字节数组转十六进制字符串
+     */
+    private static String bytesToHex(byte[] bytes) {
+        StringBuilder hexString = new StringBuilder(bytes.length * 2);
+        for (byte b : bytes) {
+            String hex = Integer.toHexString(0xff & b);
+            if (hex.length() == 1) {
+                hexString.append('0');
+            }
+            hexString.append(hex);
+        }
+        return hexString.toString();
+    }
+
+    /**
+     * 格式化文件大小
+     */
+    private static String formatFileSize(long size) {
+        if (size < 1024) return size + " B";
+        if (size < 1024 * 1024) return String.format("%.2f KB", size / 1024.0);
+        if (size < 1024 * 1024 * 1024) return String.format("%.2f MB", size / (1024.0 * 1024.0));
+        return String.format("%.2f GB", size / (1024.0 * 1024.0 * 1024.0));
+    }
+
+    /**
+     * 进度监听器接口
+     */
+    public interface ProgressListener {
+        void onStart(long totalSize);
+        void onProgress(long bytesRead, long totalSize, double progress, double speedBytesPerSec);
+        void onComplete(String md5Hash, long totalBytesProcessed);
+        long getStartTime();
+    }
+
+    /**
+     * 默认进度监听器
+     */
+    public static class DefaultProgressListener implements ProgressListener {
+        private long startTime;
+
+        @Override
+        public void onStart(long totalSize) {
+            this.startTime = System.currentTimeMillis();
+            System.out.println("开始下载,文件大小: " + formatFileSize(totalSize));
+        }
+
+        @Override
+        public void onProgress(long bytesRead, long totalSize, double progress, double speedBytesPerSec) {
+            String progressBar = createProgressBar(progress, 20);
+            System.out.printf("\r%s [%s] %.2f%% | 速度: %s/s",
+                    progressBar,
+                    formatFileSize(bytesRead) + "/" + formatFileSize(totalSize),
+                    progress,
+                    formatFileSize((long) speedBytesPerSec));
+        }
+
+        @Override
+        public void onComplete(String md5Hash, long totalBytesProcessed) {
+            long endTime = System.currentTimeMillis();
+            long elapsedTime = endTime - startTime;
+            System.out.printf("\n下载完成! 耗时: %.2f秒 | MD5: %s\n",
+                    elapsedTime / 1000.0, md5Hash);
+        }
+
+        @Override
+        public long getStartTime() {
+            return startTime;
+        }
+
+        private String createProgressBar(double progress, int length) {
+            int filledLength = (int) (progress / 100 * length);
+            StringBuilder bar = new StringBuilder();
+            for (int i = 0; i < length; i++) {
+                if (i < filledLength) {
+                    bar.append("=");
+                } else if (i == filledLength) {
+                    bar.append(">");
+                } else {
+                    bar.append(" ");
+                }
+            }
+            return bar.toString();
+        }
+    }
+
+    /**
+     * MD5计算结果封装
+     */
+    @Data
+    public static class MD5Result {
+        public final String md5Hash;
+        public final boolean success;
+        public final String message;
+        public final long fileSize;
+
+        public MD5Result(String md5Hash, boolean success, String message, long fileSize) {
+            this.md5Hash = md5Hash;
+            this.success = success;
+            this.message = message;
+            this.fileSize = fileSize;
+        }
+        public MD5Result(String md5Hash, boolean success, String message) {
+            this.md5Hash = md5Hash;
+            this.success = success;
+            this.message = message;
+            this.fileSize = 0;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder sb = new StringBuilder();
+            sb.append("=== 远程文件MD5计算结果 ===\n");
+            sb.append("文件大小: ").append(formatFileSize(fileSize)).append("\n");
+            sb.append("计算状态: ").append(success ? "成功" : "失败").append("\n");
+            sb.append("MD5值: ").append(md5Hash != null ? md5Hash : "N/A").append("\n");
+            sb.append("信息: ").append(message);
+            return sb.toString();
+        }
+    }
+}

+ 114 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/utils/RemoteFileSecurityChecker.java

@@ -0,0 +1,114 @@
+package org.springblade.archive.utils;
+
+import java.io.*;
+import java.net.*;
+import java.nio.file.*;
+import java.util.*;
+import java.util.zip.ZipFile;
+
+public class RemoteFileSecurityChecker {
+
+    // 临时文件目录
+    private static final String TEMP_DIR = System.getProperty("java.io.tmpdir") + "/file-security-check/";
+
+    static {
+        // 创建临时目录
+        new File(TEMP_DIR).mkdirs();
+    }
+
+    /**
+     * 分析远程文件
+     */
+    public static FileAnalysisResult analyzeRemoteFile(String fileUrl) throws IOException {
+        System.out.println("开始分析远程文件: " + fileUrl);
+        File tempFile = null;
+        // 下载文件到临时位置
+        if(fileUrl.contains("http")){
+            tempFile = downloadRemoteFile(fileUrl);
+        }else{
+            tempFile = new File(fileUrl);
+        }
+
+        try {
+            // 使用原有的分析逻辑
+            FileAnalysisResult result = FileFormatSecurityChecker.analyzeFile(tempFile.getAbsolutePath());
+            result.setRemoteUrl(fileUrl);
+            return result;
+        } finally {
+            // 清理临时文件
+            if (tempFile.exists()) {
+                tempFile.delete();
+            }
+        }
+    }
+
+    /**
+     * 下载远程文件到临时位置
+     */
+    private static File downloadRemoteFile(String fileUrl) throws IOException {
+        URL url = new URL(fileUrl);
+        String filename = extractFilenameFromUrl(fileUrl);
+        File tempFile = new File(TEMP_DIR + System.currentTimeMillis() + "_" + filename);
+
+        System.out.println("下载文件到: " + tempFile.getAbsolutePath());
+
+        try (InputStream in = url.openStream();
+             FileOutputStream out = new FileOutputStream(tempFile)) {
+
+            byte[] buffer = new byte[8192];
+            int bytesRead;
+            long totalBytes = 0;
+
+            while ((bytesRead = in.read(buffer)) != -1) {
+                out.write(buffer, 0, bytesRead);
+                totalBytes += bytesRead;
+
+                // 文件大小限制检查(可选)
+                if (totalBytes > 1 * 1024 * 1024 * 1024) { // 1024MB限制
+                    throw new IOException("文件大小超过限制(1024MB)");
+                }
+            }
+        }
+
+        return tempFile;
+    }
+
+    /**
+     * 从URL中提取文件名
+     */
+    private static String extractFilenameFromUrl(String fileUrl) {
+        try {
+            URL url = new URL(fileUrl);
+            String path = url.getPath();
+            if (path.contains("/")) {
+                return path.substring(path.lastIndexOf("/") + 1);
+            }
+            return path;
+        } catch (MalformedURLException e) {
+            // 如果URL解析失败,尝试直接从字符串提取
+            String[] parts = fileUrl.split("/");
+            return parts[parts.length - 1];
+        }
+    }
+
+    /**
+     * 批量分析远程文件
+     */
+    public static List<FileAnalysisResult> analyzeMultipleRemoteFiles(List<String> fileUrls) {
+        List<FileAnalysisResult> results = new ArrayList<>();
+
+        for (String fileUrl : fileUrls) {
+            try {
+                FileAnalysisResult result = analyzeRemoteFile(fileUrl);
+                results.add(result);
+            } catch (Exception e) {
+                FileAnalysisResult errorResult = new FileAnalysisResult(fileUrl);
+                errorResult.addIssue("下载或分析失败: " + e.getMessage());
+                errorResult.setRemoteUrl(fileUrl);
+                results.add(errorResult);
+            }
+        }
+
+        return results;
+    }
+}

+ 25 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/ArchiveFileController.java

@@ -12,6 +12,8 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
 
 import org.apache.commons.lang.StringUtils;
+import org.springblade.business.dto.VolumeDto1;
+import org.springblade.business.dto.VolumeDto3;
 import org.springblade.business.entity.MessageWarning;
 import org.springblade.business.entity.Task;
 import org.springblade.business.entity.TaskParallel;
@@ -42,6 +44,7 @@ import org.springblade.manager.vo.ArchiveTreeVO2;
 import org.springblade.system.entity.Role;
 import org.springblade.system.feign.ISysClient;
 import org.springframework.beans.BeanUtils;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RequestParam;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -532,4 +535,26 @@ public class ArchiveFileController extends BladeController {
     }
 
 
+    //@Scheduled(cron = "0 04 10 * * ?")
+    @GetMapping("/flushArchiveFileSort")
+    public void flushArchiveFileSort(){
+        Long projectId=1935614356128206849L;
+        archiveFileService.flushArchiveFileSort(projectId);
+    }
+
+    @GetMapping("/selectVolumeAfter")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "查询分卷之后的文件")
+    public R<List<VolumeDto1>> selectVolumeAfter(@RequestParam Long archiveId){
+        List<VolumeDto1> list = archiveFileService.selectVolumeAfter(archiveId);
+        return R.data(list);
+    }
+
+    @GetMapping("/selectVolumeBefore")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "查询分卷之前的文件")
+    public R<VolumeDto3> selectVolumeBefore(@RequestParam Long archiveId,Integer type){
+        VolumeDto3 dto = archiveFileService.selectVolumeBefore(archiveId,type);
+        return R.data(dto);
+    }
 }

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

@@ -4395,9 +4395,10 @@ public R<Boolean> saveContractTreeNode(@RequestBody AddContractTreeNodeVO vo) {
                 //if (Optional.ofNullable(half.getNodeType()).orElse(7) <= 6) {
                     newData.setIsTypePrivatePid(half.getPKeyId());
                 //}
+                //2025年12月05日10:18更改需求,需要与项目级一致
                 if (half.getType() != null && new Integer("2").equals(half.getType())) {
                     //2023年8月1日14:41:03更改需求,isBussShow默认=1
-                    newData.setIsBussShow(1);
+                    newData.setIsBussShow(half.getDefaultConceal() + 1);
                 }
 
                 //获取当前所有复制的节点的最大sort

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

@@ -474,6 +474,11 @@ public class ArchiveFileClientImpl implements ArchiveFileClient {
         iArchiveFileService.saveBatch(list);
     }
 
+    @Override
+    public ArchiveFile getArchiveFileById(Long fileId) {
+        return iArchiveFileService.getById(fileId);
+    }
+
     @Override
     public Integer selectMaxSortByContractId(Long contractId) {
         return iArchiveFileService.selectMaxSortByContractId(contractId);

+ 2 - 0
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ContractLogClientImpl.java

@@ -19,6 +19,7 @@ import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.feign.WbsTreePrivateClient;
+import org.springblade.resource.feign.NewIOSSClient;
 import org.springframework.beans.BeanUtils;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.web.bind.annotation.RestController;
@@ -39,6 +40,7 @@ public class ContractLogClientImpl implements ContractLogClient {
 
     private final WbsTreePrivateClient wbsTreePrivateClient;
     private final JdbcTemplate jdbcTemplate;
+    private final NewIOSSClient newIOSSClient;
 
     @Override
     public List<JSONObject> queryContractLogWbsByBusinessId(String businessId) {

+ 7 - 0
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/MetadataClassificationClientImpl.java

@@ -8,6 +8,8 @@ import org.springblade.business.vo.MetadataClassificationVO;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -42,4 +44,9 @@ public class MetadataClassificationClientImpl implements MetadataClassificationC
     public boolean createMetadataFiles(List<Long> fileIds){
         return iMetadataClassificationService.createMetadataFiles(fileIds, 0);
     }
+
+    @Override
+    public List<HashMap<String, Object>> getMetadaFileByFileId(Long id) {
+        return iMetadataClassificationService.getMetadaFileByFileId(id);
+    }
 }

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

@@ -18,6 +18,8 @@ package org.springblade.business.service;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import org.springblade.business.dto.VolumeDto1;
+import org.springblade.business.dto.VolumeDto3;
 import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.vo.ArchiveFileVO;
 import org.springblade.core.mp.base.BaseService;
@@ -79,4 +81,10 @@ public interface IArchiveFileService extends BaseService<ArchiveFile> {
     boolean sortByFileTime(Long nodeId);
 
     Integer selectMaxSortByContractId(Long contractId);
+
+    void flushArchiveFileSort(Long projectId);
+
+    List<VolumeDto1> selectVolumeAfter(Long archiveId);
+
+    VolumeDto3 selectVolumeBefore(Long archiveId,Integer type);
 }

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

@@ -5,6 +5,7 @@ import org.springblade.business.entity.MetadataClassification;
 import org.springblade.business.vo.MetadataClassificationVO;
 import org.springblade.core.mp.base.BaseService;
 
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -28,4 +29,6 @@ public interface IMetadataClassificationService extends BaseService<MetadataClas
     List<MetadataClassification> getMetadataClassification();
 
     boolean createMetadataFiles(List<Long> fileIds, Integer type);
+
+    List<HashMap<String, Object>> getMetadaFileByFileId(Long id);
 }

+ 129 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ArchiveFileServiceImpl.java

@@ -2,12 +2,22 @@ package org.springblade.business.service.impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
 import org.apache.commons.lang.StringUtils;
+import org.springblade.archive.entity.ArchivesAuto;
+import org.springblade.archive.feign.ArchiveAutoClient;
 import org.springblade.archive.feign.ArchiveInspectionInfoClient;
+import org.springblade.business.dto.VolumeDto1;
+import org.springblade.business.dto.VolumeDto2;
+import org.springblade.business.dto.VolumeDto3;
+import org.springblade.business.dto.VolumeDto4;
 import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.entity.Task;
 import org.springblade.business.entity.TaskParallel;
+import org.springblade.business.utils.DigestUtil;
 import org.springblade.business.vo.ArchiveFileVO;
 import org.springblade.business.mapper.ArchiveFileMapper;
 import org.springblade.business.service.IArchiveFileService;
@@ -15,9 +25,12 @@ import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.manager.entity.ArchiveTreeContract;
+import org.springblade.manager.feign.ArchiveTreeContractClient;
 import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
@@ -46,6 +59,8 @@ public class ArchiveFileServiceImpl extends BaseServiceImpl<ArchiveFileMapper, A
 
     private final ArchiveInspectionInfoClient archiveInspectionInfoClient;
     private final JdbcTemplate jdbcTemplate;
+    private final ArchiveTreeContractClient archiveTreeContractClient;
+    private final ArchiveAutoClient archiveAutoClient;
 
 
     @Override
@@ -129,6 +144,7 @@ public class ArchiveFileServiceImpl extends BaseServiceImpl<ArchiveFileMapper, A
         this.saveBatch(JSONArray.parseArray(JSONObject.toJSONString(list), ArchiveFile.class));
     }
 
+
     @Override
     public void updateArchiveFileSort(List<ArchiveFileVO> list) {
         List<Integer> listInt = new ArrayList<>();
@@ -149,6 +165,20 @@ public class ArchiveFileServiceImpl extends BaseServiceImpl<ArchiveFileMapper, A
                 if (list.get(i).getRectification() != null && list.get(i).getRectification() == 1) {
                     list.get(i).setRectification(2);
                 }
+                try {
+                    if (list.get(i).getFileUrl() != null) {
+                        list.get(i).setFileMd5(DigestUtil.md5OfUrl(list.get(i).getFileUrl()));
+                    }
+                    if (list.get(i).getPdfFileUrl() != null) {
+                        if (Objects.equals(list.get(i).getPdfFileUrl(), list.get(i).getFileUrl())) {
+                            list.get(i).setPdfMd5(list.get(i).getFileMd5());
+                        } else {
+                            list.get(i).setPdfMd5(DigestUtil.md5OfUrl(list.get(i).getPdfFileUrl()));
+                        }
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
             }
         }
         // 删除oss文件
@@ -223,7 +253,6 @@ public class ArchiveFileServiceImpl extends BaseServiceImpl<ArchiveFileMapper, A
         }
         this.updateBatchById(JSONArray.parseArray(JSONObject.toJSONString(list), ArchiveFile.class));
     }
-
     @Override
     public boolean updateArchiveFileByBoxName(Map<String, Object> jsons) {
         List<Object> list = (List<Object>) jsons.get("list");
@@ -369,4 +398,103 @@ public class ArchiveFileServiceImpl extends BaseServiceImpl<ArchiveFileMapper, A
     public Integer selectMaxSortByContractId(Long contractId) {
         return baseMapper.selectMaxSortByContractId(contractId);
     }
+
+    @Override
+    public void flushArchiveFileSort(Long projectId) {
+        List<ArchiveFile>archileFileList=baseMapper.selectArchiveFileByProjectId(projectId);
+        Map<String, List<ArchiveFile>> archiveMap = archileFileList.stream().collect(Collectors.groupingBy(ArchiveFile::getNodeId));
+        List<Long> NodeIds = archileFileList.stream()
+                .map(ArchiveFile::getNodeId)
+                .map(Long::parseLong)
+                .distinct()
+                .collect(Collectors.toList());
+        List<ArchiveTreeContract> sortIds = archiveTreeContractClient.getArchiveTreeContractListByListOrderByTreeSort(NodeIds);
+        int sort=10100001;
+        for (ArchiveTreeContract nodeId : sortIds) {
+            if(archiveMap.containsKey(nodeId.getId().toString())){
+                List<ArchiveFile> archiveFiles = archiveMap.get(nodeId.getId().toString());
+                if (archiveFiles != null) {
+                    archiveFiles = archiveFiles.stream()
+                            .sorted(Comparator.comparing(ArchiveFile::getSort, Comparator.nullsLast(Integer::compareTo)))
+                            .collect(Collectors.toList());
+                    for (ArchiveFile archiveFile : archiveFiles) {
+                        archiveFile.setSort(sort++);
+                    }
+                }
+            }
+        }
+        int i=1;
+        for (ArchiveFile file : archileFileList) {
+            this.update(Wrappers.<ArchiveFile>lambdaUpdate()
+                    .set(ArchiveFile::getSort, file.getSort())
+                    .eq(ArchiveFile::getId, file.getId()));
+            System.out.println("归档文件排序进度:" + i + "/" + archileFileList.size());
+            i++;
+        }
+        System.out.println("归档文件排序成功");
+    }
+
+    @Override
+    public List<VolumeDto1> selectVolumeAfter(Long archiveId) {
+        List<VolumeDto1> list = new ArrayList<>();
+        ArchivesAuto archivesAuto = archiveAutoClient.getArchiveById(archiveId);
+        if(archivesAuto.getIsVolume()==1&&StringUtils.isNotEmpty(archivesAuto.getVolumeIds())){
+            String volumeIds = archivesAuto.getVolumeIds();
+            String[] archivesAutoIds = volumeIds.split(",");
+            for (String autoId : archivesAutoIds) {
+                VolumeDto1 dto = new VolumeDto1();
+                ArchivesAuto auto = archiveAutoClient.getArchiveById(Long.parseLong(autoId));
+                if (auto != null) {
+                    dto.setId(auto.getId());
+                    dto.setName(auto.getName());
+                    String sql="select id,file_number,file_name,file_time,duty_user,file_page from u_archive_file where archive_id="+auto.getId()+" and is_deleted=0 order by archive_sort,sort,sort_num,create_time";
+                    List<VolumeDto2> dto2s = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(VolumeDto2.class));
+                    dto.setList(dto2s);
+                    if(!dto2s.isEmpty()){
+                        dto.setTotal(dto2s.stream().mapToInt(dto2 -> dto2.getFilePage() != null ? dto2.getFilePage() : 0).sum());
+                    }else {
+                        dto.setTotal(0);
+                    }
+                }
+                list.add(dto);
+            }
+            return list;
+        }else {
+            return list;
+        }
+    }
+
+    @Override
+    public VolumeDto3 selectVolumeBefore(Long archiveId,Integer type) {
+        ArchivesAuto auto = archiveAutoClient.getArchiveById(archiveId);
+        VolumeDto3 dto=new VolumeDto3();
+        //查询原案卷
+        if(type==1){
+            String sql="select id,file_number,file_name,file_time,duty_user,file_page from u_archive_file where archive_id="+auto.getId()+" and is_deleted=0 order by archive_sort,sort,sort_num,create_time";
+            List<VolumeDto4> dto2s = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(VolumeDto4.class));
+            dto.setId(auto.getId());
+            dto.setName(auto.getName());
+            dto.setTotal(auto.getPageN());
+            dto.setList(dto2s);
+        }else {
+            String archiveIds=auto.getId().toString();
+            //查询所有案卷
+            if(StringUtils.isNotEmpty(auto.getVolumeIds())){
+                archiveIds=archiveIds+","+auto.getVolumeIds();
+            }
+            if(archiveIds.startsWith(",")){
+                archiveIds=archiveIds.substring(1);
+            }
+            if(archiveIds.endsWith( ",")){
+                archiveIds=archiveIds.substring(0,archiveIds.length()-1);
+            }
+            String sql="select id,file_number,file_name,file_time,duty_user,file_page,archive_id from u_archive_file where archive_id in ("+archiveIds+") and is_deleted=0 order by archive_sort,sort,sort_num,create_time";
+            List<VolumeDto4> dto2s = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(VolumeDto4.class));
+            if(StringUtils.isNotEmpty(auto.getVolumeIds())){
+                dto2s.stream().filter(item ->auto.getVolumeIds().contains(item.getArchiveId().toString())).forEach(item ->item.setIsCheck(1));
+            }
+           dto.setList(dto2s);
+        }
+        return dto;
+    }
 }

+ 4 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/MetadataClassificationServiceImpl.java

@@ -1178,4 +1178,8 @@ public class MetadataClassificationServiceImpl
     }
 
 
+    @Override
+    public List<HashMap<String, Object>> getMetadaFileByFileId(Long id) {
+        return baseMapper.getMetadaFileByFileId(id);
+    }
 }

+ 10 - 14
blade-service/blade-manager/src/main/java/com/mixsmart/utils/CustomFunction.java

@@ -1690,11 +1690,16 @@ public class CustomFunction {
             List<String> result = new ArrayList<>();
             param = param.trim().replaceAll("(?i:c)", "");
             List<String> list = Arrays.asList(param.split("[^.\\d]"));
-            List<Integer> index = list.stream().map(Integer::parseInt).collect(Collectors.toList());
+            List<Integer> index = list.stream().map(Integer::parseInt).sorted().collect(Collectors.toList());
             Integer type = RandomNumberHolder.getRandomTemplateType();
             if(type==null||type==1){
                 for (Integer i : index) {
                     if (i < nodes.size()) {
+                        //获取当前节点的名称
+                        String title = nodes.get(i);
+                        if(title == null || result.stream().anyMatch(f -> f.contains(title))){
+                            continue;
+                        }
                         result.add(nodes.get(i));
                     }
                 }
@@ -1708,20 +1713,11 @@ public class CustomFunction {
                         (existing, replacement) -> replacement // 如果键重复,保留后者
                     ));
                 for (Integer i : index) {
-                    if(i==0){
-                        if(map.containsKey(1)){
-                            result.add(map.get(1));
-                        }
-                    }
-                    else if(i==1){
-                        if(map.containsKey(18)){
-                            result.add(map.get(18));
-                        }
-                    }else {
-                        if(map.containsKey(i)){
-                            result.add(map.get(i));
-                        }
+                    String title = map.get(i == 0 ? 1 : i == 1 && map.containsKey(18) ? 18 : i);
+                    if(title == null || result.stream().anyMatch(f -> f.contains(title))){
+                        continue;
                     }
+                    result.add(title);
                 }
                 return String.join("", result);
             }

+ 13 - 0
blade-service/blade-manager/src/main/java/com/mixsmart/utils/FormulaUtils.java

@@ -295,6 +295,19 @@ public class FormulaUtils {
             fd.getValues().forEach(t->t.setValue(null));
             if(data instanceof List){
                 List<Object> values = (List<Object>) data;
+                //中间元素根据数据动态扩容
+                ElementData elementData = fd.getValues().get(0);
+                //中间元素初始坐标
+                if(elementData.getX() == 0 && elementData.getY() == 0){
+                    for (int i = 1; i < values.size(); i++) {
+                        ElementData elementData1 = new ElementData();
+                        elementData1.setIndex(0);
+                        elementData1.setX(-i);
+                        elementData1.setY(0);
+                        elementData1.setGroupId(0);
+                        fd.getValues().add(elementData1);
+                    }
+                }
                 if(!retainEmpty){
                     /*不包含空白内容*/
                     values=values.stream().filter(StringUtils::isNotEmpty).collect(Collectors.toList());

+ 38 - 19
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -109,6 +109,8 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
+import static java.util.stream.Collectors.groupingBy;
+
 
 /**
  * 清表基础数据表 控制器
@@ -5222,32 +5224,39 @@ public class ExcelTabController extends BladeController {
         return R.data(query);
     }
 
+    @Scheduled(cron = "0 0 23 * * ?")
     @GetMapping("/checkAllNodeDate")
-    @ApiOperationSupport(order = 43)
-    @ApiOperation(value = "检查所有表单是否填写完毕日期")
-    public R checkAllNodeDate(Long projectId,Long contractId) throws Exception {
-        //查询出当前项目或合同段下所有的表单
-        List<WbsTreeContract>list= wbsTreeContractMapper.selectListForcheckAllNodeDate(projectId,contractId);
-        //将表单通过pid分组
-        Map<Long, List<WbsTreeContract>> map = list.stream().collect(Collectors.groupingBy(WbsTreeContract::getPId));
-        int i=map.size();
-        System.out.println("当前项目合同段有:"+i+"个节点");
+    public void checkAllNodeDate() throws Exception {
+        String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
+        if (sys_isonline.equals("20")) {
+            return;
+        }
+        String deleteSql="delete from m_is_data_complete";
+        jdbcTemplate.execute(deleteSql);
+        String insertSql="INSERT INTO m_is_data_complete (p_key_id) SELECT DISTINCT p_key_id FROM m_wbs_tree_contract WHERE date_is_complete = 2";
+        jdbcTemplate.execute(insertSql);
+        String updateSql="update m_wbs_tree_contract set date_is_complete=1 where is_deleted=0 and type=1";
+        jdbcTemplate.update(updateSql);
+        String sql="select * from m_wbs_tree_contract where is_deleted=0 and type=2 and date_is_complete=2 AND html_url is not null and p_id is not null and is_buss_show!=2";
+        List<WbsTreeContract> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+        Map<Long, List<WbsTreeContract>> map = list.stream().collect(groupingBy(WbsTreeContract::getPId));
+        int count=map.size();
+        int i=1;
+        System.out.println("开始检查"+count+"个节点");
         for (Map.Entry<Long, List<WbsTreeContract>> entry : map.entrySet()) {
+            System.out.println("检查节点:"+entry.getKey()+"已检查:"+i++);
             Long pId = entry.getKey();
             WbsTreeContract parent = wbsTreeContractMapper.selectOne(new LambdaQueryWrapper<>(WbsTreeContract.class).eq(WbsTreeContract::getPKeyId, pId));
             if(parent==null){
-                i--;
-                System.out.println("剩余:"+i+"个节点未检查");
                 continue;
             }
-            String informationSql="select * from u_information_query where wbs_id="+parent.getPKeyId()+" and contract_id="+contractId+" and is_deleted=0";
+            String informationSql="select * from u_information_query where wbs_id="+parent.getPKeyId()+" and contract_id="+parent.getContractId()+" and is_deleted=0";
             List<InformationQuery> query = jdbcTemplate.query(informationSql, new BeanPropertyRowMapper<>(InformationQuery.class));
-            if(query.isEmpty()||query.get(0).getStatus()!=0){
-                i--;
-                System.out.println("剩余:"+i+"个节点未检查");
+            if(query.isEmpty()){
                 continue;
             }
             List<WbsTreeContract> wbsTreeContractList = entry.getValue();
+            boolean flag=true;
             for (WbsTreeContract contract : wbsTreeContractList) {
                 Map<String, Object> dataInfo = excelTabService.getBussDataInfo(contract.getPKeyId(), 0, true);
                 if(dataInfo!=null){
@@ -5266,7 +5275,10 @@ public class ExcelTabController extends BladeController {
                                 }
                             }
                             if(!dateFlag){
+                                flag=false;
                                 wbsTreeContractMapper.update(null,new LambdaUpdateWrapper<WbsTreeContract>().eq(WbsTreeContract::getPKeyId,contract.getPKeyId()).set(WbsTreeContract::getDateIsComplete,2));
+                            }else {
+                                wbsTreeContractMapper.update(null,new LambdaUpdateWrapper<WbsTreeContract>().eq(WbsTreeContract::getPKeyId,contract.getPKeyId()).set(WbsTreeContract::getDateIsComplete,1));
                             }
                         }
                     }catch (Exception e){
@@ -5274,11 +5286,18 @@ public class ExcelTabController extends BladeController {
                     }
                 }
             }
-            wbsTreeContractService.checkNodeAllDate(parent);
-            i--;
-            System.out.println("剩余:"+i+"个节点未检查");
+            if(!flag){
+                List<Long> longList = new ArrayList<>(
+                        parent.getAncestorsPId() != null ? Func.toLongList(parent.getAncestorsPId()) : new ArrayList<>()
+                );
+                if (parent.getPKeyId() != null) {
+                    longList.add(parent.getPKeyId());
+                }
+                if(!longList.isEmpty()){
+                    wbsTreeContractMapper.update(null,new LambdaUpdateWrapper<WbsTreeContract>().in(WbsTreeContract::getPKeyId,longList).set(WbsTreeContract::getDateIsComplete,2));
+                }
+            }
         }
         System.out.println("检查完毕");
-        return R.status(true);
     }
 }

+ 8 - 16
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/NodeBaseInfoController.java

@@ -191,31 +191,23 @@ public class NodeBaseInfoController extends BladeController {
             List<WbsTreeContract> nodeNames = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(WbsTreeContract.class));
              nameRule = nameRule.trim().replaceAll("(?i:c)", "");
             List<String> list = Arrays.asList(nameRule.split("[^.\\d]"));
-            List<Integer> index = list.stream().map(Integer::parseInt).collect(Collectors.toList());
+            //添加排序规则,永远都是0-1-2-3-4-5-6的顺序去组装数据
+            List<Integer> index = list.stream().map(Integer::parseInt).sorted().collect(Collectors.toList());
             Map<Integer, String> map = nodeNames.stream()
                     .collect(Collectors.toMap(
                             WbsTreeContract::getNodeType,
                             WbsTreeContract::getNodeName,
                             (existing, replacement) -> replacement // 如果键重复,保留后者
                     ));
-            StringBuilder result = new StringBuilder("");
+            List<String> result = new ArrayList<>();
             for (Integer i : index) {
-                if(i==0){
-                    if(map.containsKey(1)){
-                        result.append(map.get(1));
-                    }
-                }
-                else if(i==1){
-                    if(map.containsKey(18)){
-                        result.append(map.get(18));
-                    }
-                }else {
-                    if(map.containsKey(i)){
-                        result.append(map.get(i));
-                    }
+                String title = map.get(i == 0 ? 1 : i == 1 && map.containsKey(18) ? 18 : i);
+                if(title == null || result.stream().anyMatch(f -> f.contains(title))){
+                    continue;
                 }
+                result.add(title);
             }
-        return R.data(result.toString());
+        return R.data(String.join("", result));
     }
 
     public R synPDFInfo(String contractId, String nodeId, String classify, String projectId,Map<Long,Map<String,Object>>dataMap) {

+ 20 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ContractClientImpl.java

@@ -8,14 +8,18 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
 import org.springblade.manager.entity.ContractInfo;
+import org.springblade.manager.entity.ProjectInfo;
 import org.springblade.manager.mapper.SaveUserInfoByProjectMapper;
 import org.springblade.manager.service.IContractInfoService;
+import org.springblade.manager.service.IProjectInfoService;
 import org.springblade.manager.service.impl.SaveUserInfoByProjectServiceImpl;
 import org.springblade.manager.vo.RoleSignPfxUserVO3;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Collections;
 import java.util.List;
+import java.util.Set;
 
 @RestController
 @AllArgsConstructor
@@ -24,6 +28,7 @@ public class ContractClientImpl implements ContractClient {
     private final IContractInfoService contractInfoService;
     private final SaveUserInfoByProjectMapper saveUserInfoByProjectMapper;
     private final SaveUserInfoByProjectServiceImpl saveUserInfoByProject;
+    private final IProjectInfoService projectInfoService;
 
     @Override
     public List<String> getProcessContractByJLContractId(String contractId) {
@@ -107,5 +112,20 @@ public class ContractClientImpl implements ContractClient {
         return contractInfoService.findAllUserAndRoleList(contractId,roleId);
     }
 
+    @Override
+    public List<ProjectInfo> queryProjectList(Set<String> projectIds) {
+        return projectInfoService.selectProjectList(projectIds);
+    }
+
+    @Override
+    public List<String> queryProjectIds(Set<String> projectId) {
+        return projectInfoService.queryProjectIds(projectId);
+    }
+
+    @Override
+    public List<ContractInfo> queryContractNamesListByProjectId(String projectId) {
+        return contractInfoService.queryContractNamesListByProjectId(projectId);
+    }
+
 
 }

+ 29 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/SaveUserInfoByProjectClientImpl.java

@@ -9,6 +9,8 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
 import org.springblade.manager.entity.SaveUserInfoByProject;
 import org.springblade.manager.service.SaveUserInfoByProjectService;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.SingleColumnRowMapper;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
@@ -19,6 +21,7 @@ import java.util.List;
 public class SaveUserInfoByProjectClientImpl implements SaveUserInfoByProjectClient {
 
     private final SaveUserInfoByProjectService saveUserInfoByProjectService;
+    private final JdbcTemplate jdbcTemplate;
 
     @Override
     public List<JSONObject> queryUserContractRole(List<Long> userIds, String contractId) {
@@ -65,5 +68,31 @@ public class SaveUserInfoByProjectClientImpl implements SaveUserInfoByProjectCli
         saveUserInfoByProjectService.save(obj);
     }
 
+    @Override
+    public void insertUserInfoBatch(List<SaveUserInfoByProjectDTO> list) {
+        for (SaveUserInfoByProjectDTO dto : list) {
+            Long jlzyContractId = selectIsRecordJlId(dto.getContractId());
+            if(jlzyContractId!=null){
+                dto.setIsRecordJlId(jlzyContractId);
+            }
+        }
+        saveUserInfoByProjectService.saveBatch(list);
+    }
+
+    @Override
+    public void updateUserInfoBatch(List<SaveUserInfoByProjectDTO> updateUserInfoByProjectList) {
+        saveUserInfoByProjectService.updateBatchById(updateUserInfoByProjectList);
+    }
+
+    public Long selectIsRecordJlId(String contractId){
+        String sql="select contract_id_jlyz from m_contract_relation_jlyz where contract_id_sg="+contractId;
+        List<Long> list = jdbcTemplate.query(sql, new SingleColumnRowMapper<>(Long.class));
+        if(list.isEmpty()){
+            return null;
+        }else {
+            return list.get(0);
+        }
+    }
+
 
 }

+ 4 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/KeyMapper.java

@@ -46,6 +46,10 @@ public class KeyMapper {
      * 公式id
      */
     private Long formulaId;
+    /**
+     * 是否为辅助字段
+     */
+    private Integer assist;
 
     public String getCode() {
         return this.tableName + StringPool.COLON + this.field;

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

@@ -77,4 +77,6 @@ public interface ContractInfoMapper extends BaseMapper<ContractInfo> {
     List<RoleSignPfxUserVO1> findAllUserAndRoleList1(Long contractId, Long roleId);
 
     List<RoleSignPfxUserVO2> findAllUserAndRoleList2(Long contractId, Long roleId);
+
+    List<ContractInfo> queryContractNamesListByProjectId(@Param("projectId") String projectId);
 }

+ 10 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.xml

@@ -585,5 +585,15 @@
             And r.id=#{roleId}
         </if>
     </select>
+    <select id="queryContractNamesListByProjectId" resultType="org.springblade.manager.entity.ContractInfo">
+        SELECT
+        *
+        FROM
+        m_contract_info
+        WHERE
+        is_deleted = 0
+        AND p_id = #{projectId}
+    </select>
+
 
 </mapper>

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

@@ -10,6 +10,7 @@ import org.springblade.manager.vo.ProjectUserAmountVO;
 import org.springblade.manager.vo.SingPfxManagementVO;
 
 import java.util.List;
+import java.util.Set;
 
 public interface ProjectInfoMapper extends BaseMapper<ProjectInfo> {
 
@@ -32,4 +33,6 @@ public interface ProjectInfoMapper extends BaseMapper<ProjectInfo> {
     ProjectInfo selectOneAndWbsTypeById(Long id);
 
     IPage<ProjectInfoVO> pageList(IPage<ProjectInfoVO> page, @Param("vo") ProjectInfoVO3 vo);
+
+    List<String> queryProjectIds(@Param("projectIds") Set<String> projectIds);
 }

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

@@ -191,5 +191,14 @@
             </when>
         </choose>
     </select>
+    <select id="queryProjectIds" resultType="java.lang.String">
+        select id from m_project_info where is_deleted = 0
+        <if test="projectIds != null">
+            and id in
+            <foreach item="projectId" collection="projectIds" open="(" separator="," close=")">
+                #{projectId}
+            </foreach>
+        </if>
+    </select>
 
 </mapper>

+ 3 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeMapper.xml

@@ -407,6 +407,7 @@
     <select id="selectFormElements" resultMap="wbsFormElementMap">
         select f_id,
                e_key,
+               a.assist,
                a.id,
                a.dynamic_dict,
                e_name,
@@ -425,6 +426,7 @@
         union
         select f_id,
                e_key,
+               a.assist,
                a.id,
                a.dynamic_dict,
                e_name,
@@ -445,6 +447,7 @@
         select b.id
              , IF(c.formula_id > 0, 1, 0)           globalFormula
              , b.e_name
+             , b.assist
              , e_type
              , e_length
              , e_allow_deviation

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

@@ -91,4 +91,6 @@ public interface IContractInfoService extends BaseService<ContractInfo> {
 
     R<Object> getCollectTreeNode(String contractId, String tableOwner, Long folderId, String queryValue, Long pKeyId);
     R<Object> getCollectTreeNodeByQuery(String contractId, String tableOwner, Long folderId, String queryValue);
+
+    List<ContractInfo> queryContractNamesListByProjectId(String projectId);
 }

+ 5 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IProjectInfoService.java

@@ -6,6 +6,7 @@ import org.springblade.core.mp.base.BaseService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
 import java.util.List;
+import java.util.Set;
 
 public interface IProjectInfoService extends BaseService<ProjectInfo> {
 
@@ -15,6 +16,8 @@ public interface IProjectInfoService extends BaseService<ProjectInfo> {
 
     List<ProjectInfo> selectProjectList(List<String> projectIds);
 
+    List<ProjectInfo> selectProjectList(Set<String> projectIds);
+
     IPage<ProjectInfoVO> selectProjectInfoPage(IPage<ProjectInfoVO> page, ProjectInfoVO projectInfo);
 
     List<ContractlnfoCountVO> selectContractInfoCount();
@@ -28,4 +31,6 @@ public interface IProjectInfoService extends BaseService<ProjectInfo> {
     Long getProjectIdbyName(String projectName);
 
     IPage<ProjectInfoVO> pageList(IPage<ProjectInfoVO> page, ProjectInfoVO3 vo);
+
+    List<String> queryProjectIds(Set<String> projectId);
 }

+ 5 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -1849,4 +1849,9 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
         }
         return null;
     }
+
+    @Override
+    public List<ContractInfo> queryContractNamesListByProjectId(String projectId) {
+        return contractInfoMapper.queryContractNamesListByProjectId(projectId);
+    }
 }

+ 25 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -239,6 +239,14 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             tenantId = StringPool.EMPTY;
         }
         List<ExceTabTreVO> ls = baseMapper.tabLazyTree(tenantId, modeId, parentId + "");
+        if(ls.stream().anyMatch(f -> f.getFileType() == 3)){
+            Comparator<ExceTabTreVO> safeComparator = Comparator
+                    .comparing(ExceTabTreVO::getSort, Comparator.nullsFirst(Comparator.naturalOrder()))
+                    .thenComparing(new ComplexStringComparator<>(obj ->
+                            obj.getName() != null ? obj.getName() : ""));
+            //对结果进行排序
+            ls.sort(safeComparator);
+        }
         return ForestNodeMerger.merge(ls);
     }
 
@@ -705,6 +713,14 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                             htmlElementCellMap.put(e.getHtmlUrl(), map);
                         }
                         Map<String, String> elementCell = map;
+
+                        //扩展中间元素开发 获取字段是辅助字段  并且在html上没有这个字段
+                        List<String> collect = keyMappers.stream().filter(f -> f.getAssist() == 1
+                                && elementCell.get(f.getField()) == null).map(KeyMapper::getField).collect(Collectors.toList());
+                        collect.forEach(f->{
+                            elementCell.put(f,"0_0");
+                        });
+
                         coordinateMap.computeIfAbsent(e.getInitTableName(), k -> elementCell);
                     });
                 }
@@ -826,6 +842,15 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         if(ObjectUtil.isNotEmpty(ids)){
             List<ContractLog> contractLogList = jdbcTemplate.query("select * from u_contract_log where id in (" + ids + ")", new BeanPropertyRowMapper<>(ContractLog.class));
             ContractLog contractLog = contractLogList.get(0);
+            //将原来的OSS文件删除
+            if(contractLog!=null&&StringUtils.isNotEmpty(contractLog.getPdfUrl())){
+                String pdfUrlResult = contractLog.getPdfUrl();
+                int lastIndex = pdfUrlResult.lastIndexOf("upload");
+                if (lastIndex != -1) {
+                    String fileName = pdfUrlResult.substring(lastIndex);
+                    this.newIOSSClient.removeFile(fileName);
+                }
+            }
             String oldDataId1 = contractLog.getOldDataId();
             if (ObjectUtil.isNotEmpty(oldDataId1)){
                 oldDataId = oldDataId1+","+ids;

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

@@ -5391,7 +5391,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
     private List<Map<String, Object>> listMap(List<Long> ids, ExecuteType type) {
         String pkIds = ids.stream().map(String::valueOf).collect(Collectors.joining(","));
         String tableName = ExecuteType.INSPECTION.equals(type) ? "m_wbs_tree_contract" : "m_wbs_tree_private";
-        return this.jdbcTemplate.queryForList(" select a.init_table_name as tableName,a.p_key_id as pkId ,c.e_key as field,c.e_name as eName,c.id  as fieldId ,c.e_type eType , e_allow_deviation as eAllowDeviation  " +
+        return this.jdbcTemplate.queryForList(" select a.init_table_name as tableName,a.p_key_id as pkId ,c.e_key as field,c.e_name as eName,c.id  as fieldId ,c.e_type eType, c.assist , e_allow_deviation as eAllowDeviation  " +
                 "from " + tableName + " a " +
                 "inner join m_table_info b on a.init_table_name=b.tab_en_name " +
                 "INNER JOIN m_wbs_form_element c on b.id=c.f_id " +

+ 14 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ProjectInfoServiceImpl.java

@@ -14,16 +14,14 @@ import org.springblade.manager.mapper.*;
 import org.springblade.manager.service.IProjectInfoService;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.manager.wrapper.ProjectInfoWrapper;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
@@ -41,6 +39,8 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
 
     @Resource
     private JdbcTemplate jdbcTemplate;
+    @Autowired
+    private ProjectInfoMapper projectInfoMapper;
 
     public List<ProjectUserAmountVO> queryProjectUserAmount() {
         return this.baseMapper.queryProjectUserAmount();
@@ -85,6 +85,11 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
         return this.baseMapper.selectProjectList(projectIds);
     }
 
+    @Override
+    public List<ProjectInfo> selectProjectList(Set<String> projectIds) {
+        return this.baseMapper.selectProjectList((List<String>) projectIds);
+    }
+
     @Override
     public IPage<ProjectInfoVO> selectProjectInfoPage(IPage<ProjectInfoVO> page, ProjectInfoVO projectInfo) {
         return page.setRecords(baseMapper.selectProjectInfoPage(page, projectInfo));
@@ -186,4 +191,9 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
         return pagedList;
     }
 
+    @Override
+    public List<String> queryProjectIds(Set<String> projectId) {
+        return projectInfoMapper.queryProjectIds(projectId);
+    }
+
 }

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

@@ -56,7 +56,7 @@ public class WbsParamServiceImpl extends BaseServiceImpl<WbsParamMapper, WbsPara
 
 
     @Override
-    @Cacheable(cacheNames = "file_title", key = "#wtc.pKeyId+'@'+T(System).currentTimeMillis()/(1000*100)")
+//    @Cacheable(cacheNames = "file_title", key = "#wtc.pKeyId+'@'+T(System).currentTimeMillis()/(1000*100)")
     public String createFileTitle(WbsTreeContract wtc) {
         if(wtc!=null&&wtc.getPKeyId()!=null){
             List<WbsTreeContract> nodes = tracing(wtc.getPKeyId());

+ 20 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsSynchronousServiceImpl.java

@@ -286,6 +286,7 @@ public class WbsSynchronousServiceImpl {
                     templateNodes.forEach(f -> {
                         f.setPKeyId(f.getId());
                         f.setTreePId(f.getId());
+                        f.setDefaultConceal(0);
                     });
 
                 } else {
@@ -341,6 +342,10 @@ public class WbsSynchronousServiceImpl {
                 //新增数据二次筛选  只保留任务选中的表单   但可能新增的数据包含新节点
                 if (CollectionUtil.isNotEmpty(formList)) {
                     addPrivateNodes = addPrivateNodes.stream().filter(f -> f.getType() == 1 || formList.contains(f.getPKeyId())).collect(Collectors.toList());
+                    //新增表单时
+                    addPrivateNodes.forEach(f->{
+                        f.setIsBussShow(f.getDefaultConceal() + 1);
+                    });
                 }
 
                 //筛选出需要更新的节点  同时做数据隔离
@@ -442,6 +447,11 @@ public class WbsSynchronousServiceImpl {
                                 editPrivateNode.setFullName(templateNode.getFullName());
                                 //绑定实体表
                                 editPrivateNode.setInitTableName(templateNode.getInitTableName());
+                                //绑定隐藏信息
+                                editPrivateNode.setStatus(templateNode.getStatus());
+                                editPrivateNode.setDefaultConceal(templateNode.getDefaultConceal());
+                                //合同段是根据这个字段隐藏的
+                                editPrivateNode.setIsBussShow(templateNode.getDefaultConceal() + 1);
 
                                 if (StringUtil.isBlank(templateNode.getHtmlUrl())) {
                                     throw new ServiceException(templateNode.getNodeName() + "( " + templateNode.getPKeyId() + ")HTML文件不存在");
@@ -789,6 +799,10 @@ public class WbsSynchronousServiceImpl {
                                     if (collect.contains(2) && (templateNode.getHtmlUrl() == null || templateNode.getInitTableName() == null || templateNode.getExcelId() == null)) {
                                         errorMsg.append(editContractNode.getNodeName() + "(" + editContractNode.getPKeyId() + ")").append("未配置清表;");
                                     } else {
+                                        //隐藏状态
+                                        editContractNode.setStatus(templateNode.getStatus());
+                                        editContractNode.setIsBussShow(templateNode.getIsBussShow());
+                                        //四要素
                                         editContractNode.setExcelId(templateNode.getExcelId());
                                         editContractNode.setInitTableName(templateNode.getInitTableName());
                                         editContractNode.setHtmlUrl(templateNode.getHtmlUrl());
@@ -818,7 +832,12 @@ public class WbsSynchronousServiceImpl {
                     //合同段新增节点
                     List<WbsTreeContract> addContractNode = null;
                     if (addPrivateNodes != null && (CollectionUtil.isEmpty(collect) || collect.contains(1))) {
-                        addContractNode = BeanUtil.copyProperties(addPrivateNodes, WbsTreeContract.class);
+                        addContractNode = new ArrayList<>();
+                        for (WbsTreePrivate addPrivateNode : addPrivateNodes) {
+                            WbsTreeContract wbsTreeContract1 = BeanUtil.copyProperties(addPrivateNode, WbsTreeContract.class);
+                            wbsTreeContract1.setIsBussShow(addPrivateNode.getDefaultConceal() + 1);
+                            addContractNode.add(wbsTreeContract1);
+                        }
                     }
 
                     if (CollectionUtil.isNotEmpty(addContractNode)) {
@@ -1081,7 +1100,6 @@ public class WbsSynchronousServiceImpl {
                 //当前新增节点的父节点
                 WbsTreeContract parent = addContractParentNodes.get(0);
 
-                addContractNode.setIsBussShow(1);
                 addContractNode.setIsDeleted(0);
                 addContractNode.setStatus(1);
                 addContractNode.setParentId(parent.getId());

+ 37 - 5
blade-service/blade-user/src/main/java/org/springblade/system/user/controller/UserController.java

@@ -17,6 +17,8 @@
 package org.springblade.system.user.controller;
 
 
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.read.metadata.ReadSheet;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.nacos.common.utils.MD5Utils;
@@ -26,6 +28,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.*;
 import lombok.AllArgsConstructor;
+import org.apache.commons.codec.Charsets;
 import org.apache.http.Consts;
 import org.apache.http.HttpResponse;
 import org.apache.http.NameValuePair;
@@ -37,6 +40,8 @@ import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.message.BasicNameValuePair;
 import org.springblade.common.cache.CacheNames;
 import org.springblade.common.constant.CommonConstant;
+import org.springblade.common.utils.CommonUtil;
+import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.cache.utils.CacheUtil;
 import org.springblade.core.excel.util.ExcelUtil;
 import org.springblade.core.mp.support.Condition;
@@ -56,8 +61,7 @@ import org.springblade.system.cache.ParamCache;
 import org.springblade.system.user.bean.CyGetToken;
 import org.springblade.system.user.bean.ResultCYData;
 import org.springblade.system.user.bean.ResultCYKey;
-import org.springblade.system.user.dto.TokenVerifyResult;
-import org.springblade.system.user.dto.UserDTO;
+import org.springblade.system.user.dto.*;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.excel.UserExcel;
 import org.springblade.system.user.excel.UserExcel2;
@@ -75,9 +79,10 @@ import springfox.documentation.annotations.ApiIgnore;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
+import java.net.URLEncoder;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 
 import static org.springblade.core.cache.constant.CacheConstant.USER_CACHE;
@@ -354,6 +359,15 @@ public class UserController {
         return R.success("操作成功");
     }
 
+    @PostMapping("import-user_new")
+    @ApiOperationSupport(order = 12)
+    @ApiOperation(value = "导入用户", notes = "传入excel(多sheet+纵向合同段逗号拼接+过滤全null行)")
+    public R importUserNew(@RequestParam("file") MultipartFile file) {
+        return userService.importUserNew(file);
+    }
+
+
+
     /**
      * 导出全部用户
      */
@@ -377,6 +391,24 @@ public class UserController {
         ExcelUtil.export(response, "用户数据模板" + DateUtil.time(), "用户数据表", list, UserExcel.class);
     }
 
+    @GetMapping("/downloadImportUserExcel")
+    @ApiOperationSupport(order = 31)
+    @ApiOperation(value = "下载excel数据")
+    @ApiImplicitParam(name = "fileId", value = "fileId")
+    public void downloadImportUserExcel(HttpServletResponse response) throws Exception {
+        String fileName = URLEncoder.encode("用户数据模版", Charsets.UTF_8.name());
+        String filePath="https://xinan1.zos.ctyun.cn/blade-oss-chongqing/upload/20251203/f42a9c6956903e8bd3d9559ffcaf1326.xlsx";
+        InputStream redio = CommonUtil.getOSSInputStream(filePath);
+        byte[] buffer = IoUtil.readToByteArray(redio);
+        OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
+        response.setContentType("application/vnd.ms-excel");
+        response.setCharacterEncoding(org.apache.commons.codec.Charsets.UTF_8.name());
+        response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+        toClient.write(buffer);
+        toClient.flush();
+        toClient.close();
+    }
+
 
     /**
      * 第三方注册用户

+ 3 - 0
blade-service/blade-user/src/main/java/org/springblade/system/user/service/IUserService.java

@@ -20,6 +20,7 @@ import org.springblade.system.user.excel.UserExcel;
 import org.springblade.system.user.vo.InformationQueryBIMVO;
 import org.springblade.system.user.vo.InformationQueryVO1;
 import org.springblade.system.user.vo.UserVO;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
 
@@ -248,4 +249,6 @@ public interface IUserService extends BaseService<User> {
     List<InformationQueryVO1> queryInformationByContractIdAndName(String contractId, String name);
 
     R queryInformationByFileNumber(String contractId, String fieldNumber);
+
+    R importUserNew(MultipartFile file);
 }

+ 820 - 14
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@@ -1,10 +1,13 @@
 package org.springblade.system.user.service.impl;
 
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.read.metadata.ReadSheet;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.nacos.common.utils.StringUtils;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -35,6 +38,8 @@ import org.springblade.core.tool.utils.*;
 import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
 import org.springblade.manager.entity.*;
 import org.springblade.manager.feign.ContractClient;
+import org.springblade.manager.feign.ProjectAssignmentUserClient;
+import org.springblade.manager.feign.SaveUserInfoByProjectClient;
 import org.springblade.manager.vo.PrivateTreeVO;
 import org.springblade.manager.vo.PrivateTreeVO2;
 import org.springblade.manager.vo.WbsTreeContractLazyQueryInfoVO;
@@ -45,12 +50,13 @@ import org.springblade.system.cache.DictCache;
 import org.springblade.system.cache.ParamCache;
 import org.springblade.system.cache.SysCache;
 import org.springblade.system.entity.Dept;
+import org.springblade.system.entity.Role;
 import org.springblade.system.entity.Tenant;
 import org.springblade.system.enums.DictEnum;
 import org.springblade.system.feign.ISysClient;
 import org.springblade.system.user.bean.NodeVO;
 import org.springblade.system.user.cache.UserCache;
-import org.springblade.system.user.dto.UserDTO;
+import org.springblade.system.user.dto.*;
 import org.springblade.system.user.entity.*;
 import org.springblade.system.user.enums.UserEnum;
 import org.springblade.system.user.excel.UserExcel;
@@ -69,15 +75,24 @@ import org.springblade.system.user.wrapper.UserWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.DataAccessException;
 import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.jdbc.core.BatchPreparedStatementSetter;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.SingleColumnRowMapper;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
 import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -85,6 +100,7 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.function.Function;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -115,6 +131,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
     private final JdbcTemplate jdbcTemplate;
     @Autowired
     StringRedisTemplate redisTemplate;
+    @Autowired
+    private SaveUserInfoByProjectClient saveUserInfoByProjectClient;
 
 
     @Override
@@ -1914,19 +1932,11 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
 
         if (node != null) {
             if (!new Integer("6").equals(node.getNodeType()) && !Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType() + "")) {
-                if (node.getParentId() == 0) {
-                    throw new ServiceException("请从第三层级节点开始进行检索");
-                } else {
-                    WbsTreeContract wbsTreeContract = jdbcTemplate.query("select parent_id from m_wbs_tree_contract where is_deleted = 0 and status = 1 and type = 1 and id = " + node.getParentId() + " and contract_id = " + node.getContractId(), new BeanPropertyRowMapper<>(WbsTreeContract.class)).stream().findAny().orElse(null);
-                    if (wbsTreeContract != null && wbsTreeContract.getParentId().equals(0L)) {
-                        throw new ServiceException("请从第三层级节点开始进行检索");
-                    }
-                    WbsTreeContract oldSelectedNode = BeanUtil.copyProperties(node, WbsTreeContract.class);
-                    childNodesPkeyIds = this.getChildNodesPkeyIds(oldSelectedNode, lowestNodesPkeyIds);
-                    List<String> sj = this.getSJ(contract, vo, lowestNodesPkeyIds);
-                    if (sj != null && sj.size() > 0) {
-                        submitNodeKeyIds.addAll(sj);
-                    }
+                WbsTreeContract oldSelectedNode = BeanUtil.copyProperties(node, WbsTreeContract.class);
+                childNodesPkeyIds = this.getChildNodesPkeyIds(oldSelectedNode, lowestNodesPkeyIds);
+                List<String> sj = this.getSJ(contract, vo, lowestNodesPkeyIds);
+                if (sj != null && sj.size() > 0) {
+                    submitNodeKeyIds.addAll(sj);
                 }
             }
             vo.setWbsIds(submitNodeKeyIds);
@@ -2366,4 +2376,800 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
         return R.data(information);
     }
 
+    @Override
+    @Transactional
+    public R importUserNew(MultipartFile file) {
+        List<UserImporterNew> finalUserList = new ArrayList<>();
+        List<ImportUserLog>logs=new ArrayList<>();
+        LocalDateTime now = LocalDateTime.now();
+        String importTime = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+        Long importId= SnowFlakeUtil.getId();
+        Long importUser=AuthUtil.getUserId();
+        List<User> insertUserList=new ArrayList<>();
+        List<UserDept> insertUserDeptList=new ArrayList<>();
+        List<SaveUserInfoByProjectDTO> insertUserInfoByProjectList=new ArrayList<>();
+        List<User>updateUserList=new ArrayList<>();
+        List<SaveUserInfoByProjectDTO>updateUserInfoByProjectList=new ArrayList<>();
+        try {
+            // 1. 获取所有sheet元数据
+            List<ReadSheet> allSheets = EasyExcel.read(file.getInputStream())
+                    .head(ExcelUserTemp.class)
+                    .build()
+                    .excelExecutor()
+                    .sheetList();
+            // 遍历每个Sheet,逐个读取并处理数据
+            for (ReadSheet sheet : allSheets) {
+                System.out.printf("开始读取Sheet:%s(索引:%d)%n", sheet.getSheetName(), sheet.getSheetNo());
+
+                List<ExcelUserTemp> sheetData = EasyExcel.read(file.getInputStream())
+                        .head(ExcelUserTemp.class)
+                        .sheet(sheet.getSheetNo())
+                        .headRowNumber(2)
+                        .doReadSync();
+
+                UserImporterNew currentUser = null;
+                List<ImportPorjectInfoDTO> tempProjectList = new ArrayList<>();
+                String currentProjectId = ""; // 新增:存储当前用户的“基准项目ID”(继承自新用户行)
+
+                for (ExcelUserTemp row : sheetData) {
+                    if (!isCoreFieldEmpty(row)) {
+                        // 处理上一个用户
+                        if (currentUser != null) {
+                            currentUser.setProjectInfoList(tempProjectList);
+                            finalUserList.add(currentUser);
+                        }
+
+                        // 初始化新用户
+                        currentUser = initUserImporterNew(row);
+                        tempProjectList = new ArrayList<>();
+                        // 新用户行的projectId作为基准ID
+                        currentProjectId = Objects.nonNull(row.getProjectId()) ? row.getProjectId().trim() : "";
+
+                        // 生成新用户行的项目DTO
+                        ImportPorjectInfoDTO projectDTO = buildPorjectInfoDTO(row, currentProjectId);
+                        if (projectDTO != null) {
+                            tempProjectList.add(projectDTO);
+                        }
+                    } else {
+                        // 补充行:继承当前基准项目ID
+                        if (currentUser != null) {
+                            // 若补充行有新的projectId(如王三5的补充行),更新基准ID
+                            if (Objects.nonNull(row.getProjectId()) && !row.getProjectId().trim().isEmpty()) {
+                                currentProjectId = row.getProjectId().trim();
+                            }
+                            // 生成DTO(传入基准projectId)
+                            ImportPorjectInfoDTO projectDTO = buildPorjectInfoDTO(row, currentProjectId);
+                            if (projectDTO != null) {
+                                if (!isProjectDuplicate(tempProjectList, projectDTO)) {
+                                    tempProjectList.add(projectDTO);
+                                }
+                            }
+                        }
+                    }
+                }
+
+                // 处理最后一个用户
+                if (currentUser != null) {
+                    currentUser.setProjectInfoList(tempProjectList);
+                    finalUserList.add(currentUser);
+                }
+            }
+            String file_path = FileUtils.getSysLocalFileUrl();
+            String filePath = file_path + "/importExcel/" + importId + ".xlsx";
+            try {
+                // 创建目录(如果不存在)
+                File directory = new File(file_path + "/importExcel/");
+                if (!directory.exists()) {
+                    directory.mkdirs();
+                }
+                // 保存文件
+                file.transferTo(new File(filePath));
+            } catch (IOException e) {
+                // 处理异常
+                throw new ServiceException("文件保存失败: " + e.getMessage());
+            }
+            // 5. 后续业务逻辑(批量保存等)
+            if (!finalUserList.isEmpty()) {
+                //查出所有的部门名
+                List<Dept>deptNames=jdbcTemplate.query("select id,dept_name from blade_dept where is_deleted=0",new BeanPropertyRowMapper<>(Dept.class));
+                //查出所有的角色名
+                List<Role>roleNamesSG=jdbcTemplate.query("select id,role_name from blade_role where parent_id=(select id from blade_role where role_name='施工方' and is_deleted=0 limit 1)",new BeanPropertyRowMapper<>(Role.class));
+                List<Role>roleNamesJL=jdbcTemplate.query("select id,role_name from blade_role where parent_id=(select id from blade_role where role_name='监理方' and is_deleted=0 limit 1)",new BeanPropertyRowMapper<>(Role.class));
+                List<Role>roleNamesYZ=jdbcTemplate.query("select id,role_name from blade_role where parent_id=(select id from blade_role where role_name='业主方' and is_deleted=0 limit 1)",new BeanPropertyRowMapper<>(Role.class));
+                Map<String,List<Role>> roleMap= new HashMap<>();
+                roleMap.put("3",roleNamesSG);
+                roleMap.put("2",roleNamesJL);
+                roleMap.put("1",roleNamesYZ);
+                //查出所有的项目的合同段名
+                // 查出所有的项目的合同段名
+                Set<String> projectIdSet = finalUserList.stream()
+                        .filter(user -> user.getProjectInfoList() != null) // 过滤掉projectInfoList为null的用户
+                        .flatMap(user -> user.getProjectInfoList().stream()) // 展平所有项目列表
+                        .filter(project -> project.getProjectId() != null && !project.getProjectId().trim().isEmpty()) // 过滤掉projectId为null或空的项目
+                        .map(project -> project.getProjectId().trim()) // 提取并trim projectId
+                        .collect(Collectors.toSet()); // 收集到Set中去重
+                List<String>projectIds=contractClient.queryProjectIds(projectIdSet);
+                //根据项目id查询合同段
+                Map<String,List<ContractInfo>> contractNamesMap=new HashMap<>();
+                if(!projectIds.isEmpty()){
+                    for (String projectId : projectIds) {
+                      List<ContractInfo>contractNames=contractClient.queryContractNamesListByProjectId(projectId);
+                      contractNamesMap.put(projectId,contractNames);
+                    }
+                }
+                for (UserImporterNew userImporterNew : finalUserList) {
+                    if(!userImporterNew.getProjectInfoList().isEmpty()){
+                        userImporterNew.getProjectInfoList().removeIf(o->StringUtils.isEmpty(o.getProjectId())||StringUtils.isEmpty(o.getContractInfo()));
+                    }
+                    //首先 根据账号查询用户
+                    //账号为null
+                    if(StringUtil.isEmpty(userImporterNew.getAccount())){
+                        //姓名不为null
+                        if(!StringUtil.isEmpty(userImporterNew.getRealName())){
+                            ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),userImporterNew.getRealName()+"的账号为空",importTime,importId,importUser,file.getOriginalFilename());
+                            logs.add(log);
+                        }else {
+                            ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"账号姓名都为空",importTime,importId,importUser,filePath);
+                            logs.add(log);
+                        }
+                        continue;
+                    }
+                    User user=this.getOne(new QueryWrapper<User>().lambda().eq(User::getAccount,userImporterNew.getAccount()));
+                    //账号不存在 则新增
+                    if(user==null){
+                        //前置条件判断
+                        /**
+                         * 验证姓名
+                         */
+                        if(StringUtil.isEmpty(userImporterNew.getRealName())){
+                            ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"姓名为空",importTime,importId,importUser,filePath);
+                            logs.add(log);
+                            continue;
+                        }
+                        /**
+                         * 验证手机号
+                         */
+                        if(StringUtil.isEmpty(userImporterNew.getPhone())){
+                            ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"手机号为空",importTime,importId,importUser,filePath);
+                            logs.add(log);
+                            continue;
+                        }else {
+                            boolean b = isValidChinesePhoneNumber(userImporterNew.getPhone());
+                            if(!b){
+                                ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"手机号格式错误",importTime,importId,importUser,filePath);
+                                logs.add(log);
+                                continue;
+                            }
+                        }
+                        /**
+                         * 验证身份证号
+                         */
+                        if(!StringUtil.isEmpty(userImporterNew.getIdNumber())) {
+                            boolean b = isValidIdCard(userImporterNew.getIdNumber());
+                            if(!b){
+                                ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"身份证号格式错误",importTime,importId,importUser,filePath);
+                                logs.add(log);
+                                continue;
+                            }
+                        }
+                        /**
+                         * 验证用户平台
+                         */
+                        if(StringUtil.isEmpty(userImporterNew.getUserType())){
+                            ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"用户平台为空",importTime,importId,importUser,filePath);
+                            logs.add(log);
+                            continue;
+                        }else {
+                            String userType = userImporterNew.getUserType();
+                            List<String> types = new ArrayList<>();
+                            if (userType != null && !userType.isEmpty()) {
+                                Pattern pattern = Pattern.compile("\\d+");
+                                java.util.regex.Matcher matcher = pattern.matcher(userType);
+                                while (matcher.find()) {
+                                    types.add(matcher.group());
+                                }
+                            }
+                            //判断是否只包含1,2,3,7
+                            Set<String> allowedTypes = new HashSet<>(Arrays.asList("1", "2", "3", "7"));
+                            boolean isValid = types.stream().allMatch(allowedTypes::contains);
+                            if(!isValid){
+                                ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"用户平台格式错误",importTime,importId,importUser,filePath);
+                                logs.add(log);
+                                continue;
+                            }else {
+                                userImporterNew.setUserType(String.join(",", types));
+                            }
+                        }
+                        /**
+                         * 验证部门
+                         */
+                        if(StringUtil.isEmpty(userImporterNew.getDeptName())){
+                            ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"所属部门为空",importTime,importId,importUser,filePath);
+                            logs.add(log);
+                            continue;
+                        }else {
+                            Optional<Dept> dept = deptNames.stream().filter(deptName -> !StringUtil.isEmpty(deptName.getDeptName()) && deptName.getDeptName().equals(userImporterNew.getDeptName())).findFirst();
+                            if(!dept.isPresent()){
+                                ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"所属部门不存在",importTime,importId,importUser,filePath);
+                                logs.add(log);
+                                continue;
+                            }else {
+                                userImporterNew.setDeptId(dept.get().getId());
+                            }
+                        }
+                        //如果部门信息全都为null 就跳过验证
+                        if(userImporterNew.getProjectInfoList()!=null&& !userImporterNew.getProjectInfoList().isEmpty()){
+                            List<ImportPorjectInfoDTO> projectInfoList = userImporterNew.getProjectInfoList();
+                            for (ImportPorjectInfoDTO dto : projectInfoList) {
+                                /**
+                                 * 验证项目信息
+                                 */
+                                if(StringUtil.isEmpty(dto.getProjectId())){
+                                    ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"所属项目为空",importTime,importId,importUser,filePath);
+                                    logs.add(log);
+                                    dto.setStatus(1);
+                                    continue;
+                                }else {
+                                    if(!projectIds.contains(dto.getProjectId())){
+                                        ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"所属项目Id:"+dto.getProjectId()+",没找到对应的项目",importTime,importId,importUser,filePath);
+                                        logs.add(log);
+                                        dto.setStatus(1);
+                                        continue;
+                                    }
+                                }
+                                /**
+                                 * 验证合同段
+                                 */
+                                if(StringUtil.isEmpty(dto.getContractInfo())){
+                                    ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"合同段名称/编号为空",importTime,importId,importUser,filePath);
+                                    logs.add(log);
+                                    dto.setStatus(1);
+                                    continue;
+                                }else {
+                                    List<ContractInfo> contractInfos = contractNamesMap.get(dto.getProjectId());
+                                    Optional<ContractInfo> nameOptional = contractInfos.stream().filter(c -> !StringUtil.isEmpty(c.getContractName()) && c.getContractName().equals(dto.getContractInfo())).findFirst();
+                                    Optional<ContractInfo> numberOptional  = contractInfos.stream().filter(c -> !StringUtil.isEmpty(c.getContractNumber()) && c.getContractNumber().equals(dto.getContractInfo())).findFirst();
+                                    if(!(nameOptional.isPresent()||numberOptional.isPresent())){
+                                        ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"合同段名称/编号不存在:"+dto.getContractInfo(),importTime,importId,importUser,filePath);
+                                        logs.add(log);
+                                        dto.setStatus(1);
+                                        continue;
+                                    }else {
+                                        if(nameOptional.isPresent()){
+                                            dto.setContractId(nameOptional.get().getId());
+                                        }else {
+                                            dto.setContractId(numberOptional.get().getId());
+                                        }
+                                    }
+                                }
+                                /**
+                                 * 验证所属方
+                                 */
+                                if(StringUtil.isEmpty(dto.getOwner())){
+                                    ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"所属方为空",importTime,importId,importUser,filePath);
+                                    logs.add(log);
+                                    dto.setStatus(1);
+                                    continue;
+                                }else {
+                                    String owner = dto.getOwner();
+                                    if(!(owner.equals("1")||owner.equals("2")||owner.equals("3"))){
+                                        ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"所属方格式错误",importTime,importId,importUser,filePath);
+                                        logs.add(log);
+                                        dto.setStatus(1);
+                                        continue;
+                                    }
+                                }
+                                /**
+                                 * 验证岗位
+                                 */
+                                if(StringUtil.isEmpty(dto.getRoleName())){
+                                    ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"角色为空",importTime,importId,importUser,filePath);
+                                    logs.add(log);
+                                    dto.setStatus(1);
+                                }else {
+                                    List<Role> roles = roleMap.get(dto.getOwner());
+                                    Optional<Role> role = roles.stream().filter(r -> r.getRoleName().equals(dto.getRoleName())).findFirst();
+                                    if (role.isPresent()) {
+                                        dto.setRoleId(role.get().getId());
+                                    } else {
+                                        ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"角色不存在",importTime,importId,importUser,filePath);
+                                        logs.add(log);
+                                        dto.setStatus(1);
+                                    }
+                                }
+                            }
+                        }
+                         //验证完毕 开始新增
+                        if(!userImporterNew.getProjectInfoList().isEmpty()){
+                            userImporterNew.getProjectInfoList().removeIf(dto -> dto.getStatus()==1);
+                        }
+                        String roleIds = "";
+                        if(!userImporterNew.getProjectInfoList().isEmpty()){
+                            if (userImporterNew.getProjectInfoList() != null) {
+                                roleIds = userImporterNew.getProjectInfoList().stream()
+                                        .filter(dto -> dto.getRoleId() != null)
+                                        .map(dto -> String.valueOf(dto.getRoleId())) // 显式转换为字符串
+                                        .distinct()
+                                        .collect(Collectors.joining(","));
+                            }
+                        }
+                        /**
+                         * 用户账号表
+                         */
+                        User insertUser=new User();
+                        insertUser.setId(SnowFlakeUtil.getId());
+                        insertUser.setTenantId(AuthUtil.getTenantId());
+                        insertUser.setAccount(userImporterNew.getAccount());
+                        insertUser.setUserType(userImporterNew.getUserType());
+                        insertUser.setPassword(DigestUtil.encrypt(userImporterNew.getPassword()));
+                        insertUser.setPlaintextPassword(userImporterNew.getPassword());
+                        insertUser.setName(userImporterNew.getRealName());
+                        insertUser.setRealName(userImporterNew.getRealName());
+                        insertUser.setIdNumber(userImporterNew.getIdNumber());
+                        insertUser.setPhone(userImporterNew.getPhone());
+                        insertUser.setRoleId(roleIds);
+                        insertUser.setDeptId(userImporterNew.getDeptId()+"");
+                        insertUser.setStatus("是".equals(userImporterNew.getStatus()) ? 1 : 0);
+                        insertUser.setAccCode(userImporterNew.getAccCode());
+                        insertUserList.add(insertUser);
+                        /**
+                         * 用户部门表
+                         */
+                        UserDept userDept = new UserDept();
+                        userDept.setUserId(insertUser.getId());
+                        userDept.setDeptId(userImporterNew.getDeptId());
+                        insertUserDeptList.add(userDept);
+                        /**
+                         * 项目分配用户关系表
+                         */
+                        if(!userImporterNew.getProjectInfoList().isEmpty()){
+                            List<ImportPorjectInfoDTO> projectInfoList = userImporterNew.getProjectInfoList();
+                            for (ImportPorjectInfoDTO info : projectInfoList) {
+                                SaveUserInfoByProjectDTO dto = new SaveUserInfoByProjectDTO();
+                                dto.setId(SnowFlakeUtil.getId());
+                                dto.setProjectId(info.getProjectId());
+                                dto.setContractId(info.getContractId()+"");
+                                dto.setRoleId(info.getRoleId()+"");
+                                dto.setUserId(insertUser.getId()+"");
+                                dto.setStatus(1);
+                                insertUserInfoByProjectList.add(dto);
+                            }
+                        }
+                    }else {
+                        //账号存在 则更新
+                        //模板上姓名和数据库的姓名相同则修改
+                        if(!StringUtil.isEmpty(userImporterNew.getRealName())){
+                           if(user.getRealName().equals(userImporterNew.getRealName())){
+                               //拿到项目和合同段
+                               //如果部门信息全都为null 就跳过验证
+                               if(userImporterNew.getProjectInfoList()!=null&& !userImporterNew.getProjectInfoList().isEmpty()){
+                                   List<ImportPorjectInfoDTO> projectInfoList = userImporterNew.getProjectInfoList();
+                                   for (ImportPorjectInfoDTO dto : projectInfoList) {
+                                       /**
+                                        * 验证项目信息
+                                        */
+                                       if(StringUtil.isEmpty(dto.getProjectId())){
+                                           ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"所属项目为空",importTime,importId,importUser,filePath);
+                                           logs.add(log);
+                                           dto.setStatus(1);
+                                           continue;
+                                       }else {
+                                           if(!projectIds.contains(dto.getProjectId())){
+                                               ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"所属项目Id:"+dto.getProjectId()+",没找到对应的项目",importTime,importId,importUser,filePath);
+                                               logs.add(log);
+                                               dto.setStatus(1);
+                                               continue;
+                                           }
+                                       }
+                                       /**
+                                        * 验证合同段
+                                        */
+                                       if(StringUtil.isEmpty(dto.getContractInfo())){
+                                           ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"合同段名称/编号为空",importTime,importId,importUser,filePath);
+                                           logs.add(log);
+                                           dto.setStatus(1);
+                                           continue;
+                                       }else {
+                                           List<ContractInfo> contractInfos = contractNamesMap.get(dto.getProjectId());
+                                           Optional<ContractInfo> nameOptional = contractInfos.stream().filter(c -> !StringUtil.isEmpty(c.getContractName()) && c.getContractName().equals(dto.getContractInfo())).findFirst();
+                                           Optional<ContractInfo> numberOptional  = contractInfos.stream().filter(c -> !StringUtil.isEmpty(c.getContractNumber()) && c.getContractNumber().equals(dto.getContractInfo())).findFirst();
+                                           if(!(nameOptional.isPresent()||numberOptional.isPresent())){
+                                               ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"合同段名称/编号不存在:"+dto.getContractInfo(),importTime,importId,importUser,filePath);
+                                               logs.add(log);
+                                               dto.setStatus(1);
+                                               continue;
+                                           }else {
+                                               if(nameOptional.isPresent()){
+                                                   dto.setContractId(nameOptional.get().getId());
+                                               }else {
+                                                   dto.setContractId(numberOptional.get().getId());
+                                               }
+                                           }
+                                       }
+                                       /**
+                                        * 验证所属方
+                                        */
+                                       if(StringUtil.isEmpty(dto.getOwner())){
+                                           ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"所属方为空",importTime,importId,importUser,filePath);
+                                           logs.add(log);
+                                           dto.setStatus(1);
+                                           continue;
+                                       }else {
+                                           String owner = dto.getOwner();
+                                           if(!(owner.equals("1")||owner.equals("2")||owner.equals("3"))){
+                                               ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"所属方格式错误",importTime,importId,importUser,filePath);
+                                               logs.add(log);
+                                               dto.setStatus(1);
+                                               continue;
+                                           }
+                                       }
+                                       /**
+                                        * 验证岗位
+                                        */
+                                       if(StringUtil.isEmpty(dto.getRoleName())){
+                                           ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"角色为空",importTime,importId,importUser,filePath);
+                                           logs.add(log);
+                                           dto.setStatus(1);
+                                       }else {
+                                           List<Role> roles = roleMap.get(dto.getOwner());
+                                           Optional<Role> role = roles.stream().filter(r -> r.getRoleName().equals(dto.getRoleName())).findFirst();
+                                           if (role.isPresent()) {
+                                               dto.setRoleId(role.get().getId());
+                                           } else {
+                                               ImportUserLog log=new ImportUserLog(SnowFlakeUtil.getId(),userImporterNew.getAccount(),userImporterNew.getRealName(),"角色不存在",importTime,importId,importUser,filePath);
+                                               logs.add(log);
+                                               dto.setStatus(1);
+                                           }
+                                       }
+                                   }
+                               }
+                               if (userImporterNew.getProjectInfoList() != null && !userImporterNew.getProjectInfoList().isEmpty()) {
+                                   for (ImportPorjectInfoDTO dto : userImporterNew.getProjectInfoList()) {
+                                       String sql = "select * from m_project_assignment_user where user_id=" + user.getId() + " and contract_id=" + dto.getContractId();
+                                       List<SaveUserInfoByProjectDTO> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(SaveUserInfoByProjectDTO.class));
+                                       if (query.isEmpty()) {
+                                           SaveUserInfoByProjectDTO projectdto = new SaveUserInfoByProjectDTO();
+                                           projectdto.setId(SnowFlakeUtil.getId());
+                                           projectdto.setProjectId(dto.getProjectId());
+                                           projectdto.setContractId(dto.getContractId() + "");
+                                           projectdto.setRoleId(dto.getRoleId() + "");
+                                           projectdto.setUserId(user.getId() + "");
+                                           projectdto.setStatus(1);
+                                           insertUserInfoByProjectList.add(projectdto);
+                                           user.setRoleId(user.getRoleId()+","+dto.getRoleId());
+                                           user.setStatus("是".equals(userImporterNew.getStatus()) ? 1 : 0);
+                                           updateUserList.add(user);
+                                       } else {
+                                           SaveUserInfoByProjectDTO projectdto = query.get(0);
+                                           projectdto.setRoleId(dto.getRoleId() + "");
+                                           updateUserInfoByProjectList.add(projectdto);
+                                           user.setRoleId(user.getRoleId()+","+dto.getRoleId());
+                                           user.setStatus("是".equals(userImporterNew.getStatus()) ? 1 : 0);
+                                           updateUserList.add(user);
+                                       }
+                                   }
+                               }
+                           }
+                        }
+                    }
+                }
+                if(!insertUserList.isEmpty()){
+                    this.saveBatch(insertUserList);
+                }
+                if(!insertUserDeptList.isEmpty()){
+                    userDeptService.saveBatch(insertUserDeptList);
+                }
+                if(!insertUserInfoByProjectList.isEmpty()){
+                    saveUserInfoByProjectClient.insertUserInfoBatch(insertUserInfoByProjectList);
+                }
+                if(!updateUserInfoByProjectList.isEmpty()){
+                    saveUserInfoByProjectClient.updateUserInfoBatch(updateUserInfoByProjectList);
+                }
+                if(!updateUserList.isEmpty()){
+                    for (User user : updateUserList) {
+                        String sql="select role_id from m_project_assignment_user where user_id="+user.getId()+" and is_deleted=0";
+                        List<String> roleIds = jdbcTemplate.query(sql, new SingleColumnRowMapper<>(String.class));
+                        String roleId = user.getRoleId();
+                        if (!StringUtil.isEmpty(roleId)) {
+                            // 按逗号分割,去重后再重新拼接
+                            List<String> roleIdList = Arrays.asList(roleId.split(","));
+                            List<String> distinctRoleIds = roleIdList.stream().distinct().collect(Collectors.toList());
+                            roleId = String.join(",", distinctRoleIds);
+                        }
+                        user.setRoleId(roleIds.isEmpty() ? roleId : String.join(",", roleIds));
+                    }
+                    this.updateBatchById(updateUserList);
+                }
+                if(!logs.isEmpty()){
+                    this.saveUserImportLogs(logs);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail("导入失败:" + e.getMessage());
+        }
+        if(logs.size()>0){
+            return R.fail("导入失败:" + logs.size() + "条记录导入失败");
+        }
+        return R.success("导入成功,共新增:" + insertUserList.size() + "条有效记录,更新:"+updateUserInfoByProjectList.size()+"条记录");
+    }
+
+    /**
+     * 保存用户导入日志
+     * @param logs
+     */
+    private void saveUserImportLogs(List<ImportUserLog> logs) {
+        if (logs == null || logs.isEmpty()) {
+            return;
+        }
+        String sql = "INSERT INTO blade_import_user_log " +
+                "(id, account, name, message, import_time, import_id, import_user, file_path) " +
+                "VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
+        jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
+            @Override
+            public void setValues(PreparedStatement ps, int i) throws SQLException {
+                ImportUserLog log = logs.get(i);
+                ps.setObject(1, log.getId());            // id
+                ps.setString(2, log.getAccount());       // account
+                ps.setString(3, log.getName());          // name
+                ps.setString(4, log.getMessage());       // message
+                ps.setString(5, log.getImportTime());    // import_time
+                ps.setObject(6, log.getImportId());      // import_id
+                ps.setObject(7, log.getImportUser());    // import_user
+                ps.setString(8, log.getFilePath());      // file_path
+            }
+            @Override
+            public int getBatchSize() {
+                return logs.size();
+            }
+        });
+    }
+
+    /**
+     * 初始化UserImporterNew:赋值核心字段+处理默认值
+     * @param row Excel行数据
+     * @return 初始化后的UserImporterNew
+     */
+    private UserImporterNew initUserImporterNew(ExcelUserTemp row) {
+        UserImporterNew user = new UserImporterNew();
+        // 处理默认值:密码默认"user123456",登录状态默认"是"
+        String defaultPwd = Objects.isNull(row.getPassword()) || row.getPassword().trim().isEmpty()
+                ? "user123456"
+                : row.getPassword().trim();
+        String defaultStatus = Objects.isNull(row.getStatus()) || row.getStatus().trim().isEmpty()
+                ? "是"
+                : row.getStatus().trim();
+
+        // 赋值核心用户字段(trim避免空格问题)
+        user.setAccount(Objects.nonNull(row.getAccount()) ? row.getAccount().trim() : "");
+        user.setPassword(defaultPwd);
+        user.setRealName(Objects.nonNull(row.getRealName()) ? row.getRealName().trim() : "");
+        user.setUserType(Objects.nonNull(row.getUserType()) ? row.getUserType().trim() : "");
+        user.setPhone(Objects.nonNull(row.getPhone()) ? row.getPhone().trim() : "");
+        user.setIdNumber(Objects.nonNull(row.getIdNumber()) ? row.getIdNumber().trim() : "");
+        user.setDeptName(Objects.nonNull(row.getDeptName()) ? row.getDeptName().trim() : "");
+        user.setAccCode(Objects.nonNull(row.getAccCode()) ? row.getAccCode().trim() : "");
+        user.setStatus(defaultStatus);
+        user.setDeptId(null);
+        return user;
+    }
+    /**
+     * 构建PorjectInfoDTO:补充行继承基准projectId
+     * @param row Excel行数据
+     * @param baseProjectId 基准项目ID(新用户行的projectId)
+     * @return 有效DTO(projectId非空)
+     */
+    private ImportPorjectInfoDTO buildPorjectInfoDTO(ExcelUserTemp row, String baseProjectId) {
+        // 优先用行内projectId,为空则用基准ID
+        String projectId = Objects.nonNull(row.getProjectId()) ? row.getProjectId().trim() : baseProjectId;
+        // 基准ID也为空则视为无效
+        if (projectId.isEmpty()) {
+            return null;
+        }
+
+        ImportPorjectInfoDTO dto = new ImportPorjectInfoDTO();
+        dto.setProjectId(projectId);
+        dto.setContractInfo(Objects.nonNull(row.getContractInfo()) ? row.getContractInfo().trim() : "");
+        dto.setOwner(Objects.nonNull(row.getOwner()) ? row.getOwner().trim() : "");
+        dto.setRoleName(Objects.nonNull(row.getRoleName()) ? row.getRoleName().trim() : "");
+        return dto;
+    }
+    /**
+     * 判断项目是否重复:按「项目ID+合同段」组合去重
+     * @param projectList 已存在的项目列表
+     * @param newDTO 新项目DTO
+     * @return true=重复,false=不重复
+     */
+    private boolean isProjectDuplicate(List<ImportPorjectInfoDTO> projectList, ImportPorjectInfoDTO newDTO) {
+        for (ImportPorjectInfoDTO existDTO : projectList) {
+            // 项目ID和合同段均相同 → 视为重复
+            boolean isSameProjectId = existDTO.getProjectId().equals(newDTO.getProjectId());
+            boolean isSameContract = existDTO.getContractInfo().equals(newDTO.getContractInfo());
+            if (isSameProjectId && isSameContract) {
+                return true;
+            }
+        }
+        return false;
+    }
+    /**
+     * 判断核心字段是否为空:用于识别「新用户行」vs「补充行」
+     * 核心字段:登录账号+用户姓名+手机号码(至少一个非空即为新用户行)
+     * @param row Excel行数据
+     * @return true=核心字段全空(补充行),false=核心字段有值(新用户行)
+     */
+    private boolean isCoreFieldEmpty(ExcelUserTemp row) {
+        return (Objects.isNull(row.getAccount()) || row.getAccount().trim().isEmpty())
+                && (Objects.isNull(row.getRealName()) || row.getRealName().trim().isEmpty())
+                && (Objects.isNull(row.getPhone()) || row.getPhone().trim().isEmpty());
+    }
+    /**
+     * 判断中国大陆手机号格式是否正确
+     *
+     * @param phoneNumber 手机号
+     * @return true表示格式正确,false表示格式错误
+     */
+    public static boolean isValidChinesePhoneNumber(String phoneNumber) {
+        if (phoneNumber == null || phoneNumber.length() != 11) {
+            return false;
+        }
+
+        // 使用正则表达式匹配手机号格式
+        String regex = "^1[3-9]\\d{9}$";
+        return phoneNumber.matches(regex);
+    }
+
+    /**
+     * 判断身份证格式是否正确
+     *
+     * @param idCard 身份证号码
+     * @return true表示格式正确,false表示格式错误
+     */
+    public static boolean isValidIdCard(String idCard) {
+        if (idCard == null || idCard.trim().isEmpty()) {
+            return false;
+        }
+
+        idCard = idCard.trim();
+
+        // 长度验证
+        if (idCard.length() == 15) {
+            return isValidIdCard15(idCard);
+        } else if (idCard.length() == 18) {
+            return isValidIdCard18(idCard);
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * 验证15位身份证号码
+     *
+     * @param idCard 15位身份证号码
+     * @return true表示格式正确,false表示格式错误
+     */
+    private static boolean isValidIdCard15(String idCard) {
+        // 15位身份证号码为纯数字
+        if (!Pattern.matches("\\d{15}", idCard)) {
+            return false;
+        }
+
+        // 验证出生日期
+        String birthDay = "19" + idCard.substring(6, 12); // 15位身份证年份默认为19XX年
+        return isValidDate(birthDay, "yyyyMMdd");
+    }
+
+    /**
+     * 验证18位身份证号码
+     *
+     * @param idCard 18位身份证号码
+     * @return true表示格式正确,false表示格式错误
+     */
+    private static boolean isValidIdCard18(String idCard) {
+        // 18位身份证号码前17位为数字,最后一位为数字或X
+        if (!Pattern.matches("\\d{17}[\\dXx]", idCard)) {
+            return false;
+        }
+
+        // 验证地址码(简单验证前两位)
+        String areaCode = idCard.substring(0, 2);
+        if (!AREA_CODES.contains(areaCode)) {
+            return false;
+        }
+
+        // 验证出生日期
+        String birthDay = idCard.substring(6, 14);
+        if (!isValidDate(birthDay, "yyyyMMdd")) {
+            return false;
+        }
+
+        // 验证校验码
+        return checkIdCard18(idCard);
+    }
+
+    /**
+     * 验证日期格式是否正确
+     *
+     * @param date   日期字符串
+     * @param format 日期格式
+     * @return true表示日期格式正确,false表示日期格式错误
+     */
+    private static boolean isValidDate(String date, String format) {
+        SimpleDateFormat sdf = new SimpleDateFormat(format);
+        sdf.setLenient(false); // 严格模式,不允许不合理的日期
+        try {
+            sdf.parse(date);
+            // 检查年份范围(例如:1900年至今)
+            Calendar calendar = new GregorianCalendar();
+            calendar.setTime(sdf.parse(date));
+            int year = calendar.get(Calendar.YEAR);
+            int currentYear = Calendar.getInstance().get(Calendar.YEAR);
+            return year >= 1900 && year <= currentYear;
+        } catch (ParseException e) {
+            return false;
+        }
+    }
+
+    /**
+     * 验证18位身份证号码的校验码
+     *
+     * @param idCard 18位身份证号码
+     * @return true表示校验码正确,false表示校验码错误
+     */
+    private static boolean checkIdCard18(String idCard) {
+        char[] idCardArray = idCard.toCharArray();
+        int[] weight = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
+        char[] validate = {'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'};
+        int sum = 0;
+
+        for (int i = 0; i < 17; i++) {
+            sum += (idCardArray[i] - '0') * weight[i];
+        }
+
+        int mod = sum % 11;
+        char validateCode = validate[mod];
+
+        return Character.toUpperCase(idCardArray[17]) == validateCode;
+    }
+
+    // 简化的省份代码列表(前两位)
+    private static final java.util.Set<String> AREA_CODES = new java.util.HashSet<>();
+    static {
+        AREA_CODES.add("11"); // 北京
+        AREA_CODES.add("12"); // 天津
+        AREA_CODES.add("13"); // 河北
+        AREA_CODES.add("14"); // 山西
+        AREA_CODES.add("15"); // 内蒙古
+        AREA_CODES.add("21"); // 辽宁
+        AREA_CODES.add("22"); // 吉林
+        AREA_CODES.add("23"); // 黑龙江
+        AREA_CODES.add("31"); // 上海
+        AREA_CODES.add("32"); // 江苏
+        AREA_CODES.add("33"); // 浙江
+        AREA_CODES.add("34"); // 安徽
+        AREA_CODES.add("35"); // 福建
+        AREA_CODES.add("36"); // 江西
+        AREA_CODES.add("37"); // 山东
+        AREA_CODES.add("41"); // 河南
+        AREA_CODES.add("42"); // 湖北
+        AREA_CODES.add("43"); // 湖南
+        AREA_CODES.add("44"); // 广东
+        AREA_CODES.add("45"); // 广西
+        AREA_CODES.add("46"); // 海南
+        AREA_CODES.add("50"); // 重庆
+        AREA_CODES.add("51"); // 四川
+        AREA_CODES.add("52"); // 贵州
+        AREA_CODES.add("53"); // 云南
+        AREA_CODES.add("54"); // 西藏
+        AREA_CODES.add("61"); // 陕西
+        AREA_CODES.add("62"); // 甘肃
+        AREA_CODES.add("63"); // 青海
+        AREA_CODES.add("64"); // 宁夏
+        AREA_CODES.add("65"); // 新疆
+        AREA_CODES.add("71"); // 台湾
+        AREA_CODES.add("81"); // 香港
+        AREA_CODES.add("82"); // 澳门
+        AREA_CODES.add("91"); // 国外
+    }
+
+
 }