Selaa lähdekoodia

Merge remote-tracking branch 'origin/master' into master

# Conflicts:
#	blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java
yangyj 2 vuotta sitten
vanhempi
commit
db01da09c4
23 muutettua tiedostoa jossa 512 lisäystä ja 460 poistoa
  1. 0 7
      blade-ops/blade-xxljob-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml
  2. 4 1
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/InformationQuery.java
  3. 2 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/QueryProcessDataVO.java
  4. 3 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialSelfInspectionRecordVO.java
  5. 6 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/WbsTreeContract.java
  6. 1 1
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  7. 7 1
      blade-service/blade-business/src/main/java/org/springblade/business/controller/NeiYeController.java
  8. 12 12
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java
  9. 74 22
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java
  10. 7 2
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml
  11. 8 3
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSelfInspectionRecordMapper.java
  12. 1 1
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSelfInspectionRecordMapper.xml
  13. 3 5
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialSelfInspectionRecordService.java
  14. 55 18
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java
  15. 180 255
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java
  16. 89 20
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java
  17. 7 7
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/TextdictInfoController.java
  18. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsFormElementController.java
  19. 5 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreePrivateController.java
  20. 28 47
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ExcelTabClientImpl.java
  21. 1 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml
  22. 1 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java
  23. 17 57
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

+ 0 - 7
blade-ops/blade-xxljob-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml

@@ -5,31 +5,24 @@
 
 	<resultMap id="XxlJobInfo" type="com.xxl.job.admin.core.model.XxlJobInfo" >
 		<result column="id" property="id" />
-
 		<result column="job_group" property="jobGroup" />
 	    <result column="job_cron" property="jobCron" />
 	    <result column="job_desc" property="jobDesc" />
-
 	    <result column="add_time" property="addTime" />
 	    <result column="update_time" property="updateTime" />
-
 	    <result column="author" property="author" />
 	    <result column="alarm_email" property="alarmEmail" />
-
 		<result column="executor_route_strategy" property="executorRouteStrategy" />
 		<result column="executor_handler" property="executorHandler" />
 	    <result column="executor_param" property="executorParam" />
 		<result column="executor_block_strategy" property="executorBlockStrategy" />
 		<result column="executor_timeout" property="executorTimeout" />
 		<result column="executor_fail_retry_count" property="executorFailRetryCount" />
-
 	    <result column="glue_type" property="glueType" />
 	    <result column="glue_source" property="glueSource" />
 	    <result column="glue_remark" property="glueRemark" />
 		<result column="glue_updatetime" property="glueUpdatetime" />
-
 		<result column="child_jobid" property="childJobId" />
-
 		<result column="trigger_status" property="triggerStatus" />
 		<result column="trigger_last_time" property="triggerLastTime" />
 		<result column="trigger_next_time" property="triggerNextTime" />

+ 4 - 1
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/InformationQuery.java

@@ -116,9 +116,12 @@ public class InformationQuery extends BaseEntity {
     @ApiModelProperty("排序")
     private Integer sort;
 
-    @ApiModelProperty("pdf路径,引用试验记录后合并的pdf")
+    @ApiModelProperty("关联试验文件后合并的pdf路径")
     private String pdfTrialUrl;
 
+    @ApiModelProperty("关联工程部位信息后合并的pdf路径")
+    private String pdfTrialUrlPosition;
+
     @ApiModelProperty("首件关联工序资料ids")
     private String sjRecordIds;
 

+ 2 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/QueryProcessDataVO.java

@@ -31,4 +31,6 @@ public class QueryProcessDataVO {
 
     private String reportNumber;
 
+    private String isExperiment;
+
 }

+ 3 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialSelfInspectionRecordVO.java

@@ -26,4 +26,7 @@ public class TrialSelfInspectionRecordVO extends TrialSelfInspectionRecord {
     @ApiModelProperty("样品信息ids")
     private String sampleIds;
 
+    @ApiModelProperty("原材料检测报告ids(试验记录id)")
+    private String rawMaterialIds;
+
 }

+ 6 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/WbsTreeContract.java

@@ -258,4 +258,10 @@ public class WbsTreeContract extends BaseEntity {
     @ApiModelProperty(value = "是否为引用元素 1是 2否")
     private Integer isEle;
 
+    /**
+     * 数据分组
+     */
+    @ApiModelProperty(value = "数据分组Id")
+    private Long tabGroupId;
+
 }

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

@@ -2472,7 +2472,7 @@ public class InformationWriteQueryController extends BladeController {
             //施工合同段
             rootTreeNode = this.informationQueryService.queryContractTree(contractId, StringUtils.isNotEmpty(parentId) ? parentId : "0", 1);
             rootTreeNode.stream().forEach(rtn->{
-                if (rtn.getSubmitCounts() > 0L){
+                if (rtn.getSubmitCounts() > 0L && rtn.getColorStatus() <= 1 && rtn.getNotExsitChild() == false){
                     rtn.setColorStatus(2);
                 }
             });

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

@@ -98,6 +98,12 @@ public class NeiYeController {
             if (queryDataResult != null && queryDataResult.size() > 0) {
                 //删除掉首件
                 queryDataResult.removeIf(query -> StringUtils.isNotEmpty(query.getQueryType()) && "3".equals(query.getQueryType()));
+                //过滤试验
+                String isExperiment = queryVO.getIsExperiment()+"";
+                if (!"".equals(isExperiment) && !"null".equals(isExperiment) && isExperiment != null) {
+                    queryDataResult = queryDataResult.stream()
+                            .filter(qdr->isExperiment.equals(qdr.getIsExperiment())).collect(Collectors.toList());
+                }
                 //设置评定值
                 queryDataResult.stream().forEach(qdr->qdr.setEvaluate("false"));
                 List<QueryProcessDataVO> vos = queryDataResult.stream().filter(qdr -> qdr.getTitle().contains("质量检验评定表"))
@@ -236,7 +242,7 @@ public class NeiYeController {
                             map.get("detectionStartToEndTime"),
                             new Integer("1").equals(vo.getStatus()) ? "待审批" : new Integer("2").equals(vo.getStatus()) ? "已审批" : "未上报",
                             vo.getEvaluate(),
-                            "false",
+                            vo.getIsExperiment(),
                             vo.getReportNumber()));
                 }
                 //转换为page信息

+ 12 - 12
blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java

@@ -31,6 +31,8 @@ import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.flow.core.entity.BladeFlow;
 import org.springblade.flow.core.feign.NewFlowClient;
+import org.springblade.manager.entity.ContractInfo;
+import org.springblade.manager.feign.ContractClient;
 import org.springblade.resource.feign.CommonFileClient;
 import org.springblade.resource.feign.NewISmsClient;
 import org.springblade.system.entity.DictBiz;
@@ -79,7 +81,7 @@ public class TaskController extends BladeController {
 
 	private final CommonFileClient commonFileClient;
 
-	private final ITrialSelfInspectionRecordService iTrialSelfInspectionRecordService;
+	private final ContractClient contractClient;
 
 	/**
 	 * 记录短信验证码超时时间
@@ -286,9 +288,6 @@ public class TaskController extends BladeController {
 				taskApprovalVOS.add(approvalVO);
 			}
 
-			//修改试验填报状态,关联工程部位信息pdf
-			this.iTrialSelfInspectionRecordService.updateTrialSelfInspectionRecordStatus(taskApprovalVOS);
-
 			//审批
 			this.taskService.batchCompleteApprovalTask(taskApprovalVOS,AuthUtil.getUserId());
 
@@ -421,7 +420,9 @@ public class TaskController extends BladeController {
 		List<String> parallelProcessInstanceIds = new ArrayList<>();
 		//统合查询方法
 		this.integrationMethod(queryVO, masterTaskMap, parallelMap, parallelProcessInstanceIds, "1");
-
+		if (masterTaskMap.size() == 0){
+			return R.data(null);
+		}
 		//获取待办(基于原生待办)
 		R<Object> rObject = this.newFlowClient.selectTodoPage(queryVO.getCurrent(), queryVO.getSize(),queryVO.getOrdType()==null?1:queryVO.getOrdType(), String.join(",", parallelProcessInstanceIds));
 		//处理参数
@@ -466,7 +467,12 @@ public class TaskController extends BladeController {
 		}
 		//合同段ID
 		if(StringUtils.isNotEmpty(queryVO.getContractId())){
-			wrapper.eq(Task::getContractId, queryVO.getContractId());
+			ContractInfo contractInfo = contractClient.getContractById(Long.valueOf(queryVO.getContractId()));
+			if (contractInfo.getContractType() == 2){
+				wrapper.eq(Task::getProjectId, queryVO.getProjectId());
+			}else {
+				wrapper.eq(Task::getContractId, queryVO.getContractId());
+			}
 		}
 		//开始结束时间
 		if(StringUtils.isNotEmpty(queryVO.getStartTime()) && StringUtils.isNotEmpty(queryVO.getEndTime())){
@@ -584,9 +590,6 @@ public class TaskController extends BladeController {
 			taskBatch.setCreateTime(new Date());
 			this.taskBatchService.save(taskBatch);
 
-			//修改试验填报状态
-			this.iTrialSelfInspectionRecordService.updateTrialSelfInspectionRecordStatus(taskApprovalVOS);
-
 			return R.data(true, "当前等待电签的批次较多,请等待几分钟后刷新页面查看........");
 		} else {
 			//生成等待批次,任务完成后删除
@@ -594,9 +597,6 @@ public class TaskController extends BladeController {
 			taskApprovalVOS.add(taskApprovalVO);
 			this.taskService.batchCompleteApprovalTask(taskApprovalVOS,AuthUtil.getUserId());
 
-			//修改试验填报状态
-			this.iTrialSelfInspectionRecordService.updateTrialSelfInspectionRecordStatus(taskApprovalVOS);
-
 			return R.data(true, "提交成功");
 		}
 	}

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

@@ -1,6 +1,8 @@
 package org.springblade.business.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -8,33 +10,38 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
-import org.apache.commons.lang.StringUtils;
 import org.springblade.business.dto.*;
-import org.springblade.business.entity.InformationQuery;
 import org.springblade.business.entity.TrialDetectionData;
+import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.business.service.ITrialDetectionDataService;
 import org.springblade.business.service.ITrialSampleInfoService;
 import org.springblade.business.service.ITrialSelfInspectionRecordService;
+import org.springblade.business.utils.FileUtils;
 import org.springblade.business.vo.*;
+import org.springblade.common.constant.CommonConstant;
+import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
+import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.ObjectUtil;
-import org.springblade.manager.entity.TableFile;
+import org.springblade.core.tool.utils.ResourceUtil;
 import org.springblade.manager.entity.TrialSelfDataRecord;
-import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.feign.WbsTreePrivateClient;
 import org.springblade.manager.vo.TableFileVO;
 import org.springblade.manager.vo.WbsTreePrivateVO;
+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.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.validation.Valid;
+import java.io.File;
 import java.io.FileNotFoundException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -50,6 +57,7 @@ public class TrialDetectionController extends BladeController {
     private final ITrialSelfInspectionRecordService iTrialSelfInspectionRecordService;
     private final WbsTreePrivateClient wbsTreePrivateClient;
     private final JdbcTemplate jdbcTemplate;
+    private final NewIOSSClient newIOSSClient;
 
     @GetMapping("/data/detail")
     @ApiOperationSupport(order = 1)
@@ -89,7 +97,7 @@ public class TrialDetectionController extends BladeController {
     @PostMapping("/self/page")
     @ApiOperationSupport(order = 6)
     @ApiOperation(value = "自检记录分页查询", notes = "传入TrialSelfInspectionRecordPageDTO")
-    public R<IPage<TrialSelfInspectionRecordVO>> selfPage(@RequestBody Query query, @RequestBody TrialSelfInspectionRecordPageDTO dto) {
+    public R<IPage<TrialSelfInspectionRecordVO>> selfPage(@RequestBody Query query, @RequestBody TrialSelfInspectionRecordPageDTO dto) throws FileNotFoundException {
         return R.data(iTrialSelfInspectionRecordService.selfPage(Condition.getPage(query), dto));
     }
 
@@ -139,7 +147,33 @@ public class TrialDetectionController extends BladeController {
     @ApiOperationSupport(order = 13)
     @ApiOperation(value = "自检记录批量删除", notes = "传入ids,字符串逗号分隔")
     public R<Object> selfRemove(@Valid @RequestParam String ids) {
-        return R.status(iTrialSelfInspectionRecordService.deleteLogic(Func.toLongList(ids)));
+        List<TrialSelfInspectionRecord> recordList = iTrialSelfInspectionRecordService.getBaseMapper().selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
+                .select(TrialSelfInspectionRecord::getTaskStatus)
+                .ne(TrialSelfInspectionRecord::getTaskStatus, "未上报")
+                .in(TrialSelfInspectionRecord::getId, Func.toLongList(ids)));
+        if (recordList.size() > 0) {
+            return R.fail("只能删除未上报记录信息,操作失败");
+        }
+        //刪除按钮状态记录
+        String sql1 = "delete from u_trial_self_data_record where record_id in(" + ids + ")";
+        jdbcTemplate.execute(sql1);
+
+        //删除样品关联记录
+        String sql2 = "delete from u_trial_self_sample where self_id in(" + ids + ")";
+        jdbcTemplate.execute(sql2);
+
+        //删除工程部位关联记录
+        String sql3 = "delete from u_trial_raw_material_self_record where self_record_id in(" + ids + ")";
+        jdbcTemplate.execute(sql3);
+
+        //删除原材料检测报告关联记录
+        String sql4 = "delete from u_trial_self_quality_project where self_id in(" + ids + ")";
+        jdbcTemplate.execute(sql4);
+
+        //删除试验记录
+        String sql5 = "delete from u_trial_self_inspection_record where id in(" + ids + ")";
+        jdbcTemplate.execute(sql5);
+        return R.status(true);
     }
 
     @GetMapping("/self/show-buss-tab")
@@ -170,7 +204,7 @@ public class TrialDetectionController extends BladeController {
         String sql = "select * from u_trial_self_data_record where record_id = " + id + " and tab_id = " + pKeyId;
         List<TrialSelfDataRecord> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TrialSelfDataRecord.class));
         TrialSelfDataRecord obj = query.stream().findAny().orElse(null);
-        if (obj != null){
+        if (obj != null) {
             return R.data(obj.getPdfUrl());
         }
         return R.data("");
@@ -178,20 +212,47 @@ public class TrialDetectionController extends BladeController {
 
     @GetMapping("/get-buss-pdfs")
     @ApiOperationSupport(order = 18)
-    @ApiOperation(value = "自检多表PDF预览", notes = "传入nodeId、classify、contractId、projectId")
-    public R<Object> getPDFs(String nodeId, String classify, String contractId, String projectId) {
-        String sql = "select pdf_url, e_visa_pdf_url from u_information_query where project_id ='" + projectId + "' and classify='" + classify + "' and  wbs_id='" + nodeId + "' and contract_id ='" + contractId + "'";
+    @ApiOperation(value = "自检多表PDF预览", notes = "传入nodeId=试验记录id、classify、contractId、projectId")
+    public R<Object> getPDFs(String nodeId, String classify, String contractId, String projectId) throws FileNotFoundException {
+        String sql = "select pdf_url,e_visa_pdf_url from u_information_query where project_id ='" + projectId + "' and classify='" + classify + "' and  wbs_id='" + nodeId + "' and contract_id ='" + contractId + "'";
         List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
         if (maps.size() >= 1) {
             Map<String, Object> stringObjectMap = maps.get(0);
             Object pdfUrl = stringObjectMap.get("pdf_url");
             if (stringObjectMap.get("e_visa_pdf_url") != null) {
-                //优先使用电签的PDF
+                //优先使用电签的pdf
                 pdfUrl = stringObjectMap.get("e_visa_pdf_url");
             }
+
+            //关联原材料检测报告的pdf(合并后的dpf都一样,取其一)
+            String sqlRecord = "select old_pdf_url from u_trial_raw_material_self_record where self_record_id =" + nodeId;
+            TrialRawMaterialSelfRecord recordObj = jdbcTemplate.query(sqlRecord, new BeanPropertyRowMapper<>(TrialRawMaterialSelfRecord.class)).stream().findAny().orElse(null);
+            if (pdfUrl != null && recordObj != null && recordObj.getOldPdfUrl() != null) {
+                String pdfUrlTrialRawMaterial = recordObj.getOldPdfUrl();
+                List<String> pdfList = new ArrayList<>();
+                //试验原始pdf
+                pdfList.add(pdfUrl.toString());
+                //材料检测报告pdf
+                pdfList.add(pdfUrlTrialRawMaterial);
+                //合并
+                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())) {
+                    pdfUrl = bladeFile.getLink();
+                }
+            }
+
             return R.data(pdfUrl);
         } else {
-            return R.fail("无历史数据预览,请保存数据");
+            return R.fail("无历史数据预览请保存数据");
         }
     }
 
@@ -268,15 +329,6 @@ public class TrialDetectionController extends BladeController {
         return R.fail(200, "未查询到数据");
     }
 
-    @PostMapping("/self/project-position/submit")
-    @ApiOperationSupport(order = 26)
-    @ApiOperation(value = "自检记录关联工程部位信息保存", notes = "传入SelfProjectPositionSubmitDTO")
-    public R<Object> recordProjectPosition(@Valid @RequestBody SelfProjectPositionSubmitDTO dto) throws FileNotFoundException {
-        //TODO 已剥离,融合到批量审批中
-        //return R.status(iTrialSelfInspectionRecordService.recordProjectPosition(dto));
-        return R.status(true);
-    }
-
     @PostMapping("/self/record-sample/submit")
     @ApiOperationSupport(order = 27)
     @ApiOperation(value = "自检记录关联取样信息保存", notes = "传入RecordSampleSubmitDTO")

+ 7 - 2
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml

@@ -49,6 +49,7 @@
         <result column="nodeType" property="nodeType"/>
         <result column="evaluate" property="evaluate"/>
         <result column="queryType" property="queryType"/>
+        <result column="isExperiment" property="isExperiment"/>
     </resultMap>
 
     <resultMap id="queryContractTreeMap" type="org.springblade.manager.vo.WbsTreeContractTreeVOS">
@@ -285,7 +286,9 @@
                 and tc.contract_id = wtc.contract_id
                 and NOT EXISTS (select 1 from u_information_query as q where iq.id = q.id and q.status > iq.status) LIMIT 1
             ) AS evaluate,
-            uiq.type AS queryType
+            uiq.type AS queryType,
+            case WHEN uiq.pdf_trial_url is null then 'false'
+                ELSE 'true' end AS isExperiment
         FROM
             m_wbs_tree_contract AS wtc
         LEFT JOIN u_information_query AS uiq ON wtc.p_key_id = uiq.wbs_id AND uiq.classify = #{classify} and uiq.is_deleted = 0
@@ -560,7 +563,9 @@
             wtc.parent_id AS parentId,
             uiq.id AS informationQueryId,
             IFNULL(uiq.status,0) AS status,
-            uiq.type AS queryType
+            uiq.type AS queryType,
+            case WHEN uiq.pdf_trial_url is null then 'false'
+                 ELSE 'true' end AS isExperiment
         FROM
             m_wbs_tree_contract AS wtc
             LEFT JOIN u_information_query AS uiq ON wtc.p_key_id = uiq.wbs_id AND uiq.classify = #{classify} and uiq.is_deleted = 0

+ 8 - 3
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSelfInspectionRecordMapper.java

@@ -2,6 +2,7 @@ package org.springblade.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.manager.entity.WbsTreeContract;
 
@@ -9,7 +10,7 @@ import java.util.List;
 
 public interface TrialSelfInspectionRecordMapper extends BaseMapper<TrialSelfInspectionRecord> {
 
-    List<TrialSelfInspectionRecord> selectAll(Long nodeId,Long contractId);
+    List<TrialSelfInspectionRecord> selectAll(Long nodeId, Long contractId);
 
     void saveSelfSample(Long id, Long selfId, String samplingId);
 
@@ -23,13 +24,13 @@ public interface TrialSelfInspectionRecordMapper extends BaseMapper<TrialSelfIns
 
     void delSelfQuality(Long id);
 
-    void saveSelfQuality(Long id, Long selfId, String qualityNodeId);
+    void saveSelfQuality(Long id, Long selfId, Long qualityNodeId);
 
     List<String> selectQualityNodeId(String id);
 
     String selectInformationQuery(String id, String contractId, String classify);
 
-    void updateInformationQuery(String id, String contractId, String classify, String link);
+    void updateInformationQuery(Long id, Long contractId,String link);
 
     void deleteSeletedStatusByNodeId(String nodeId, Integer type, String recordId);
 
@@ -40,4 +41,8 @@ public interface TrialSelfInspectionRecordMapper extends BaseMapper<TrialSelfIns
     List<String> selectSelectedStatusList(Long nodeId, String type);
 
     List<WbsTreeContract> selectWbsTreeContractListByPKeyIds(@Param("idList") List<String> ids);
+
+    @Select("select self_id from u_trial_self_quality_project where quality_node_id = #{pKeyId}")
+    List<String> selectTrialIdByNodeId(Long pKeyId);
+
 }

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSelfInspectionRecordMapper.xml

@@ -45,7 +45,7 @@
     </insert>
 
     <update id="updateInformationQuery">
-        update u_information_query set pdf_url = #{link} where wbs_id = #{id} and classify = #{classify} and contract_id = #{contractId} and is_deleted = 0
+        update u_information_query set pdf_trial_url_position = #{link} where wbs_id = #{id} and contract_id = #{contractId} and is_deleted = 0
     </update>
 
     <delete id="delSelfSample">

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

@@ -13,7 +13,7 @@ import java.util.List;
 
 public interface ITrialSelfInspectionRecordService extends BaseService<TrialSelfInspectionRecord> {
 
-    IPage<TrialSelfInspectionRecordVO> selfPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto);
+    IPage<TrialSelfInspectionRecordVO> selfPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) throws FileNotFoundException;
 
     String selfSubmit(TrialSelfInspectionRecordDTO dto) throws FileNotFoundException;
 
@@ -27,14 +27,14 @@ public interface ITrialSelfInspectionRecordService extends BaseService<TrialSelf
 
     List<TrialSelfInspectionRecordVO2> getRawMaterialInfo(String nodeId, String contractId, String id);
 
-    boolean rawMaterialSubmitRelation(RawMaterialSubmitRelationDTO dto) throws FileNotFoundException;
+    boolean rawMaterialSubmitRelation(RawMaterialSubmitRelationDTO dto, TrialSelfInspectionRecord obj) throws FileNotFoundException;
 
     String selfPrintPdf(String ids) throws FileNotFoundException;
 
     String selfPrintNullPdf(String ids) throws Exception;
 
     @Async
-    void updateTrialSelfInspectionRecordStatus(List<TaskApprovalVO> obj) throws FileNotFoundException;
+    void updateTrialSelfInspectionRecordStatus(String pdfUrlEVisa, List<TaskApprovalVO> obj) throws FileNotFoundException;
 
     String addBussFile(MultipartFile file, Long pkeyId, String nodeId, String contractId, String projectId, String classify, String id, String tableType) throws Exception;
 
@@ -42,8 +42,6 @@ public interface ITrialSelfInspectionRecordService extends BaseService<TrialSelf
 
     boolean fileSubmit(TrialFileSubmitDTO dto) throws FileNotFoundException;
 
-    boolean recordProjectPosition(SelfProjectPositionSubmitDTO dto) throws FileNotFoundException;
-
     boolean recordSampleSubmit(RecordSampleSubmitDTO dto);
 
 }

+ 55 - 18
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -13,10 +13,7 @@ import org.slf4j.LoggerFactory;
 import org.springblade.business.entity.*;
 import org.springblade.business.mapper.TaskMapper;
 import org.springblade.business.service.*;
-import org.springblade.business.vo.BusinessUserOpinionVO;
-import org.springblade.business.vo.MessageWarningVO;
-import org.springblade.business.vo.TaskApprovalVO;
-import org.springblade.business.vo.TaskVO;
+import org.springblade.business.vo.*;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
@@ -42,6 +39,8 @@ import org.springblade.manager.entity.ProjectInfo;
 import org.springblade.manager.feign.ContractClient;
 import org.springblade.manager.feign.ProjectClient;
 import org.springframework.beans.BeanUtils;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -92,6 +91,10 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 
     private final UserOpinionServiceImpl userOpinionService;
 
+    private final JdbcTemplate jdbcTemplate;
+
+    private final ITrialSelfInspectionRecordService iTrialSelfInspectionRecordService;
+
     @Override
     public List<TaskParallel> queryApprovalUser(String formDataIds) {
         //返回结果
@@ -216,9 +219,34 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     }
                 }
 
-            } else {
+            } else if (new Integer("1").equals(query.getType())) {
+                //资料填报
+                if (StringUtils.isNotEmpty(query.getEVisaPdfUrl()) || StringUtils.isNotEmpty(query.getPdfUrl()) || StringUtils.isNotEmpty(query.getPdfTrialUrl()) || StringUtils.isNotEmpty(query.getPdfTrialUrlPosition())) {
+                    //资料填报原始pdf
+                    vo.setApprovalFileList(query.getName(), StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl());
+
+                    //试验关联文件合并pdf
+                    if (StringUtils.isNotEmpty(query.getPdfTrialUrl())) {
+                        vo.setApprovalFileList(query.getName() + "(关联试验文件)", StringUtils.isNotEmpty(query.getPdfTrialUrl()) ? query.getPdfTrialUrl() : null);
+                    }
+
+                    //试验关联的工程部位信息合并pdf
+                    if (StringUtils.isNotEmpty(query.getPdfTrialUrlPosition())) {
+                        vo.setApprovalFileList(query.getName() + "(关联试验工程部位信息文件)", StringUtils.isNotEmpty(query.getPdfTrialUrlPosition()) ? query.getPdfTrialUrlPosition() : null);
+                    }
+                }
+            } else if (new Integer("2").equals(query.getType())) {
+                //试验
                 if (StringUtils.isNotEmpty(query.getEVisaPdfUrl()) || StringUtils.isNotEmpty(query.getPdfUrl())) {
+                    //试验原始pdf
                     vo.setApprovalFileList(query.getName(), StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl());
+
+                    //试验关联的原材料检测报告合并pdf (wbsId=试验记录id)
+                    String sqlRecord = "select old_pdf_url from u_trial_raw_material_self_record where self_record_id =" + query.getWbsId();
+                    TrialRawMaterialSelfRecord recordObj = jdbcTemplate.query(sqlRecord, new BeanPropertyRowMapper<>(TrialRawMaterialSelfRecord.class)).stream().findAny().orElse(null);
+                    if (recordObj != null) {
+                        vo.setApprovalFileList(query.getName() + "(原材料检测报告)", StringUtils.isNotEmpty(recordObj.getOldPdfUrl()) ? recordObj.getOldPdfUrl() : null);
+                    }
                 }
             }
         }
@@ -351,21 +379,21 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
     }
 
     @Override
-    public List<String> queryBatchListThree(String projectId, String contractId,String type) {
-        if ("1".equals(type)){
+    public List<String> queryBatchListThree(String projectId, String contractId, String type) {
+        if ("1".equals(type)) {
             return baseMapper.queryBatchListThree(projectId, contractId);
-        }else if ("2".equals(type)){
+        } else if ("2".equals(type)) {
             return baseMapper.queryBatchListFlagFirst(projectId, contractId);
-        }else {
+        } else {
             return baseMapper.queryBatchListFirst(projectId, contractId);
         }
     }
 
     @Override
     public Map<String, String> queryContractAllBatch(String contract) {
-        Map<String,String> map = new HashMap<>();
-        baseMapper.queryContractAllBatch(contract).stream().forEach(task->{
-            map.put(task.getFormDataId(),task.getBatch()+"");
+        Map<String, String> map = new HashMap<>();
+        baseMapper.queryContractAllBatch(contract).stream().forEach(task -> {
+            map.put(task.getFormDataId(), task.getBatch() + "");
         });
         return map;
     }
@@ -375,8 +403,6 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         return this.baseMapper.queryBatchList(projectId, contract);
     }
 
-    //@Async
-
     /**
      * 批量电签接口
      *
@@ -416,13 +442,18 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 
     }
 
-    private void checkIsExsitTaskBatch(List<TaskApprovalVO> taskApprovalVOS, String batchId) {
+    private void checkIsExsitTaskBatch(List<TaskApprovalVO> taskApprovalVOS, String batchId) throws FileNotFoundException {
         boolean isContinue = true;
         while (isContinue) {
             logger.info("【任务审核】当前批次开始电签。批次ID:" + batchId);
             //执行电签
             for (TaskApprovalVO taskApprovalVO : taskApprovalVOS) {
-                this.completeApprovalTask(taskApprovalVO);
+                String pdfUrlEVisa = this.completeApprovalTask(taskApprovalVO);
+
+                //TODO ============== 电签成功,修改试验状态,关联工程部位信息pdf(只有电签成功,才修改) ==============
+                if (StringUtils.isNotEmpty(pdfUrlEVisa)){
+                    this.iTrialSelfInspectionRecordService.updateTrialSelfInspectionRecordStatus(pdfUrlEVisa, taskApprovalVOS);
+                }
             }
             //删除掉对应批次
             this.taskBatchService.deletedById(batchId);
@@ -446,7 +477,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
     }
 
     // 电签主流程业务
-    private void completeApprovalTask(TaskApprovalVO taskApprovalVO) {
+    private String completeApprovalTask(TaskApprovalVO taskApprovalVO) {
         //获取流程ID
         String taskId = taskApprovalVO.getTaskId();
         //获取业务实例ID
@@ -459,7 +490,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         //获取当前分支信息
         TaskParallel currentLink = this.taskParallelService.getOne(Wrappers.<TaskParallel>lambdaQuery().eq(TaskParallel::getParallelProcessInstanceId, parallelProcessInstanceId).eq(TaskParallel::getIsDeleted, 0));
         if (currentLink == null) {
-            return;
+            return "";
         }
         //获取主流程
         Task masterTask = this.getOne(Wrappers.<Task>lambdaQuery().eq(Task::getIsDeleted, 0).eq(Task::getProcessInstanceId, currentLink.getProcessInstanceId()));
@@ -514,10 +545,15 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                         this.update(Wrappers.<Task>lambdaUpdate().set(Task::getStatus, 2).set(Task::getUpdateTime, new Date()).eq(Task::getId, masterTask.getId()));
                         //修改对应的业务数据状态为已审批
                         this.updateBusinessDataByFormDataId(masterTask, 2, finalPdfUrl);
+
+                        //返回电签成功的pdf路径,给试验用
+                        return finalPdfUrl;
                     }
                 } else {
                     //只更新PDF路径
                     this.updateBusinessDataByFormDataId(masterTask, 1, eVisaStatus.contains("@@@@") ? eVisaStatus.split("@@@@")[1] : null);
+
+                    return eVisaStatus.contains("@@@@") ? eVisaStatus.split("@@@@")[1] : null;
                 }
             } else if ("eVisaError".equals(eVisaStatus) || eVisaStatus.contains("eVisaError")) {
                 //电签失败,将对应分支任务的电签状态修改为99并添加错误信息
@@ -599,6 +635,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             this.abolishMessage(masterTask, currentLink, comment);
 
         }
+        return "";
     }
 
     /**

+ 180 - 255
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -3,7 +3,6 @@ package org.springblade.business.service.impl;
 import cn.hutool.core.date.LocalDateTimeUtil;
 import com.alibaba.fastjson.JSONArray;
 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;
@@ -13,7 +12,6 @@ import lombok.AllArgsConstructor;
 import org.apache.commons.lang.time.DateUtils;
 import org.springblade.business.dto.*;
 import org.springblade.business.entity.*;
-import org.springblade.business.feign.InformationQueryClient;
 import org.springblade.business.mapper.TrialMaterialMobilizationMapper;
 import org.springblade.business.mapper.TrialSampleInfoMapper;
 import org.springblade.business.mapper.TrialSelfInspectionRecordMapper;
@@ -55,6 +53,7 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.util.*;
 import java.util.List;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 @Service
@@ -68,12 +67,10 @@ public class TrialSelfInspectionRecordServiceImpl
     private final IUserClient iUserClient;
     private final ContractClient contractClient;
     private final WbsTreePrivateClient wbsTreePrivateClient;
-    private final WbsTreeContractClient wbsTreeContractClient;
     private final ExcelTabClient excelTabClient;
     private final IDictClient iDictClient;
     private final JdbcTemplate jdbcTemplate;
     private final NewIOSSClient newIOSSClient;
-    private final InformationQueryClient informationQueryClient;
     private final IOSSClient iossClient;
     private final CommonFileClient commonFileClient;
     private final TableFileClient tableFileClient;
@@ -82,7 +79,7 @@ public class TrialSelfInspectionRecordServiceImpl
     private final TrialDetectionDataServiceImpl trialDetectionDataService;
 
     @Override
-    public IPage<TrialSelfInspectionRecordVO> selfPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) {
+    public IPage<TrialSelfInspectionRecordVO> selfPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) throws FileNotFoundException {
         QueryWrapper<TrialSelfInspectionRecord> queryWrapper = Condition.getQueryWrapper(dto);
         if (StringUtils.isNotEmpty(dto.getQueryValue())) {
             queryWrapper.lambda().like(TrialSelfInspectionRecord::getTrialProjectName, dto.getQueryValue());
@@ -101,16 +98,18 @@ public class TrialSelfInspectionRecordServiceImpl
         IPage<TrialSelfInspectionRecord> pages = this.page(page, queryWrapper.lambda().orderByDesc(true, TrialSelfInspectionRecord::getCreateTime));
         IPage<TrialSelfInspectionRecordVO> trialSelfInspectionRecordVOIPage = TrialSelfInspectionRecordWarpper.build().pageVO(pages);
         List<TrialSelfInspectionRecordVO> records = trialSelfInspectionRecordVOIPage.getRecords();
-        List<Dict> trialDetectionCategory = iDictClient.getList("trial_detection_category").getData();
+        Map<String, Dict> map = iDictClient.getList("trial_detection_category").getData().stream().collect(Collectors.toMap(Dict::getDictKey, Function.identity()));
 
         for (TrialSelfInspectionRecordVO record : records) {
-            for (Dict dict : trialDetectionCategory) {
-                if (dict.getDictKey().equals(String.valueOf(record.getDetectionCategory()))) {
+            record.setIsUploadCertificateName((new Integer(1)).equals(record.getIsUploadCertificate()) ? "是" : "否");
+            record.setDetectionResultName((new Integer(1)).equals(record.getDetectionResult()) ? "合格" : "不合格");
+
+            if (ObjectUtils.isNotEmpty(record.getDetectionCategory())) {
+                Dict dict = map.get(String.valueOf(record.getDetectionCategory()));
+                if (dict != null) {
                     record.setDetectionCategoryName(dict.getDictValue());
                 }
             }
-            record.setIsUploadCertificateName(record.getIsUploadCertificate().equals(1) ? "是" : "否");
-            record.setDetectionResultName(record.getDetectionResult().equals(1) ? "合格" : "不合格");
 
             //工程部位及用途名称
             if (ObjectUtil.isNotEmpty(record.getProjectPosition())) {
@@ -131,10 +130,66 @@ public class TrialSelfInspectionRecordServiceImpl
             if (query.size() > 0) {
                 record.setSampleIds(org.apache.commons.lang.StringUtils.join(query, ","));
             }
+
+            //原材料检测报告ids
+            String sql1 = "select raw_material_record_id,old_pdf_url from u_trial_raw_material_self_record where self_record_id = " + record.getId();
+            List<TrialRawMaterialSelfRecord> query1 = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(TrialRawMaterialSelfRecord.class));
+            if (query1.size() > 0) {
+                List<Long> ids = query1.stream().map(TrialRawMaterialSelfRecord::getRawMaterialRecordId).collect(Collectors.toList());
+                record.setRawMaterialIds(org.apache.commons.lang.StringUtils.join(ids, ","));
+            }
+
+            //合并的pdfUrl
+            String pdf = this.getMergePdfToTrial(record.getContractId(), record.getId());
+            record.setPdfUrl(pdf);
         }
         return trialSelfInspectionRecordVOIPage.setRecords(records);
     }
 
+    private String getMergePdfToTrial(Long contractId, Long nodeId) throws FileNotFoundException {
+        String sql = "select pdf_url,e_visa_pdf_url from u_information_query where wbs_id='" + nodeId + "' and contract_id ='" + contractId + "'";
+        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
+        if (maps.size() >= 1) {
+            Map<String, Object> stringObjectMap = maps.get(0);
+            Object pdfUrl = stringObjectMap.get("pdf_url");
+
+            if (stringObjectMap.get("e_visa_pdf_url") != null) {
+                //优先使用电签的pdf
+                pdfUrl = stringObjectMap.get("e_visa_pdf_url");
+            }
+
+            //关联原材料检测报告的pdf(合并后的dpf都一样,取其一)
+            String sqlRecord = "select old_pdf_url from u_trial_raw_material_self_record where self_record_id =" + nodeId;
+            TrialRawMaterialSelfRecord recordObj = jdbcTemplate.query(sqlRecord, new BeanPropertyRowMapper<>(TrialRawMaterialSelfRecord.class)).stream().findAny().orElse(null);
+            if (pdfUrl != null && recordObj != null && recordObj.getOldPdfUrl() != null) {
+                String pdfUrlTrialRawMaterial = recordObj.getOldPdfUrl();
+                List<String> pdfList = new ArrayList<>();
+                //试验原始pdf
+                pdfList.add(pdfUrl.toString());
+                //材料检测报告pdf
+                pdfList.add(pdfUrlTrialRawMaterial);
+                //合并
+                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())) {
+                    pdfUrl = bladeFile.getLink();
+                    return pdfUrl.toString();
+                }
+            }
+            assert pdfUrl != null;
+            return pdfUrl.toString();
+        }
+        return "";
+    }
+
     @Override
     public List<SampleAncillaryDocumentsVO> selfAncillaryDocumentsList(String id) {
         //获取材料附件信息
@@ -166,13 +221,13 @@ public class TrialSelfInspectionRecordServiceImpl
         List<Attach> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(Attach.class));
         for (SampleAncillaryDocumentsVO sampleAncillaryDocumentsVO : result) {
             for (Attach attach : query) {
-                if (sampleAncillaryDocumentsVO.getOtherAccessories().equals(attach.getLink())) {
+                if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getOtherAccessories()) && sampleAncillaryDocumentsVO.getOtherAccessories().equals(attach.getLink())) {
                     sampleAncillaryDocumentsVO.setOtherAccessoriesName(attach.getOriginalName());
                 }
-                if (sampleAncillaryDocumentsVO.getProductionCertificate().equals(attach.getLink())) {
+                if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getProductionCertificate()) && sampleAncillaryDocumentsVO.getProductionCertificate().equals(attach.getLink())) {
                     sampleAncillaryDocumentsVO.setProductionCertificateName(attach.getOriginalName());
                 }
-                if (sampleAncillaryDocumentsVO.getQualityInspectionReport().equals(attach.getLink())) {
+                if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getQualityInspectionReport()) && sampleAncillaryDocumentsVO.getQualityInspectionReport().equals(attach.getLink())) {
                     sampleAncillaryDocumentsVO.setQualityInspectionReportName(attach.getOriginalName());
                 }
             }
@@ -229,12 +284,16 @@ public class TrialSelfInspectionRecordServiceImpl
         List<TrialSelfInspectionRecordVO2> recordVO2s;
         //编辑
         if (StringUtils.isNotEmpty(id)) {
-            //获取nodeId节点下的记录信息(排除当前id记录)
+            //获取nodeId节点下的合格的记录信息(排除当前id记录)
             List<TrialSelfInspectionRecord> result = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
+                    .eq(TrialSelfInspectionRecord::getDetectionResult, 1)
+                    .eq(TrialSelfInspectionRecord::getStatus, 1)
                     .eq(TrialSelfInspectionRecord::getNodeId, nodeId)
                     .eq(TrialSelfInspectionRecord::getContractId, contractId)
                     .ne(TrialSelfInspectionRecord::getId, id)
-                    .eq(TrialSelfInspectionRecord::getStatus, 1));
+                    .isNotNull(TrialSelfInspectionRecord::getReportNo)
+                    .orderByDesc(TrialSelfInspectionRecord::getCreateTime)
+            );
 
             recordVO2s = BeanUtil.copyProperties(result, TrialSelfInspectionRecordVO2.class);
 
@@ -256,9 +315,12 @@ public class TrialSelfInspectionRecordServiceImpl
         } else {
             //新增
             List<TrialSelfInspectionRecord> result = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
+                    .eq(TrialSelfInspectionRecord::getDetectionResult, 1)
+                    .eq(TrialSelfInspectionRecord::getStatus, 1)
                     .eq(TrialSelfInspectionRecord::getNodeId, nodeId)
                     .eq(TrialSelfInspectionRecord::getContractId, contractId)
-                    .eq(TrialSelfInspectionRecord::getStatus, 1));
+                    .isNotNull(TrialSelfInspectionRecord::getReportNo)
+                    .orderByDesc(TrialSelfInspectionRecord::getCreateTime));
 
             recordVO2s = BeanUtil.copyProperties(result, TrialSelfInspectionRecordVO2.class);
         }
@@ -285,110 +347,58 @@ public class TrialSelfInspectionRecordServiceImpl
 
     @Override
     @Async
-    public boolean rawMaterialSubmitRelation(RawMaterialSubmitRelationDTO dto) throws FileNotFoundException {
+    public boolean rawMaterialSubmitRelation(RawMaterialSubmitRelationDTO dto, TrialSelfInspectionRecord obj) throws
+            FileNotFoundException {
         if (ObjectUtil.isEmpty(dto.getId())) {
             throw new ServiceException("请先保存填报数据后,再关联原材检测报告信息");
         } else {
-            TrialSelfInspectionRecord objMain = this.getBaseMapper().selectById(dto.getId());
-            if (ObjectUtil.isNotEmpty(objMain) && (("已审批").equals(objMain.getTaskStatus()) || ("待审批").equals(objMain.getTaskStatus()))) {
+            if (ObjectUtil.isNotEmpty(obj) && (("已审批").equals(obj.getTaskStatus()) || ("待审批").equals(obj.getTaskStatus()))) {
                 throw new ServiceException("当前填报数据已上报,无法进行关联操作");
             }
-            if (StringUtils.isNotEmpty(dto.getIds())) { //新增关系,合并pdf
-                List<String> idsList = Func.toStrList(dto.getIds());
-                //获取ids、id下的pdfUrl
-                List<String> ids = new ArrayList<>();
-                ids.add(dto.getId());
-                ids.addAll(idsList);
-                List<TrialSelfInspectionRecord> recordList = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().in(TrialSelfInspectionRecord::getId, ids).eq(TrialSelfInspectionRecord::getStatus, 1));
-                TrialSelfInspectionRecord oldObj = recordList.stream().filter(f -> f.getId().equals(Long.parseLong(dto.getId()))).findAny().orElse(null);
-                List<TrialSelfInspectionRecord> oldOther = recordList.stream().filter(f -> !f.getId().equals(Long.parseLong(dto.getId()))).collect(Collectors.toList());
-
-                //获取原始pdfUrl
-                String sql = "select * from u_trial_raw_material_self_record where self_record_id =" + dto.getId();
-                TrialRawMaterialSelfRecord recordOld = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TrialRawMaterialSelfRecord.class)).stream().findAny().orElse(null);
-                if (recordOld != null && oldObj != null) {
-                    oldObj.setPdfUrl(recordOld.getOldPdfUrl());
-                }
 
-                //当前记录pdfUrl置顶
-                List<TrialSelfInspectionRecord> recordList2 = new ArrayList<>();
-                recordList2.add(oldObj);
-                recordList2.addAll(oldOther);
-                List<String> listPdfUrl = recordList2.stream().map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
+            //新增或编辑
+            if (StringUtils.isNotEmpty(dto.getIds())) {
+                //当前关联的原材料记录id
+                List<String> ids = Func.toStrList(dto.getIds());
+
+                //获取原材料的pdf
+                List<TrialSelfInspectionRecord> recordList = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
+                        .select(TrialSelfInspectionRecord::getPdfUrl, TrialSelfInspectionRecord::getId)
+                        .in(TrialSelfInspectionRecord::getId, ids).eq(TrialSelfInspectionRecord::getStatus, 1));
+                List<TrialSelfInspectionRecord> recordObjList = recordList.stream().filter(f -> !f.getId().equals(Long.parseLong(dto.getId()))).collect(Collectors.toList());
+                List<String> pdfUrlAll = new ArrayList<>();
+                if (recordObjList.size() > 0) {
+                    pdfUrlAll.addAll(recordObjList.stream().filter(f -> StringUtils.isNotEmpty(f.getPdfUrl())).map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList()));
+                }
 
-                if (listPdfUrl.size() > 0) {
-                    //合并PDF
+                if (pdfUrlAll.size() > 0) {
                     String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
                     String listPdf = filePath + "/pdf/" + dto.getNodeId() + ".pdf";
                     File tabPDF = ResourceUtil.getFile(listPdf);
                     if (tabPDF.exists()) {
                         tabPDF.delete();
                     }
-                    FileUtils.mergePdfPublicMethods(listPdfUrl, listPdf);
+                    FileUtils.mergePdfPublicMethods(pdfUrlAll, listPdf);
                     BladeFile bladeFile = this.newIOSSClient.uploadFile(dto.getNodeId() + ".pdf", listPdf);
 
-                    //获取试验记录id的试验项目名称
-                    List<String> collect = recordList.stream().map(TrialSelfInspectionRecord::getTrialProjectName).collect(Collectors.toList());
-                    String name = collect.stream().findAny().orElse(null);
-                    String trialProjectName;
-                    if (collect.size() > 1) {
-                        trialProjectName = name + "等" + collect.size() + "个文件";
-                    } else {
-                        trialProjectName = name;
-                    }
-
-                    //删除当前记录关系信息
+                    //删除记录关系
                     String sql1 = "delete from u_trial_raw_material_self_record where self_record_id ='" + dto.getId() + "'";
                     jdbcTemplate.execute(sql1);
-                    //新增当前记录关系信息
-                    for (String s : idsList) {
-                        if (oldObj != null) {
-                            String sql2 = "insert into u_trial_raw_material_self_record(id,self_record_id,raw_material_record_id,old_pdf_url) values(" + SnowFlakeUtil.getId() + "," + dto.getId() + "," + s + ",'" + oldObj.getPdfUrl() + "')";
+                    //新增记录关系
+                    for (String recordId : ids) {
+                        if (!recordId.equals(dto.getId())) {
+                            String sql2 = "insert into u_trial_raw_material_self_record(id,self_record_id,raw_material_record_id,old_pdf_url) values(" + SnowFlakeUtil.getId() + "," + dto.getId() + "," + recordId + ",'" + bladeFile.getLink() + "')";
                             jdbcTemplate.execute(sql2);
                         }
                     }
-
-                    if (ObjectUtil.isNotEmpty(bladeFile)) {
-                        //修改pdfURL
-                        String querySql = "select * from u_information_query where classify='" + dto.getType() + "' and wbs_id='" + dto.getId() + "' and contract_id ='" + dto.getContractId() + "'";
-                        List<Map<String, Object>> resultSQL = jdbcTemplate.queryForList(querySql);
-                        if (resultSQL.size() > 0) {
-                            String sql3 = "update u_information_query set pdf_url ='" + bladeFile.getLink() + "', name = '" + trialProjectName + "' where classify= '" + dto.getType() + "' and wbs_id='" + dto.getId() + "' and contract_id ='" + dto.getContractId() + "'";
-                            jdbcTemplate.execute(sql3);
-                        } else {
-                            informationQueryClient.saveData(dto.getId(), dto.getProjectId(), dto.getContractId(), String.valueOf(dto.getType()), bladeFile.getLink(), trialProjectName);
-                        }
-
-                        //修改当前记录pdfUrl
-                        this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate().set(TrialSelfInspectionRecord::getPdfUrl, bladeFile.getLink()).eq(TrialSelfInspectionRecord::getId, dto.getId()));
-
-                        return true;
-                    } else {
-                        //删除关系
-                        jdbcTemplate.execute(sql1);
-                        return false;
-                    }
+                    return true;
                 }
-            } else {
-                //删除关系,恢复当前记录的原始pdfUrl
-                TrialSelfInspectionRecord obj = baseMapper.selectById(dto.getId());
-                String sql = "select * from u_trial_raw_material_self_record where self_record_id =" + dto.getId();
-                TrialRawMaterialSelfRecord record = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TrialRawMaterialSelfRecord.class)).stream().findAny().orElse(null);
-                if (record != null) {
-                    //修改pdfURL
-                    String querySql = "select * from u_information_query where classify='" + dto.getType() + "' and wbs_id='" + dto.getId() + "' and contract_id ='" + dto.getContractId() + "'";
-                    List<Map<String, Object>> resultSQL = jdbcTemplate.queryForList(querySql);
-                    if (resultSQL.size() > 0) {
-                        String sql3 = "update u_information_query set pdf_url ='" + record.getOldPdfUrl() + "', name = '" + obj.getTrialProjectName() + "' where classify= '" + dto.getType() + "' and wbs_id='" + dto.getId() + "' and contract_id ='" + dto.getContractId() + "'";
-                        jdbcTemplate.execute(sql3);
-                    } else {
-                        informationQueryClient.saveData(dto.getId(), dto.getProjectId(), dto.getContractId(), String.valueOf(dto.getType()), record.getOldPdfUrl(), obj.getTrialProjectName());
-                    }
-
-                    //修改当前记录pdfUrl
-                    this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate().set(TrialSelfInspectionRecord::getPdfUrl, record.getOldPdfUrl()).eq(TrialSelfInspectionRecord::getId, dto.getId()));
 
-                    //删除当前记录关系信息
+            } else {
+                //删除全部
+                String sql = "select id from u_trial_raw_material_self_record where self_record_id =" + dto.getId();
+                List<TrialRawMaterialSelfRecord> recordList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TrialRawMaterialSelfRecord.class));
+                if (recordList.size() > 0) {
                     String sql1 = "delete from u_trial_raw_material_self_record where self_record_id ='" + dto.getId() + "'";
                     jdbcTemplate.execute(sql1);
                 }
@@ -459,7 +469,7 @@ public class TrialSelfInspectionRecordServiceImpl
 
     @Override
     @Async
-    public void updateTrialSelfInspectionRecordStatus(List<TaskApprovalVO> obj) throws FileNotFoundException {
+    public void updateTrialSelfInspectionRecordStatus(String pdfUrlEVisa, List<TaskApprovalVO> obj) throws FileNotFoundException {
         for (TaskApprovalVO taskApprovalVO : obj) {
             if (ObjectUtil.isNotEmpty(taskApprovalVO.getParallelProcessInstanceId())) {
                 String sql = "select process_instance_id from u_task_parallel where parallel_process_instance_id = '" + taskApprovalVO.getParallelProcessInstanceId() + "'";
@@ -469,44 +479,39 @@ public class TrialSelfInspectionRecordServiceImpl
                     if (StringUtils.isNotEmpty(trialSelfInspectionRecordId)) {
                         this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
                                 .set(TrialSelfInspectionRecord::getTaskStatus, "OK".equals(taskApprovalVO.getFlag()) ? "已审批" : "已废除")
+                                .set(TrialSelfInspectionRecord::getPdfUrl, pdfUrlEVisa) //pdfUrlEVisa=电签后的pdf
                                 .eq(TrialSelfInspectionRecord::getId, trialSelfInspectionRecordId)
                         );
 
-                        //TODO ------审批通过且合格的自检记录信息,关联到工程部位信息的施工质检节点上去------
                         TrialSelfInspectionRecord record = baseMapper.selectById(trialSelfInspectionRecordId);
                         if (("已审批").equals(record.getTaskStatus()) && (new Integer(1)).equals(record.getDetectionResult()) && (new Integer(1)).equals(record.getDetectionCategory())) {
+                            /**
+                             * 在资料填报工序-预览全部pdf时再拼接合并显示,当前只做储存(如果当前资料填报工序节点有其他多个试验记录pdf关联信息,那么合并存储,否则直接存储)
+                             */
                             if (StringUtils.isNotEmpty(record.getProjectPosition())) {
-                                List<String> ids = Func.toStrList(record.getProjectPosition());
-
-                                //删除当前试验记录关联信息
-                                baseMapper.delSelfQuality(record.getId());
-
-                                for (String pKeyId : ids) {
-                                    //新增关联信息
-                                    baseMapper.saveSelfQuality(SnowFlakeUtil.getId(), record.getId(), pKeyId);
-
-                                    //合并pdf到质检树节点
-                                    WbsTreeContract wbsTreeContract = wbsTreeContractClient.getContractNodeByPrimaryKeyId(pKeyId);
-                                    if (wbsTreeContract != null) {
-                                        List<String> pdfUrlList = new ArrayList<>();
-                                        String classify;
-
-                                        if (wbsTreeContract.getTableOwner().contains("1") || wbsTreeContract.getTableOwner().contains("2") || wbsTreeContract.getTableOwner().contains("3")) {
-                                            classify = "1";
-                                        } else {
-                                            classify = "2";
-                                        }
-
-                                        String pdfUrlNodeAll = baseMapper.selectInformationQuery(pKeyId, wbsTreeContract.getContractId(), classify);
-
-                                        if (StringUtils.isEmpty(pdfUrlNodeAll) || StringUtils.isEmpty(record.getPdfUrl())) {
+                                //有pdf的节点
+                                String sqlNodeAll = "select wbs_id from u_information_query where wbs_id in(" + record.getProjectPosition() + ") and contract_id = " + record.getContractId();
+                                List<Long> collect = jdbcTemplate.query(sqlNodeAll, new BeanPropertyRowMapper<>(InformationQuery.class)).stream().map(InformationQuery::getWbsId).collect(Collectors.toList());
+                                if (collect.size() > 0) {
+                                    //删除当前记录关联记录
+                                    baseMapper.delSelfQuality(record.getId());
+                                    for (Long pKeyId : collect) {
+                                        //新增当前记录关联信息
+                                        baseMapper.saveSelfQuality(SnowFlakeUtil.getId(), record.getId(), pKeyId);
+
+                                        //获取当前工程部位节点最新的关联试验记录ids
+                                        List<String> trialRecordIds = baseMapper.selectTrialIdByNodeId(pKeyId);
+
+                                        //如果当前工程部位节点的关联试验记录id只有一条,且等于当前关联试验记录id,那么不合并,直接存储该条试验记录的pdf
+                                        if (trialRecordIds.size() == 1 && trialRecordIds.get(0).equals(record.getId().toString())) {
+                                            //修改当前试验pdf到质检树节点的pdf_trial_url_position上存储
+                                            baseMapper.updateInformationQuery(pKeyId, record.getContractId(), record.getPdfUrl());
                                             continue;
                                         }
 
-                                        //质检节点pdfUrl
-                                        pdfUrlList.add(pdfUrlNodeAll);
-                                        //试验记录pdfUrl
-                                        pdfUrlList.add(record.getPdfUrl());
+                                        //如果当前工程部位节点的关联试验记录id有多条,那么合并
+                                        List<TrialSelfInspectionRecord> pdfUrlList = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().select(TrialSelfInspectionRecord::getPdfUrl).in(TrialSelfInspectionRecord::getId, trialRecordIds));
+                                        List<String> pdfS = pdfUrlList.stream().filter(f -> StringUtils.isNotEmpty(f.getPdfUrl())).map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
 
                                         String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
                                         String listPdf = filePath + "/pdf/" + pKeyId + ".pdf";
@@ -514,11 +519,12 @@ public class TrialSelfInspectionRecordServiceImpl
                                         if (tabPDF.exists()) {
                                             tabPDF.delete();
                                         }
-                                        FileUtils.mergePdfPublicMethods(pdfUrlList, listPdf);
+
+                                        FileUtils.mergePdfPublicMethods(pdfS, listPdf);
                                         BladeFile bladeFile = this.newIOSSClient.uploadFile(pKeyId + ".pdf", listPdf);
                                         if (bladeFile != null) {
-                                            //修改质检树合并后的pdfUrl
-                                            baseMapper.updateInformationQuery(pKeyId, wbsTreeContract.getContractId(), classify, bladeFile.getLink());
+                                            //修改合并的试验pdf到质检树节点的pdf_trial_url_position上存储
+                                            baseMapper.updateInformationQuery(pKeyId, record.getContractId(), bladeFile.getLink());
                                         }
                                     }
                                 }
@@ -531,7 +537,8 @@ public class TrialSelfInspectionRecordServiceImpl
     }
 
     @Override
-    public String addBussFile(MultipartFile file, Long pkeyId, String nodeId, String contractId, String projectId, String classify, String id, String tableType) throws Exception {
+    public String addBussFile(MultipartFile file, Long pkeyId, String nodeId, String contractId, String
+            projectId, String classify, String id, String tableType) throws Exception {
         R<BladeFile> bladeFile = iossClient.addFileInfo(file);
         BladeFile bladeFile1 = bladeFile.getData();
         TableFile tableFile = new TableFile();
@@ -645,16 +652,15 @@ public class TrialSelfInspectionRecordServiceImpl
         List<String> sampleIds = baseMapper.selectSelfSampleRecord(id);
         if (sampleIds.size() > 0) {
             List<TrialSampleInfo> trialSampleInfos = trialSampleInfoMapper.selectBatchIds(sampleIds);
-            List<User> users = iUserClient.selectUserAll();
+            Map<Long, User> map = iUserClient.selectUserAll().stream().collect(Collectors.toMap(User::getId, Function.identity()));
             if (trialSampleInfos.size() > 0) {
                 for (TrialSampleInfo trialSampleInfo : trialSampleInfos) {
-                    for (User user : users) {
-                        if (trialSampleInfo.getUserId().equals(user.getId())) {
-                            TrialSampleInfoVO trialSampleInfoVO = BeanUtil.copyProperties(trialSampleInfo, TrialSampleInfoVO.class);
-                            if (trialSampleInfoVO != null) {
-                                trialSampleInfoVO.setUserName(ObjectUtil.isNotEmpty(user.getName()) ? user.getName() : user.getRealName());
-                                result.add(trialSampleInfoVO);
-                            }
+                    User user = map.get(trialSampleInfo.getUserId());
+                    if (user != null) {
+                        TrialSampleInfoVO trialSampleInfoVO = BeanUtil.copyProperties(trialSampleInfo, TrialSampleInfoVO.class);
+                        if (trialSampleInfoVO != null) {
+                            trialSampleInfoVO.setUserName(ObjectUtil.isNotEmpty(user.getName()) ? user.getName() : user.getRealName());
+                            result.add(trialSampleInfoVO);
                         }
                     }
                 }
@@ -698,7 +704,7 @@ public class TrialSelfInspectionRecordServiceImpl
                 this.saveOrUpdate(dto);
             }
 
-            //TODO ------保存实体表数据、试验记录信息、生成pdf------
+            //------保存实体表数据、试验记录信息、生成pdf------
             try {
                 String pdfURL = excelTabClient.saveTabData(dto.getIsBatchSave(), dto.getDataInfo(), dto.getType(), dto.getTableType(), dto.getId(), obj.getTableIds());
                 if (StringUtils.isNotEmpty(pdfURL)) {
@@ -709,8 +715,8 @@ public class TrialSelfInspectionRecordServiceImpl
                 throw new ServiceException("保存实体表数据生成pdf时发生异常" + e.getMessage());
             }
 
-            //TODO ------关联工程及用途关系新增或删除------
-            if (StringUtils.isEmpty(obj.getProjectPosition())) {
+            //------关联工程及用途关系新增或删除------(已做修改,在审批修改状态时,再建立关联关系)
+            /*if (StringUtils.isEmpty(obj.getProjectPosition())) {
                 String delSql = "delete from u_trial_self_quality_project where self_id = " + obj.getId();
                 jdbcTemplate.execute(delSql);
             } else {
@@ -723,9 +729,9 @@ public class TrialSelfInspectionRecordServiceImpl
                     String insertSql = "insert into u_trial_self_quality_project(id,self_id,quality_node_id) values (" + SnowFlakeUtil.getId() + "," + obj.getId() + "," + recordNodeId + ")";
                     jdbcTemplate.execute(insertSql);
                 }
-            }
+            }*/
 
-            //TODO ------关联原材料检测报告------
+            //------关联原材料检测报告------
             RawMaterialSubmitRelationDTO relationDTO = new RawMaterialSubmitRelationDTO();
             relationDTO.setId(obj.getId().toString());
             relationDTO.setIds(dto.getRawMaterialIds());
@@ -733,19 +739,15 @@ public class TrialSelfInspectionRecordServiceImpl
             relationDTO.setContractId(dto.getContractId().toString());
             relationDTO.setProjectId(dto.getProjectId());
             relationDTO.setType(dto.getType());
-            if (StringUtils.isNotEmpty(relationDTO.getIds())) {
-                this.rawMaterialSubmitRelation(relationDTO);
-            }
+            this.rawMaterialSubmitRelation(relationDTO, obj);
 
-            //TODO ------关联取样信息------
+            //------关联取样信息------
             RecordSampleSubmitDTO recordSampleSubmitDTO = new RecordSampleSubmitDTO();
             recordSampleSubmitDTO.setId(obj.getId());
             recordSampleSubmitDTO.setSampleIds(dto.getSampleIds());
-            if (StringUtils.isNotEmpty(relationDTO.getIds())) {
-                this.recordSampleSubmit(recordSampleSubmitDTO);
-            }
+            this.recordSampleSubmit(recordSampleSubmitDTO);
 
-            //TODO ------新增设备使用记录信息------
+            //------新增设备使用记录信息------
             this.trialDeviceUseService.addDeviceUseInfo(dto);
         }
 
@@ -759,12 +761,12 @@ public class TrialSelfInspectionRecordServiceImpl
         if (ObjectUtil.isEmpty(dto.getId())) {
             throw new ServiceException("请先保存填报数据后,再关联取样信息");
         }
-        //删除关联信息
+        //删除关联
         baseMapper.delSelfSample(dto.getId());
         if (StringUtils.isNotEmpty(dto.getSampleIds())) {
             List<String> ids = Func.toStrList(dto.getSampleIds());
             for (String id : ids) {
-                //新增关联信息
+                //新增关联
                 baseMapper.saveSelfSample(SnowFlakeUtil.getId(), dto.getId(), id);
             }
 
@@ -814,72 +816,6 @@ public class TrialSelfInspectionRecordServiceImpl
         return true;
     }
 
-    @Override
-    public boolean recordProjectPosition(SelfProjectPositionSubmitDTO dto) throws FileNotFoundException {
-        if (ObjectUtil.isEmpty(dto.getId())) {
-            throw new ServiceException("请先保存填报数据后,再关联工程部位及用途信息");
-        }
-        //已审批记录关联
-        if (StringUtils.isNotEmpty(dto.getProjectPosition())) {
-            TrialSelfInspectionRecord obj = baseMapper.selectById(dto.getId());
-            if (("已审批").equals(obj.getTaskStatus())) {
-                //删除关联信息
-                baseMapper.delSelfQuality(dto.getId());
-
-                List<String> ids = Func.toStrList(dto.getProjectPosition());
-                //新增关联信息
-                for (String id : ids) {
-                    baseMapper.saveSelfQuality(SnowFlakeUtil.getId(), dto.getId(), id);
-                }
-
-                //把当前试验的PDF合并关联到质检树节点下
-                List<String> contractNodePKeyIds = baseMapper.selectQualityNodeId(String.valueOf(dto.getId())); //获取合同段质检树的节点PkeyId
-                for (String pKeyId : contractNodePKeyIds) {
-                    WbsTreeContract wbsTreeContract = wbsTreeContractClient.getContractNodeByPrimaryKeyId(pKeyId);
-                    if (wbsTreeContract != null) {
-                        List<String> pdfUrlList = new ArrayList<>();
-                        String classify;
-                        if (wbsTreeContract.getTableOwner().contains("1") || wbsTreeContract.getTableOwner().contains("2") || wbsTreeContract.getTableOwner().contains("3")) {
-                            classify = "1";
-                        } else {
-                            classify = "2";
-                        }
-                        String pdfUrlNodeAll = baseMapper.selectInformationQuery(pKeyId, wbsTreeContract.getContractId(), classify);
-
-                        if (StringUtils.isEmpty(pdfUrlNodeAll) || StringUtils.isEmpty(obj.getPdfUrl())) {
-                            continue;
-                        }
-
-                        //质检节点合并pdfUrl
-                        pdfUrlList.add(pdfUrlNodeAll);
-                        //试验pdfUrl
-                        pdfUrlList.add(obj.getPdfUrl());
-
-                        //合并PDF
-                        String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-                        String listPdf = filePath + "/pdf/" + pKeyId + ".pdf";
-                        File tabPDF = ResourceUtil.getFile(listPdf);
-                        if (tabPDF.exists()) {
-                            tabPDF.delete();
-                        }
-                        FileUtils.mergePdfPublicMethods(pdfUrlList, listPdf);
-                        BladeFile bladeFile = this.newIOSSClient.uploadFile(pKeyId + ".pdf", listPdf);
-                        if (bladeFile != null) {
-                            //修改质检树合并后的pdfURL
-                            baseMapper.updateInformationQuery(pKeyId, wbsTreeContract.getContractId(), classify, bladeFile.getLink());
-                        }
-                    }
-                }
-            } else {
-                throw new ServiceException("当前试验记录任务未上报审批,关联工程部位及用途信息失败");
-            }
-        } else {
-            //删除关联信息
-            baseMapper.delSelfQuality(dto.getId());
-        }
-        return true;
-    }
-
     private void buildNumber(TrialSelfInspectionRecordDTO dto) {
         StringSPUtils spUtils = new StringSPUtils();
         List<TrialSelfInspectionRecord> result = baseMapper.selectAll(dto.getNodeId(), dto.getContractId());
@@ -1039,23 +975,20 @@ public class TrialSelfInspectionRecordServiceImpl
         }
     }
 
-    public IPage<TrialSelfInspectionRecordVO> trialDataPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) {
+    public IPage<TrialSelfInspectionRecordVO> trialDataPage
+            (IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) {
         QueryWrapper<TrialSelfInspectionRecord> queryWrapper = Condition.getQueryWrapper(dto);
-
         if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getStartTime()) && org.apache.commons.lang.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(TrialSelfInspectionRecord::getReportDate, dto.getStartTime(), endTime);
         }
-
         queryWrapper.lambda().eq(TrialSelfInspectionRecord::getTaskStatus, "已审批");
         queryWrapper.lambda().eq(TrialSelfInspectionRecord::getDetectionResult, 1); //合格
         queryWrapper.lambda().eq(TrialSelfInspectionRecord::getDetectionCategory, 1); //自检
-
-        IPage<TrialSelfInspectionRecord> pages = this.page(page, queryWrapper.lambda().orderBy(true, true, TrialSelfInspectionRecord::getCreateTime));
+        IPage<TrialSelfInspectionRecord> pages = this.page(page, queryWrapper.lambda().orderByDesc(TrialSelfInspectionRecord::getCreateTime));
         IPage<TrialSelfInspectionRecordVO> trialSelfInspectionRecordVOIPage = TrialSelfInspectionRecordWarpper.build().pageVO(pages);
         List<TrialSelfInspectionRecordVO> records = trialSelfInspectionRecordVOIPage.getRecords();
-
         //查询是否关联过
         if (ObjectUtil.isNotEmpty(dto.getQualityTestPKeyId())) {
             List<String> selectedIds = baseMapper.selectSelectedStatusList(Long.parseLong(dto.getQualityTestPKeyId()), "1");
@@ -1066,7 +999,6 @@ public class TrialSelfInspectionRecordServiceImpl
                         record.setIsSelectedStatus(1);
                     }
                 }
-
                 record.setDetectionResultName(record.getDetectionResult().equals(1) ? "合格" : "不合格");
                 //工程部位及用途名称
                 if (ObjectUtil.isNotEmpty(record.getProjectPosition())) {
@@ -1081,7 +1013,6 @@ public class TrialSelfInspectionRecordServiceImpl
                     }
                 }
             }
-
         } else {
             for (TrialSelfInspectionRecordVO record : records) {
                 record.setDetectionResultName(record.getDetectionResult().equals(1) ? "合格" : "不合格");
@@ -1099,16 +1030,17 @@ public class TrialSelfInspectionRecordServiceImpl
                 }
             }
         }
-
         return trialSelfInspectionRecordVOIPage.setRecords(records);
     }
 
     @Override
     public boolean fileSubmit(TrialFileSubmitDTO dto) throws FileNotFoundException {
+        /**
+         * 在资料填报工序-预览全部pdf时再拼接合并显示,当前只做储存
+         */
         if (ObjectUtil.isEmpty(dto.getType())) {
             throw new ServiceException("请选择一个类型");
-        }
-        if (ObjectUtil.isEmpty(dto.getNodeId())) {
+        } else if (ObjectUtil.isEmpty(dto.getNodeId())) {
             throw new ServiceException("未获取到当前节点信息");
         }
 
@@ -1120,14 +1052,14 @@ public class TrialSelfInspectionRecordServiceImpl
                 .eq(InformationQuery::getType, 1)).stream().findAny().orElse(null);
 
         if (StringUtils.isNotEmpty(dto.getIds())) {
-            if (informationQuery != null && StringUtils.isNotEmpty(informationQuery.getPdfUrl())) {
-
+            if (informationQuery != null) {
                 List<String> pdfList = new ArrayList<>();
-
-                //TODO ------自检------
+                //------自检------
                 if (dto.getType().equals(1)) {
-                    //当前施工pdf
-                    pdfList.add(informationQuery.getPdfUrl());
+                    if (informationQuery.getPdfTrialUrl() != null) {
+                        //如果当前存在第三方、外委的pdf,那么拼接
+                        pdfList.add(informationQuery.getPdfTrialUrl());
+                    }
 
                     //自检pdf
                     List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
@@ -1136,15 +1068,11 @@ public class TrialSelfInspectionRecordServiceImpl
                     List<String> pdfURLs = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
                     pdfList.addAll(pdfURLs);
 
-                    //TODO ------第三方、外委------
+                    //------第三方、外委------
                 } else if (dto.getType().equals(2) || dto.getType().equals(3)) {
-
                     if (informationQuery.getPdfTrialUrl() != null) {
-                        //如果当前存在自检pdf,那么拼接
+                        //如果当前存在试验自检pdf,那么拼接
                         pdfList.add(informationQuery.getPdfTrialUrl());
-                    } else {
-                        //当前施工pdf
-                        pdfList.add(informationQuery.getPdfUrl());
                     }
 
                     //第三方、外委pdf
@@ -1159,11 +1087,10 @@ public class TrialSelfInspectionRecordServiceImpl
                         }
                     }
                     pdfList.addAll(pdfURLs);
-
                 }
 
                 if (pdfList.size() > 0) {
-                    //合并pdf把试验自检记录、第三方、外委的pdf追加到当前质检合同段树节点下的pdf后显示
+                    //合并试验自检、第三方、外委的pdf
                     List<String> collect = pdfList.stream().filter(Objects::nonNull).collect(Collectors.toList());
                     String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
                     String listPdf = filePath + "/pdf/" + informationQuery.getId() + ".pdf";
@@ -1216,14 +1143,12 @@ public class TrialSelfInspectionRecordServiceImpl
                     List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().in(TrialSelfInspectionRecord::getId, ids));
                     List<String> pdfURLs = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
                     pdfList.addAll(pdfURLs);
-
                 }
 
-                if (pdfList.size() > 0) {
-                    //合并pdf把试验自检记录、第三方、外委的pdf追加到当前质检合同段树节点下的pdf后显示
+                if (pdfList.size() > 0 && informationQuery != null) {
+                    //重新合并
                     List<String> collect = pdfList.stream().filter(Objects::nonNull).collect(Collectors.toList());
                     String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-                    assert informationQuery != null;
                     String listPdf = filePath + "/pdf/" + informationQuery.getId() + ".pdf";
                     File tabPDF = ResourceUtil.getFile(listPdf);
                     if (tabPDF.exists()) {
@@ -1232,7 +1157,7 @@ public class TrialSelfInspectionRecordServiceImpl
                     FileUtils.mergePdfPublicMethods(collect, listPdf);
                     BladeFile bladeFile = this.newIOSSClient.uploadFile(informationQuery.getId() + ".pdf", listPdf);
                     if (bladeFile != null) {
-                        //修改当前节点的pdfTrialURL地址
+                        //修改当前节点最新的pdfTrialURL地址
                         if (informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getPdfTrialUrl, bladeFile.getLink()).eq(InformationQuery::getId, informationQuery.getId()))) {
                             for (String recordId : recordIds) {
                                 baseMapper.deleteSeletedStatusByNodeId(dto.getNodeId(), dto.getType(), recordId); //先删除对应记录
@@ -1245,16 +1170,16 @@ public class TrialSelfInspectionRecordServiceImpl
 
             } else {
                 //修改pdfTrialUrl=null
-                assert informationQuery != null;
-                informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getPdfTrialUrl, null).eq(InformationQuery::getId, informationQuery.getId()));
+                if (informationQuery != null) {
+                    informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getPdfTrialUrl, null).eq(InformationQuery::getId, informationQuery.getId()));
+                }
             }
             //删除该类型的所有记录信息
             baseMapper.deleteSeletedStatusByNodeId(dto.getNodeId(), dto.getType(), null);
-
             return true;
         }
-
         return false;
     }
 
+
 }

+ 89 - 20
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -18,6 +18,7 @@ import lombok.SneakyThrows;
 import org.apache.commons.codec.Charsets;
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ObjectUtils;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
@@ -1123,32 +1124,32 @@ public class ExcelTabController extends BladeController {
                                 objs.add(jsonObject);
                             }
 
-                            String checkbox = "<hc-form-checkbox-group @keyup.shift.up='keyupShiftUp' @keyup.shift.down='keyupShiftDown' @keyup.shift.left='keyupShiftLeft' @keyup.shift.right='keyupShiftRight' :objs='" + objs + "'  @change='checkboxGroupChange' @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " placeholder=''> </hc-form-checkbox-group>";
+                            String checkbox = "<hc-form-checkbox-group @keydown.shift.up='keyupShiftUp' @keydown.shift.down='keyupShiftDown' @keydown.shift.left='keyupShiftLeft' @keydown.shift.right='keyupShiftRight' :objs='" + objs + "'  @change='checkboxGroupChange' @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " placeholder=''> </hc-form-checkbox-group>";
                             data.empty().append(checkbox);
 
                         } else {
                             if (index_state) { // 区域内
                                 if (rowspan >= 1) {
-                                    data.empty().append("<el-input type='textarea' @keyup.shift.up='keyupShiftUp' @keyup.shift.down='keyupShiftDown' @keyup.shift.left='keyupShiftLeft'  @keyup.shift.right='keyupShiftRight'  @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%;'   :rows=" + rowspan * 2 + " placeholder=''> </el-input>");
+                                    data.empty().append("<el-input type='textarea' @keydown.shift.up='keyupShiftUp' @keydown.shift.down='keyupShiftDown' @keydown.shift.left='keyupShiftLeft'  @keydown.shift.right='keyupShiftRight'  @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%;'   :rows=" + rowspan * 2 + " placeholder=''> </el-input>");
                                 } else {
-                                    data.empty().append("<el-input type='text' @keyup.shift.up='keyupShiftUp' @keyup.shift.down='keyupShiftDown' @keyup.shift.left='keyupShiftLeft'  @keyup.shift.right='keyupShiftRight'  @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%;' placeholder=''> </el-input>");
+                                    data.empty().append("<el-input type='text' @keydown.shift.up='keyupShiftUp' @keydown.shift.down='keyupShiftDown' @keydown.shift.left='keyupShiftLeft'  @keydown.shift.right='keyupShiftRight'  @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%;' placeholder=''> </el-input>");
                                 }
                             } else { // 区域外
                                 if (j == 0) {
                                     if (colspan == maxCol && i >= 1) {
                                         if (rowspan >= 1) {
-                                            data.empty().append("<el-input @keyup.shift.up='keyupShiftUp' @keyup.shift.down='keyupShiftDown' @keyup.shift.left='keyupShiftLeft' @keyup.shift.right='keyupShiftRight' type='textarea'  @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%;'   :rows=" + rowspan * 2 + " placeholder=''> </el-input>");
+                                            data.empty().append("<el-input @keydown.shift.up='keyupShiftUp' @keydown.shift.down='keyupShiftDown' @keydown.shift.left='keyupShiftLeft' @keydown.shift.right='keyupShiftRight' type='textarea'  @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%;'   :rows=" + rowspan * 2 + " placeholder=''> </el-input>");
                                         } else {
-                                            data.empty().append("<el-input @keyup.shift.up='keyupShiftUp' @keyup.shift.down='keyupShiftDown' @keyup.shift.left='keyupShiftLeft' @keyup.shift.right='keyupShiftRight' type='text' @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%;' placeholder=''> </el-input>");
+                                            data.empty().append("<el-input @keydown.shift.up='keyupShiftUp' @keydown.shift.down='keyupShiftDown' @keydown.shift.left='keyupShiftLeft' @keydown.shift.right='keyupShiftRight' type='text' @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%;' placeholder=''> </el-input>");
                                         }
                                     }
                                 } else {
                                     Element bforData = tds.get(j - 1);
                                     if (!bforData.text().isEmpty() || bforData.html().indexOf("hc-form-checkbox-group") >= 0) {
                                         if (rowspan >= 1) {
-                                            data.empty().append("<el-input @keyup.shift.up='keyupShiftUp' @keyup.shift.down='keyupShiftDown' @keyup.shift.left='keyupShiftLeft' @keyup.shift.right='keyupShiftRight' type='textarea' @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%;'   :rows=" + rowspan * 2 + " placeholder=''> </el-input>");
+                                            data.empty().append("<el-input @keydown.shift.up='keyupShiftUp' @keydown.shift.down='keyupShiftDown' @keydown.shift.left='keyupShiftLeft' @keydown.shift.right='keyupShiftRight' type='textarea' @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%;'   :rows=" + rowspan * 2 + " placeholder=''> </el-input>");
                                         } else {
-                                            data.empty().append("<el-input @keyup.shift.up='keyupShiftUp' @keyup.shift.down='keyupShiftDown' @keyup.shift.left='keyupShiftLeft'  @keyup.shift.right='keyupShiftRight' type='text' @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%;' placeholder=''> </el-input>");
+                                            data.empty().append("<el-input @keydown.shift.up='keyupShiftUp' @keydown.shift.down='keyupShiftDown' @keydown.shift.left='keyupShiftLeft'  @keydown.shift.right='keyupShiftRight' type='text' @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%;' placeholder=''> </el-input>");
                                         }
                                     }
                                 }
@@ -1385,11 +1386,15 @@ public class ExcelTabController extends BladeController {
                 .eq(WbsTreeContract::getContractId, wbsTreeContract.getContractId())
                 .eq(WbsTreeContract::getParentId, wbsTreeContract.getParentId()));
         List<WbsTreeContract> wbsTreeContractList2 = wbsTreeContractList.stream().sorted(Comparator.comparing(WbsTreeContract::getCreateTime).reversed()).collect(Collectors.toList());
+        long tabGroupId = SnowFlakeUtil.getId();
+        // 添加所有
+        wbsTreeContractList2.forEach(WbsTreeContract -> WbsTreeContract.setTabGroupId(tabGroupId));
 
 
         long newPkId = SnowFlakeUtil.getId();
         wbsTreeContract.setPKeyId(newPkId);
         wbsTreeContract.setCreateTime(new Date());
+        wbsTreeContract.setTabGroupId(tabGroupId);
         String nodeName = wbsTreeContractList2.get(0).getNodeName();
 
         if (nodeName.indexOf("__") >= 0) {
@@ -1408,15 +1413,14 @@ public class ExcelTabController extends BladeController {
         String tabName = wbsTreeContract.getInitTableName();
         // 字段查询 并去掉公式字段
 
-        String colkeys = "SELECT GROUP_CONCAT(e_key) as colkeys from m_table_info a ,m_wbs_form_element b WHERE a.tab_en_name = '" + tabName + "' and a.id=b.f_id ";
+        String colkeys = "SELECT GROUP_CONCAT(COLUMN_NAME) as colkeys from information_schema.COLUMNS c where c.table_name='"+tabName+"' and COLUMN_NAME not in('id','p_key_id')";
         Map<String, Object> stringObjectMap = jdbcTemplate.queryForMap(colkeys);
         colkeys = stringObjectMap.get("colkeys") + "";
-
         // 复制表数据
 
         String querySql = "insert into " + tabName + " (id,p_key_id," + colkeys + ") select '" + newPkId + "','" + newPkId + "'," + colkeys + " from " + tabName + " where p_key_id=" + pkeyId;
         jdbcTemplate.execute(querySql);
-
+        wbsTreeContractService.saveBatch(wbsTreeContractList2);
         wbsTreeContractService.save(wbsTreeContract);
         return R.data("成功");
     }
@@ -1514,24 +1518,23 @@ public class ExcelTabController extends BladeController {
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "nodeId", value = "当前节点Id", required = true),
             @ApiImplicitParam(name = "classify", value = "填报的类型(施工或监理)", required = true),
-            @ApiImplicitParam(name = "projectId", value = "项目ID", required = true),
             @ApiImplicitParam(name = "contractId", value = "合同段Id", required = true)
     })
-    public R getpdfs(String nodeId, String classify, String contractId, String projectId) {
-        String sql = "select pdf_url, e_visa_pdf_url,pdf_trial_url from u_information_query  where classify='" + classify + "' and  wbs_id='" + nodeId + "' and contract_id ='" + contractId + "' ";
-
+    public R getPdfS(String nodeId, String classify, String contractId) throws FileNotFoundException {
+        String sql = "select pdf_url,e_visa_pdf_url,pdf_trial_url,pdf_trial_url_position from u_information_query where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id='" + contractId + "'";
         List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
-        if (maps != null && maps.size() >= 1) {
+        if (maps.size() >= 1) {
             Map<String, Object> stringObjectMap = maps.get(0);
             Object pdfUrl = stringObjectMap.get("pdf_url");
             if (stringObjectMap.get("e_visa_pdf_url") != null) {
-                //优先使用电签的PDF
+                //优先使用电签的pdf
                 pdfUrl = stringObjectMap.get("e_visa_pdf_url");
+
             }
 
-            if (stringObjectMap.get("pdf_trial_url") != null) {
-                //优先使用试验合并的PDF
-                pdfUrl = stringObjectMap.get("pdf_trial_url");
+            if (stringObjectMap.get("pdf_trial_url") != null || stringObjectMap.get("pdf_trial_url_position") != null) {
+                //合并试验关联文件、试验工程部位信息的pdf
+                pdfUrl = this.mergePdfShow(pdfUrl, stringObjectMap);
             }
 
             if (StringUtils.isEmpty(pdfUrl + "")) {
@@ -1540,10 +1543,47 @@ public class ExcelTabController extends BladeController {
                 return R.data(pdfUrl);
             }
         } else {
-            return R.fail("无历史数据预览,请保存数据");
+            return R.fail("无历史数据预览,请保存数据");
+        }
+    }
+
+    /**
+     * 合并pdf展示
+     */
+    private Object mergePdfShow(Object oldPdfUrl, Map<String, Object> stringObjectMap) throws FileNotFoundException {
+        Object pdfUrl = "";
+        List<String> pdfList = new ArrayList<>();
+        //施工填报的原始pdf
+        pdfList.add(oldPdfUrl.toString());
+        //关联试验的pdf
+        Object pdfTrialUrl = stringObjectMap.get("pdf_trial_url");
+        Object pdfTrialUrlPosition = stringObjectMap.get("pdf_trial_url_position");
+        if (pdfTrialUrl != null) {
+            pdfList.add(pdfTrialUrl.toString());
+        }
+        if (pdfTrialUrlPosition != null) {
+            pdfList.add(pdfTrialUrlPosition.toString());
+        }
+        //合并
+        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())) {
+                pdfUrl = bladeFile.getLink();
+            }
         }
+        return pdfUrl;
     }
 
+
     /**
      * 用户端删除复制信息表
      */
@@ -1563,17 +1603,46 @@ public class ExcelTabController extends BladeController {
     @ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存")
     public R<String> saveBussData(@Valid @RequestBody JSONObject dataInfo, BladeUser bladeUser) throws Exception {
         JSONArray dataArray = new JSONArray();
+
         if (dataInfo.containsKey("dataInfo")) { // 节点保存
             JSONObject jsonObject = dataInfo.getJSONObject("dataInfo");
             dataArray = jsonObject.getJSONArray("orderList");
         } else { // 单个保存
             dataArray.add(dataInfo);
         }
+
         JSONObject tableInfo1 = dataArray.getJSONObject(0);
         String nodeid = tableInfo1.getString("nodeId");
         String contractId = tableInfo1.getString("contractId");
         String projectId = tableInfo1.getString("projectId");
         String classify = tableInfo1.getString("classify");
+        String groupId = tableInfo1.getString("tabGroupId");
+        String pkeyId = tableInfo1.getString("pkeyId");
+
+        //
+        String pkeyIds = pkeyId;
+        String groupIds = groupId;
+        for(int i=1;i<dataArray.size();i++){
+            JSONObject jsonObject = dataArray.getJSONObject(i);
+            pkeyIds +=","+ jsonObject.getString("pkeyId");;
+            groupIds +=","+ jsonObject.getString("tabGroupId");;
+        }
+        if(StringUtils.isNotEmpty(groupIds)){
+            List<WbsTreeContract> wbsTreeContractList = this.wbsTreeContractService.getBaseMapper().selectList(
+                    Wrappers.<WbsTreeContract>lambdaQuery()
+                            .in(WbsTreeContract::getTabGroupId, groupIds)
+                            .notIn(WbsTreeContract::getPKeyId,pkeyIds)
+                            .eq(WbsTreeContract::getIsDeleted,BladeConstant.DB_NOT_DELETED)
+            );
+            if(wbsTreeContractList!=null && wbsTreeContractList.size()>=1){
+                for(WbsTreeContract data: wbsTreeContractList){
+                     R bussDataInfo = this.getBussDataInfo(data.getPKeyId());
+                     Object data1 = bussDataInfo.getData();
+                    dataArray.add(data1);
+                }
+            }
+        }
+
         List<TableInfo> tableInfoList = this.excelTabService.getTableInfoList(dataArray);
         try {
             this.excelTabService.formulaFillData(tableInfoList, Long.parseLong(nodeid));

+ 7 - 7
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/TextdictInfoController.java

@@ -257,12 +257,12 @@ public class TextdictInfoController extends BladeController {
 
         String vmode = "formData." + keyname;
         if (textdictInfo.getTextId().equals("input")) { // 文本框
-            element.empty().append("<el-input type='text'  @keyup.shift.up='keyupShiftUp' @keyup.shift.down='keyupShiftDown' @keyup.shift.left='keyupShiftLeft' @keyup.shift.right='keyupShiftRight' v-model=" + vmode + " placeholder=" + placeholder + " keyname=" + keyname + " weighing=" + weighing + "  @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%' > </el-input>");
+            element.empty().append("<el-input type='text' id=" + keyname + " @keydown.shift.up='keyupShiftUp' @keydown.shift.down='keyupShiftDown' @keydown.shift.left='keyupShiftLeft' @keydown.shift.right='keyupShiftRight' v-model=" + vmode + " placeholder=" + placeholder + " keyname=" + keyname + " weighing=" + weighing + "  @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%' > </el-input>");
         } else if (textdictInfo.getTextId().equals("textarea")) { // 文本域
             int rowspan = element.attr("ROWSPAN").equals("") ? 0 : Integer.parseInt(element.attr("ROWSPAN"));
-            element.empty().append("<el-input :rows=" + rowspan * 2 + "  @keyup.shift.up='keyupShiftUp' @keyup.shift.down='keyupShiftDown' @keyup.shift.left='keyupShiftLeft' @keyup.shift.right='keyupShiftRight'  type='textarea' placeholder=" + placeholder + " v-model=" + vmode + "    keyname=" + keyname + " weighing=" + weighing + "  @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%'  > </el-input>");
+            element.empty().append("<el-input :rows=" + rowspan * 2 + " id=" + keyname + " @keydown.shift.up='keyupShiftUp' @keydown.shift.down='keyupShiftDown' @keydown.shift.left='keyupShiftLeft' @keydown.shift.right='keyupShiftRight'  type='textarea' placeholder=" + placeholder + " v-model=" + vmode + "    keyname=" + keyname + " weighing=" + weighing + "  @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%'  > </el-input>");
         } else if (textdictInfo.getTextId().equals("select")) { // 下拉框
-            String selectText = " <el-select v-model=" + vmode + " @keyup.shift.up='keyupShiftUp' @keyup.shift.down='keyupShiftDown' @keyup.shift.left='keyupShiftLeft' @keyup.shift.right='keyupShiftRight' keyname=" + keyname + " weighing=" + weighing + " placeholder=" + placeholder + " trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + ">"; //v-model="+keyname+"
+            String selectText = " <el-select id=" + keyname + " v-model=" + vmode + " @keydown.shift.up='keyupShiftUp' @keydown.shift.down='keyupShiftDown' @keydown.shift.left='keyupShiftLeft' @keydown.shift.right='keyupShiftRight' keyname=" + keyname + " weighing=" + weighing + " placeholder=" + placeholder + " trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + ">"; //v-model="+keyname+"
             List<TextdictInfo_vo> optionList = textdictInfo.getTextInfo();
             if (optionList != null && optionList.size() >= 1) {
                 for (int i = 0; i < optionList.size(); i++)
@@ -272,7 +272,7 @@ public class TextdictInfoController extends BladeController {
             element.empty().append(selectText);
         } else if (textdictInfo.getTextId().equals("radio")) { // 单选按钮
 
-            String radioText = "<el-radio-group @keyup.shift.up='keyupShiftUp' @keyup.shift.down='keyupShiftDown' @keyup.shift.left='keyupShiftLeft' @keyup.shift.right='keyupShiftRight'  v-model=" + vmode + " keyname=" + keyname + " weighing=" + weighing + " placeholder=" + placeholder + " trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + ">";
+            String radioText = "<el-radio-group id=" + keyname + " @keyDowns='dateKeydown' v-model=" + vmode + " keyname=" + keyname + " weighing=" + weighing + " placeholder=" + placeholder + " trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + ">";
             List<TextdictInfo_vo> optionList = textdictInfo.getTextInfo();
             if (optionList != null && optionList.size() >= 1) {
                 for (int i = 0; i < optionList.size(); i++)
@@ -290,7 +290,7 @@ public class TextdictInfoController extends BladeController {
                     jsonObject.put("name", optionList.get(i).getDictValue());
                     objs.add(jsonObject);
                 }
-                String checkbox = "<hc-form-checkbox-group  @keyup.shift.up='keyupShiftUp' @keyup.shift.down='keyupShiftDown' @keyup.shift.left='keyupShiftLeft' @keyup.shift.right='keyupShiftRight' :objs='" + objs + "'  @change='checkboxGroupChange' :val=" + vmode + " v-model=" + vmode + " keyname=" + keyname + " weighing=" + weighing + " placeholder=" + placeholder + " trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + "> </hc-form-checkbox-group>";
+                String checkbox = "<hc-form-checkbox-group   @keyDowns='dateKeydown' :objs='" + objs + "'  @change='checkboxGroupChange' :val=" + vmode + " v-model=" + vmode + " keyname=" + keyname + " weighing=" + weighing + " placeholder=" + placeholder + " trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + "> </hc-form-checkbox-group>";
                 element.empty().append(checkbox);
             }
         } else if (textdictInfo.getTextId().equals("date")) { // 日期--年月日时分秒
@@ -313,9 +313,9 @@ public class TextdictInfoController extends BladeController {
             element.children().get(0).attr("@change", "datePickerChange($event,'" + keyname + "')");
 
         } else if (textdictInfo.getTextId().equals("img")) {
-            element.empty().append("<hc-table-form-upload @keyup.shift.up='keyupShiftUp' @keyup.shift.down='keyupShiftDown' @keyup.shift.left='keyupShiftLeft' @keyup.shift.right='keyupShiftRight'  :src='" + vmode + "' placeholder=" + placeholder + " v-model=" + vmode + "  keyName=" + keyname + " weighing=" + weighing + "  @success='formUploadSuccess' @del='delTableFormFile' trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + "></hc-table-form-upload> ");
+            element.empty().append("<hc-table-form-upload @keydown.shift.up='keyupShiftUp' @keydown.shift.down='keyupShiftDown' @keydown.shift.left='keyupShiftLeft' @keydown.shift.right='keyupShiftRight'  :src='" + vmode + "' placeholder=" + placeholder + " v-model=" + vmode + "  keyName=" + keyname + " weighing=" + weighing + "  @success='formUploadSuccess' @del='delTableFormFile' trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + "></hc-table-form-upload> ");
         } else if (textdictInfo.getTextId().equals("searchSelect")) { //搜索框
-            element.empty().append("<hc-form-select-search @keyup.shift.up='keyupShiftUp' @keyup.shift.down='keyupShiftDown' @keyup.shift.left='keyupShiftLeft' @keyup.shift.right='keyupShiftRight' type='dap_site_data' :val=" + vmode + " contractId=''  pkeyId='' @change='formRemoteChange' v-model=" + vmode + " placeholder=" + placeholder + " keyname=" + keyname + " weighing=" + weighing + "  @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%' > </hc-form-select-search>");
+            element.empty().append("<hc-form-select-search id=" + keyname + " @keydown.shift.up='keyupShiftUp' @keydown.shift.down='keyupShiftDown' @keydown.shift.left='keyupShiftLeft' @keydown.shift.right='keyupShiftRight' type='dap_site_data' :val=" + vmode + " contractId=''  pkeyId='' @change='formRemoteChange' v-model=" + vmode + " placeholder=" + placeholder + " keyname=" + keyname + " weighing=" + weighing + "  @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%' > </hc-form-select-search>");
         }
         element.attr("@click", "getInformation(" + oncklickText + ")");
         File writefile = new File(wbsTreePrivate.getHtmlUrl());

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsFormElementController.java

@@ -189,7 +189,7 @@ public class WbsFormElementController extends BladeController {
 
 
     /**
-     * 提交清表关联公有Wbs树并创建元素
+     * 提交@keydown公有Wbs树并创建元素
      */
     @ApiOperationSupport(order = 11)
     @ApiOperation(value = "提交清表关联公有Wbs树并创建元素", notes = "节点id、表名、元素DTO")

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

@@ -639,6 +639,11 @@ public class WbsTreePrivateController extends BladeController {
                     treePrivate.setIsBussShow(record.getIsBussShow());
                     treePrivate.setIsTabPdf(record.getIsTabPdf());
                     treePrivate.setTabFileType(record.getIsTabFileType());
+                } else {
+                    treePrivate.setPdfUrl(null);
+                    treePrivate.setIsBussShow(1);
+                    treePrivate.setIsTabPdf(1);
+                    treePrivate.setTabFileType(1);
                 }
 
                 //表单数据

+ 28 - 47
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ExcelTabClientImpl.java

@@ -51,15 +51,17 @@ public class ExcelTabClientImpl implements ExcelTabClient {
         String nodeId = table.getString("nodeId");
         String projectId = table.getString("projectId");
         String contractId = table.getString("contractId");
-
         List<TableInfo> tableInfoList = this.excelTabService.getTableInfoList(dataArray);
-
         String pdfUrl = "";
 
-        //TODO ------入库-试验填报数据,当前记录id作为groupId------
+        /**
+         * ------试验填报数据保存,当前记录id作为groupId------
+         */
         this.excelTabService.saveOrUpdateInfoTrial(tableInfoList, id);
 
-        //TODO ------公式填充------
+        /**
+         * ------公式填充------
+         */
         try {
             this.excelTabService.formulaFillData(tableInfoList, Long.parseLong(nodeId));
         } catch (Exception e) {
@@ -67,7 +69,9 @@ public class ExcelTabClientImpl implements ExcelTabClient {
         }
 
         if (isBatchSave == 0) {
-            //TODO ------单表PDF保存------
+            /**
+             * ------单表PDF保存------
+             */
             TableInfo tableInfo = tableInfoList.stream().findAny().orElse(null);
             assert tableInfo != null;
             if (tabIds.contains(tableInfo.getPkeyId())) {
@@ -80,22 +84,21 @@ public class ExcelTabClientImpl implements ExcelTabClient {
                 List<String> pdfList = query.stream().map(TrialSelfDataRecord::getPdfUrl).collect(Collectors.toList());
 
                 String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-                String pdfPath2 = file_path + "/pdf//" + id + "_2.pdf";
-                File tabPdf2 = ResourceUtil.getFile(pdfPath2);
-                if (tabPdf2.exists()) {
-                    tabPdf2.delete();
+                String pdfPath = file_path + "/pdf//" + id + "_2.pdf";
+                File tabPdf = ResourceUtil.getFile(pdfPath);
+                if (tabPdf.exists()) {
+                    tabPdf.delete();
                 }
-                FileUtils.mergePdfPublicMethods(pdfList, pdfPath2);
-                BladeFile bladeFile = newIOSSClient.uploadFile(id + "2.pdf", pdfPath2);
+                FileUtils.mergePdfPublicMethods(pdfList, pdfPath);
+                BladeFile bladeFile = newIOSSClient.uploadFile(id + "2.pdf", pdfPath);
 
                 String sqlUpdate = "update u_trial_self_inspection_record set pdf_url = '" + bladeFile.getLink() + "' where id = " + id;
                 jdbcTemplate.execute(sqlUpdate);
 
-                //获取试验记录id的试验项目名称
+                //获取试验记录id的试验项目名称,重新合并pdf集合(解决单表保存后上报找不到题名问题)
                 String sql2 = "select trial_project_name from u_trial_self_inspection_record where id = " + id;
                 TrialSelfInspectionRecord obj = jdbcTemplate.query(sql2, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class)).stream().findAny().orElse(null);
                 assert obj != null;
-                //重新合并pdf集合(解决单表保存后上报找不到题名问题)
                 String querySql = "select id from u_information_query where classify ='" + type + "' and wbs_id ='" + id + "' and contract_id ='" + contractId + "'";
                 List<InformationQuery> query2 = jdbcTemplate.query(querySql, new BeanPropertyRowMapper<>(InformationQuery.class));
                 if (query2.size() > 0) {
@@ -104,34 +107,20 @@ public class ExcelTabClientImpl implements ExcelTabClient {
                 } else {
                     informationQueryClient.saveData(id.toString(), projectId, contractId, type.toString(), bladeFile.getLink(), obj.getTrialProjectName());
                 }
-
-                //修改原材料检测报告原始pdfUrl
-                String sql3 = "select id from u_trial_raw_material_self_record where self_record_id =" + id;
-                TrialRawMaterialSelfRecord record = jdbcTemplate.query(sql3, new BeanPropertyRowMapper<>(TrialRawMaterialSelfRecord.class)).stream().findAny().orElse(null);
-                if (ObjectUtil.isNotEmpty(record)) {
-                    String sqlUpdate2 = "update u_trial_raw_material_self_record set old_pdf_url = '" + bladeFile.getLink() + "' where self_record_id =" + id;
-                    jdbcTemplate.execute(sqlUpdate2);
-                }
             }
 
         } else if (isBatchSave == 1) {
-            //TODO ------多表PDF保存------
-            pdfUrl = excelTabService.getBussPDFSTrial(nodeId,
-                    tableType, //tableType=表类型 1=记录表 2=报告单
-                    String.valueOf(type), //type=所属方 1=施工质检 2=监理抽检
-                    contractId, //合同段id
-                    projectId, //项目id
-                    id,  //记录id
-                    tabIds //新增的表的pKeyIds
-            );
-
-            //TODO ------修改原材料检测报告原始pdfUrl------
-            String sql = "select id from u_trial_raw_material_self_record where self_record_id =" + id;
-            TrialRawMaterialSelfRecord record = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TrialRawMaterialSelfRecord.class)).stream().findAny().orElse(null);
-            if (ObjectUtil.isNotEmpty(record)) {
-                String sqlUpdate = "update u_trial_raw_material_self_record set old_pdf_url = '" + pdfUrl + "' where self_record_id =" + id;
-                jdbcTemplate.execute(sqlUpdate);
-            }
+            /**
+             * ------多表PDF保存------
+             * tableType=表类型 1=记录表 2=报告单
+             * type=所属方 1=施工质检 2=监理抽检
+             * contractId=合同段id
+             * projectId=项目id
+             * id=记录id
+             * tabIds=表的pKeyIds
+             */
+            pdfUrl = excelTabService.getBussPDFSTrial(nodeId, tableType, String.valueOf(type), contractId, projectId, id, tabIds);
+
         }
         return pdfUrl;
     }
@@ -143,15 +132,7 @@ public class ExcelTabClientImpl implements ExcelTabClient {
 
     @Override
     public String getBussPDFSTrial(String nodeId, String tableType, String classify, String contractId, String projectId, String id, String tabIds) throws Exception {
-        //合并PDF加载
-        return excelTabService.getBussPDFSTrial(nodeId,
-                tableType, //tableType=表类型 1=记录表 2=报告单
-                classify, //type=所属方 1=施工质检 2=监理抽检
-                contractId, //合同段id
-                projectId, //项目id
-                Long.parseLong(id), //记录id
-                tabIds //新增的表的pKeyIds
-        );
+        return excelTabService.getBussPDFSTrial(nodeId, tableType, classify, contractId, projectId, Long.parseLong(id), tabIds);
     }
 
 

+ 1 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml

@@ -50,6 +50,7 @@
         <result column="import_matching_info" property="importMatchingInfo"/>
         <result column="is_concealed_works_node" property="isConcealedWorksNode"/>
         <result column="is_ele" property="isEle"/>
+        <result column="tab_group_id" property="tabGroupId"/>
     </resultMap>
 
 

+ 1 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java

@@ -11,6 +11,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
 import java.util.List;
+import java.util.Map;
 
 public interface IWbsTreeContractService extends BaseService<WbsTreeContract> {
 

+ 17 - 57
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -1070,13 +1070,14 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         reData.remove("contractId");
         reData.remove("pkeyId");
         reData.remove("projectId");
+        reData.put("tabGroupId",wbsTreeContract.getTabGroupId());
         return R.data(reData);
     }
 
     @Override
     public R getBussPdfInfo(Long pkeyId) throws Exception {
         String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-        //String file_path = "/Users/hongchuangyanfa/Desktop/";
+       // String file_path = "/Users/hongchuangyanfa/Desktop/";
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
                 .eq(WbsTreeContract::getPKeyId, pkeyId));
 
@@ -1318,7 +1319,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             }
         }
 
-        //  wb.saveToFile(excelPath, ExcelVersion.Version2010);
+        //wb.saveToFile(excelPath, ExcelVersion.Version2010);
         //输出流
         FileOutputStream outputStream = new FileOutputStream(excelPath);
         workbook.write(outputStream);
@@ -1403,41 +1404,25 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             tabpdf2.delete();
         }
 
-        //TODO ------ 试验pdf关联部位工程及信息 liuYC 2023-03-13 ------
-        //获取试验记录id
-        List<String> recordIds = baseMapper.queryTrialRecordId(nodeId).stream().distinct().collect(Collectors.toList());
-        if (recordIds.size() > 0) {
-            String recordInfoSql = "select detection_category,detection_result,task_status,pdf_url from u_trial_self_inspection_record where pdf_url is not null and id in(" + StringUtils.join(recordIds, ",") + ")";
-            List<TrialSelfInspectionRecord> query = jdbcTemplate.query(recordInfoSql, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class));
-            if (query.size() > 0) {
-                //只获取已审批合格自检记录,追加试验pdf到质检后面
-                List<String> pdfUrlsTrail = query.stream().filter(f -> ("已审批").equals(f.getTaskStatus())
-                        && (new Integer(1).equals(f.getDetectionResult()))
-                        && (new Integer(1).equals(f.getDetectionCategory()))).map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
-                if (pdfUrlsTrail.size() > 0) {
-                    data.addAll(pdfUrlsTrail);
-                }
-            }
-        }
-
+        //资料填报原始pdf合并
         FileUtils.mergePdfPublicMethods(data, listPdf);
         BladeFile bladeFile = this.newIOSSClient.uploadFile(nodeId + ".pdf", listPdf);
 
         //获取当前填报节点sort
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, nodeId));
 
-        // 获取顺序
+        //获取顺序
         int sort = 0;
         if (ObjectUtil.isNotEmpty(wbsTreeContract)) {
             if (wbsTreeContract.getSort() != null) {
                 sort = wbsTreeContract.getSort();
             }
         }
+
         String sql = "update u_information_query set pdf_url ='" + bladeFile.getLink() + "' ,sort = " + sort + " where classify='" + classify + "' and  wbs_id='" + nodeId + "' and contract_id ='" + contractId + "' ";
         jdbcTemplate.execute(sql);
     }
 
-
     /**
      * 试验 获取填报信息
      */
@@ -1624,13 +1609,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 
                         if (StringUtils.isNotEmpty(tabVal) && !tabVal.equals("null")) {
 
-                            //处理相同字段名称问题,同一个KeyName,那么拼接value
-                            Object oldValue = reData.get(key);
-                            if (oldValue != null) {
-                                reData.put(key, oldValue + "、" + tabVal);
-                                continue;
-                            }
-
                             //时间段处理
                             if (tabVal.contains("T") && tabVal.contains(".000Z]")) {
                                 String[] tabData = tabVal.split("_\\^_");
@@ -1672,7 +1650,13 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                                 for (String data : mysql) {
                                     String[] tabData = data.split("_\\^_");
                                     if (StringUtils.isNotEmpty(tabData[0])) {
-                                        reData.put(key, tabData[0]);
+                                        //处理相同字段名称问题,同一个KeyName,那么拼接value
+                                        Object oldValue = reData.get(key);
+                                        if (ObjectUtils.isNotEmpty(oldValue)) {
+                                            reData.put(key, oldValue + "、" + tabData[0]);
+                                        } else {
+                                            reData.put(key, tabData[0]);
+                                        }
                                     }
                                 }
                             } else if (tabVal.contains("_^_")) {
@@ -1823,31 +1807,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                                     }
                                 }
 
-                                /*if (myData.contains("T") && myData.contains("-") && myData.contains(":")) {
-                                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
-                                    sdf.setTimeZone(TimeZone.getTimeZone("GTM+8"));
-                                    SimpleDateFormat formatStr = new SimpleDateFormat("yyyy年MM月dd日");
-
-                                    if (myData.contains(",") && myData.contains("]")) {
-                                        myData = myData.replace("[", "").replace("]", "").replaceAll("'", "");
-                                        String[] dataVal = myData.split(",");
-                                        String[] Start_dataStr = dataVal[0].split("T")[0].split("-");
-                                        String StartDate = StringUtil.format("{}年{}月{}日", Start_dataStr[0], Start_dataStr[1], Integer.parseInt(Start_dataStr[2]) + 1).trim();
-
-                                        String[] end_dataStr = dataVal[1].split("T")[0].split("-");
-
-                                        String endDate = StringUtil.format("{}年{}月{}日", end_dataStr[0], end_dataStr[1], Integer.parseInt(end_dataStr[2]) + 1).trim();
-                                        if (StartDate.equals(endDate)) {
-                                            myData = StartDate;
-                                        } else {
-                                            myData = StartDate + "-" + endDate;
-                                        }
-                                    } else {
-                                        String[] dataStr = myData.split("T")[0].split("-");
-                                        myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]) + 1);
-                                    }
-                                }*/
-
                                 if (myData.contains("https") && myData.contains("aliyuncs")) {
                                     BufferedImage image = ImageIO.read(CommonUtil.getOSSInputStream(myData));
                                     int colspan = data.attr("COLSPAN").equals("") ? 0 : Integer.parseInt(data.attr("COLSPAN"));
@@ -1902,9 +1861,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 }
                 // 组装电签设置
                 QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
+                queryWrapper.select("col_key", "id");
                 queryWrapper.eq("type", 2);
                 queryWrapper.eq("tab_id", wbsTreePrivate.getPKeyId());
-
                 List<TextdictInfo> textDictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
                 if (textDictInfos != null && !textDictInfos.isEmpty()) {
                     for (TextdictInfo e : textDictInfos) {
@@ -2005,7 +1964,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         List<WbsTreePrivate> recordTable = queryList.stream().filter(f -> f.getTableType() == 1).collect(Collectors.toList());
         if (queryList.size() > 0) {
             for (WbsTreePrivate report : reportTable) {
-                if (StringUtils.isNotEmpty(report.getHtmlUrl())) { //没有excel表单的不生成pdf
+                //没有excel表单的不生成pdf
+                if (StringUtils.isNotEmpty(report.getHtmlUrl())) {
                     //生成报告单pdf
                     String bussPdfInfo = this.getBussPDFTrial(report.getPKeyId(), contractId, id);
                     if (StringUtils.isNotEmpty(bussPdfInfo)) {
@@ -2014,7 +1974,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 }
             }
             for (WbsTreePrivate record : recordTable) {
-                if (StringUtils.isNotEmpty(record.getHtmlUrl())) { //没有excel表单的不生成pdf
+                if (StringUtils.isNotEmpty(record.getHtmlUrl())) {
                     //生成记录表pdf
                     String bussPdfInfo = this.getBussPDFTrial(record.getPKeyId(), contractId, id);
                     if (StringUtils.isNotEmpty(bussPdfInfo)) {