Browse Source

档案-同步质检试验资料

qianxb 2 months ago
parent
commit
472b041908

+ 17 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialSelfInspectionRecordFileVO.java

@@ -1,8 +1,12 @@
 package org.springblade.business.vo;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
+import java.util.Date;
 
 @Data
 public class TrialSelfInspectionRecordFileVO implements Serializable {
@@ -15,4 +19,17 @@ public class TrialSelfInspectionRecordFileVO implements Serializable {
 
     private Integer type;
 
+    private Long nodeId;
+
+    private String fileName;
+
+    @DateTimeFormat(
+            pattern = "yyyy-MM-dd HH:mm:ss"
+    )
+    @JsonFormat(
+            pattern = "yyyy-MM-dd HH:mm:ss"
+    )
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+
 }

+ 3 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/ArchiveTree.java

@@ -182,6 +182,9 @@ public class ArchiveTree extends BaseEntity {
     @ApiModelProperty(value = "日志资料类型,逗号拼接")
     private String contractLogType;
 
+    @ApiModelProperty(value = "试验资料类型(归档树)对应字典试验节点类型,数字逗号拼接")
+    private String contractTrialType;
+
     public ArchiveTree() {
     }
 

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

@@ -247,6 +247,9 @@ public class ArchiveTreeContract extends BaseEntity {
     @ApiModelProperty(value = "日志资料类型,逗号拼接")
     private String contractLogType;
 
+    @ApiModelProperty(value = "试验资料类型(归档树)对应字典试验节点类型,数字逗号拼接")
+    private String contractTrialType;
+
     public ArchiveTreeContract() {
     }
 
@@ -317,6 +320,7 @@ public class ArchiveTreeContract extends BaseEntity {
         this.archiveAutoGroupSelect = archiveTree.getArchiveAutoGroupSelect();
         this.isUploadFileDisplayConfigurationTree = archiveTree.getIsUploadFileDisplayConfigurationTree();
         this.contractLogType = archiveTree.getContractLogType();
+        this.contractTrialType = archiveTree.getContractTrialType();
     }
 
     public void sync(ArchiveTreeVO2 archiveTree) {

+ 44 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/ArchiveSyncTrialVO.java

@@ -0,0 +1,44 @@
+package org.springblade.manager.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springblade.core.tool.node.INode;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Param   档案同步质检试验VO
+ * @Author wangwl
+ * @Date 2024/9/12 16:02
+ **/
+@Data
+public class ArchiveSyncTrialVO {
+
+
+    @ApiModelProperty(value = "主键id")
+    private Long pKeyId;
+
+    @ApiModelProperty(value = "主键id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long id;
+
+    @ApiModelProperty(value = "父主键id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long parentId;
+
+    @ApiModelProperty(value = "节点名称")
+    private String nodeName;
+
+    @ApiModelProperty(value = "节点全称")
+    private String fullName;
+
+    @ApiModelProperty(value = "节点类型,试验为51,52,53")
+    private Integer nodeType;
+
+    @ApiModelProperty(value = "排序")
+    private Integer sort;
+}

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

@@ -107,7 +107,8 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
             return this.wbsTreeContractService.list(wrapper);
         } else {
             //.eq(WbsTreeContract::getType, "1")
-            return this.wbsTreeContractService.list(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getParentId, treeNode.getId()).eq(WbsTreeContract::getContractId, treeNode.getContractId()).eq(WbsTreeContract::getStatus, 1).orderByAsc(WbsTreeContract::getSort).orderByAsc(WbsTreeContract::getFullName));
+            return this.wbsTreeContractService.list(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getParentId, treeNode.getId()).eq(WbsTreeContract::getType,1)
+                    .eq(WbsTreeContract::getContractId, treeNode.getContractId()).eq(WbsTreeContract::getStatus, 1).orderByAsc(WbsTreeContract::getSort).orderByAsc(WbsTreeContract::getFullName));
         }
     }
 

+ 13 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ArchiveTreeContractMapper.java

@@ -23,8 +23,12 @@ import org.springblade.archive.dto.JiLinQueryDto;
 import org.springblade.archive.entity.ArchiveExpertConclusion;
 import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.entity.InformationQuery;
+import org.springblade.business.entity.TrialDetectionData;
+import org.springblade.business.entity.TrialSelfInspectionRecord;
+import org.springblade.business.vo.TrialSelfInspectionRecordFileVO;
 import org.springblade.manager.dto.ArchiveTreeContractDTO;
 import org.springblade.manager.entity.ArchiveTreeContract;
+import org.springblade.manager.entity.TrialClassificationConfiguration;
 import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.vo.*;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -161,4 +165,13 @@ public interface ArchiveTreeContractMapper extends BaseMapper<ArchiveTreeContrac
 
     List<DictBiz> getLogDict();
 
+    List<ArchiveSyncTrialVO> getAllTrialNode(@Param("projectId") Long projectId);
+
+    List<TrialSelfInspectionRecord> getAllTrialRecord(@Param("contractId") Long contractId);
+
+    List<TrialSelfInspectionRecordFileVO> getAllTrialRecordFile(@Param("ids") List<Long> recordIds);
+
+    List<TrialClassificationConfiguration> getAllThreeTestNode();
+
+    List<TrialDetectionData> getAllTrialTestRecord(@Param("contractId") Long contractId);
 }

+ 36 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ArchiveTreeContractMapper.xml

@@ -768,4 +768,40 @@
     <select id="getLogDict" resultType="org.springblade.system.entity.DictBiz">
         select * from blade_dict_biz where parent_id != 0 and code = 'contract_log_type' and is_deleted = 0
     </select>
+    <select id="getAllTrialNode" resultType="org.springblade.manager.vo.ArchiveSyncTrialVO">
+        select p_key_id,id,parent_id,node_name,full_name,node_type,sort
+        from m_wbs_tree_private
+        where wbs_type = 2 and project_id = #{projectId} and `type` = 1 and is_deleted = 0
+          and node_type in (51,52,53)
+        order by sort
+    </select>
+    <select id="getAllTrialRecord" resultType="org.springblade.business.entity.TrialSelfInspectionRecord">
+        select *
+        from u_trial_self_inspection_record
+        where contract_id = #{contractId} and is_deleted = 0 and task_status = '已审批'
+    </select>
+    <select id="getAllTrialRecordFile"
+            resultType="org.springblade.business.vo.TrialSelfInspectionRecordFileVO">
+        select id,self_id,url,type,
+               (select node_id from u_trial_self_inspection_record sir where sir.id = sirf.self_id) as nodeId
+        from u_trial_self_inspection_record_file sirf
+        where self_id in
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+    <select id="getAllThreeTestNode"
+            resultType="org.springblade.manager.entity.TrialClassificationConfiguration">
+        select *
+        from m_trial_classification_configuration
+        where is_deleted = 0 and parent_id in
+            (
+                select id from m_trial_classification_configuration where is_deleted = 0 and parent_id = 0 and node_type in (1,2)
+                )
+    </select>
+    <select id="getAllTrialTestRecord" resultType="org.springblade.business.entity.TrialDetectionData">
+        select *
+        from m_trial_detection_data
+        where contract_id = #{contractId} and is_deleted = 0
+    </select>
 </mapper>

+ 274 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractSyncImpl.java

@@ -10,10 +10,13 @@ import org.springblade.archive.feign.ArchiveAutoClient;
 import org.springblade.business.dto.ImageClassificationFileDTO;
 import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.entity.InformationQuery;
+import org.springblade.business.entity.TrialDetectionData;
+import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.business.feign.ArchiveFileClient;
 import org.springblade.business.feign.ImageClassificationFileClient;
 import org.springblade.business.feign.InformationQueryClient;
 import org.springblade.business.vo.TreeVoTwo;
+import org.springblade.business.vo.TrialSelfInspectionRecordFileVO;
 import org.springblade.common.utils.ForestNodeMergerEx;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
@@ -28,10 +31,14 @@ import org.springblade.manager.mapper.ArchiveTreeContractMapper;
 import org.springblade.manager.service.*;
 import org.springblade.manager.utils.ForestNodeMerger;
 import org.springblade.manager.vo.*;
+import org.springblade.resource.entity.Attach;
 import org.springblade.system.entity.DictBiz;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.util.*;
@@ -70,6 +77,8 @@ public class ArchiveTreeContractSyncImpl {
 
     private final IWbsTreePrivateService wbsTreePrivateService;
 
+    private final JdbcTemplate jdbcTemplate;
+
 
 
     /**
@@ -769,6 +778,9 @@ public class ArchiveTreeContractSyncImpl {
      * 同步合同段数据时,统一校验通道,3声像资料,6日志资料,2试验资料
      */
     public void syncDataCheck(Long projectId, Long contractId, Long nodeId,Integer associationType) {
+        if (ObjectUtil.isEmpty(contractId)){
+            throw new ServiceException("未获取到当前同步节点的合同段信息,请查看是否当前节点在合同段节点下");
+        }
         // 合同信息
         ContractInfo contractInfo = contractInfoService.getById(contractId);
         // 判断是否正在同步
@@ -869,10 +881,140 @@ public class ArchiveTreeContractSyncImpl {
 
     /**
      * 同步某个合同段的试验资料到归档
+     *      因为试验系统没有做完,所以目前某些类型的同步会同步所有数据,并且也缺失一些文件的基础信息,
+     *          如大小,页码等,等做完之后,再完善。目前整体功能没有问题
      */
     @Transactional
     public void syncContractTrialData(Long projectId, ContractInfo contractInfo, ArchiveTreeContract archiveTreeContract) {
+        //获取勾选的试验类型
+        String contractTrialType = archiveTreeContract.getContractTrialType();
+        if (StringUtils.isBlank(contractTrialType)){
+            throw new ServiceException("当前节点未配置同步试验资料类型");
+        }
+        List<Integer> TrialType = Arrays.stream(contractTrialType.split(","))
+                .map(Integer::parseInt) // 将每个字符串转换为Integer
+                .collect(Collectors.toList());
+        Long contractId = contractInfo.getId();
+        String tenantId = AuthUtil.getTenantId();
+        log.info("同步试验文件,projectId:"+projectId+",contractId:"+contractId+",nodeId:"+archiveTreeContract.getId());
+        //先删除试验资料节点下的所有节点与文件
+        archiveTreeContractMapper.removeImageNodeFile(archiveTreeContract.getContractId(),archiveTreeContract.getId());
+        archiveTreeContractMapper.removeImageNodeChild(archiveTreeContract.getContractId(),archiveTreeContract.getId());
+
+        //查出所有试验节点,节点是共用项目级的
+        List<ArchiveSyncTrialVO> trials = archiveTreeContractMapper.getAllTrialNode(projectId);
+        //试验节点按照类型分组
+        Map<Integer, List<ArchiveSyncTrialVO>> trialsMap = trials.stream().collect(Collectors.groupingBy(ArchiveSyncTrialVO::getNodeType));
+        //查出所有的试验报告,报告是合同段独立的
+        List<TrialSelfInspectionRecord> records = archiveTreeContractMapper.getAllTrialRecord(contractId);
+        //试验报告按照节点分组
+        Map<Long, List<TrialSelfInspectionRecord>> recordsMap = records.stream().collect(Collectors.groupingBy(TrialSelfInspectionRecord::getNodeId));
+        List<ArchiveTreeContract> addNode = new ArrayList<>();
+        List<ArchiveFile> addFile = new ArrayList<>();
+        /**循环指定试验类型 */
+        for (Integer type : TrialType) {
+            //根据类型获取试验节点
+            List<ArchiveSyncTrialVO> trialVOS = trialsMap.get(type);
+            if (CollectionUtil.isEmpty(trialVOS)){
+                continue;
+            }
+            //循环试验节点
+            for (ArchiveSyncTrialVO vo : trialVOS) {
+                //把节点转换为档案节点,挂载到同步节点下
+                ArchiveTreeContract trialNode = createTypeNode(vo.getNodeName(), archiveTreeContract);
+                addNode.add(trialNode);
+                //获取出节点下面的报告,并转换为档案文件
+                List<TrialSelfInspectionRecord> files = recordsMap.get(vo.getPKeyId());
+                if (CollectionUtil.isEmpty(files)){
+                    continue;
+                }
+                //挂载到子节点下
+                List<ArchiveFile> newArchiveFileList = files.stream().map(file -> {
+                    ArchiveFile archiveFile = trialFileCovertArchiveFile(file, trialNode);
+                    return archiveFile;
+                }).collect(Collectors.toList());
+                addFile.addAll(newArchiveFileList);
+            }
 
+        }
+        /**单独处理外委和第三方报告 */
+        if (contractTrialType.contains("98")){
+            //获取所有的外委和第三方节点
+            List<TrialClassificationConfiguration> threeTestNodes = archiveTreeContractMapper.getAllThreeTestNode();
+            //获取出合同段所有的检测报告
+            List<TrialDetectionData> dataList = archiveTreeContractMapper.getAllTrialTestRecord(contractId);
+            //检测报告,按照节点分组
+            Map<Long, List<TrialDetectionData>> dataMap = dataList.stream().collect(Collectors.groupingBy(l -> l.getNodeId()));
+            //循环所有节点
+            for (TrialClassificationConfiguration vo : threeTestNodes) {
+                //把节点转换为档案节点,挂载到同步节点下
+                ArchiveTreeContract trialNode = createTypeNode(vo.getNodeName(), archiveTreeContract);
+                addNode.add(trialNode);
+                //获取出节点下面的报告,并转换为档案文件
+                List<TrialDetectionData> files = dataMap.get(vo.getId());
+                if (CollectionUtil.isEmpty(files)){
+                    continue;
+                }
+                //挂载到子节点下
+                List<ArchiveFile> newArchiveFileList = files.stream().map(file -> {
+                    ArchiveFile archiveFile = trialTestFileCovertArchiveFile(file, trialNode);
+                    return archiveFile;
+                }).collect(Collectors.toList());
+                addFile.addAll(newArchiveFileList);
+            }
+        }
+
+        /**单独处理原材料资质证书 */
+        if (contractTrialType.contains("99")){
+            //获取所有的原材节点
+            List<ArchiveSyncTrialVO> trialVOS = trialsMap.get(52);
+            if (CollectionUtil.isNotEmpty(trialVOS)){
+                //查询出整个系统的附件,设计问题
+                Map<String, Attach> maps = jdbcTemplate.query("select link,original_name from blade_attach", new BeanPropertyRowMapper<>(Attach.class)).stream().collect(Collectors.toMap(Attach::getLink, Attach -> Attach, (obj1, obj2) -> obj1));
+                //获取出所有节点id
+                List<Long> nodeIds = trialVOS.stream().map(l -> l.getPKeyId()).collect(Collectors.toList());
+                //根据节点id,查询出所有的报告id
+                List<Long> recordIds = records.stream().filter(l -> nodeIds.contains(l.getNodeId())).map(l -> l.getId()).collect(Collectors.toList());
+                //根据报告id,查询出所有的报告附件
+                List<TrialSelfInspectionRecordFileVO> fileVOS = archiveTreeContractMapper.getAllTrialRecordFile(recordIds);
+                //报告附件按照节点id分组
+                Map<Long, List<TrialSelfInspectionRecordFileVO>> fileMap = fileVOS.stream().collect(Collectors.groupingBy(l -> l.getNodeId()));
+                //循环原材节点
+                for (ArchiveSyncTrialVO vo : trialVOS) {
+                    //把节点转换为档案节点,挂载到同步节点下
+                    ArchiveTreeContract trialNode = createTypeNode(vo.getNodeName(), archiveTreeContract);
+                    addNode.add(trialNode);
+                    //获取出节点下面的报告下面的附件,并转换为档案文件
+                    List<TrialSelfInspectionRecordFileVO> files = fileMap.get(vo.getPKeyId());
+                    if (CollectionUtil.isEmpty(files)){
+                        continue;
+                    }
+                    //上个开发太懒,敷衍了事,重新设置附件相关值
+                    for (TrialSelfInspectionRecordFileVO file : files) {
+                        Attach attach = maps.get(file.getUrl());
+                        if (attach != null){
+                            file.setFileName(attach.getOriginalName());
+                            file.setCreateTime(attach.getCreateTime());
+                        }
+                    }
+                    //挂载到子节点下
+                    List<ArchiveFile> newArchiveFileList = files.stream().map(file -> {
+                        ArchiveFile archiveFile = trialFileCovertArchiveFile2(file, trialNode);
+                        return archiveFile;
+                    }).collect(Collectors.toList());
+                    addFile.addAll(newArchiveFileList);
+                }
+
+            }
+
+        }
+        if (addNode.size() > 0){
+            addNode.stream().forEach(l->l.setTenantId(tenantId));
+            archiveTreeContractMapper.batchInsertArchiveTreeContract(addNode);
+        }
+        if (addFile.size() > 0){
+            archiveFileClient.addArchiveFile(addFile);
+        }
     }
 
     /**
@@ -883,7 +1025,7 @@ public class ArchiveTreeContractSyncImpl {
         //获取勾选的日志类型
         String contractLogType = archiveTreeContract.getContractLogType();
         if (StringUtils.isBlank(contractLogType)){
-            throw new ServiceException("当前节点未配置同步日志类型");
+            throw new ServiceException("当前节点未配置同步日志资料类型");
         }
         List<Integer> logType = Arrays.stream(contractLogType.split(","))
                 .map(Integer::parseInt) // 将每个字符串转换为Integer
@@ -904,14 +1046,18 @@ public class ArchiveTreeContractSyncImpl {
         List<ArchiveFile> addFile = new ArrayList<>();
         //获取合同段所有的日志,并且附带类型
         List<ArchiveSyncLogVO> logs = wbsTreePrivateService.getContractAllLog(contractId);
+        if (CollectionUtil.isEmpty(logs)){
+            throw new ServiceException("当前合同段下没有日志资料");
+        }
         //日志按照类型分组
         Map<Integer, List<ArchiveSyncLogVO>> logMap = logs.stream().collect(Collectors.groupingBy(ArchiveSyncLogVO::getLogType));
-        //循环选择的日志类型,生成子节点
+        //循环选择的日志类型
         for (Integer type : logType) {
             String typeName = dictMap.get(type);
             if (StringUtils.isBlank(typeName)){
                 throw new ServiceException("日志存在字典中未配置的类型,请检查后再同步");
             }
+            //生成子节点
             ArchiveTreeContract logNode = createTypeNode(typeName, archiveTreeContract);
             /** 如果到时候修改需求,只显示有日志的,则下面文件存在再add*/
             addNode.add(logNode);
@@ -969,6 +1115,9 @@ public class ArchiveTreeContractSyncImpl {
 
         //获取合同下声像资料所有文件
         List<ImageClassificationFileDTO> imageClassificationFileList = imageClassificationFileClient.getImageClassificationFileListByContractId(contractId);
+        if (CollectionUtil.isEmpty(imageClassificationFileList)){
+            throw new ServiceException("当前合同段下没有声像资料");
+        }
         Map<Long, List<ImageClassificationFileDTO>> imageMap = imageClassificationFileList.stream().collect(Collectors.groupingBy(l -> l.getClassifyId()));
 
         //获取声像资料分类,生成声像资料下级节点
@@ -1124,6 +1273,129 @@ public class ArchiveTreeContractSyncImpl {
         return archiveFile;
     }
 
+    /**
+     * 质检试验资料附件 转换为 档案文件
+     */
+    private ArchiveFile trialFileCovertArchiveFile2(TrialSelfInspectionRecordFileVO vo,ArchiveTreeContract parentNode)
+    {
+        ArchiveFile archiveFile = new ArchiveFile();
+        archiveFile.setId(SnowFlakeUtil.getId());
+        archiveFile.setProjectId(String.valueOf(parentNode.getProjectId()));
+        archiveFile.setContractId(String.valueOf(parentNode.getContractId()));
+        archiveFile.setNodeId(parentNode.getId()+"");
+//        archiveFile.setFileNumber(vo.getReportNo());
+        archiveFile.setFileName(vo.getFileName());
+        if (vo.getCreateTime() != null) {
+            archiveFile.setFileTime(new SimpleDateFormat("yyyy-MM-dd").format(vo.getCreateTime()));
+        }
+        archiveFile.setFileUrl(vo.getUrl());
+        archiveFile.setPdfFileUrl(vo.getUrl());
+        archiveFile.setFilePage(1);
+        archiveFile.setIsApproval(0);
+        archiveFile.setIsCertification(1);
+        archiveFile.setIsNeedCertification(0);
+//        archiveFile.setDutyUser(vo.getTrialUserName());
+//        archiveFile.setCreateUser(vo.getCreateUser());
+        archiveFile.setStatus(0);
+        archiveFile.setIsDeleted(0);
+        archiveFile.setFileType(2L);
+        // 创建 LocalDateTime
+        LocalDateTime localDateTime = new Date().toInstant()
+                .atZone(ZoneId.systemDefault())
+                .toLocalDateTime();
+        archiveFile.setFtime(localDateTime);
+        archiveFile.setUtime(localDateTime);
+        archiveFile.setSort(0);
+        archiveFile.setPageNum("1");
+        archiveFile.setSourceType(1);
+        archiveFile.setIsElement(0);
+        archiveFile.setRectification(0);
+        archiveFile.setArchiveFileStorageType(StorageTypeEnum.SOUND_IMAGE.getCode());
+        return archiveFile;
+    }
+
+    /**
+     * 质检试验检测资料 转换为 档案文件
+     */
+    private ArchiveFile trialTestFileCovertArchiveFile(TrialDetectionData vo,ArchiveTreeContract parentNode)
+    {
+        ArchiveFile archiveFile = new ArchiveFile();
+        archiveFile.setId(SnowFlakeUtil.getId());
+        archiveFile.setProjectId(String.valueOf(parentNode.getProjectId()));
+        archiveFile.setContractId(String.valueOf(parentNode.getContractId()));
+        archiveFile.setNodeId(parentNode.getId()+"");
+        archiveFile.setFileNumber(vo.getReportNo());
+        archiveFile.setFileName(vo.getMaterialName()+vo.getSpecificationModel());
+        if (vo.getReportDate() != null) {
+            archiveFile.setFileTime(new SimpleDateFormat("yyyy-MM-dd").format(vo.getReportDate()));
+        }
+        archiveFile.setFileUrl(vo.getReportAttachmentUrl());
+        archiveFile.setPdfFileUrl(vo.getReportAttachmentUrl());
+        archiveFile.setFilePage(1);
+        archiveFile.setIsApproval(0);
+        archiveFile.setIsCertification(1);
+        archiveFile.setIsNeedCertification(0);
+        archiveFile.setDutyUser(vo.getUserName());
+        archiveFile.setCreateUser(vo.getCreateUser());
+        archiveFile.setStatus(0);
+        archiveFile.setIsDeleted(0);
+        archiveFile.setFileType(2L);
+        // 创建 LocalDateTime
+        LocalDateTime localDateTime = new Date().toInstant()
+                .atZone(ZoneId.systemDefault())
+                .toLocalDateTime();
+        archiveFile.setFtime(localDateTime);
+        archiveFile.setUtime(localDateTime);
+        archiveFile.setSort(0);
+        archiveFile.setPageNum("1");
+        archiveFile.setSourceType(1);
+        archiveFile.setIsElement(0);
+        archiveFile.setRectification(0);
+        archiveFile.setArchiveFileStorageType(StorageTypeEnum.SOUND_IMAGE.getCode());
+        return archiveFile;
+    }
+
+    /**
+     * 质检试验资料 转换为 档案文件
+     */
+    private ArchiveFile trialFileCovertArchiveFile(TrialSelfInspectionRecord vo,ArchiveTreeContract parentNode)
+    {
+        ArchiveFile archiveFile = new ArchiveFile();
+        archiveFile.setId(SnowFlakeUtil.getId());
+        archiveFile.setProjectId(String.valueOf(parentNode.getProjectId()));
+        archiveFile.setContractId(String.valueOf(parentNode.getContractId()));
+        archiveFile.setNodeId(parentNode.getId()+"");
+        archiveFile.setFileNumber(vo.getReportNo());
+        archiveFile.setFileName(StringUtils.isNotBlank(vo.getSpecificationModel())?vo.getSpecificationModel():vo.getTrialProjectName());
+        if (vo.getReportDate() != null) {
+            archiveFile.setFileTime(new SimpleDateFormat("yyyy-MM-dd").format(vo.getReportDate()));
+        }
+        archiveFile.setFileUrl(vo.getPdfUrl());
+        archiveFile.setPdfFileUrl(vo.getPdfUrl());
+        archiveFile.setFilePage(1);
+        archiveFile.setIsApproval(0);
+        archiveFile.setIsCertification(1);
+        archiveFile.setIsNeedCertification(0);
+        archiveFile.setDutyUser(vo.getTrialUserName());
+        archiveFile.setCreateUser(vo.getCreateUser());
+        archiveFile.setStatus(0);
+        archiveFile.setIsDeleted(0);
+        archiveFile.setFileType(2L);
+        // 创建 LocalDateTime
+        LocalDateTime localDateTime = new Date().toInstant()
+                .atZone(ZoneId.systemDefault())
+                .toLocalDateTime();
+        archiveFile.setFtime(localDateTime);
+        archiveFile.setUtime(localDateTime);
+        archiveFile.setSort(0);
+        archiveFile.setPageNum("1");
+        archiveFile.setSourceType(1);
+        archiveFile.setIsElement(0);
+        archiveFile.setRectification(0);
+        archiveFile.setArchiveFileStorageType(StorageTypeEnum.SOUND_IMAGE.getCode());
+        return archiveFile;
+    }
+
     /**
      * 质检日志资料 转换为 档案文件
      */