Explorar o código

Merge branch 'refs/heads/feature-lihb-20250731' into test-merge

# Conflicts:
#	blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java
LHB hai 4 días
pai
achega
a141fff5b3

+ 6 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialCyFinishTestReport.java

@@ -134,6 +134,12 @@ public class TrialCyFinishTestReport {
     @ApiModelProperty("实验树Id")
     @TableField("exam_name_info_id")
     public String examNameInfoId;
+    /**
+     * 试验树id
+     */
+    @ApiModelProperty("组装文件(报告+记录+委托单)")
+    @TableField("assemble_file")
+    public String assembleFile;
     /**
      * 附件
      */

+ 6 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialCyThirdReport.java

@@ -269,6 +269,12 @@ public class TrialCyThirdReport {
     @ApiModelProperty("实验树Id")
     @TableField("exam_name_info_id")
     public String examNameInfoId;
+    /**
+     * 试验树id
+     */
+    @ApiModelProperty("组装文件(报告+记录+委托单)")
+    @TableField("assemble_file")
+    public String assembleFile;
 
     /**
      * 附件

+ 85 - 9
blade-service/blade-business/src/main/java/org/springblade/business/scheduled/ChenYuTestScheduled.java

@@ -20,24 +20,24 @@ import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.message.BasicNameValuePair;
 import org.apache.http.util.EntityUtils;
-import org.springblade.business.entity.TrialCyAccessories;
-import org.springblade.business.entity.TrialCyFinishTestReport;
-import org.springblade.business.entity.TrialCyTestType;
-import org.springblade.business.entity.TrialCyThirdReport;
+import org.springblade.business.entity.*;
 import org.springblade.business.scheduled.vo.*;
 import org.springblade.business.service.TrialCyAccessoriesService;
 import org.springblade.business.service.TrialCyFinishTestReportService;
 import org.springblade.business.service.TrialCyTestTypeService;
 import org.springblade.business.service.TrialCyThirdReportService;
+import org.springblade.business.utils.FileUtils;
+import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.common.utils.SystemUtils;
+import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.redis.cache.BladeRedis;
 import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.CollectionUtil;
-import org.springblade.core.tool.utils.DigestUtil;
-import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.core.tool.utils.*;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.entity.ProjectInfo;
+import org.springblade.resource.feign.NewIOSSClient;
+import org.springblade.system.cache.ParamCache;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -47,6 +47,7 @@ import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.annotation.Resource;
 import java.io.ByteArrayOutputStream;
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
@@ -94,6 +95,9 @@ public class ChenYuTestScheduled {
     @Resource
     private TrialCyAccessoriesService trialCyAccessoriesService;
 
+    @Resource
+    private NewIOSSClient newIOSSClient;
+
     private CloseableHttpClient httpClient;
     private static final String TOKEN_REDIS_KEY = "blade:cqcy:token";
     private static final String PROJECT_CODE = "cqcyfx";
@@ -335,24 +339,59 @@ public class ChenYuTestScheduled {
                         //处理boolean值
                         report.setExperimentResult(String.valueOf(report.getExperimentResult() == null ? 0 : "True".equals(report.getExperimentResult()) ? 1 : 0));
 
+                        List<String> urls = new ArrayList<>();
+                        if (StringUtil.isNotBlank(report.getReportFilePath())) {
+                            urls.add(report.getReportFilePath());
+                        }
+                        if (StringUtil.isNotBlank(report.getRecordFilePath())) {
+                            urls.add(report.getRecordFilePath());
+                        }
+
                         //处理附件
                         List<TrialCyAccessories> accessories = report.getAccessories();
                         if (CollectionUtil.isNotEmpty(accessories)) {
                             accessories.forEach(f -> {
                                 f.setId(SnowFlakeUtil.getId());
                                 f.setReportId(id);
+                                if (StringUtil.isNotBlank(f.getFilePath())) {
+                                    urls.add(f.getFilePath());
+                                }
                             });
 
                             if (CollectionUtil.isNotEmpty(ids)) {
                                 trialCyAccessoriesService.remove(Wrappers.<TrialCyAccessories>lambdaQuery()
                                         .in(TrialCyAccessories::getReportId, ids));
                             }
-
                             trialCyAccessoriesService.saveBatch(accessories);
                         }
+
+                        //组合文件
+                        if (urls.size() > 0) {
+                            //重新合并
+                                String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+                                String listPdf = filePath + "/pdf/" + id + ".pdf";
+                                File tabPDF = ResourceUtil.getFile(listPdf);
+                                if (tabPDF.exists()) {
+                                    tabPDF.delete();
+                                }
+                                FileUtils.mergePdfPublicMethods(urls, listPdf);
+                                BladeFile bladeFile = this.newIOSSClient.uploadFile(id + ".pdf", listPdf);
+                                if (bladeFile != null) {
+                                    report.setAssembleFile(bladeFile.getLink());
+                                }
+                        }
                     }
                     if (CollectionUtil.isNotEmpty(ids)) {
                         trialCyFinishTestReportService.removeBatchByIds(ids);
+
+                        List<String> fileUrls = list.stream().map(TrialCyFinishTestReport::getAssembleFile).filter(StringUtil::isNotBlank).collect(Collectors.toList());
+                        if(CollectionUtil.isNotEmpty(fileUrls)){
+                            //删除组合文件
+                            fileUrls.forEach(f -> {
+                                String pdfName = f.split("upload")[1];
+                                this.newIOSSClient.removeFile("upload" + pdfName);
+                            });
+                        }
                     }
 
                     trialCyFinishTestReportService.saveBatch(reports);
@@ -375,7 +414,7 @@ public class ChenYuTestScheduled {
             return;
         }
 
-        Integer[] thirdTypes = {0,1,2};
+        Integer[] thirdTypes = {0, 1, 2};
 
         String token = getToken();
         ensureProjectIdInitialized();
@@ -436,6 +475,15 @@ public class ChenYuTestScheduled {
 
                         List<TrialCyThirdReport> reports = data.toJavaList(TrialCyThirdReport.class);
                         for (TrialCyThirdReport report : reports) {
+
+                            List<String> urls = new ArrayList<>();
+                            if (StringUtil.isNotBlank(report.getReportDocFilePath())) {
+                                urls.add(report.getReportDocFilePath());
+                            }
+                            if (StringUtil.isNotBlank(report.getRecordDocFilePath())) {
+                                urls.add(report.getRecordDocFilePath());
+                            }
+
                             Long id = SnowFlakeUtil.getId();
                             report.setPKeyId(id);
                             report.setContractId(contractId);
@@ -451,6 +499,10 @@ public class ChenYuTestScheduled {
                                 accessories.forEach(f -> {
                                     f.setId(SnowFlakeUtil.getId());
                                     f.setReportId(id);
+
+                                    if (StringUtil.isNotBlank(f.getFilePath())) {
+                                        urls.add(f.getFilePath());
+                                    }
                                 });
                                 //删除旧数据
                                 if (CollectionUtil.isNotEmpty(ids)) {
@@ -460,10 +512,34 @@ public class ChenYuTestScheduled {
                                 //添加新数据
                                 trialCyAccessoriesService.saveBatch(accessories);
                             }
+
+                            //组合文件
+                            if (urls.size() > 0) {
+                                //重新合并
+                                String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+                                String listPdf = filePath + "/pdf/" + id + ".pdf";
+                                File tabPDF = ResourceUtil.getFile(listPdf);
+                                if (tabPDF.exists()) {
+                                    tabPDF.delete();
+                                }
+                                FileUtils.mergePdfPublicMethods(urls, listPdf);
+                                BladeFile bladeFile = this.newIOSSClient.uploadFile(id + ".pdf", listPdf);
+                                if (bladeFile != null) {
+                                    report.setAssembleFile(bladeFile.getLink());
+                                }
+                            }
                         }
                         //删除旧数据
                         if (CollectionUtil.isNotEmpty(ids)) {
                             trialCyThirdReportService.removeBatchByIds(ids);
+                            List<String> fileUrls = list.stream().map(TrialCyThirdReport::getAssembleFile).filter(StringUtil::isNotBlank).collect(Collectors.toList());
+                            if(CollectionUtil.isNotEmpty(fileUrls)){
+                                //删除组合文件
+                                fileUrls.forEach(f -> {
+                                    String pdfName = f.split("upload")[1];
+                                    this.newIOSSClient.removeFile("upload" + pdfName);
+                                });
+                            }
                         }
 
                         //添加新数据

+ 185 - 171
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -100,6 +100,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
     private final ITrialNumberRuleService trialNumberRuleService;
     private final TrialCyThirdReportService trialCyThirdReportService;
     private final TrialCyFinishTestReportService trialCyFinishTestReportService;
+    private final TrialCyAccessoriesService trialCyAccessoriesService;
 
     @Override
     public IPage<TrialSelfInspectionRecordVO> selfPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) throws FileNotFoundException {
@@ -118,7 +119,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 List<EntrustInfo> entrustInfos = entrustInfoMapper.selectList(Wrappers.<EntrustInfo>lambdaQuery()
                         .like(EntrustInfo::getEntrustNo, dto.getQueryValue()));
                 List<Long> entrustIds;
-                if(CollectionUtil.isNotEmpty(entrustInfos)){
+                if (CollectionUtil.isNotEmpty(entrustInfos)) {
                     entrustIds = entrustInfos.stream().map(EntrustInfo::getId).collect(Collectors.toList());
                 } else {
                     entrustIds = null;
@@ -126,11 +127,11 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
 
                 queryWrapper.lambda().and(
                         wq ->
-                            wq.like(TrialSelfInspectionRecord::getTrialProjectName, dto.getQueryValue()).or()
-                                    .like(TrialSelfInspectionRecord::getRecordNo, dto.getQueryValue()).or()
-                                    .like(TrialSelfInspectionRecord::getReportNo, dto.getQueryValue()).or()
-                                    .like(TrialSelfInspectionRecord::getSpecificationNumber, dto.getQueryValue()).or()
-                                    .in(CollectionUtil.isNotEmpty(entrustIds),TrialSelfInspectionRecord::getEntrustId, entrustIds)
+                                wq.like(TrialSelfInspectionRecord::getTrialProjectName, dto.getQueryValue()).or()
+                                        .like(TrialSelfInspectionRecord::getRecordNo, dto.getQueryValue()).or()
+                                        .like(TrialSelfInspectionRecord::getReportNo, dto.getQueryValue()).or()
+                                        .like(TrialSelfInspectionRecord::getSpecificationNumber, dto.getQueryValue()).or()
+                                        .in(CollectionUtil.isNotEmpty(entrustIds), TrialSelfInspectionRecord::getEntrustId, entrustIds)
                 );
             }
             if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getStartTime()) && org.apache.commons.lang.StringUtils.isNotEmpty(dto.getEndTime())) {
@@ -144,7 +145,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getQueryStatus())) {
                 queryWrapper.lambda().eq(TrialSelfInspectionRecord::getDetectionResult, dto.getQueryStatus());
             }
-            if (dto.getSortType() !=  null) {
+            if (dto.getSortType() != null) {
                 if (dto.getSortType().equals("1")) {
                     queryWrapper.lambda().orderByAsc(TrialSelfInspectionRecord::getReportNo);
                 } else if (dto.getSortType().equals("2")) {
@@ -209,17 +210,17 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 }
                 //委托单名称 委托单编号
                 EntrustInfo entrustInfo = entrustInfoMapper.selectById(record.getEntrustId());
-                if (entrustInfo != null){
+                if (entrustInfo != null) {
                     record.setEntrustName(entrustInfo.getEntrustName());
                     record.setEntrustNo(entrustInfo.getEntrustNo());
                     //材料id不为空
-                     if(Func.isNotEmpty(entrustInfo.getSampleId())){
-                         TrialSampleInfo sampleInfo = trialSampleInfoMapper.selectById(entrustInfo.getSampleId());
-                         if (Func.isNotEmpty(sampleInfo)){
-                             record.setSpecificationNumber(sampleInfo.getSpecificationNumber());
-                             record.setSpecificationModel(sampleInfo.getSpecificationModel());
-                         }
-                     }
+                    if (Func.isNotEmpty(entrustInfo.getSampleId())) {
+                        TrialSampleInfo sampleInfo = trialSampleInfoMapper.selectById(entrustInfo.getSampleId());
+                        if (Func.isNotEmpty(sampleInfo)) {
+                            record.setSpecificationNumber(sampleInfo.getSpecificationNumber());
+                            record.setSpecificationModel(sampleInfo.getSpecificationModel());
+                        }
+                    }
                 }
                 if (record.getBaseInfo() != null && !record.getBaseInfo().isEmpty()) {
                     try {
@@ -310,7 +311,8 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
     }
 
     /**
-     *新增返回该试验材料报告关联的委托单pdf也拼接在后面
+     * 新增返回该试验材料报告关联的委托单pdf也拼接在后面
+     *
      * @param contractId
      * @param nodeId
      * @param type
@@ -318,7 +320,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
      * @throws FileNotFoundException
      */
     private String getMergePdfToTrialNew(Long contractId, Long nodeId, Integer type) throws FileNotFoundException {
-        String sql = "select pdf_url,e_visa_pdf_url from u_information_query where wbs_id='" + nodeId + "' and status in(0,1,2) and contract_id ='" + contractId + "' and classify = '" + type + "'" ;
+        String sql = "select pdf_url,e_visa_pdf_url from u_information_query where wbs_id='" + nodeId + "' and status in(0,1,2) and contract_id ='" + contractId + "' and classify = '" + type + "'";
         List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
         if (maps.size() >= 1) {
             Map<String, Object> stringObjectMap = maps.get(0);
@@ -330,11 +332,11 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             }
             String entrustPdfUrl = "";
             //关联的委托单pdf
-            String sqlEntrust = "select entrust_id from u_trial_self_inspection_record where is_deleted = 0 and id = "+nodeId ;
+            String sqlEntrust = "select entrust_id from u_trial_self_inspection_record where is_deleted = 0 and id = " + nodeId;
             TrialSelfInspectionRecord record = jdbcTemplate.queryForObject(sqlEntrust, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class));
-            if(ObjectUtil.isNotEmpty(record) && ObjectUtil.isNotEmpty(record.getEntrustId()) && record.getEntrustId() != 0){
+            if (ObjectUtil.isNotEmpty(record) && ObjectUtil.isNotEmpty(record.getEntrustId()) && record.getEntrustId() != 0) {
                 //优先查询带电签的,没有电签在查entrust_pdf
-                String sqlEntrustPdf = "SELECT COALESCE(entrust_e_pdf, entrust_pdf) AS pdf_url from u_entrust_info where is_deleted = 0 and id = "+record.getEntrustId();
+                String sqlEntrustPdf = "SELECT COALESCE(entrust_e_pdf, entrust_pdf) AS pdf_url from u_entrust_info where is_deleted = 0 and id = " + record.getEntrustId();
                 try {
                     entrustPdfUrl = jdbcTemplate.queryForObject(sqlEntrustPdf, String.class);
                 } catch (DataAccessException e) {
@@ -353,7 +355,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 //材料检测报告pdf
                 pdfList.add(pdfUrlTrialRawMaterial);
                 //委托单pdf
-                if(ObjectUtil.isNotEmpty(entrustPdfUrl)){
+                if (ObjectUtil.isNotEmpty(entrustPdfUrl)) {
                     pdfList.add(entrustPdfUrl);
                 }
                 String file_path = FileUtils.getSysLocalFileUrl();
@@ -375,10 +377,10 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             }
             assert pdfUrl != null;
             //拼接委托单pdf
-            if(ObjectUtil.isNotEmpty(entrustPdfUrl)){
+            if (ObjectUtil.isNotEmpty(entrustPdfUrl)) {
                 List<String> pdfList = new ArrayList<>();
                 //试验原始pdf
-                if(pdfUrl!=null){
+                if (pdfUrl != null) {
                     pdfList.add(pdfUrl.toString());
                 }
                 //委托单pdf
@@ -398,8 +400,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                         pdfUrl = bladeFile.getLink();
                         return pdfUrl.toString();
                     }
-            }}
-            if(ObjectUtil.isNotEmpty(pdfUrl)){
+                }
+            }
+            if (ObjectUtil.isNotEmpty(pdfUrl)) {
                 return pdfUrl.toString();
             }
         }
@@ -1137,7 +1140,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
         //------初始当前填报的表pKeyIds------
         this.initTrialTabIds(dto);
 
-//        if(!this.judgingParameters(dto)){
+//        if (!this.judgingParameters(dto)) {
 //            //------初始编号信息------
 //            this.initBuildNumber(dto);
 //        }
@@ -1149,7 +1152,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             //如果传递了编号就修改对应记录的值 以第一张表的数据为准
             this.updateRecordNoOrReportNo(obj, dto);
             //------编辑时记录表编号或报告单编号为Null的重新生成------
-//            if(!this.judgingParameters(dto)){
+//            if (!this.judgingParameters(dto)) {
 //                this.reBuildNumber(obj, dto);
 //            }
             //------保存实体表数据、试验记录信息、生成PDF------
@@ -1165,29 +1168,29 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             this.trialDeviceUseService.addDeviceUseInfo(dto, obj.getId());
         }
         // ---- 修改样品单号信息 --------
-        if(dto!=null && Func.isNotEmpty(dto.getEntrustId())){
+        if (dto != null && Func.isNotEmpty(dto.getEntrustId())) {
             //修改项目节点基础信息
-            jdbcTemplate.update("update u_entrust_info set sample_status=4 where id ='"+dto.getEntrustId()+"'");
+            jdbcTemplate.update("update u_entrust_info set sample_status=4 where id ='" + dto.getEntrustId() + "'");
         }
         String[] strings = dto.getTableType().split(",");
-        if(StringUtils.isNotEmpty(dto.getRecordAutoNumber())||StringUtils.isNotEmpty(dto.getReportAutoNumber())){
-            if (dto.getOldRecordNumber()!=null&&dto.getOldRecordNumber().equals(dto.getRecordNo())||dto.getOldReportNumber()!=null&&dto.getOldReportNumber().equals(dto.getReportNo())) {
-                if(strings.length==1){
-                    if(strings[0].equals("1")){
-                        if(StringUtils.isNotEmpty(dto.getRecordAutoNumber())){
-                            trialNumberRuleService.checkSave(Long.valueOf(dto.getProjectId()),4,dto.getId(),dto.getRecordAutoNumber());
+        if (StringUtils.isNotEmpty(dto.getRecordAutoNumber()) || StringUtils.isNotEmpty(dto.getReportAutoNumber())) {
+            if (dto.getOldRecordNumber() != null && dto.getOldRecordNumber().equals(dto.getRecordNo()) || dto.getOldReportNumber() != null && dto.getOldReportNumber().equals(dto.getReportNo())) {
+                if (strings.length == 1) {
+                    if (strings[0].equals("1")) {
+                        if (StringUtils.isNotEmpty(dto.getRecordAutoNumber())) {
+                            trialNumberRuleService.checkSave(Long.valueOf(dto.getProjectId()), 4, dto.getId(), dto.getRecordAutoNumber());
                         }
-                    }else {
-                        if(StringUtils.isNotEmpty(dto.getReportAutoNumber())){
-                            trialNumberRuleService.checkSave(Long.valueOf(dto.getProjectId()),5,dto.getId(),dto.getReportAutoNumber());
+                    } else {
+                        if (StringUtils.isNotEmpty(dto.getReportAutoNumber())) {
+                            trialNumberRuleService.checkSave(Long.valueOf(dto.getProjectId()), 5, dto.getId(), dto.getReportAutoNumber());
                         }
                     }
-                }else {
-                    if(StringUtils.isNotEmpty(dto.getRecordAutoNumber())){
-                        trialNumberRuleService.checkSave(Long.valueOf(dto.getProjectId()),4,dto.getId(),dto.getRecordAutoNumber());
+                } else {
+                    if (StringUtils.isNotEmpty(dto.getRecordAutoNumber())) {
+                        trialNumberRuleService.checkSave(Long.valueOf(dto.getProjectId()), 4, dto.getId(), dto.getRecordAutoNumber());
                     }
-                    if(StringUtils.isNotEmpty(dto.getReportAutoNumber())){
-                        trialNumberRuleService.checkSave(Long.valueOf(dto.getProjectId()),5,dto.getId(),dto.getReportAutoNumber());
+                    if (StringUtils.isNotEmpty(dto.getReportAutoNumber())) {
+                        trialNumberRuleService.checkSave(Long.valueOf(dto.getProjectId()), 5, dto.getId(), dto.getReportAutoNumber());
                     }
                 }
             }
@@ -1197,53 +1200,55 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
 
     /**
      * 取到传入的表单中的报告编号或者记录编号 修改记录表中相应字段的值
+     *
      * @param obj
      * @param dto
      */
     private void updateRecordNoOrReportNo(TrialSelfInspectionRecord obj, TrialSelfInspectionRecordDTO dto) {
-            JSONArray dataArray = dto.getDataInfo().getJSONArray("orderList");
-            //获取第一张表的数据  编号以第一张表为准
-            List<JSONObject> dataList = dataArray.toJavaList(JSONObject.class);
-           // 根据 type 字段进行分组
-             Map<String, List<JSONObject>> groupedByType = dataList.stream()
-            .collect(Collectors.groupingBy(jsonObject -> jsonObject.getString("type")));
-          for (Map.Entry<String, List<JSONObject>> entry : groupedByType.entrySet()) {
-              List<JSONObject> jsonObjects = groupedByType.get(entry.getKey());
-              JSONObject   jsonObject = jsonObjects.get(0);
-              if(entry.getKey().equals("2")&&jsonObjects.size()>1){
-                  jsonObject = jsonObjects.get(1);
-              }
-              String pkeyId = jsonObject.getString("pkeyId");
-              String sql = "select * from m_wbs_tree_private where p_key_id =" + pkeyId;
-              WbsTreePrivate table = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
-              String fileUrl = table.getHtmlUrl();
-              try {
-                  InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
-                  String htmlString = IoUtil.readToString(fileInputStream);
-                  htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
-                  Document doc = Jsoup.parse(htmlString);
-                  // 查找所有具有 placeholderxx 属性的元素
-                  //表类型 1,9=记录表 2,10=报告单
-                  if(table.getTableType() == 9 || table.getTableType() == 1){
-                      //记录表  以第一张表为准
-                      this.updateRecordNoOrReportNo(dto, jsonObject, doc, "记录编 号:", "record_no");
-                      this.updateRecordNoOrReportNo(dto, jsonObject, doc, "记录编号:", "record_no");
-                  }else if(table.getTableType() == 10 || table.getTableType() == 2){
-                      //报告单
-                      this.updateRecordNoOrReportNo(dto,jsonObject,doc,"报告编号:","report_no");
-                      //  :不一样 一个中文一个英文
-                      this.updateRecordNoOrReportNo(dto,jsonObject,doc,"报告编号:","report_no");
-                  }
-              } catch (Exception e) {
-                  log.error(e.getMessage());
-              }
-          }
+        JSONArray dataArray = dto.getDataInfo().getJSONArray("orderList");
+        //获取第一张表的数据  编号以第一张表为准
+        List<JSONObject> dataList = dataArray.toJavaList(JSONObject.class);
+        // 根据 type 字段进行分组
+        Map<String, List<JSONObject>> groupedByType = dataList.stream()
+                .collect(Collectors.groupingBy(jsonObject -> jsonObject.getString("type")));
+        for (Map.Entry<String, List<JSONObject>> entry : groupedByType.entrySet()) {
+            List<JSONObject> jsonObjects = groupedByType.get(entry.getKey());
+            JSONObject jsonObject = jsonObjects.get(0);
+            if (entry.getKey().equals("2") && jsonObjects.size() > 1) {
+                jsonObject = jsonObjects.get(1);
+            }
+            String pkeyId = jsonObject.getString("pkeyId");
+            String sql = "select * from m_wbs_tree_private where p_key_id =" + pkeyId;
+            WbsTreePrivate table = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
+            String fileUrl = table.getHtmlUrl();
+            try {
+                InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
+                String htmlString = IoUtil.readToString(fileInputStream);
+                htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
+                Document doc = Jsoup.parse(htmlString);
+                // 查找所有具有 placeholderxx 属性的元素
+                //表类型 1,9=记录表 2,10=报告单
+                if (table.getTableType() == 9 || table.getTableType() == 1) {
+                    //记录表  以第一张表为准
+                    this.updateRecordNoOrReportNo(dto, jsonObject, doc, "记录编 号:", "record_no");
+                    this.updateRecordNoOrReportNo(dto, jsonObject, doc, "记录编号:", "record_no");
+                } else if (table.getTableType() == 10 || table.getTableType() == 2) {
+                    //报告单
+                    this.updateRecordNoOrReportNo(dto, jsonObject, doc, "报告编号:", "report_no");
+                    //  :不一样 一个中文一个英文
+                    this.updateRecordNoOrReportNo(dto, jsonObject, doc, "报告编号:", "report_no");
+                }
+            } catch (Exception e) {
+                log.error(e.getMessage());
+            }
+        }
 
 
     }
 
     /**
      * 判断入参中用户是否自己手动填写了 报告编号或者记录编号
+     *
      * @param dto
      * @return
      */
@@ -1262,20 +1267,20 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 Document doc = Jsoup.parse(htmlString);
                 //可能出现的几种情况 4种情况 记录编 号: 记录编号: 报告编号: 报告编号: 编号:
                 Elements elementsWithPlaceholderxx = doc.select("[placeholderxx='记录编 号:']");
-                if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
+                if (elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null) {
                     elementsWithPlaceholderxx = doc.select("[placeholderxx='记录编号:']");
-                    if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
+                    if (elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null) {
                         elementsWithPlaceholderxx = doc.select("[placeholderxx='报告编号:']");
-                        if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
+                        if (elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null) {
                             elementsWithPlaceholderxx = doc.select("[placeholderxx='报告编号:']");
-                            if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
+                            if (elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null) {
                                 elementsWithPlaceholderxx = doc.select("[placeholderxx='编号:']");
                             }
                         }
                     }
                 }
                 //没找到直接返回false
-                if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
+                if (elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null) {
                     log.error("方法:private boolean JudgingParameters(TrialSelfInspectionRecordDTO dto)中 未找到元素");
                     return false;
                 }
@@ -1283,9 +1288,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 String key = first.attr("id");
                 //记录编号或者报告编号的值
                 String recordOrReportNo = jsonObject.getString(key);
-                if(recordOrReportNo != null || "".equals(recordOrReportNo)){
+                if (recordOrReportNo != null || "".equals(recordOrReportNo)) {
                     return true;
-                }else {
+                } else {
                     return false;
                 }
             } catch (Exception e) {
@@ -1297,31 +1302,32 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
 
     /**
      * 修改记录编号或者报告编号的值
+     *
      * @param dto
      * @param jsonObject
      * @param doc
      * @param value
      * @param fileVlue
      */
-    private void updateRecordNoOrReportNo(TrialSelfInspectionRecord dto,JSONObject jsonObject,Document doc,String  value, String fileVlue) {
-        Elements elementsWithPlaceholderxx = doc.select("[placeholderxx="+value+"]");
-        if((elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null) && value.equals("报告编号:")){
+    private void updateRecordNoOrReportNo(TrialSelfInspectionRecord dto, JSONObject jsonObject, Document doc, String value, String fileVlue) {
+        Elements elementsWithPlaceholderxx = doc.select("[placeholderxx=" + value + "]");
+        if ((elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null) && value.equals("报告编号:")) {
             //特殊情况
             value = "编号:";
-            elementsWithPlaceholderxx = doc.select("[placeholderxx="+value+"]");
+            elementsWithPlaceholderxx = doc.select("[placeholderxx=" + value + "]");
         }
-        if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
+        if (elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null) {
             return;
         }
         Element first = elementsWithPlaceholderxx.first();
         String key = first.attr("id");
         //记录编号或者报告编号的值
         String recordOrReportNo = jsonObject.getString(key);
-        if(!"".equals(recordOrReportNo) && !(recordOrReportNo == null)){
-            String updateSql = "update u_trial_self_inspection_record set " + fileVlue +"='" + recordOrReportNo + "' where id='" + dto.getId()+"'";
-            if(fileVlue.equals("record_no")){
-               dto.setRecordNo(recordOrReportNo);
-            }else {
+        if (!"".equals(recordOrReportNo) && !(recordOrReportNo == null)) {
+            String updateSql = "update u_trial_self_inspection_record set " + fileVlue + "='" + recordOrReportNo + "' where id='" + dto.getId() + "'";
+            if (fileVlue.equals("record_no")) {
+                dto.setRecordNo(recordOrReportNo);
+            } else {
                 dto.setReportNo(recordOrReportNo);
             }
             jdbcTemplate.execute(updateSql);
@@ -1374,7 +1380,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             for (int i = 0; i < dataArray.size(); i++) {
                 JSONObject jsonObject = dataArray.getJSONObject(i);
                 String type = jsonObject.getString("type");
-                if(ObjectUtil.isEmpty(type)){
+                if (ObjectUtil.isEmpty(type)) {
                     throw new RuntimeException("请点击表单后再进行保存");
                 }
                 if (type.equals("1")) {
@@ -1396,37 +1402,37 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 updateSql = getUpdateSql(dto, pdfURL, listPdf, snowId, "record_pdf_url", 2, "report_pdf_url");
             } else {
                 //一起保存的数据  只改变pdf_url
-                this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate().set(TrialSelfInspectionRecord::getPdfUrl, pdfURL).set(TrialSelfInspectionRecord::getTaskStatus,"未上报").eq(TrialSelfInspectionRecord::getId, dto.getId()));
+                this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate().set(TrialSelfInspectionRecord::getPdfUrl, pdfURL).set(TrialSelfInspectionRecord::getTaskStatus, "未上报").eq(TrialSelfInspectionRecord::getId, dto.getId()));
             }
             if (ObjectUtil.isNotEmpty(updateSql)) {
                 jdbcTemplate.execute(updateSql);
             }
-        } else if (pdfURL!=null&&pdfURL.startsWith("500")) {
-            pdfURL=pdfURL.substring(3);
+        } else if (pdfURL != null && pdfURL.startsWith("500")) {
+            pdfURL = pdfURL.substring(3);
             throw new ServiceException(pdfURL);
         }
     }
 
     @NotNull
-    private String getUpdateSql(TrialSelfInspectionRecordDTO dto, String pdfURL, String listPdf, Long snowId,String param1,int type,String param2) {
+    private String getUpdateSql(TrialSelfInspectionRecordDTO dto, String pdfURL, String listPdf, Long snowId, String param1, int type, String param2) {
         String updateSql;
-        String sqlForAntherPDF = "SELECT "+param1+ " from u_trial_self_inspection_record where id =  " + dto.getId() + " and is_deleted = 0";
+        String sqlForAntherPDF = "SELECT " + param1 + " from u_trial_self_inspection_record where id =  " + dto.getId() + " and is_deleted = 0";
         String AntherPDFUrl = jdbcTemplate.queryForObject(sqlForAntherPDF, new SingleColumnRowMapper<String>(String.class));
-        if(ObjectUtil.isNotEmpty(AntherPDFUrl)){
+        if (ObjectUtil.isNotEmpty(AntherPDFUrl)) {
             //合并后保存  把报告单合并在前面
-            if(type == 1){
+            if (type == 1) {
                 FileUtils.mergePdfPublicMethods(Arrays.asList(AntherPDFUrl, pdfURL), listPdf);
-            }else {
-                FileUtils.mergePdfPublicMethods(Arrays.asList(pdfURL,AntherPDFUrl), listPdf);
+            } else {
+                FileUtils.mergePdfPublicMethods(Arrays.asList(pdfURL, AntherPDFUrl), listPdf);
             }
 
             BladeFile bladeFile = this.newIOSSClient.uploadFile(snowId + ".pdf", listPdf);
-            updateSql = "update u_trial_self_inspection_record set pdf_url = '" + bladeFile.getLink() + "',"+param2+ "= '"+ pdfURL + "' ,task_status='未上报' where id='" + dto.getId()+"'";
+            updateSql = "update u_trial_self_inspection_record set pdf_url = '" + bladeFile.getLink() + "'," + param2 + "= '" + pdfURL + "' ,task_status='未上报' where id='" + dto.getId() + "'";
             //合并后更新queryInfo表的pdfurl
             String updateForQurtyInfo = "update u_information_query set pdf_url ='" + bladeFile.getLink() + "' where classify='" + dto.getType() + "' and  wbs_id='" + dto.getId() + "' and contract_id ='" + dto.getContractId() + "' ";
             jdbcTemplate.execute(updateForQurtyInfo);
-        }else {
-            updateSql = "update u_trial_self_inspection_record set "+param2+" = '"+ pdfURL + "' ,task_status='未上报' where id='" + dto.getId()+"'";
+        } else {
+            updateSql = "update u_trial_self_inspection_record set " + param2 + " = '" + pdfURL + "' ,task_status='未上报' where id='" + dto.getId() + "'";
         }
         return updateSql;
     }
@@ -1450,16 +1456,16 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
 
             //取样信息
             List<TrialSampleInfo> trialSampleInfos = trialSampleInfoMapper.selectList(Wrappers.<TrialSampleInfo>lambdaQuery().in(TrialSampleInfo::getId, ids));
-            List<String> samplingLocations = trialSampleInfos.stream().map(TrialSampleInfo::getSamplingLocation).filter(string -> string !=null && !string.isEmpty()).collect(Collectors.toList());
+            List<String> samplingLocations = trialSampleInfos.stream().map(TrialSampleInfo::getSamplingLocation).filter(string -> string != null && !string.isEmpty()).collect(Collectors.toList());
             String samplingLocation = org.apache.commons.lang.StringUtils.join(samplingLocations, "、");
 
-            List<String> calculationUnits = trialSampleInfos.stream().map(TrialSampleInfo::getCalculationUnit).filter(string -> string !=null && !string.isEmpty()).collect(Collectors.toList());
+            List<String> calculationUnits = trialSampleInfos.stream().map(TrialSampleInfo::getCalculationUnit).filter(string -> string != null && !string.isEmpty()).collect(Collectors.toList());
             String calculationUnit = org.apache.commons.lang.StringUtils.join(calculationUnits, "、");
 
-            List<String> specificationNumbers = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationNumber).filter(string -> string !=null && !string.isEmpty()).collect(Collectors.toList());
+            List<String> specificationNumbers = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationNumber).filter(string -> string != null && !string.isEmpty()).collect(Collectors.toList());
             String specificationNumber = org.apache.commons.lang.StringUtils.join(specificationNumbers, "、");
 
-            List<String> specificationModels = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationModel).filter(string -> string !=null && !string.isEmpty()).collect(Collectors.toList());
+            List<String> specificationModels = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationModel).filter(string -> string != null && !string.isEmpty()).collect(Collectors.toList());
             String specificationModel = org.apache.commons.lang.StringUtils.join(specificationModels, "、");
 
             //更新
@@ -1567,7 +1573,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                         throw new ServiceException("当前编号已达到最大值9999,操作失败");
                     }*/
 
-                    maxRecordNo = recordNos.size()+"";
+                    maxRecordNo = recordNos.size() + "";
                 }
 
             }
@@ -1590,7 +1596,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                     } else {
                         throw new ServiceException("当前编号已达到最大值9999,操作失败");
                     }*/
-                    maxReportNo = reportNos.size()+"";
+                    maxReportNo = reportNos.size() + "";
 
                 }
             }
@@ -1643,7 +1649,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                     } else {
                         throw new ServiceException("当前编号已达到最大值9999,操作失败");
                     }*/
-                    maxRecordNo = recordNos.size()+"";
+                    maxRecordNo = recordNos.size() + "";
                 }
 
                 WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(String.valueOf(dto.getNodeId()))).stream().findAny().orElse(null);
@@ -1683,7 +1689,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                     } else {
                         throw new ServiceException("当前编号已达到最大值9999,操作失败");
                     }*/
-                    maxReportNo = reportNos.size()+"";
+                    maxReportNo = reportNos.size() + "";
                 }
 
                 WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(String.valueOf(dto.getNodeId()))).stream().findAny().orElse(null);
@@ -1703,8 +1709,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             }
         }
     }
+
     //提前构建记录或者报告编号 供用户保存前提交时使用(新增保存前显示系统引用的记录编号或者报告编号)
-    public HashMap<String,String> buildNumberView(TrialSelfInspectionRecordDTO dto) {
+    public HashMap<String, String> buildNumberView(TrialSelfInspectionRecordDTO dto) {
         StringSPUtils spUtils = new StringSPUtils();
         List<TrialSelfInspectionRecord> result = baseMapper.selectAll(dto.getNodeId(), dto.getContractId(), dto.getType());
         List<TrialSelfInspectionRecord> trialSelfInspectionRecords = result.stream().filter(Objects::nonNull).collect(Collectors.toList());
@@ -1730,7 +1737,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                         throw new ServiceException("当前编号已达到最大值9999,操作失败");
                     }*/
 
-                    maxRecordNo = recordNos.size()+"";
+                    maxRecordNo = recordNos.size() + "";
                 }
 
             }
@@ -1753,7 +1760,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                     } else {
                         throw new ServiceException("当前编号已达到最大值9999,操作失败");
                     }*/
-                    maxReportNo = reportNos.size()+"";
+                    maxReportNo = reportNos.size() + "";
 
                 }
             }
@@ -1767,9 +1774,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 //记录表
                 if (StringUtils.isNotEmpty(maxRecordNo)) {
                     HashMap<String, String> stringStringHashMap = new HashMap<>();
-                    stringStringHashMap.put("type","记录表");
+                    stringStringHashMap.put("type", "记录表");
                     if (trialSelfInspectionRecord != null) {
-                        stringStringHashMap.put("valueStr",trialSelfInspectionRecord.getRecordNo());
+                        stringStringHashMap.put("valueStr", trialSelfInspectionRecord.getRecordNo());
                         return stringStringHashMap;
                     }
                     String str1 = "JL" +
@@ -1777,16 +1784,16 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                             "-" + year +
                             "-" + spUtils.getStringSP(wbsTreePrivate.getNodeName().trim()) +
                             "-" + maxRecordNo;
-                    stringStringHashMap.put("valueStr",str1);
+                    stringStringHashMap.put("valueStr", str1);
                     return stringStringHashMap;
                 }
 
                 //报告单
                 if (StringUtils.isNotEmpty(maxReportNo)) {
                     HashMap<String, String> stringStringHashMap = new HashMap<>();
-                    stringStringHashMap.put("type","报告单");
+                    stringStringHashMap.put("type", "报告单");
                     if (trialSelfInspectionRecord != null) {
-                        stringStringHashMap.put("valueStr",trialSelfInspectionRecord.getReportNo());
+                        stringStringHashMap.put("valueStr", trialSelfInspectionRecord.getReportNo());
                         return stringStringHashMap;
                     }
                     String str2 = "BG" +
@@ -1794,7 +1801,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                             "-" + year +
                             "-" + spUtils.getStringSP(wbsTreePrivate.getNodeName().trim()) +
                             "-" + maxReportNo;
-                    stringStringHashMap.put("valueStr",str2);
+                    stringStringHashMap.put("valueStr", str2);
                     return stringStringHashMap;
                 }
             }
@@ -1820,7 +1827,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                     } else {
                         throw new ServiceException("当前编号已达到最大值9999,操作失败");
                     }*/
-                    maxRecordNo = recordNos.size()+"";
+                    maxRecordNo = recordNos.size() + "";
                 }
 
                 WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(String.valueOf(dto.getNodeId()))).stream().findAny().orElse(null);
@@ -1831,9 +1838,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 } else {
                     //记录表
                     HashMap<String, String> stringStringHashMap = new HashMap<>();
-                    stringStringHashMap.put("type","记录表");
+                    stringStringHashMap.put("type", "记录表");
                     if (trialSelfInspectionRecord != null) {
-                        stringStringHashMap.put("valueStr",trialSelfInspectionRecord.getRecordNo());
+                        stringStringHashMap.put("valueStr", trialSelfInspectionRecord.getRecordNo());
                         return stringStringHashMap;
                     }
                     String str1 = "JL" +
@@ -1841,7 +1848,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                             "-" + year +
                             "-" + spUtils.getStringSP(wbsTreePrivate.getNodeName().trim()) +
                             "-" + maxRecordNo;
-                    stringStringHashMap.put("valueStr",str1);
+                    stringStringHashMap.put("valueStr", str1);
                     return stringStringHashMap;
                 }
             }
@@ -1867,7 +1874,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                     } else {
                         throw new ServiceException("当前编号已达到最大值9999,操作失败");
                     }*/
-                    maxReportNo = reportNos.size()+"";
+                    maxReportNo = reportNos.size() + "";
                 }
 
                 WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(String.valueOf(dto.getNodeId()))).stream().findAny().orElse(null);
@@ -1878,9 +1885,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 } else {
                     //报告单
                     HashMap<String, String> stringStringHashMap = new HashMap<>();
-                    stringStringHashMap.put("type","报告单");
+                    stringStringHashMap.put("type", "报告单");
                     if (trialSelfInspectionRecord != null) {
-                        stringStringHashMap.put("valueStr",trialSelfInspectionRecord.getReportNo());
+                        stringStringHashMap.put("valueStr", trialSelfInspectionRecord.getReportNo());
                         return stringStringHashMap;
                     }
                     String str2 = "BG" +
@@ -1888,7 +1895,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                             "-" + year +
                             "-" + spUtils.getStringSP(wbsTreePrivate.getNodeName().trim()) +
                             "-" + maxReportNo;
-                    stringStringHashMap.put("valueStr",str2);
+                    stringStringHashMap.put("valueStr", str2);
                     return stringStringHashMap;
                 }
             }
@@ -1982,9 +1989,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 if (dto.getType().equals(1)) {
                     //自检pdf
                     List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
-                            .select(TrialSelfInspectionRecord::getPdfUrl,TrialSelfInspectionRecord::getContractId,TrialSelfInspectionRecord::getId,TrialSelfInspectionRecord::getType)
+                            .select(TrialSelfInspectionRecord::getPdfUrl, TrialSelfInspectionRecord::getContractId, TrialSelfInspectionRecord::getId, TrialSelfInspectionRecord::getType)
                             .in(TrialSelfInspectionRecord::getId, Func.toLongList(dto.getIds())));
-                    if(trialSelfInspectionRecords.size()>0){
+                    if (trialSelfInspectionRecords.size() > 0) {
                         for (TrialSelfInspectionRecord record : trialSelfInspectionRecords) {
                             String pdf = this.getMergePdfToTrialNew(record.getContractId(), record.getId(), record.getType());
                             pdfList.add(pdf);
@@ -2009,14 +2016,21 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 }
 
                 //成渝自检
-                if (dto.getType().equals(11)){
+                if (dto.getType().equals(11)) {
                     List<TrialCyFinishTestReport> trialCyFinishTestReports = trialCyFinishTestReportService.getBaseMapper().selectList(Wrappers.<TrialCyFinishTestReport>lambdaQuery().in(TrialCyFinishTestReport::getTaskId, Func.toLongList(dto.getIds())));
-                    List<String> collect = trialCyFinishTestReports.stream().map(TrialCyFinishTestReport::getReportFilePath).filter(StringUtils::isNotBlank).collect(Collectors.toList());
-                    pdfList.addAll(collect);
-                }else if(dto.getType().equals(12) || dto.getType().equals(13)){
+                    trialCyFinishTestReports.forEach(f -> {
+                        if (StringUtils.isNotBlank(f.getAssembleFile())) {
+                            pdfList.add(f.getAssembleFile());
+                        }
+
+                    });
+                } else if (dto.getType().equals(12) || dto.getType().equals(13)) {
                     List<TrialCyThirdReport> trialCyThirdReports = trialCyThirdReportService.getBaseMapper().selectList(Wrappers.<TrialCyThirdReport>lambdaQuery().in(TrialCyThirdReport::getId, Func.toLongList(dto.getIds())));
-                    List<String> collect = trialCyThirdReports.stream().map(TrialCyThirdReport::getReportDocFilePath).filter(StringUtils::isNotBlank).collect(Collectors.toList());
-                    pdfList.addAll(collect);
+                    trialCyThirdReports.forEach(f -> {
+                        if (StringUtils.isNotBlank(f.getAssembleFile())) {
+                            pdfList.add(f.getAssembleFile());
+                        }
+                    });
                 }
 
                 if (pdfList.size() > 0) {
@@ -2117,7 +2131,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
     @Override
     public R getSamplePdfUrl(String id, String contrctId) {
         try {
-            String  pdf = this.getMergePdfToTrial(Func.toLong(contrctId), Func.toLong(id));
+            String pdf = this.getMergePdfToTrial(Func.toLong(contrctId), Func.toLong(id));
             return R.data(pdf);
         } catch (FileNotFoundException e) {
             throw new RuntimeException(e);
@@ -2189,28 +2203,28 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
         if (entrustInfo != null && info == null && oldTrialSampleInfo != null) {
             if (entrustInfo.getSampleId() != null && entrustInfo.getSampleId().equals(oldTrialSampleInfo.getId())) {
                 record.setEntrustId(null);
-                baseInfo.setEntrustId( null);
+                baseInfo.setEntrustId(null);
                 baseInfo.setEntrustNo(null);
             }
         }
-        boolean a=true;
-        boolean b=true;
+        boolean a = true;
+        boolean b = true;
         record.setBaseInfo(JSON.toJSONString(baseInfo));
         if (oldRecord == null) {
-            if(StringUtils.isNotEmpty(record.getRecordNo())){
-                if(StringUtils.isNotEmpty(record.getRecordNo())){
-                    a= trialNumberRuleService.checkTrialNumberIsExist(record.getRecordNo(), 4, record.getContractId());
+            if (StringUtils.isNotEmpty(record.getRecordNo())) {
+                if (StringUtils.isNotEmpty(record.getRecordNo())) {
+                    a = trialNumberRuleService.checkTrialNumberIsExist(record.getRecordNo(), 4, record.getContractId());
                 }
             }
-            if(StringUtils.isNotEmpty(record.getRecordNo())){
-                if(StringUtils.isNotEmpty(record.getReportNo())){
-                    b= trialNumberRuleService.checkTrialNumberIsExist(record.getReportNo(), 5, record.getContractId());
+            if (StringUtils.isNotEmpty(record.getRecordNo())) {
+                if (StringUtils.isNotEmpty(record.getReportNo())) {
+                    b = trialNumberRuleService.checkTrialNumberIsExist(record.getReportNo(), 5, record.getContractId());
                 }
             }
-            if(!a){
+            if (!a) {
                 throw new ServiceException("记录编号已存在");
             }
-            if(!b){
+            if (!b) {
                 throw new ServiceException("报告编号已存在");
             }
             this.save(record);
@@ -2235,9 +2249,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 if (StringUtils.isNotBlank(samplingLocation) || StringUtils.isNotBlank(calculationUnit) || StringUtils.isNotBlank(specificationNumber) || StringUtils.isNotBlank(specificationModel)) {
                     this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
                             .set(StringUtils.isNotBlank(samplingLocation), TrialSelfInspectionRecord::getSamplingLocation, samplingLocation)
-                            .set(StringUtils.isNotBlank(calculationUnit),TrialSelfInspectionRecord::getCompany, calculationUnit)
-                            .set(StringUtils.isNotBlank(specificationNumber),TrialSelfInspectionRecord::getSpecificationNumber, specificationNumber)
-                            .set(StringUtils.isNotBlank(specificationModel),TrialSelfInspectionRecord::getSpecificationModel, specificationModel)
+                            .set(StringUtils.isNotBlank(calculationUnit), TrialSelfInspectionRecord::getCompany, calculationUnit)
+                            .set(StringUtils.isNotBlank(specificationNumber), TrialSelfInspectionRecord::getSpecificationNumber, specificationNumber)
+                            .set(StringUtils.isNotBlank(specificationModel), TrialSelfInspectionRecord::getSpecificationModel, specificationModel)
                             .eq(TrialSelfInspectionRecord::getId, record.getId()));
                 }
                 if (entrustInfo == null) {
@@ -2252,9 +2266,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             }
         }
         // ---- 修改样品单号信息 --------
-        if(entrustInfo != null){
+        if (entrustInfo != null) {
             //修改项目节点基础信息
-            jdbcTemplate.update("update u_entrust_info set sample_status=4 where id ='"+entrustInfo.getId()+"'");
+            jdbcTemplate.update("update u_entrust_info set sample_status=4 where id ='" + entrustInfo.getId() + "'");
             if (entrustInfo.getSampleId() != null) {
                 TrialSampleInfo sampleInfo = trialSampleInfoMapper.selectById(entrustInfo.getSampleId());
                 if (sampleInfo != null) {
@@ -2273,9 +2287,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                     if (StringUtils.isNotBlank(samplingLocation) || StringUtils.isNotBlank(calculationUnit) || StringUtils.isNotBlank(specificationNumber) || StringUtils.isNotBlank(specificationModel)) {
                         this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
                                 .set(StringUtils.isNotBlank(samplingLocation), TrialSelfInspectionRecord::getSamplingLocation, samplingLocation)
-                                .set(StringUtils.isNotBlank(calculationUnit),TrialSelfInspectionRecord::getCompany, calculationUnit)
-                                .set(StringUtils.isNotBlank(specificationNumber),TrialSelfInspectionRecord::getSpecificationNumber, specificationNumber)
-                                .set(StringUtils.isNotBlank(specificationModel),TrialSelfInspectionRecord::getSpecificationModel, specificationModel)
+                                .set(StringUtils.isNotBlank(calculationUnit), TrialSelfInspectionRecord::getCompany, calculationUnit)
+                                .set(StringUtils.isNotBlank(specificationNumber), TrialSelfInspectionRecord::getSpecificationNumber, specificationNumber)
+                                .set(StringUtils.isNotBlank(specificationModel), TrialSelfInspectionRecord::getSpecificationModel, specificationModel)
                                 .eq(TrialSelfInspectionRecord::getId, record.getId()));
                     }
                 }
@@ -2293,16 +2307,16 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             recordDTO.setTrialUserName(AuthUtil.getNickName());
             this.trialDeviceUseService.addDeviceUseInfo(recordDTO, record.getId());
         }
-            if(dto.getOldRecordNumber()!=null&&dto.getOldRecordNumber().equals(dto.getRecordNo())){
-                if(StringUtils.isNotEmpty(dto.getRecordAutoNumber())){
-                    trialNumberRuleService.checkSave(dto.getContractId(),4,record.getId(),dto.getRecordAutoNumber());
-                }
+        if (dto.getOldRecordNumber() != null && dto.getOldRecordNumber().equals(dto.getRecordNo())) {
+            if (StringUtils.isNotEmpty(dto.getRecordAutoNumber())) {
+                trialNumberRuleService.checkSave(dto.getContractId(), 4, record.getId(), dto.getRecordAutoNumber());
             }
-            if(dto.getOldReportNumber()!=null&&dto.getOldReportNumber().equals(dto.getReportNo())){
-                if(StringUtils.isNotEmpty(dto.getReportAutoNumber())){
-                    trialNumberRuleService.checkSave(dto.getContractId(),5,record.getId(),dto.getReportAutoNumber());
-                }
+        }
+        if (dto.getOldReportNumber() != null && dto.getOldReportNumber().equals(dto.getReportNo())) {
+            if (StringUtils.isNotEmpty(dto.getReportAutoNumber())) {
+                trialNumberRuleService.checkSave(dto.getContractId(), 5, record.getId(), dto.getReportAutoNumber());
             }
+        }
 
         return record.getId();
     }