liuyc 2 年之前
父節點
當前提交
513b339d75
共有 13 個文件被更改,包括 233 次插入135 次删除
  1. 16 3
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialMaterialMobilization.java
  2. 3 3
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java
  3. 1 1
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialSievePoreController.java
  4. 1 1
      blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialMaterialMobilizationExcel.java
  5. 6 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml
  6. 1 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialSampleInfoService.java
  7. 58 4
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java
  8. 44 30
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDetectionDataServiceImpl.java
  9. 5 3
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceClassificationServiceImpl.java
  10. 15 9
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceUseServiceImpl.java
  11. 18 16
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialMaterialMobilizationServiceImpl.java
  12. 10 12
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSampleInfoServiceImpl.java
  13. 55 52
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

+ 16 - 3
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialMaterialMobilization.java

@@ -5,11 +5,11 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
+import org.hibernate.validator.constraints.Length;
 import org.springblade.core.mp.base.BaseEntity;
 import org.springblade.core.mp.base.BaseEntity;
 
 
 import javax.validation.constraints.DecimalMax;
 import javax.validation.constraints.DecimalMax;
-import javax.validation.constraints.DecimalMin;
-import javax.validation.constraints.Size;
+import javax.validation.constraints.Max;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.Date;
 
 
@@ -38,6 +38,7 @@ public class TrialMaterialMobilization extends BaseEntity {
      * 材料名称
      * 材料名称
      */
      */
     @ApiModelProperty(value = "材料名称")
     @ApiModelProperty(value = "材料名称")
+    @Length(max = 100, message = "材料名称最大长度100个字符")
     private String materialName;
     private String materialName;
 
 
     /**
     /**
@@ -50,36 +51,42 @@ public class TrialMaterialMobilization extends BaseEntity {
      * 规格型号
      * 规格型号
      */
      */
     @ApiModelProperty(value = "规格型号")
     @ApiModelProperty(value = "规格型号")
+    @Length(max = 100, message = "规格型号最大长度100个字符")
     private String specificationModel;
     private String specificationModel;
 
 
     /**
     /**
-     * 规格编号
+     * 材料编号
      */
      */
     @ApiModelProperty(value = "材料编号")
     @ApiModelProperty(value = "材料编号")
+    @Length(max = 100, message = "规格编号最大长度100个字符")
     private String materialNumber;
     private String materialNumber;
 
 
     /**
     /**
      * 材料单价
      * 材料单价
      */
      */
     @ApiModelProperty(value = "材料单价")
     @ApiModelProperty(value = "材料单价")
+    @DecimalMax(value = "10", message = "材料单价最大长度10个字符")
     private BigDecimal materialPrice;
     private BigDecimal materialPrice;
 
 
     /**
     /**
      * 材料数量
      * 材料数量
      */
      */
     @ApiModelProperty(value = "材料数量")
     @ApiModelProperty(value = "材料数量")
+    @Max(value = 10, message = "材料数量最长10个字符")
     private Integer materialCount;
     private Integer materialCount;
 
 
     /**
     /**
      * 计算单位
      * 计算单位
      */
      */
     @ApiModelProperty(value = "计算单位")
     @ApiModelProperty(value = "计算单位")
+    @Length(max = 10, message = "计算单位最大长度10个字符")
     private String calculationUnit;
     private String calculationUnit;
 
 
     /**
     /**
      * 生产批号
      * 生产批号
      */
      */
     @ApiModelProperty(value = "生产批号")
     @ApiModelProperty(value = "生产批号")
+    @Length(max = 50, message = "生产批号最大长度50个字符")
     private String batchNumber;
     private String batchNumber;
 
 
     /**
     /**
@@ -93,36 +100,42 @@ public class TrialMaterialMobilization extends BaseEntity {
      * 拟定部位
      * 拟定部位
      */
      */
     @ApiModelProperty(value = "拟定部位")
     @ApiModelProperty(value = "拟定部位")
+    @Length(max = 100, message = "规格编号最大长度100个字符")
     private String proposedPosition;
     private String proposedPosition;
 
 
     /**
     /**
      * 供应商单位
      * 供应商单位
      */
      */
     @ApiModelProperty(value = "供应商单位")
     @ApiModelProperty(value = "供应商单位")
+    @Length(max = 100, message = "供应商单位最大长度100个字符")
     private String supplierUnit;
     private String supplierUnit;
 
 
     /**
     /**
      * 生产地/厂家
      * 生产地/厂家
      */
      */
     @ApiModelProperty(value = "生产地/厂家")
     @ApiModelProperty(value = "生产地/厂家")
+    @Length(max = 100, message = "生产地/厂家最大长度100个字符")
     private String placeOfProduction;
     private String placeOfProduction;
 
 
     /**
     /**
      * 生产合格证
      * 生产合格证
      */
      */
     @ApiModelProperty(value = "生产合格证")
     @ApiModelProperty(value = "生产合格证")
+    @Length(max = 255, message = "生产合格证最大长度255个字符")
     private String productionCertificate;
     private String productionCertificate;
 
 
     /**
     /**
      * 厂家质检报告
      * 厂家质检报告
      */
      */
     @ApiModelProperty(value = "厂家质检报告")
     @ApiModelProperty(value = "厂家质检报告")
+    @Length(max = 255, message = "厂家质检报告最大长度255个字符")
     private String qualityInspectionReport;
     private String qualityInspectionReport;
 
 
     /**
     /**
      * 其他附件
      * 其他附件
      */
      */
     @ApiModelProperty(value = "其他附件")
     @ApiModelProperty(value = "其他附件")
+    @Length(max = 255, message = "其他附件最大长度255个字符")
     private String otherAccessories;
     private String otherAccessories;
 
 
     /**
     /**

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

@@ -104,9 +104,9 @@ public class TrialDetectionController extends BladeController {
 
 
     @GetMapping("/sample/list-info")
     @GetMapping("/sample/list-info")
     @ApiOperationSupport(order = 7)
     @ApiOperationSupport(order = 7)
-    @ApiOperation(value = "查询关联样品信息列表", notes = "传入节点id、当前记录id")
-    public R<List<TrialSampleInfoVO3>> sampleListInfo(Long nodeId, Long id) {
-        return R.data(iTrialSampleInfoService.sampleListInfo(nodeId, id));
+    @ApiOperation(value = "查询关联样品信息列表", notes = "传入节点id、当前记录id,合同段contractId")
+    public R<List<TrialSampleInfoVO3>> sampleListInfo(Long nodeId, Long id, Long contractId) {
+        return R.data(iTrialSampleInfoService.sampleListInfo(nodeId, id, contractId));
     }
     }
 
 
     @GetMapping("/self/sample-list")
     @GetMapping("/self/sample-list")

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

@@ -49,7 +49,7 @@ public class TrialSievePoreController extends BladeController {
     @ApiOperationSupport(order = 3)
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "筛孔分类删除", notes = "传入id")
     @ApiOperation(value = "筛孔分类删除", notes = "传入id")
     public R<Object> classificationRemove(@Valid @RequestParam String id) {
     public R<Object> classificationRemove(@Valid @RequestParam String id) {
-        List<TrialSievePoreClassificationData> query = jdbcTemplate.query("select id from u_trial_sieve_pore_classification_data where class_id =" + id, new BeanPropertyRowMapper<>(TrialSievePoreClassificationData.class));
+        List<TrialSievePoreClassificationData> query = jdbcTemplate.query("select id from u_trial_sieve_pore_classification_data where is_deleted = 0 and class_id =" + id, new BeanPropertyRowMapper<>(TrialSievePoreClassificationData.class));
         if (query.size() > 0) {
         if (query.size() > 0) {
             throw new ServiceException("当前分类下存在数据,删除失败");
             throw new ServiceException("当前分类下存在数据,删除失败");
         }
         }

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialMaterialMobilizationExcel.java

@@ -54,7 +54,7 @@ public class TrialMaterialMobilizationExcel implements Serializable {
     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date mobilizationDate;
     private Date mobilizationDate;
 
 
-    @ExcelProperty(value = "拟部位")
+    @ExcelProperty(value = "拟部位")
     private String proposedPosition;
     private String proposedPosition;
 
 
     @ExcelProperty(value = "供应商单位")
     @ExcelProperty(value = "供应商单位")

+ 6 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml

@@ -34,6 +34,8 @@
         <result column="link_merge_pdf_url" property="linkMergePdfUrl"/>
         <result column="link_merge_pdf_url" property="linkMergePdfUrl"/>
         <result column="sj_record_ids" property="sjRecordIds"/>
         <result column="sj_record_ids" property="sjRecordIds"/>
         <result column="sort" property="sort"/>
         <result column="sort" property="sort"/>
+        <result column="pdf_trial_url" property="pdfTrialUrl"/>
+        <result column="pdf_trial_url_position" property="pdfTrialUrlPosition"/>
     </resultMap>
     </resultMap>
 
 
     <resultMap id="queryProcessDataMap" type="org.springblade.business.vo.QueryProcessDataVO">
     <resultMap id="queryProcessDataMap" type="org.springblade.business.vo.QueryProcessDataVO">
@@ -589,6 +591,8 @@
 
 
     <select id="selectInformationQueryPageTwo" resultMap="informationQueryResultMap">
     <select id="selectInformationQueryPageTwo" resultMap="informationQueryResultMap">
         select
         select
+        query.pdf_trial_url,
+        query.pdf_trial_url_position,
         query.wbs_id,
         query.wbs_id,
         query.id,
         query.id,
         query.name,
         query.name,
@@ -603,6 +607,8 @@
         from
         from
         (
         (
         select
         select
+        iq.pdf_trial_url_position,
+        iq.pdf_trial_url,
         iq.sort,
         iq.sort,
         iq.id,
         iq.id,
         iq.name,
         iq.name,

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

@@ -30,6 +30,6 @@ public interface ITrialSampleInfoService extends BaseService<TrialSampleInfo> {
 
 
     List<TrialSampleInfoVO2> useDeviceList(Long nodeId);
     List<TrialSampleInfoVO2> useDeviceList(Long nodeId);
 
 
-    List<TrialSampleInfoVO3> sampleListInfo(Long nodeId, Long id);
+    List<TrialSampleInfoVO3> sampleListInfo(Long nodeId, Long id, Long contractId);
 
 
 }
 }

+ 58 - 4
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java

@@ -3,6 +3,7 @@ package org.springblade.business.service.impl;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
@@ -24,8 +25,10 @@ import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.ResourceUtil;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.feign.ContractClient;
 import org.springblade.manager.feign.ContractClient;
@@ -43,6 +46,8 @@ import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
 
+import java.io.File;
+import java.io.FileNotFoundException;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
@@ -552,6 +557,13 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
                     }
                     }
                 }
                 }
 
 
+                //试验关联文件pdf
+                try {
+                    this.getMergePdf(vor);
+                } catch (FileNotFoundException e) {
+                    e.printStackTrace();
+                }
+
             });
             });
             page.setRecords(voResult);
             page.setRecords(voResult);
             page.setTotal(count);
             page.setTotal(count);
@@ -562,6 +574,48 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
         return page.setRecords(null);
         return page.setRecords(null);
     }
     }
 
 
+    private void getMergePdf(InformationQueryVO vor) throws FileNotFoundException {
+        String pdfUrl = vor.getPdfUrl();
+        if (StringUtils.isNotEmpty(vor.getEVisaPdfUrl())) {
+            //优先使用电签的pdf
+            pdfUrl = vor.getEVisaPdfUrl();
+            vor.setPdfUrl(pdfUrl);
+        }
+
+        if (StringUtils.isNotEmpty(vor.getPdfTrialUrl()) || StringUtils.isNotEmpty(vor.getPdfTrialUrlPosition())) {
+            //合并试验关联文件、试验工程部位信息的pdf
+            List<String> pdfList = new ArrayList<>();
+            //施工填报的原始pdf
+            pdfList.add(pdfUrl);
+            //关联试验的pdf
+            String pdfTrialUrl = vor.getPdfTrialUrl();
+            String pdfTrialUrlPosition = vor.getPdfTrialUrlPosition();
+            if (pdfTrialUrl != null) {
+                pdfList.add(pdfTrialUrl);
+            }
+            if (pdfTrialUrlPosition != null) {
+                pdfList.add(pdfTrialUrlPosition);
+            }
+            //合并
+            if (pdfList.size() >= 2) {
+                String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+                Long id = SnowFlakeUtil.getId();
+                String trialPdf = file_path + "/pdf/" + id + ".pdf";
+                File trialPdf2 = ResourceUtil.getFile(trialPdf);
+                if (trialPdf2.exists()) {
+                    trialPdf2.delete();
+                }
+                //合并当前所有选择的试验pdf
+                FileUtils.mergePdfPublicMethods(pdfList, trialPdf);
+                BladeFile bladeFile = this.newIOSSClient.uploadFile(id + ".pdf", trialPdf);
+                if (bladeFile != null && ObjectUtils.isNotEmpty(bladeFile.getLink())) {
+                    vor.setPdfUrl(bladeFile.getLink());
+                }
+            }
+        }
+    }
+
+
     @Override
     @Override
     public List<WbsTreeContract> getContractWbsTreeAll(WbsTreeContract wbsTreeContract) {
     public List<WbsTreeContract> getContractWbsTreeAll(WbsTreeContract wbsTreeContract) {
         return baseMapper.getContractWbsTreeAll(wbsTreeContract);
         return baseMapper.getContractWbsTreeAll(wbsTreeContract);
@@ -670,10 +724,10 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
 
 
 
 
     @Override
     @Override
-    public void AsyncWbsTree(String primaryKeyId,String parentId,String contractId,String contractIdRelation,String classifyType){
-        String dataInfoId = contractId+"_"+parentId+"_"+classifyType;
+    public void AsyncWbsTree(String primaryKeyId, String parentId, String contractId, String contractIdRelation, String classifyType) {
+        String dataInfoId = contractId + "_" + parentId + "_" + classifyType;
         List<WbsTreeContractTreeVOS> wbsTreeContractTreeVOS = this.queryContractTree(parentId, contractId, contractIdRelation, classifyType);
         List<WbsTreeContractTreeVOS> wbsTreeContractTreeVOS = this.queryContractTree(parentId, contractId, contractIdRelation, classifyType);
-        JSONArray array= JSONArray.parseArray(JSON.toJSONString(wbsTreeContractTreeVOS));
-        RedisTemplate.opsForValue().set("blade-manager::contract:wbstree:"+dataInfoId,JSON.toJSON(array).toString());
+        JSONArray array = JSONArray.parseArray(JSON.toJSONString(wbsTreeContractTreeVOS));
+        RedisTemplate.opsForValue().set("blade-manager::contract:wbstree:" + dataInfoId, JSON.toJSON(array).toString());
     }
     }
 }
 }

+ 44 - 30
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDetectionDataServiceImpl.java

@@ -14,7 +14,9 @@ import org.jsoup.select.Elements;
 import org.springblade.business.dto.TrialDetectionDataDTO;
 import org.springblade.business.dto.TrialDetectionDataDTO;
 import org.springblade.business.dto.TrialDetectionDataPageDTO;
 import org.springblade.business.dto.TrialDetectionDataPageDTO;
 import org.springblade.business.entity.TrialDetectionData;
 import org.springblade.business.entity.TrialDetectionData;
+import org.springblade.business.entity.TrialDeviceClassification;
 import org.springblade.business.entity.TrialSampleInfo;
 import org.springblade.business.entity.TrialSampleInfo;
+import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.business.mapper.TrialDetectionDataMapper;
 import org.springblade.business.mapper.TrialDetectionDataMapper;
 import org.springblade.business.mapper.TrialSelfInspectionRecordMapper;
 import org.springblade.business.mapper.TrialSelfInspectionRecordMapper;
 import org.springblade.business.service.ITrialDetectionDataService;
 import org.springblade.business.service.ITrialDetectionDataService;
@@ -72,6 +74,8 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
         List<TrialDetectionData> trialDetectionData2 = baseMapper.selectList(Wrappers.<TrialDetectionData>lambdaQuery()
         List<TrialDetectionData> trialDetectionData2 = baseMapper.selectList(Wrappers.<TrialDetectionData>lambdaQuery()
                 .select(TrialDetectionData::getId)
                 .select(TrialDetectionData::getId)
                 .isNotNull(TrialDetectionData::getEntrustNo)
                 .isNotNull(TrialDetectionData::getEntrustNo)
+                .eq(TrialDetectionData::getContractId, obj.getContractId())
+                .eq(TrialDetectionData::getNodeId, obj.getNodeId())
                 .eq(TrialDetectionData::getEntrustNo, obj.getEntrustNo()));
                 .eq(TrialDetectionData::getEntrustNo, obj.getEntrustNo()));
         if (ObjectUtil.isEmpty(obj.getId()) && trialDetectionData2.size() > 0) {
         if (ObjectUtil.isEmpty(obj.getId()) && trialDetectionData2.size() > 0) {
             throw new ServiceException("委托编号在当前合同段节点下已存在,请重新填写");
             throw new ServiceException("委托编号在当前合同段节点下已存在,请重新填写");
@@ -88,38 +92,48 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
 
 
     @Override
     @Override
     public IPage<TrialDetectionDataVO> dataPage(IPage<TrialDetectionData> page, TrialDetectionDataPageDTO dto) {
     public IPage<TrialDetectionDataVO> dataPage(IPage<TrialDetectionData> page, TrialDetectionDataPageDTO dto) {
-        QueryWrapper<TrialDetectionData> queryWrapper = Condition.getQueryWrapper(dto);
-        if (StringUtils.isNotEmpty(dto.getQueryStatus())) {
-            queryWrapper.lambda().eq(TrialDetectionData::getStatus, dto.getQueryStatus());
-        }
-        if (StringUtils.isNotEmpty(dto.getStartTime()) && StringUtils.isNotEmpty(dto.getEndTime())) {
-            String endTime = dto.getEndTime();
-            endTime = DateUtil.format(DateUtils.addDays(DateUtil.parse(endTime, "yyyy-MM-dd"), 1), "yyyy-MM-dd");
-            queryWrapper.lambda().between(TrialDetectionData::getReportDate, dto.getStartTime(), endTime);
-        }
-        if (StringUtils.isNotEmpty(dto.getQueryName())) {
-            queryWrapper.lambda().like(TrialDetectionData::getUserName, dto.getQueryName());
-        }
-        if (StringUtils.isNotEmpty(dto.getQueryValue())) {
-            queryWrapper.lambda().and(wrapper -> wrapper.like(TrialDetectionData::getEntrustNo, dto.getQueryValue()).or().like(TrialDetectionData::getReportNo, dto.getQueryValue()));
-        }
-        IPage<TrialDetectionData> pages = this.page(page, queryWrapper.lambda().orderBy(true, false, TrialDetectionData::getCreateTime));
-        List<TrialDetectionDataVO> trialDetectionDataVOS = BeanUtil.copyProperties(pages.getRecords(), TrialDetectionDataVO.class);
+        //获取当前选择节点所有的子级节点pKeyIds
+        TrialDeviceClassification selectedNode = jdbcTemplate.query("select id from m_trial_classification_configuration where id = " + dto.getNodeId(), new BeanPropertyRowMapper<>(TrialDeviceClassification.class)).stream().findAny().orElse(null);
+        if (selectedNode != null) {
+            List<TrialDeviceClassification> ziNodeIds = jdbcTemplate.query("select id from m_trial_classification_configuration where is_deleted = 0 and find_in_set('" + selectedNode.getId() + "',ancestors)", new BeanPropertyRowMapper<>(TrialDeviceClassification.class));
+            QueryWrapper<TrialDetectionData> queryWrapper = Condition.getQueryWrapper(dto);
+            if (ziNodeIds.size() > 0) {
+                dto.setNodeId(null);
+                List<Long> pIds = ziNodeIds.stream().map(TrialDeviceClassification::getId).collect(Collectors.toList());
+                queryWrapper.lambda().in(TrialDetectionData::getNodeId, pIds);
+            }
+            if (StringUtils.isNotEmpty(dto.getQueryStatus())) {
+                queryWrapper.lambda().eq(TrialDetectionData::getStatus, dto.getQueryStatus());
+            }
+            if (StringUtils.isNotEmpty(dto.getStartTime()) && StringUtils.isNotEmpty(dto.getEndTime())) {
+                String endTime = dto.getEndTime();
+                endTime = DateUtil.format(DateUtils.addDays(DateUtil.parse(endTime, "yyyy-MM-dd"), 1), "yyyy-MM-dd");
+                queryWrapper.lambda().between(TrialDetectionData::getReportDate, dto.getStartTime(), endTime);
+            }
+            if (StringUtils.isNotEmpty(dto.getQueryName())) {
+                queryWrapper.lambda().like(TrialDetectionData::getUserName, dto.getQueryName());
+            }
+            if (StringUtils.isNotEmpty(dto.getQueryValue())) {
+                queryWrapper.lambda().and(wrapper -> wrapper.like(TrialDetectionData::getEntrustNo, dto.getQueryValue()).or().like(TrialDetectionData::getReportNo, dto.getQueryValue()));
+            }
+            IPage<TrialDetectionData> pages = this.page(page, queryWrapper.lambda().orderBy(true, false, TrialDetectionData::getCreateTime));
+            List<TrialDetectionDataVO> trialDetectionDataVOS = BeanUtil.copyProperties(pages.getRecords(), TrialDetectionDataVO.class);
 
 
-        if (ObjectUtil.isNotEmpty(dto.getQualityTestPKeyId())) {
-            List<String> list = inspectionRecordMapper.selectSelectedStatusList(Long.parseLong(dto.getQualityTestPKeyId()), "2,3");
+            if (ObjectUtil.isNotEmpty(dto.getQualityTestPKeyId())) {
+                List<String> list = inspectionRecordMapper.selectSelectedStatusList(Long.parseLong(dto.getQualityTestPKeyId()), "2,3");
 
 
-            //是否关联过
-            for (TrialDetectionDataVO trialDetectionDataVO : trialDetectionDataVOS) {
-                for (String recordId : list) {
-                    if (trialDetectionDataVO.getId().toString().equals(recordId)) {
-                        trialDetectionDataVO.setIsSelectedStatus(1);
+                //是否关联过
+                for (TrialDetectionDataVO trialDetectionDataVO : trialDetectionDataVOS) {
+                    for (String recordId : list) {
+                        if (trialDetectionDataVO.getId().toString().equals(recordId)) {
+                            trialDetectionDataVO.setIsSelectedStatus(1);
+                        }
                     }
                     }
                 }
                 }
             }
             }
+            return PageUtil.toPage(pages, trialDetectionDataVOS);
         }
         }
-
-        return PageUtil.toPage(pages, trialDetectionDataVOS);
+        return null;
     }
     }
 
 
     @Override
     @Override
@@ -133,8 +147,8 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
                 TrialDetectionData obj = BeanUtil.copyProperties(trialDetectionDatum, TrialDetectionData.class);
                 TrialDetectionData obj = BeanUtil.copyProperties(trialDetectionDatum, TrialDetectionData.class);
                 if (obj != null) {
                 if (obj != null) {
                     obj.setId(SnowFlakeUtil.getId());
                     obj.setId(SnowFlakeUtil.getId());
-                    obj.setEntrustNo(String.valueOf(SnowFlakeUtil.getId()));
-                    obj.setReportNo(String.valueOf(SnowFlakeUtil.getId()));
+                    obj.setEntrustNo(null);
+                    obj.setReportNo(null);
                     insertData.add(obj);
                     insertData.add(obj);
                 }
                 }
             }
             }
@@ -145,8 +159,8 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
             TrialDetectionData obj = BeanUtil.copyProperties(dto, TrialDetectionData.class);
             TrialDetectionData obj = BeanUtil.copyProperties(dto, TrialDetectionData.class);
             if (obj != null) {
             if (obj != null) {
                 obj.setId(SnowFlakeUtil.getId());
                 obj.setId(SnowFlakeUtil.getId());
-                obj.setEntrustNo(String.valueOf(SnowFlakeUtil.getId()));
-                obj.setReportNo(String.valueOf(SnowFlakeUtil.getId()));
+                obj.setEntrustNo(null);
+                obj.setReportNo(null);
                 this.save(obj);
                 this.save(obj);
             }
             }
         }
         }

+ 5 - 3
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceClassificationServiceImpl.java

@@ -26,7 +26,9 @@ public class TrialDeviceClassificationServiceImpl extends BaseServiceImpl<TrialD
     @Override
     @Override
     public String classInit(Long contractId) {
     public String classInit(Long contractId) {
         List<String> names = Arrays.asList("力学室", "集料室", "土工室", "水泥室", "外检室", "标养室", "其他");
         List<String> names = Arrays.asList("力学室", "集料室", "土工室", "水泥室", "外检室", "标养室", "其他");
-        List<TrialDeviceClassification> trialDeviceClassifications = baseMapper.selectList(Wrappers.<TrialDeviceClassification>lambdaQuery().in(TrialDeviceClassification::getClassName, names));
+        List<TrialDeviceClassification> trialDeviceClassifications = baseMapper.selectList(Wrappers.<TrialDeviceClassification>lambdaQuery()
+                .eq(TrialDeviceClassification::getContractId, contractId)
+                .in(TrialDeviceClassification::getClassName, names));
         if (trialDeviceClassifications.size() == 0) {
         if (trialDeviceClassifications.size() == 0) {
             //初始化
             //初始化
             int sort = 1;
             int sort = 1;
@@ -46,10 +48,10 @@ public class TrialDeviceClassificationServiceImpl extends BaseServiceImpl<TrialD
             }
             }
             if (data.size() > 0) {
             if (data.size() > 0) {
                 this.saveBatch(data);
                 this.saveBatch(data);
-                return "初始化成功";
+                return "init success";
             }
             }
         }
         }
-        return "无需初始化";
+        return "init skip";
     }
     }
 
 
     @Override
     @Override

+ 15 - 9
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceUseServiceImpl.java

@@ -28,6 +28,7 @@ import org.springblade.business.wrapper.TrialDeviceUseWarpper;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.common.utils.SystemUtils;
 import org.springblade.common.utils.SystemUtils;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.oss.model.BladeFile;
@@ -69,17 +70,22 @@ public class TrialDeviceUseServiceImpl extends BaseServiceImpl<TrialDeviceUseMap
 
 
     @Override
     @Override
     public boolean useSubmit(TrialDeviceUseDTO dto) {
     public boolean useSubmit(TrialDeviceUseDTO dto) {
+        if (ObjectUtil.isEmpty(dto.getDeviceInfoId())) {
+            throw new ServiceException("未获取到当前设备分类信息");
+        }
         //获取设备信息
         //获取设备信息
         TrialDeviceInfo trialDeviceInfo = trialDeviceInfoMapper.selectById(dto.getDeviceInfoId());
         TrialDeviceInfo trialDeviceInfo = trialDeviceInfoMapper.selectById(dto.getDeviceInfoId());
-        if (ObjectUtil.isNotEmpty(trialDeviceInfo.getDeviceModel())) {
-            dto.setDeviceModel(trialDeviceInfo.getDeviceModel());
-        }
-        if (ObjectUtil.isNotEmpty(trialDeviceInfo.getFactoryNumber())) {
-            dto.setFactoryNumber(trialDeviceInfo.getFactoryNumber());
-        }
-        TrialDeviceUse trialDeviceUse = BeanUtil.copyProperties(dto, TrialDeviceUse.class);
-        if (trialDeviceUse != null) {
-            return this.saveOrUpdate(trialDeviceUse);
+        if (trialDeviceInfo != null) {
+            if (ObjectUtil.isNotEmpty(trialDeviceInfo.getDeviceModel())) {
+                dto.setDeviceModel(trialDeviceInfo.getDeviceModel());
+            }
+            if (ObjectUtil.isNotEmpty(trialDeviceInfo.getFactoryNumber())) {
+                dto.setFactoryNumber(trialDeviceInfo.getFactoryNumber());
+            }
+            TrialDeviceUse trialDeviceUse = BeanUtil.copyProperties(dto, TrialDeviceUse.class);
+            if (trialDeviceUse != null) {
+                return this.saveOrUpdate(trialDeviceUse);
+            }
         }
         }
         return false;
         return false;
     }
     }

+ 18 - 16
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialMaterialMobilizationServiceImpl.java

@@ -106,10 +106,10 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
         }
         }
         List<TrialMaterialMobilization> list = new ArrayList<>();
         List<TrialMaterialMobilization> list = new ArrayList<>();
         for (TrialMaterialMobilizationDTO trialMaterialMobilizationDTO : dto) {
         for (TrialMaterialMobilizationDTO trialMaterialMobilizationDTO : dto) {
-            List<TrialMaterialMobilization> query = jdbcTemplate.query("select id,material_name from u_trial_material_mobilization where material_number = '" + trialMaterialMobilizationDTO.getMaterialNumber() + "'", new BeanPropertyRowMapper<>(TrialMaterialMobilization.class));
+            List<TrialMaterialMobilization> query = jdbcTemplate.query("select id,material_name from u_trial_material_mobilization where is_deleted = 0 and material_number = '" + trialMaterialMobilizationDTO.getMaterialNumber() + "' and contract_id = " + trialMaterialMobilizationDTO.getContractId(), new BeanPropertyRowMapper<>(TrialMaterialMobilization.class));
             if (query.size() > 0) {
             if (query.size() > 0) {
                 TrialMaterialMobilization trialMaterialMobilization = query.stream().findAny().orElse(null);
                 TrialMaterialMobilization trialMaterialMobilization = query.stream().findAny().orElse(null);
-                throw new ServiceException("材料【" + trialMaterialMobilization.getMaterialName() + "】的编号重复,请重新填写");
+                throw new ServiceException("材料【" + trialMaterialMobilization.getMaterialName() + "】的编号在当前合同段重复,请重新填写");
             }
             }
             trialMaterialMobilizationDTO.setId(SnowFlakeUtil.getId());
             trialMaterialMobilizationDTO.setId(SnowFlakeUtil.getId());
             list.add(trialMaterialMobilizationDTO);
             list.add(trialMaterialMobilizationDTO);
@@ -164,22 +164,24 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
         List<Dict> materialTypes = iDictClient.getList("material_type").getData();
         List<Dict> materialTypes = iDictClient.getList("material_type").getData();
 
 
         data.forEach(excel -> {
         data.forEach(excel -> {
-            TrialMaterialMobilization trialMaterialMobilization = BeanUtil.copyProperties(excel, TrialMaterialMobilization.class);
-            if (trialMaterialMobilization != null) {
-                List<TrialMaterialMobilization> query = jdbcTemplate.query("select id,material_name from u_trial_material_mobilization where material_number = '" + trialMaterialMobilization.getMaterialNumber() + "'", new BeanPropertyRowMapper<>(TrialMaterialMobilization.class));
-                if (query.size() > 0) {
-                    TrialMaterialMobilization obj = query.stream().findAny().orElse(null);
-                    throw new ServiceException("材料【" + obj.getMaterialName() + "】的编号重复,导入失败");
-                }
-                for (Dict materialType : materialTypes) {
-                    if (excel.getMaterialType().equals(materialType.getDictValue())) {
-                        trialMaterialMobilization.setMaterialType(Integer.parseInt(materialType.getDictKey()));
-                        break;
+            if (excel != null && excel.getMaterialType() != null) {
+                TrialMaterialMobilization trialMaterialMobilization = BeanUtil.copyProperties(excel, TrialMaterialMobilization.class);
+                if (trialMaterialMobilization != null) {
+                    List<TrialMaterialMobilization> query = jdbcTemplate.query("select id,material_name from u_trial_material_mobilization where is_deleted = 0 and material_number = '" + trialMaterialMobilization.getMaterialNumber() + "' and contract_id = " + contractId, new BeanPropertyRowMapper<>(TrialMaterialMobilization.class));
+                    if (query.size() > 0) {
+                        TrialMaterialMobilization obj = query.stream().findAny().orElse(null);
+                        throw new ServiceException("材料【" + obj.getMaterialName() + "】的编号在当前合同段重复,导入失败");
+                    }
+                    for (Dict materialType : materialTypes) {
+                        if (excel.getMaterialType().equals(materialType.getDictValue())) {
+                            trialMaterialMobilization.setMaterialType(Integer.parseInt(materialType.getDictKey()));
+                            break;
+                        }
                     }
                     }
+                    trialMaterialMobilization.setUserId(SecureUtil.getUserId());
+                    trialMaterialMobilization.setContractId(contractId);
+                    list.add(trialMaterialMobilization);
                 }
                 }
-                trialMaterialMobilization.setUserId(SecureUtil.getUserId());
-                trialMaterialMobilization.setContractId(contractId);
-                list.add(trialMaterialMobilization);
             }
             }
         });
         });
         if (isCovered) {
         if (isCovered) {

+ 10 - 12
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSampleInfoServiceImpl.java

@@ -17,6 +17,7 @@ import org.apache.commons.lang.time.DateUtils;
 import org.springblade.business.dto.TrialSampleInfoDTO;
 import org.springblade.business.dto.TrialSampleInfoDTO;
 import org.springblade.business.entity.TrialSampleInfo;
 import org.springblade.business.entity.TrialSampleInfo;
 import org.springblade.business.entity.TrialSamplingRecord;
 import org.springblade.business.entity.TrialSamplingRecord;
+import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.business.excel.TrialSampleInfoExcel;
 import org.springblade.business.excel.TrialSampleInfoExcel;
 import org.springblade.business.mapper.TrialSampleInfoMapper;
 import org.springblade.business.mapper.TrialSampleInfoMapper;
 import org.springblade.business.mapper.TrialSamplingRecordMapper;
 import org.springblade.business.mapper.TrialSamplingRecordMapper;
@@ -88,10 +89,12 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
     }
     }
 
 
     @Override
     @Override
-    public List<TrialSampleInfoVO3> sampleListInfo(Long nodeId, Long id) {
-        List<TrialSampleInfo> trialSampleInfos = baseMapper.selectList(Wrappers.<TrialSampleInfo>query().lambda().eq(TrialSampleInfo::getNodeId, nodeId));
-        List<User> users = iUserClient.selectUserAll();
+    public List<TrialSampleInfoVO3> sampleListInfo(Long nodeId, Long id, Long contractId) {
         List<TrialSampleInfoVO3> list = new ArrayList<>();
         List<TrialSampleInfoVO3> list = new ArrayList<>();
+        List<TrialSampleInfo> trialSampleInfos = baseMapper.selectList(Wrappers.<TrialSampleInfo>query().lambda()
+                .eq(TrialSampleInfo::getContractId, contractId)
+                .eq(TrialSampleInfo::getNodeId, nodeId));
+        List<User> users = iUserClient.selectUserAll();
         for (TrialSampleInfo trialSampleInfo : trialSampleInfos) {
         for (TrialSampleInfo trialSampleInfo : trialSampleInfos) {
             for (User user : users) {
             for (User user : users) {
                 if (trialSampleInfo.getUserId().equals(user.getId())) {
                 if (trialSampleInfo.getUserId().equals(user.getId())) {
@@ -166,11 +169,6 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
 
 
     @Override
     @Override
     public boolean sampleSubmit(TrialSampleInfoDTO obj) {
     public boolean sampleSubmit(TrialSampleInfoDTO obj) {
-        /*if (ObjectUtil.isEmpty(SecureUtil.getUserId())) {
-            throw new ServiceException("获取用户信息失败");
-        }
-        obj.setUserId(SecureUtil.getUserId());*/
-
         //如果样品编号为空,那么就自动生成
         //如果样品编号为空,那么就自动生成
         if (ObjectUtil.isEmpty(obj.getSpecificationNumber())) {
         if (ObjectUtil.isEmpty(obj.getSpecificationNumber())) {
             this.buildNumber(obj);
             this.buildNumber(obj);
@@ -249,10 +247,10 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
         }
         }
         List<TrialSampleInfo> list = new ArrayList<>();
         List<TrialSampleInfo> list = new ArrayList<>();
         for (TrialSampleInfoDTO trialSampleInfoDTO : dto) {
         for (TrialSampleInfoDTO trialSampleInfoDTO : dto) {
-            List<TrialSampleInfo> query = jdbcTemplate.query("select id,material_name from u_trial_sample_info where specification_number = '" + trialSampleInfoDTO.getSpecificationNumber() + "'", new BeanPropertyRowMapper<>(TrialSampleInfo.class));
+            List<TrialSampleInfo> query = jdbcTemplate.query("select id,material_name from u_trial_sample_info where is_deleted = 0 and specification_number = '" + trialSampleInfoDTO.getSpecificationNumber() + "' and contract_id = " + trialSampleInfoDTO.getContractId(), new BeanPropertyRowMapper<>(TrialSampleInfo.class));
             if (query.size() > 0) {
             if (query.size() > 0) {
                 TrialSampleInfo trialSampleInfo = query.stream().findAny().orElse(null);
                 TrialSampleInfo trialSampleInfo = query.stream().findAny().orElse(null);
-                throw new ServiceException("材料【" + trialSampleInfo.getMaterialName() + "】的编号重复,请重新填写");
+                throw new ServiceException("材料【" + trialSampleInfo.getMaterialName() + "】的编号在当前合同段重复,请重新填写");
             }
             }
             trialSampleInfoDTO.setId(SnowFlakeUtil.getId());
             trialSampleInfoDTO.setId(SnowFlakeUtil.getId());
             list.add(trialSampleInfoDTO);
             list.add(trialSampleInfoDTO);
@@ -269,10 +267,10 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
         data.forEach(excel -> {
         data.forEach(excel -> {
             TrialSampleInfo trialSampleInfo = BeanUtil.copyProperties(excel, TrialSampleInfo.class);
             TrialSampleInfo trialSampleInfo = BeanUtil.copyProperties(excel, TrialSampleInfo.class);
             if (trialSampleInfo != null) {
             if (trialSampleInfo != null) {
-                List<TrialSampleInfo> query = jdbcTemplate.query("select id,material_name from u_trial_sample_info where specification_number = '" + trialSampleInfo.getSpecificationNumber() + "'", new BeanPropertyRowMapper<>(TrialSampleInfo.class));
+                List<TrialSampleInfo> query = jdbcTemplate.query("select id,material_name from u_trial_sample_info where is_deleted = 0 and specification_number = '" + trialSampleInfo.getSpecificationNumber() + "' and contract_id = " + contractId, new BeanPropertyRowMapper<>(TrialSampleInfo.class));
                 if (query.size() > 0) {
                 if (query.size() > 0) {
                     TrialSampleInfo obj = query.stream().findAny().orElse(null);
                     TrialSampleInfo obj = query.stream().findAny().orElse(null);
-                    throw new ServiceException("材料【" + obj.getMaterialName() + "】的编号重复,请重新填写后导入");
+                    throw new ServiceException("材料【" + obj.getMaterialName() + "】的编号在当前合同段重复,请重新填写后导入");
                 }
                 }
                 if ("是".equals(excel.getIsOutsourcing())) {
                 if ("是".equals(excel.getIsOutsourcing())) {
                     trialSampleInfo.setIsOutsourcing(1);
                     trialSampleInfo.setIsOutsourcing(1);

+ 55 - 52
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -239,7 +239,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             List<String> mobilizationIds = new ArrayList<>();
             List<String> mobilizationIds = new ArrayList<>();
             for (String sampleId : sampleIds) {
             for (String sampleId : sampleIds) {
                 String mobilizationId = baseMapper.selectMobilizationRecord(sampleId);
                 String mobilizationId = baseMapper.selectMobilizationRecord(sampleId);
-                mobilizationIds.add(mobilizationId);
+                if (StringUtils.isNotEmpty(mobilizationId)){
+                    mobilizationIds.add(mobilizationId);
+                }
             }
             }
             if (mobilizationIds.size() > 0) {
             if (mobilizationIds.size() > 0) {
                 List<TrialMaterialMobilization> trialMaterialMobilizations = trialMaterialMobilizationMapper.selectBatchIds(mobilizationIds);
                 List<TrialMaterialMobilization> trialMaterialMobilizations = trialMaterialMobilizationMapper.selectBatchIds(mobilizationIds);
@@ -319,7 +321,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 }
                 }
 
 
                 //重构编号
                 //重构编号
-                this.buildNumber(dto);
+                //this.buildNumber(dto);
                 this.reNumberNo(trialSelfInspectionRecord, dto);
                 this.reNumberNo(trialSelfInspectionRecord, dto);
 
 
                 dto.setCreateTime(new Date());
                 dto.setCreateTime(new Date());
@@ -334,59 +336,60 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                     List<String> pKeyIds = Func.toStrList(tableIds);
                     List<String> pKeyIds = Func.toStrList(tableIds);
                     for (String pKeyId : pKeyIds) {
                     for (String pKeyId : pKeyIds) {
                         WbsTreePrivate tab = wbsTreePrivateClient.getNodeByPrimaryKeyId(pKeyId);
                         WbsTreePrivate tab = wbsTreePrivateClient.getNodeByPrimaryKeyId(pKeyId);
-                        //复制数据
-                        List<Map<String, Object>> oneTabData = wbsTreePrivateClient.getTrialDataInfo(pKeyId, trialSelfInspectionRecord.getId());
-                        if (oneTabData.size() >= 1) {
-                            Map<String, Object> dataMap2 = oneTabData.get(0);
-
-                            dataMap2.remove("id");
-                            dataMap2.remove("p_key_id");
-                            dataMap2.remove("group_id");
-
-                            //sql组装
-                            String sqlInfo = "";
-                            sqlInfo = "INSERT INTO " + tab.getInitTableName() + " (";
-                            StringBuilder keyStr = new StringBuilder("id,p_key_id,group_id,");
-                            StringBuilder valStr = new StringBuilder(SnowFlakeUtil.getId() + "," + pKeyId + "," + dto.getId() + ",");
-                            for (String keys : dataMap2.keySet()) {
-                                if (!(dataMap2.get(keys) + "").equals("null")) {
-                                    String keysResult = keys.split("__")[0];
-                                    String keysResult2 = keys.split("__")[1];
-                                    keyStr.append(keysResult).append(",");
-                                    Object value = dataMap2.get(keys);
-
-                                    //替换报告单号、记录编号
-                                    if (String.valueOf(value).contains("JL-")) {
-                                        value = StringUtils.isNotEmpty(dto.getRecordNo()) ? dto.getRecordNo() : null;
-                                    }
-                                    if (String.valueOf(value).contains("BG-")) {
-                                        value = StringUtils.isNotEmpty(dto.getReportNo()) ? dto.getReportNo() : null;
-                                    }
+                        if (tab != null) {
+                            //查询字段
+                            String sql = "select COLUMN_NAME from information_schema.`COLUMNS` WHERE table_name = '" + tab.getInitTableName() + "'";
+                            List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
+                            List<Object> filed = new ArrayList<>();
+                            for (Map<String, Object> map : maps) {
+                                Object column_name = map.get("COLUMN_NAME");
+                                if (!(("id").equals(column_name) || ("group_id").equals(column_name) || ("p_key_id").equals(column_name))) {
+                                    filed.add(column_name);
+                                }
+                            }
 
 
-                                    String values = value + "_^_" + keysResult2;
-                                    valStr.append("'").append(values).append("',");
+                            //复制表数据
+                            String querySql = "select " + org.apache.commons.lang.StringUtils.join(filed, ",") + " from " + tab.getInitTableName() + " where p_key_id=" + pKeyId + " and group_id = " + trialSelfInspectionRecord.getId();
+                            List<Map<String, Object>> dataList = jdbcTemplate.queryForList(querySql);
+                            if (dataList.size() >= 1) {
+                                Map<String, Object> dataMap2 = dataList.get(0);
+
+                                dataMap2.remove("id");
+                                dataMap2.remove("p_key_id");
+                                dataMap2.remove("group_id");
+
+                                //sql组装
+                                String sqlInfo = "";
+                                sqlInfo = "INSERT INTO " + tab.getInitTableName() + " ( ";
+                                StringBuilder keyStr = new StringBuilder("id,p_key_id,group_id,");
+                                StringBuilder valStr = new StringBuilder(SnowFlakeUtil.getId() + "," + pKeyId + "," + dto.getId() + ",");
+                                for (String keys : dataMap2.keySet()) {
+                                    if (!(dataMap2.get(keys) + "").equals("null")) {
+                                        keyStr.append(keys).append(",");
+                                        valStr.append("'").append(dataMap2.get(keys)).append("',");
+                                    }
                                 }
                                 }
+                                keyStr = new StringBuilder(keyStr.substring(0, keyStr.lastIndexOf(",")));
+                                valStr = new StringBuilder(valStr.substring(0, valStr.lastIndexOf(",")));
+                                sqlInfo = sqlInfo + keyStr + ") VALUES (" + valStr + ")";
+
+                                jdbcTemplate.execute(sqlInfo);
                             }
                             }
-                            keyStr = new StringBuilder(keyStr.substring(0, keyStr.lastIndexOf(",")));
-                            valStr = new StringBuilder(valStr.substring(0, valStr.lastIndexOf(",")));
-                            sqlInfo = sqlInfo + keyStr + ") VALUES (" + valStr + ")";
-                            //新增
-                            jdbcTemplate.execute(sqlInfo);
-                        }
 
 
-                        //复制附件文件
-                        List<TableFile> oldFiles = jdbcTemplate.query("select domain_url,name,extension,type,is_deleted,domain_pdf_url,status from m_table_file where is_deleted = 0 and tab_id = '" + pKeyId + "' and trial_record_id = " + trialSelfInspectionRecord.getId(), new BeanPropertyRowMapper<>(TableFile.class));
-                        List<TableFile> newFiles = new ArrayList<>();
-                        for (TableFile oldFile : oldFiles) {
-                            TableFile obj = BeanUtil.copyProperties(oldFile, TableFile.class);
-                            if (obj != null) {
-                                obj.setId(SnowFlakeUtil.getId());
-                                obj.setTabId(pKeyId + ""); //表pKeyId
-                                obj.setTrialRecordId(dto.getId()); //当前记录id
-                                newFiles.add(obj);
+                            //复制附件文件
+                            List<TableFile> oldFiles = jdbcTemplate.query("select domain_url,name,extension,type,is_deleted,domain_pdf_url,status from m_table_file where is_deleted = 0 and tab_id = '" + pKeyId + "' and trial_record_id = " + trialSelfInspectionRecord.getId(), new BeanPropertyRowMapper<>(TableFile.class));
+                            List<TableFile> newFiles = new ArrayList<>();
+                            for (TableFile oldFile : oldFiles) {
+                                TableFile obj = BeanUtil.copyProperties(oldFile, TableFile.class);
+                                if (obj != null) {
+                                    obj.setId(SnowFlakeUtil.getId());
+                                    obj.setTabId(pKeyId + ""); //表pKeyId
+                                    obj.setTrialRecordId(dto.getId()); //当前记录id
+                                    newFiles.add(obj);
+                                }
                             }
                             }
+                            tableFileClient.saveBatch(newFiles);
                         }
                         }
-                        tableFileClient.saveBatch(newFiles);
                     }
                     }
                 }
                 }
 
 
@@ -530,7 +533,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
     @Override
     @Override
     public String selfPrintPdf(String ids) throws FileNotFoundException {
     public String selfPrintPdf(String ids) throws FileNotFoundException {
         List<TrialSelfInspectionRecord> recordList = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().in(TrialSelfInspectionRecord::getId, Func.toLongList(ids)).eq(TrialSelfInspectionRecord::getStatus, 1));
         List<TrialSelfInspectionRecord> recordList = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().in(TrialSelfInspectionRecord::getId, Func.toLongList(ids)).eq(TrialSelfInspectionRecord::getStatus, 1));
-        List<String> listPdfUrl = recordList.stream().filter(f -> ObjectUtil.isNotEmpty(f.getPdfUrl())).map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
+        List<String> listPdfUrl = recordList.stream().map(TrialSelfInspectionRecord::getPdfUrl).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
         if (listPdfUrl.size() > 0) {
         if (listPdfUrl.size() > 0) {
             //合并PDF
             //合并PDF
             Long id = SnowFlakeUtil.getId();
             Long id = SnowFlakeUtil.getId();
@@ -553,7 +556,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
     public String selfPrintNullPdf(String ids) throws Exception {
     public String selfPrintNullPdf(String ids) throws Exception {
         String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
         String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
         List<TrialSelfInspectionRecord> recordList = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().in(TrialSelfInspectionRecord::getId, Func.toLongList(ids)).eq(TrialSelfInspectionRecord::getStatus, 1));
         List<TrialSelfInspectionRecord> recordList = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().in(TrialSelfInspectionRecord::getId, Func.toLongList(ids)).eq(TrialSelfInspectionRecord::getStatus, 1));
-        List<String> tabIdsAll = recordList.stream().filter(f -> ObjectUtil.isNotEmpty(f.getTableIds())).map(TrialSelfInspectionRecord::getTableIds).collect(Collectors.toList());
+        List<String> tabIdsAll = recordList.stream().map(TrialSelfInspectionRecord::getTableIds).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
         List<String> tabIds = new ArrayList<>();
         List<String> tabIds = new ArrayList<>();
         for (String tabId : tabIdsAll) {
         for (String tabId : tabIdsAll) {
             List<String> strings = Func.toStrList(tabId);
             List<String> strings = Func.toStrList(tabId);
@@ -787,7 +790,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             throw new ServiceException("操作失败!");
             throw new ServiceException("操作失败!");
         }
         }
 
 
-        // 获取excel流  html流
+        //获取excel流和html流
         Workbook wb = new Workbook();
         Workbook wb = new Workbook();
         wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
         wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
         //获取工作表
         //获取工作表