Procházet zdrojové kódy

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

# Conflicts:
#	blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java
#	blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java
lvy před 3 měsíci
rodič
revize
e66a004c3c
12 změnil soubory, kde provedl 336 přidání a 77 odebrání
  1. 6 3
      blade-common/src/main/java/org/springblade/common/utils/CommonUtil.java
  2. 15 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrailDeviceUseInfoDTO.java
  3. 5 38
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrialSeleInspectionRecordBaseInfoDTO.java
  4. 75 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrialSeleInspectionRecordInfoDTO.java
  5. 3 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialSelfInspectionRecord.java
  6. 4 4
      blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.xml
  7. 5 5
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveExpertConclusionServiceImpl.java
  8. 135 2
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java
  9. 34 14
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java
  10. 2 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialSelfInspectionRecordService.java
  11. 43 4
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java
  12. 9 7
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractSyncImpl.java

+ 6 - 3
blade-common/src/main/java/org/springblade/common/utils/CommonUtil.java

@@ -857,11 +857,15 @@ public class CommonUtil {
     public static byte[] compressImage3(String url) throws IOException, ImageProcessingException, MetadataException {
         try(InputStream file = CommonUtil.getOSSInputStream(url)) {
             byte[] imageData = InputStreamToBytes(file);
-            return compressImage3(imageData);
+            String extension = url.substring(url.lastIndexOf(".") + 1).toUpperCase();
+            if ("JPG".equals(extension) || "JPEG".equals(extension)) {
+                extension = "JPEG";
+            }
+            return compressImage3(imageData, extension);
         }
     }
 
-    public static byte[] compressImage3(byte[] imageData) throws ImageProcessingException, IOException, MetadataException {
+    public static byte[] compressImage3(byte[] imageData, String formatName) throws ImageProcessingException, IOException, MetadataException {
         // 读取原始图像(处理旋转问题)
         int orientation = 1;
         Metadata metadata = ImageMetadataReader.readMetadata(new ByteArrayInputStream(imageData));
@@ -873,7 +877,6 @@ public class CommonUtil {
             }
         }
         // 缩放图像
-        String formatName = "JPEG";
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         long sizeLimit = 1024*1024*5; //5M 1920 ×1080
         int width = 1080;

+ 15 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrailDeviceUseInfoDTO.java

@@ -28,6 +28,21 @@ public class TrailDeviceUseInfoDTO extends TrialDeviceUse {
     @ApiModelProperty(value = "使用时长,分")
     private Long useDuration;
 
+    /**
+     * 使用日期
+     */
+    @ApiModelProperty(value = "使用日期")
+    private String useDate;
 
+    /**
+     * 使用开始时间
+     */
+    @ApiModelProperty(value = "使用开始时间")
+    private String useStartTime;
+    /**
+     * 使用结束时间
+     */
+    @ApiModelProperty(value = "使用结束时间")
+    private String useEndTime;
 
 }

+ 5 - 38
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrialSeleInspectionRecordBaseInfoDTO.java

@@ -29,18 +29,21 @@ import java.util.List;
 public class TrialSeleInspectionRecordBaseInfoDTO implements Serializable {
 	private static final long serialVersionUID = 1L;
 
+	@ApiModelProperty("委托单id")
+	private Long entrustId;
+
+	@ApiModelProperty("委托单编号")
+	private String entrustNo;
 	/**
 	 * 项目名称
 	 */
 	@ApiModelProperty("项目名称")
 	private String projectName;
-
 	/**
 	 * 施工单位
 	 */
 	@ApiModelProperty("施工单位")
 	private String constructionUnit;
-
 	/**
 	 * 监理单位
 	 */
@@ -56,42 +59,6 @@ public class TrialSeleInspectionRecordBaseInfoDTO implements Serializable {
 	@ApiModelProperty("工程部位/用途")
 	private String projectPosition;
 
-	@ApiModelProperty("委托单编号")
-	private String entrustNo;
-
-	@ApiModelProperty("记录编号")
-	private String recordNo;
-
-	@ApiModelProperty("报告编号")
-	private String reportNo;
-
-	@ApiModelProperty("判断依据列表")
-	private List<StandardVo> standardVos;
-
-	@ApiModelProperty("判断依据:规范id")
-	private Long standardId;
-
-	@ApiModelProperty("规范信息ids")
-	private String standardInfoIds;
-
-
-	@ApiModelProperty("规范信息")
-	private List<StandardVo> standardInfos;
-
 	@ApiModelProperty("样品信息")
 	private TrialSampleInfo trialSampleInfo;
-
-	@ApiModelProperty("样品信息列表")
-	private List<TrialSampleInfo> trialSampleInfoList;
-
-	@ApiModelProperty("设备信息和使用信息")
-	private List<TrailDeviceUseInfoDTO> trailDeviceUseInfoDTOS;
-
-	@Data
-	public static class StandardVo {
-		@ApiModelProperty("id")
-		private Long id;
-		@ApiModelProperty("name")
-		private String name;
-	}
 }

+ 75 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrialSeleInspectionRecordInfoDTO.java

@@ -0,0 +1,75 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springblade.business.entity.TrialSampleInfo;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+@Data
+public class TrialSeleInspectionRecordInfoDTO extends TrialSeleInspectionRecordBaseInfoDTO {
+	private static final long serialVersionUID = 1L;
+
+	@ApiModelProperty("id")
+	private Long id;
+
+	@ApiModelProperty(value = "节点ID")
+	private Long nodeId;
+
+	@ApiModelProperty(value = "合同段id")
+	private Long contractId;
+
+	@ApiModelProperty("记录编号")
+	private String recordNo;
+
+	@ApiModelProperty("报告编号")
+	private String reportNo;
+
+	@ApiModelProperty(value = "记录表自增流水号")
+	private String recordAutoNumber;
+
+	@ApiModelProperty(value = "报告单自增流水号")
+	private String reportAutoNumber;
+
+	@ApiModelProperty("判断依据列表")
+	private List<StandardVo> standardVos;
+
+	@ApiModelProperty("判断依据:规范id")
+	private Long standardId;
+
+	@ApiModelProperty("规范信息ids")
+	private String standardInfoIds;
+
+	@ApiModelProperty("规范信息")
+	private List<StandardVo> standardInfos;
+
+
+	@ApiModelProperty("设备信息和使用信息")
+	private List<TrailDeviceUseInfoDTO> trailDeviceUseInfoDTOS;
+
+	@Data
+	public static class StandardVo {
+		@ApiModelProperty("id")
+		private Long id;
+		@ApiModelProperty("name")
+		private String name;
+	}
+}

+ 3 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialSelfInspectionRecord.java

@@ -86,4 +86,7 @@ public class TrialSelfInspectionRecord extends BaseEntity {
     @ApiModelProperty("规范信息")
     private String standardInfoIds;
 
+    @ApiModelProperty("基础信息")
+    private String baseInfo;
+
 }

+ 4 - 4
blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.xml

@@ -218,7 +218,7 @@
 
     <select id="approvalFile" resultType="org.springblade.archive.vo.ArchivesAutoVO$ApprovalFile">
         <if test="archiveId!=null">
-            select * from u_archive_file where archive_id = #{archiveId} and is_element = 0 order by sort
+            select * from u_archive_file where archive_id = #{archiveId} order by sort
         </if>
     </select>
 
@@ -1172,7 +1172,7 @@
                uaa.id,uaa.name,uaa.page_n ,uaa.remark ,uaa.file_number,uaa.unit,uaa.start_date,uaa.end_date,
                 (select bdb.dict_value  from blade_dict_biz bdb WHERE bdb.is_sealed = 0 and bdb.code = 'storage_period' and bdb.dict_key = uaa.storage_time limit 1 ) as storageTimeValue
         from m_archive_tree_contract matc right join u_archives_auto uaa on matc.id = uaa.node_id
-        WHERE uaa.is_deleted = 0 and matc.is_deleted = 0 and uaa.is_apply = #{isApply} and matc.ancestors like concat("%",#{firstNode},"%")
+        WHERE uaa.is_deleted = 0 and matc.is_deleted = 0 and uaa.is_apply = #{isApply} and matc.ancestors like concat("%",#{firstNode},"%") and uaa.is_archive = 1
         order by uaa.tree_sort
     </select>
     <select id="getNodeArchives" resultType="org.springblade.archive.vo.ArchiveInspectVO">
@@ -1273,7 +1273,7 @@
         )
     </select>
     <select id="getRoutingInspection" resultType="org.springblade.archive.vo.ArchiveWarningVO">
-        select uaf.file_name ,uaf.file_url,0 as sourceType,uaf.node_id,
+        select uaf.file_name ,IF(uaf.file_url is null or uaf.file_url = '', uaf.pdf_file_url, uaf.file_url) as file_url,0 as sourceType,uaf.node_id,
                (select uaa.name from u_archives_auto uaa WHERE uaa.id = uaf.archive_id) as archive_name,
                (select GROUP_CONCAT(uai.opinion) from u_archive_inspection uai WHERE uai.file_id = uaf.id) as allopinion
         from u_archive_file uaf join m_archive_tree_contract atc on uaf.node_id  = atc.id
@@ -1284,7 +1284,7 @@
     <select id="getSpotCheck" resultType="org.springblade.archive.vo.ArchiveWarningVO">
         select GROUP_CONCAT(aei.opinion) as allopinion,aei.archive_name ,aei.node_id,1 as sourceType,
                (select uaf.file_name from u_archive_file uaf WHERE uaf.id = aei.file_id) as fileName,
-               (select uaf.file_url from u_archive_file uaf WHERE uaf.id = aei.file_id) as fileUrl
+               (select IF(uaf.file_url is null or uaf.file_url = '', uaf.pdf_file_url, uaf.file_url) as file_url from u_archive_file uaf WHERE uaf.id = aei.file_id) as fileUrl
         from m_archive_tree_contract atc join u_archive_expert_inspection aei on aei.node_id  = atc.id
         where atc.project_id  = #{projectId} and atc.is_deleted = 0 and aei.is_deleted = 0 and aei.is_pass = 0
           and atc.is_deleted = 0

+ 5 - 5
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveExpertConclusionServiceImpl.java

@@ -243,11 +243,11 @@ public class ArchiveExpertConclusionServiceImpl extends BaseServiceImpl<ArchiveE
             throw new ServiceException("专家账号信息错误,请联系管理员");
         }
         //获取所有专家个人证书
-        List<SignPfxFile> list = baseMapper.getAllSign(userIds);
-        if (list.size() == 0 || list.size() != userIds.size()){
-            throw new ServiceException("有专家没有配置电签,请联系管理员");
-        }
-        Map<Long, SignPfxFile> map = list.stream().collect(Collectors.toMap(l -> l.getCertificateUserId(), l -> l));
+//        List<SignPfxFile> list = baseMapper.getAllSign(userIds);
+//        if (list.size() == 0 || list.size() != userIds.size()){
+//            throw new ServiceException("有专家没有配置电签,请联系管理员");
+//        }
+//        Map<Long, SignPfxFile> map = list.stream().collect(Collectors.toMap(l -> l.getCertificateUserId(), l -> l));
 
         String pdfUrl = "";
         try {

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

@@ -379,11 +379,144 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		if (StringUtils.isNotBlank(vo.getSecretLevel())) {
 			vo.setSecretLevelValue("1".equals(vo.getSecretLevel()) ? "机密" : ("2".equals(vo.getSecretLevel()) ? "绝密" : "秘密"));
 		}
-		if (vo.getApprovalFileList() != null && vo.getApprovalFileList().size() > 0) {
-			vo.setPageNumber(vo.getApprovalFileList().size());
+		List<ArchivesAutoVO.ApprovalFile> approvalFiles = vo.getApprovalFileList();
+		ArchivesAutoVO.ApprovalFile front = null;
+		ArchivesAutoVO.ApprovalFile cataLog = null;
+		ArchivesAutoVO.ApprovalFile spare = null;
+		ArchivesAutoVO.ApprovalFile back = null;
+		if (approvalFiles != null && !approvalFiles.isEmpty()) {
+			// 四要素
+			Map<String, List<ArchivesAutoVO.ApprovalFile>> collect = approvalFiles.stream().collect(Collectors.groupingBy(approvalFile -> {
+				if (approvalFile != null &&
+						(approvalFile.getFileName().equals("封面") || approvalFile.getFileName().equals("卷内目录") || approvalFile.getFileName().equals("备考表") || approvalFile.getFileName().equals("背脊"))) {
+					return approvalFile.getFileName();
+				}
+				return "0";
+			}, Collectors.toList()));
+			List<ArchivesAutoVO.ApprovalFile> approvalFiles1 = collect.get("0");
+			if (approvalFiles1 == null) {
+				approvalFiles1 = new ArrayList<>();
+			}
+			vo.setPageNumber(approvalFiles1.size());
+			vo.setApprovalFileList(approvalFiles1);
+			if (collect.containsKey("封面")) {
+				front = collect.get("封面").stream().max(Comparator.comparing(ArchivesAutoVO.ApprovalFile::getId)).orElse(null);
+			}
+			if (collect.containsKey("卷内目录")) {
+				cataLog = collect.get("卷内目录").stream().max(Comparator.comparing(ArchivesAutoVO.ApprovalFile::getId)).orElse(null);
+			}
+			if (collect.containsKey("备考表")) {
+				spare = collect.get("备考表").stream().max(Comparator.comparing(ArchivesAutoVO.ApprovalFile::getId)).orElse(null);
+			}
+			if (collect.containsKey("背脊")) {
+				back = collect.get("背脊").stream().max(Comparator.comparing(ArchivesAutoVO.ApprovalFile::getId)).orElse(null);
+			}
 		} else {
 			vo.setPageNumber(0);
 		}
+		String outUrl = vo.getOutUrl();
+		if (StringUtils.isNotBlank(outUrl)) {
+			// 根据 factorType 字符串生成档案号码字符串链表
+			ArchiveProjectConfig config = archiveProjectConfigService.getByProjectIdOrNew(vo.getProjectId());
+			String[] frontUrls = outUrl.split(",");
+			for (String frontUrl : frontUrls) {
+				// 封面(原r_Archives_front)增加中文"封面"匹配
+				if (front == null && (frontUrl.contains(ArchiveAutoPdfServiceImpl.ARCHIVE_NUMBER[0])
+						|| frontUrl.contains("封面"))
+						&& config.getFactorType().contains("1")) {
+					front = new ArchivesAutoVO.ApprovalFile();
+					front.setFileName("封面");
+					if(frontUrl.contains("@@@")){
+						front.setFileUrl(frontUrl.substring(0,frontUrl.indexOf("@@@")));
+					}else {
+						front.setFileUrl(frontUrl);
+					}
+				}
+				// 卷内目录(原r_Archives_catalog)增加中文匹配
+				else if (cataLog == null && (frontUrl.contains(ArchiveAutoPdfServiceImpl.ARCHIVE_NUMBER[1])
+						|| frontUrl.contains("卷内目录"))
+						&& config.getFactorType().contains("2")) {
+					cataLog = new ArchivesAutoVO.ApprovalFile();
+					cataLog.setFileName("卷内目录");
+					if(frontUrl.contains("@@@")){
+						cataLog.setFileUrl(frontUrl.substring(0,frontUrl.indexOf("@@@")));
+					}else {
+						cataLog.setFileUrl(frontUrl);
+					}
+				}
+				// 备考表(原r_Archives_spare)增加中文匹配
+				else if (spare == null && (frontUrl.contains(ArchiveAutoPdfServiceImpl.ARCHIVE_NUMBER[2])
+						|| frontUrl.contains("备考表"))
+						&& config.getFactorType().contains("3")) {
+					spare = new ArchivesAutoVO.ApprovalFile();
+					spare.setFileName("备考表");
+					if(frontUrl.contains("@@@")){
+						spare.setFileUrl(frontUrl.substring(0,frontUrl.indexOf("@@@")));
+					}else {
+						spare.setFileUrl(frontUrl);
+					}
+				}
+				// 背脊(原r_Archives_back)增加中文匹配
+				else if (back == null && (frontUrl.contains(ArchiveAutoPdfServiceImpl.ARCHIVE_NUMBER[3])
+						|| frontUrl.contains("背脊"))
+						&& config.getFactorType().contains("4")) {
+					back = new ArchivesAutoVO.ApprovalFile();
+					back.setFileName("背脊");
+					if(frontUrl.contains("@@@")){
+						back.setFileUrl(frontUrl.substring(0,frontUrl.indexOf("@@@")));
+					}else {
+						back.setFileUrl(frontUrl);
+					}
+				}
+			}
+			List<ArchivesAutoVO.ApprovalFile> files = vo.getApprovalFileList();;
+			if (files != null) {
+				String tempId = null;
+				if (!files.isEmpty()) {
+					tempId = files.get(0).getId();
+				}
+				if (front != null && front.getFileUrl() != null) {
+					if (front.getId() == null && tempId != null) {
+						front.setId(tempId + "_1");
+					}
+					if (front.getId() != null) {
+						front.setPdfFileUrl(front.getFileUrl());
+						files.add(0,front);
+					}
+				}
+				if (cataLog != null && cataLog.getFileUrl() != null) {
+					if (cataLog.getId() == null && tempId != null) {
+						cataLog.setId(tempId  + "_2");
+					}
+					if (cataLog.getId() != null) {
+						cataLog.setPdfFileUrl(cataLog.getFileUrl());
+						if (front != null && front.getFileUrl() != null) {
+							files.add(1,cataLog);
+						} else {
+							files.add(0,cataLog);
+						}
+					}
+				}
+				if (spare != null && spare.getFileUrl() != null) {
+					if (spare.getId() == null && tempId != null) {
+						spare.setId(tempId  + "_3");
+					}
+					if (spare.getId() != null) {
+						spare.setPdfFileUrl(spare.getFileUrl());
+						files.add(spare);
+					}
+				}
+				if (back != null && back.getFileUrl() != null) {
+					if (back.getId() == null && tempId != null) {
+						back.setId(tempId  + "_4");
+					}
+					if (back.getId() != null) {
+						back.setPdfFileUrl(back.getFileUrl());
+						files.add(back);
+					}
+				}
+			}
+		}
 		return vo;
 	}
 

+ 34 - 14
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java

@@ -1,5 +1,6 @@
 package org.springblade.business.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
@@ -542,7 +543,7 @@ public class TrialDetectionController extends BladeController {
     @GetMapping("/self/getBaseInfo")
     @ApiOperationSupport(order = 30)
     @ApiOperation(value = "获取试验自检基础信息", notes = "传入节点pKeyId")
-    public R<TrialSeleInspectionRecordBaseInfoDTO> getBaseInfo(@RequestParam Long projectId, @RequestParam Long contractId, @RequestParam Long nodeId, @RequestParam(required = false) Long id) {
+    public R<TrialSeleInspectionRecordInfoDTO> getBaseInfo(@RequestParam Long projectId, @RequestParam Long contractId, @RequestParam Long nodeId, @RequestParam(required = false) Long id) {
         ProjectInfo projectInfo = jdbcTemplate.query("select * from m_project_info where id = " + projectId, new BeanPropertyRowMapper<>(ProjectInfo.class)).stream().findAny().orElse(null);
         if (projectInfo == null) {
             return R.fail("未获取到项目信息");
@@ -551,7 +552,7 @@ public class TrialDetectionController extends BladeController {
         if (contractInfo == null) {
             return R.fail("未获取到合同信息");
         }
-        TrialSeleInspectionRecordBaseInfoDTO vo = new TrialSeleInspectionRecordBaseInfoDTO();
+        TrialSeleInspectionRecordInfoDTO vo = new TrialSeleInspectionRecordInfoDTO();
         vo.setProjectName(projectInfo.getProjectName());
         vo.setConstructionUnit(contractInfo.getConstructionUnitName());
         if (contractInfo.getContractType().equals(2)) {
@@ -569,21 +570,27 @@ public class TrialDetectionController extends BladeController {
         if (id != null) {
             TrialSelfInspectionRecord record = jdbcTemplate.query("select * from u_trial_self_inspection_record where id = " + id, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class)).stream().findAny().orElse(null);
             if (record != null) {
+                String baseInfo = record.getBaseInfo();
+                if (baseInfo != null) {
+                    TrialSeleInspectionRecordInfoDTO info = JSON.parseObject(baseInfo, TrialSeleInspectionRecordInfoDTO.class);
+                    BeanUtil.copyProperties(info, vo);
+                }
                 // 取样
                 Long entrustId = record.getEntrustId();
-                if (entrustId != null) {
+                if (vo.getEntrustNo() == null && entrustId != null) {
                     EntrustInfo entrustInfo = jdbcTemplate.query("select * from u_entrust_info where id = " + entrustId, new BeanPropertyRowMapper<>(EntrustInfo.class)).stream().findAny().orElse(null);
                     if (entrustInfo != null) {
                         vo.setEntrustNo(entrustInfo.getEntrustNo());
+                        vo.setEntrustId(entrustInfo.getId());
                     }
                 }
-                List<TrialSelfSample> selfSampleList = jdbcTemplate.query("select * from u_trial_self_sample where self_id = " + id, new BeanPropertyRowMapper<>(TrialSelfSample.class));
-
-                if (!selfSampleList.isEmpty()) {
-                    String samplingIds = selfSampleList.stream().map(TrialSelfSample::getSamplingId).map(String::valueOf).collect(Collectors.joining(","));
-                    List<TrialSampleInfo> trialSampleInfoList = jdbcTemplate.query("select * from u_trial_sample_info where id in (" + samplingIds + ")", new BeanPropertyRowMapper<>(TrialSampleInfo.class));
-                    vo.setTrialSampleInfoList(trialSampleInfoList);
-                    vo.setTrialSampleInfo(trialSampleInfoList.isEmpty() ? new TrialSampleInfo() : trialSampleInfoList.get(0));
+                if (vo.getTrialSampleInfo() == null) {
+                    List<TrialSelfSample> selfSampleList = jdbcTemplate.query("select * from u_trial_self_sample where self_id = " + id, new BeanPropertyRowMapper<>(TrialSelfSample.class));
+                    if (!selfSampleList.isEmpty()) {
+                        String samplingIds = selfSampleList.stream().map(TrialSelfSample::getSamplingId).map(String::valueOf).collect(Collectors.joining(","));
+                        List<TrialSampleInfo> trialSampleInfoList = jdbcTemplate.query("select * from u_trial_sample_info where id in (" + samplingIds + ")", new BeanPropertyRowMapper<>(TrialSampleInfo.class));
+                        vo.setTrialSampleInfo(trialSampleInfoList.isEmpty() ? new TrialSampleInfo() : trialSampleInfoList.get(0));
+                    }
                 }
                 if (vo.getProjectPosition() == null) {
                     vo.setProjectPosition(record.getProjectPosition());
@@ -596,9 +603,9 @@ public class TrialDetectionController extends BladeController {
                         Set<Long> ids = standardInfoList.stream().map(StandardInfo::getParentId).collect(Collectors.toSet());
                         List<StandardInfo> parentStandardInfoList = jdbcTemplate.query("select * from u_standard_info where id in (" + org.apache.commons.lang.StringUtils.join(ids, ",") + ")", new BeanPropertyRowMapper<>(StandardInfo.class));
                         Map<Long, List<StandardInfo>> map = standardInfoList.stream().collect(Collectors.groupingBy(StandardInfo::getParentId));
-                        List<TrialSeleInspectionRecordBaseInfoDTO.StandardVo> standardVos = new ArrayList<>();
+                        List<TrialSeleInspectionRecordInfoDTO.StandardVo> standardVos = new ArrayList<>();
                         parentStandardInfoList.forEach(standardInfo -> {
-                            TrialSeleInspectionRecordBaseInfoDTO.StandardVo standardVo = new TrialSeleInspectionRecordBaseInfoDTO.StandardVo();
+                            TrialSeleInspectionRecordInfoDTO.StandardVo standardVo = new TrialSeleInspectionRecordInfoDTO.StandardVo();
                             List<StandardInfo> list = map.get(standardInfo.getId());
                             if (list != null && !list.isEmpty()) {
                                 standardVo.setId(list.get(0).getId());
@@ -624,6 +631,10 @@ public class TrialDetectionController extends BladeController {
                             trailDeviceUseInfoDTO.setAccuracy(deviceInfo.getAccuracy());
                             // 计算使用时长
                             trailDeviceUseInfoDTO.setUseDuration(DateUtils.dateDiff(trailDeviceUseInfoDTO.getStartDate(), trailDeviceUseInfoDTO.getEndDate()));
+                            // 从开始时间中获取日期
+                            trailDeviceUseInfoDTO.setUseDate(DateUtils.getDateStr(trailDeviceUseInfoDTO.getStartDate()));
+                            trailDeviceUseInfoDTO.setUseStartTime(DateUtils.getTimeStr(trailDeviceUseInfoDTO.getStartDate()).substring(11));
+                            trailDeviceUseInfoDTO.setUseEndTime(DateUtils.getTimeStr(trailDeviceUseInfoDTO.getStartDate()).substring(11));
                         }
                     });
                 }
@@ -633,18 +644,27 @@ public class TrialDetectionController extends BladeController {
         if (vo.getRecordNo() == null) {
             Map<String, String> map = trialNumberRuleService.getTrialNumber(projectId, contractId, 4, nodeId, true);
             vo.setRecordNo(map.get("trialNumber"));
+            vo.setRecordAutoNumber(map.get("trialAutoNumber"));
         }
         if (vo.getReportNo() == null) {
             Map<String, String> map = trialNumberRuleService.getTrialNumber(projectId, contractId, 5, nodeId, true);
             vo.setReportNo(map.get("trialNumber"));
+            vo.setReportAutoNumber(map.get("trialAutoNumber"));
         }
-        List<TrialSeleInspectionRecordBaseInfoDTO.StandardVo> mapList = jdbcTemplate.query("SELECT id,name from u_wbs_private_standard WHERE type = 2 and is_deleted = 0 and status = 1 and private_id = " + nodeId,
-                new BeanPropertyRowMapper<>(TrialSeleInspectionRecordBaseInfoDTO.StandardVo.class));
+        List<TrialSeleInspectionRecordInfoDTO.StandardVo> mapList = jdbcTemplate.query("SELECT id,name from u_wbs_private_standard WHERE type = 2 and is_deleted = 0 and status = 1 and private_id = " + nodeId,
+                new BeanPropertyRowMapper<>(TrialSeleInspectionRecordInfoDTO.StandardVo.class));
         vo.setStandardVos(mapList);
         return R.data(vo);
     }
 
 
+    @PostMapping("/self/saveBaseInfo")
+    @ApiOperationSupport(order = 30)
+    @ApiOperation(value = "保存试验自检基础信息")
+    public R<Boolean> saveBaseInfo(@RequestBody TrialSeleInspectionRecordInfoDTO vo) {
+        return R.status(iTrialSelfInspectionRecordService.saveBaseInfo(vo));
+    }
+
     /**
      * 获取最近一次使用的设备信息
      */

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

@@ -46,4 +46,6 @@ public interface ITrialSelfInspectionRecordService extends BaseService<TrialSelf
 
 
     R getSamplePdfUrl(String id,String contrctId);
+
+    Boolean saveBaseInfo(TrialSeleInspectionRecordInfoDTO vo);
 }

+ 43 - 4
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -1,9 +1,11 @@
 package org.springblade.business.service.impl;
 
 import cn.hutool.core.date.LocalDateTimeUtil;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
@@ -1415,16 +1417,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.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.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.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.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, "、");
 
             //更新
@@ -2084,5 +2086,42 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
         }
     }
 
+    @Override
+    public Boolean saveBaseInfo(TrialSeleInspectionRecordInfoDTO dto) {
+        TrialSelfInspectionRecord record = new TrialSelfInspectionRecord();
+        BeanUtil.copyProperties(dto, record);
+        TrialSeleInspectionRecordBaseInfoDTO baseInfo = new TrialSeleInspectionRecordBaseInfoDTO();
+        BeanUtil.copyProperties(dto, baseInfo);
+        record.setBaseInfo(JSON.toJSONString(baseInfo));
+        this.saveOrUpdate(record);
+        TrialSampleInfo trialSampleInfo = dto.getTrialSampleInfo();
+        if (trialSampleInfo != null) {
+            TrialSampleInfo sampleInfo = trialSampleInfoMapper.selectById(trialSampleInfo.getId());
+            if (sampleInfo != null) {
+                //------关联取样信息------
+                RecordSampleSubmitDTO sampleSubmitDTO = new RecordSampleSubmitDTO();
+                sampleSubmitDTO.setId(record.getId());
+                sampleSubmitDTO.setSampleIds(trialSampleInfo.getId() + "");
+                //删除关联
+                baseMapper.delSelfSample(record.getId());
+                baseMapper.saveSelfSample(SnowFlakeUtil.getId(), record.getId(), trialSampleInfo.getId() + "");
+                //更新
+                this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
+                        .set(sampleInfo.getSamplingLocation() != null && !sampleInfo.getSamplingLocation().isEmpty(),TrialSelfInspectionRecord::getSamplingLocation, sampleInfo.getSamplingLocation())
+                        .set(sampleInfo.getCalculationUnit() != null && !sampleInfo.getCalculationUnit().isEmpty(), TrialSelfInspectionRecord::getCompany, sampleInfo.getCalculationUnit())
+                        .set(trialSampleInfo.getSpecificationNumber() != null && !trialSampleInfo.getSpecificationNumber().isEmpty(), TrialSelfInspectionRecord::getSpecificationNumber, trialSampleInfo.getSpecificationNumber())
+                        .set(sampleInfo.getSpecificationModel() != null && !sampleInfo.getSpecificationModel().isEmpty(), TrialSelfInspectionRecord::getSpecificationModel, sampleInfo.getSpecificationModel())
+                        .eq(TrialSelfInspectionRecord::getId, sampleSubmitDTO.getId())
+                );
+            }
+        }
+        // ---- 修改样品单号信息 --------
+        if(Func.isNotEmpty(dto.getEntrustId())){
+            //修改项目节点基础信息
+            jdbcTemplate.update("update u_entrust_info set sample_status=4 where id ='"+dto.getEntrustId()+"'");
+        }
+        return true;
+    }
+
 
 }

+ 9 - 7
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractSyncImpl.java

@@ -619,8 +619,10 @@ public class ArchiveTreeContractSyncImpl {
                         archiveFile.setFilePage(info.getEVisaPdfPage());
                         archiveFile.setFileSize(info.getEVisaPdfSize());
                         archiveFile.setIsCertification(1);
-                        archiveFile.setCertificationTime(info.getBusinessTime());
-                        archiveFile.setFileTime(info.getBusinessTime());
+                        if (StringUtils.isNotEmpty(info.getBusinessTime())) {
+                            archiveFile.setCertificationTime(info.getBusinessTime());
+                            archiveFile.setFileTime(info.getBusinessTime());
+                        }
                         archiveFile.setSort(sort);
                         if (nodeId != null && !nodeId.toString().equals(archiveFile.getNodeId())) {
                             archiveFile.setNodeId(nodeId.toString());
@@ -688,14 +690,14 @@ public class ArchiveTreeContractSyncImpl {
             // 特殊类型处理:根据 nodeType 匹配对应的数字
             if (treeContractVO6.getNodeType() != null) {
                 switch (treeContractVO6.getNodeType()) {
-                    case 1: // 单位工程 → 匹配 2
-                        return majarDataType.contains("2");
+                    case 1: // 单位工程 → 匹配 9
+                        return majarDataType.contains("9");
                     case 2: // 分部工程 → 匹配 8
                     case 3: // 子分部工程 → 匹配 8
                         return majarDataType.contains("8");
-                    case 4: // 分项工程 → 匹配 9
-                    case 5: // 子分项工程 → 匹配 9
-                        return majarDataType.contains("9");
+                    case 4: // 分项工程 → 匹配 2
+                    case 5: // 子分项工程 → 匹配 2
+                        return majarDataType.contains("2");
                     default:
                         return majarDataType.contains(currentMajor);
                 }