浏览代码

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

yangyj 2 年之前
父节点
当前提交
d46071455f
共有 19 个文件被更改,包括 349 次插入111 次删除
  1. 27 17
      blade-service/blade-business/src/main/java/org/springblade/business/controller/NeiYeController.java
  2. 17 0
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java
  3. 1 1
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialMaterialController.java
  4. 2 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TaskMapper.java
  5. 7 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TaskMapper.xml
  6. 1 1
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSelfInspectionRecordMapper.java
  7. 3 2
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSelfInspectionRecordMapper.xml
  8. 5 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITaskService.java
  9. 8 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java
  10. 9 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialContainerClassificationServiceImpl.java
  11. 1 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceOverhaulServiceImpl.java
  12. 2 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceUseServiceImpl.java
  13. 18 19
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialMaterialMobilizationServiceImpl.java
  14. 9 6
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSampleInfoServiceImpl.java
  15. 47 4
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java
  16. 1 1
      blade-service/blade-business/src/main/java/org/springblade/business/utils/FileUtils.java
  17. 136 59
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/FirstController.java
  18. 47 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java
  19. 8 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

+ 27 - 17
blade-service/blade-business/src/main/java/org/springblade/business/controller/NeiYeController.java

@@ -103,6 +103,16 @@ public class NeiYeController {
                 if (queryDataResult.size() <= 0){
                     return R.data(300, null, "未查询到数据");
                 }
+                //审批状态
+                String taskStatus = queryVO.getTaskStatus();
+                if (!"".equals(taskStatus) && !"null".equals(taskStatus) && taskStatus != null) {
+                    Integer status = Integer.parseInt(taskStatus) - 1;
+                    queryDataResult = queryDataResult.stream()
+                            .filter(qdr->status.equals(qdr.getStatus())).collect(Collectors.toList());
+                }
+                if (queryDataResult.size() <= 0){
+                    return R.data(300, null, "未查询到数据");
+                }
                 //分组
                 List<List<QueryProcessDataVO>> groupList = CommonUtil.getBatchSize(queryDataResult, queryVO.getSize());
                 List<QueryProcessDataVO> groupQueryList = groupList.get(queryVO.getCurrent() == 0 ? 0 : queryVO.getCurrent() - 1);
@@ -138,22 +148,22 @@ public class NeiYeController {
                     }
                     //todo 当前缺少是否关联评定、是否关联试验 =================================
                     //过滤输入框条件
-                String queryStr = queryVO.getQueryStr();
-                if (!"".equals(queryStr) && !"null".equals(queryStr) && queryStr != null){
-                    if (!map.get("unitProject").toUpperCase().contains(queryStr.toUpperCase())){
-                        continue;
-                    }
-                }
-                    //审批状态
-                    String taskStatus = queryVO.getTaskStatus();
-                    if (!"".equals(taskStatus) && !"null".equals(taskStatus) && taskStatus != null) {
-                        String status = Integer.parseInt(taskStatus) - 1 + "";
-                        if (vo.getStatus() == null){
-                            vo.setStatus(0);
-                        }
-                        if (!status.equals(vo.getStatus()+"")){
+                    String queryStr = queryVO.getQueryStr();
+                    if (!"".equals(queryStr) && !"null".equals(queryStr) && queryStr != null){
+                        StringBuilder str = new StringBuilder();
+                        str.append(map.get("unitProject"));
+                        if (map.get("partProject") != null && map.get("partProject")!= "")
+                            str.append(map.get("partProject"));
+                        if (map.get("partChildProject") != null && map.get("partChildProject")!= "")
+                            str.append(map.get("partChildProject"));
+                        if (map.get("subentryProject") != null && map.get("subentryProject")!= "")
+                            str.append(map.get("subentryProject"));
+                        if (map.get("subentryChildProject") != null && map.get("subentryChildProject")!= "")
+                            str.append(map.get("subentryChildProject"));
+                        if (  vo.getTitle() != null &&   vo.getTitle()!= "")
+                            str.append(vo.getTitle());
+                        if (!str.toString().toUpperCase().contains(queryStr.toUpperCase()))
                             continue;
-                        }
                     }
                     //上报批次
                     if (vo.getInformationQueryId() != null){
@@ -161,7 +171,7 @@ public class NeiYeController {
                         Task task;
                         if (tasks == null || tasks.size() <= 0){
                             task = new Task();
-                            task.setBatch(-1);
+                            task.setBatch(0);
                         }else {
                             tasks = tasks.stream().sorted(Comparator.comparing(e -> e.getCreateTime())).collect(Collectors.toList());
                             task = tasks.get(tasks.size() - 1);
@@ -175,7 +185,7 @@ public class NeiYeController {
                             }
                         }
                     }else {
-                        map.put("reportNumber","-1");
+                        map.put("reportNumber","0");
                     }
                     //新增列表数据
                     neiYeLedgerVOList.add(new NeiYeLedgerVO(map.get("unitProject"),

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

@@ -332,6 +332,23 @@ public class TaskController extends BladeController {
 		return R.data(this.taskService.queryBatchList(projectId, contractId));
 	}
 
+	/**
+	 * 获取当前合同段有哪些上报批次
+	 * @param projectId 项目ID
+	 * @param contractId 合同段ID
+	 */
+	@GetMapping("/query-batch-list-two")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "获取当前合同段的上报批次")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "projectId", value = "项目ID", required = true),
+			@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
+	})
+	public R<List<String>> queryBatchListTwo(String projectId, String contractId){
+		return R.data(this.taskService.queryBatchListTwo(projectId, contractId));
+	}
+
+
 	/**
 	 * 获取任务类型或任务状态
 	 */

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

@@ -42,7 +42,7 @@ public class TrialMaterialController extends BladeController {
 
     @GetMapping("/mobilization/verification")
     @ApiOperationSupport(order = 1)
-    @ApiOperation(value = "进场材料校验编号唯一", notes = "传入materialNumber")
+    @ApiOperation(value = "进场材料校验编号唯一", notes = "传入materialNumber,id")
     public R<Object> mobilizationVerification(@Valid @RequestParam String materialNumber, @RequestParam String id) {
         return R.data(iTrialMaterialMobilizationService.mobilizationVerification(materialNumber, id));
     }

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

@@ -34,4 +34,6 @@ public interface TaskMapper extends BaseMapper<Task> {
 
     List<Task> queryBatchList(@Param("projectId") String projectId, @Param("contractId") String contractId);
 
+    List<String> queryBatchListTwo(@Param("projectId") String projectId, @Param("contractId") String contractId);
+
 }

+ 7 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TaskMapper.xml

@@ -50,5 +50,12 @@
         </if>
         group by batch
     </select>
+    <select id="queryBatchListTwo" resultType="java.lang.String">
+        select DISTINCT batch from u_task where is_deleted = 0 and status in (1,2) and project_id = #{projectId}
+        <if test="contractId != null and contractId != ''">
+            and contract_id = #{contractId}
+        </if>
+        order by batch
+    </select>
 
 </mapper>

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

@@ -9,7 +9,7 @@ import java.util.List;
 
 public interface TrialSelfInspectionRecordMapper extends BaseMapper<TrialSelfInspectionRecord> {
 
-    List<TrialSelfInspectionRecord> selectAll(Long nodeId);
+    List<TrialSelfInspectionRecord> selectAll(Long nodeId,Long contractId);
 
     void saveSelfSample(Long id, Long selfId, String samplingId);
 

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

@@ -64,7 +64,7 @@
     </delete>
 
     <select id="selectAll" resultType="org.springblade.business.entity.TrialSelfInspectionRecord">
-        select * from u_trial_self_inspection_record where node_id = #{nodeId}
+        select * from u_trial_self_inspection_record where node_id = #{nodeId} and contract_id = #{contractId}
     </select>
 
     <select id="selectSelfSampleRecord" resultType="java.lang.String">
@@ -95,7 +95,8 @@
         select record_id from u_trial_file_pdf_record where node_id = #{nodeId} and `type` != #{type}
     </select>
 
-    <select id="selectWbsTreeContractListByPKeyIds" resultType="org.springblade.manager.entity.WbsTreeContract" parameterType="java.util.List">
+    <select id="selectWbsTreeContractListByPKeyIds" resultType="org.springblade.manager.entity.WbsTreeContract"
+            parameterType="java.util.List">
         select node_name from m_wbs_tree_contract
         <where>
             <if test="idList.size()>0">

+ 5 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/ITaskService.java

@@ -67,4 +67,9 @@ public interface ITaskService extends BaseService<Task> {
      */
     Map<String,String> getTaskCount(String projectId, String contractId, String userId);
 
+    /**
+     * 获取当前合同段有哪些上报批次
+     */
+    List<String> queryBatchListTwo(String projectId, String contractId);
+
 }

+ 8 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -332,6 +332,14 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         return map;
     }
 
+    /**
+     * 获取当前合同段有哪些上报批次
+     */
+    @Override
+    public List<String> queryBatchListTwo(String projectId, String contractId) {
+        return baseMapper.queryBatchListTwo(projectId,contractId);
+    }
+
     @Override
     public List<Task> queryBatchList(String projectId, String contract) {
         return this.baseMapper.queryBatchList(projectId, contract);

+ 9 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialContainerClassificationServiceImpl.java

@@ -223,6 +223,15 @@ public class TrialContainerClassificationServiceImpl
             //全部查询
             hashMaps = baseMapper.selectLikeByFieldKey2(trialContainerClassification.getContainerInitTabName(), current, size);
         }
+        for (HashMap<Object, Object> hashMap : hashMaps) {
+            for (Map.Entry<Object, Object> objectObjectEntry : hashMap.entrySet()) {
+                if (objectObjectEntry.getKey().equals("field_calibration_time")) {
+                    String s = objectObjectEntry.getValue().toString();
+                    String s1 = s.split(" ")[0];
+                    objectObjectEntry.setValue(s1);
+                }
+            }
+        }
         return page.setRecords(hashMaps);
     }
 

+ 1 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceOverhaulServiceImpl.java

@@ -204,6 +204,7 @@ public class TrialDeviceOverhaulServiceImpl extends BaseServiceImpl<TrialDeviceO
                 for (TrialDeviceClassification classification : deviceClassificationList) {
                     if (classification.getId().equals(pdfDatum.getDeviceClassId())) {
                         PDFUtil.createTableCell(classification.getClassName(), textFont, table, lineHeight, colSpan);
+                        break;
                     }
                 }
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getDeviceNumber()) ? pdfDatum.getDeviceNumber() : "", textFont, table, lineHeight, colSpan);

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

@@ -216,6 +216,7 @@ public class TrialDeviceUseServiceImpl extends BaseServiceImpl<TrialDeviceUseMap
                 for (TrialDeviceClassification classification : deviceClassificationList) {
                     if (classification.getId().equals(pdfDatum.getDeviceClassId())) {
                         PDFUtil.createTableCell(classification.getClassName(), textFont, table, lineHeight, colSpan);
+                        break;
                     }
                 }
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getDeviceNumber()) ? pdfDatum.getDeviceNumber() : "", textFont, table, lineHeight, colSpan);
@@ -226,6 +227,7 @@ public class TrialDeviceUseServiceImpl extends BaseServiceImpl<TrialDeviceUseMap
                 for (WbsTreePrivate wbsTreePrivate : wbsTreePrivates) {
                     if (pdfDatum.getNodeId().equals(wbsTreePrivate.getPKeyId())) {
                         PDFUtil.createTableCell(wbsTreePrivate.getNodeName(), textFont, table, lineHeight, colSpan);
+                        break;
                     }
                 }
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getSpecificationNumber()) ? pdfDatum.getSpecificationNumber() : "", textFont, table, lineHeight, colSpan);

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

@@ -36,6 +36,7 @@ import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.*;
+import org.springblade.manager.vo.ImportContractNodeVO;
 import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.system.entity.Dict;
 import org.springblade.system.feign.IDictClient;
@@ -45,8 +46,7 @@ import org.springframework.stereotype.Service;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
@@ -121,7 +121,7 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
                     .or().like(TrialMaterialMobilization::getSpecificationModel, obj.getQueryValue())
                     .or().like(TrialMaterialMobilization::getMaterialNumber, obj.getQueryValue()));
         }
-        IPage<TrialMaterialMobilization> pages = this.page(page, queryWrapper.lambda().orderBy(true, true, TrialMaterialMobilization::getCreateTime));
+        IPage<TrialMaterialMobilization> pages = this.page(page, queryWrapper.lambda().orderBy(true, true, TrialMaterialMobilization::getMobilizationDate));
 
         IPage<TrialMaterialMobilizationVO> trialMaterialMobilizationVOIPage = TrialMaterialMobilizationWarpper.build().pageVO(pages);
         List<TrialMaterialMobilizationVO> records = trialMaterialMobilizationVOIPage.getRecords();
@@ -168,7 +168,9 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
             response.setHeader("Content-Disposition", "inline; filename=" + java.net.URLEncoder.encode(fileName, "UTF-8"));
 
             //构造数据
-            List<TrialMaterialMobilization> list = baseMapper.selectBatchIds(Func.toLongList(ids));
+            List<TrialMaterialMobilization> list = baseMapper.selectBatchIds(Func.toLongList(ids)).stream()
+                    .sorted(Comparator.comparing(TrialMaterialMobilization::getMobilizationDate, Comparator.nullsLast(Date::compareTo))).collect(Collectors.toList());
+            List<TrialMaterialMobilizationVO> pdfData = BeanUtil.copyProperties(list, TrialMaterialMobilizationVO.class);
 
             //材料类型
             R<List<Dict>> typeList = iDictClient.getList("material_type");
@@ -186,18 +188,6 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
                 }
             }
 
-            List<TrialMaterialMobilizationVO> pdfData = new ArrayList<>();
-            for (TrialMaterialMobilization trialMaterialMobilization : list) {
-                for (User user : userList) {
-                    if (trialMaterialMobilization.getUserId().equals(user.getId())) {
-                        TrialMaterialMobilizationVO trialMaterialMobilizationVO = BeanUtil.copyProperties(trialMaterialMobilization, TrialMaterialMobilizationVO.class);
-                        assert trialMaterialMobilizationVO != null;
-                        trialMaterialMobilizationVO.setUserName(user.getName());
-                        pdfData.add(trialMaterialMobilizationVO);
-                    }
-                }
-            }
-
             //创建文档,设置页面大小、左右上下边距
             Document document = new Document();
             BaseFont bfChinese = null;
@@ -274,21 +264,30 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getMaterialNumber()) ? pdfDatum.getMaterialNumber() : "", textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getMobilizationDate()) ? DateUtil.formatDate(pdfDatum.getMobilizationDate()) : "", textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getMaterialName()) ? pdfDatum.getMaterialName() : "", textFont, table, lineHeight, colSpan);
+
                 for (Dict type : typeList.getData()) {
                     if (type.getDictKey().equals(pdfDatum.getMaterialType().toString())) {
-                        PDFUtil.createTableCell(type.getDictValue(), textFont, table, lineHeight, colSpan);
+                        PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getMaterialType()) ? pdfDatum.getMaterialType().toString() : type.getDictValue(), textFont, table, lineHeight, colSpan);
+                        break;
                     }
                 }
+
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getSpecificationModel()) ? pdfDatum.getSpecificationModel() : "", textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getSupplierUnit()) ? pdfDatum.getSupplierUnit() : "", textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getMaterialPrice()) ? pdfDatum.getMaterialPrice().toString() : "", textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getMaterialCount()) ? pdfDatum.getMaterialCount().toString() : "", textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getCalculationUnit()) ? pdfDatum.getCalculationUnit() : "", textFont, table, lineHeight, colSpan);
-                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getBatchNumber()) ? pdfDatum.getBatchNumber().toString() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getBatchNumber()) ? pdfDatum.getBatchNumber() : "", textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getPlaceOfProduction()) ? pdfDatum.getPlaceOfProduction() : "", textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getProposedPosition()) ? pdfDatum.getProposedPosition() : "", textFont, table, lineHeight, colSpan);
-                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getUserName()) ? pdfDatum.getUserName() : "", textFont, table, lineHeight, colSpan);
+                for (User user : userList) {
+                    if (pdfDatum.getUserId().equals(user.getId())) {
+                        PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getUserName()) ? pdfDatum.getUserName() : user.getName(), textFont, table, lineHeight, colSpan);
+                        break;
+                    }
+                }
             }
+
             document.add(table);
             document.close();
             fileOutputStream.close();

+ 9 - 6
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSampleInfoServiceImpl.java

@@ -149,20 +149,19 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public boolean sampleSubmit(TrialSampleInfoDTO obj) {
         if (ObjectUtil.isEmpty(SecureUtil.getUserId())) {
             throw new ServiceException("获取用户信息失败");
         }
         obj.setUserId(SecureUtil.getUserId());
-        //新增时自动构建样品编号
-        if (ObjectUtil.isEmpty(obj.getId())) {
+        //如果样品编号为空,那么就自动生成
+        if (ObjectUtil.isEmpty(obj.getSpecificationNumber())) {
             this.buildNumber(obj);
         }
-        //保存
+
         this.saveOrUpdate(obj);
 
-        //新增或者修改成功后关联样品取样信息
+        //关联样品取样信息
         if (obj.getId() != null && obj.getMobilizationId() != null) {
             //获取当前选择的样品信息
             TrialSamplingRecord trialSamplingRecord = trialSamplingRecordMapper.selectByMobilizationIdAndSampleInfoId(obj.getMobilizationId(), obj.getId());
@@ -184,7 +183,11 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
         //获取当前合同段节点下所有样品信息
         List<TrialSampleInfo> trialSampleInfos = baseMapper.selectList(Wrappers.<TrialSampleInfo>lambdaQuery().eq(TrialSampleInfo::getContractId, obj.getContractId()).eq(TrialSampleInfo::getNodeId, obj.getNodeId()));
         //获取记录表最大编号
-        List<String> recordNos = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationNumber).collect(Collectors.toList());
+        List<String> recordNosOld = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationNumber).collect(Collectors.toList());
+
+        //只获取YP类型的自动生成的编号
+        List<String> recordNos = recordNosOld.stream().filter(f -> f.contains("YP-")).collect(Collectors.toList());
+
         String maxRecordNo;
         if (recordNos.size() == 0) {
             maxRecordNo = "0001";

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

@@ -96,7 +96,7 @@ public class TrialSelfInspectionRecordServiceImpl
         if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getQueryStatus())) {
             queryWrapper.lambda().eq(TrialSelfInspectionRecord::getDetectionResult, dto.getQueryStatus());
         }
-        IPage<TrialSelfInspectionRecord> pages = this.page(page, queryWrapper.lambda().orderBy(true, true, TrialSelfInspectionRecord::getCreateTime));
+        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();
@@ -701,6 +701,49 @@ public class TrialSelfInspectionRecordServiceImpl
                 //新增关联信息
                 baseMapper.saveSelfSample(SnowFlakeUtil.getId(), dto.getId(), id);
             }
+
+            //取样信息
+            List<TrialSampleInfo> trialSampleInfos = trialSampleInfoMapper.selectList(Wrappers.<TrialSampleInfo>lambdaQuery().in(TrialSampleInfo::getId, ids));
+            List<String> samplingLocations = trialSampleInfos.stream().map(TrialSampleInfo::getSamplingLocation).collect(Collectors.toList());
+            String samplingLocation = samplingLocations.stream().findAny().orElse(null);
+            if (samplingLocations.size() > 1 && StringUtils.isNotEmpty(samplingLocation)) {
+                samplingLocation = samplingLocation + "等" + samplingLocations.size() + "个取样地点";
+            } else if (StringUtils.isEmpty(samplingLocation)) {
+                samplingLocation = "取样地点为空";
+            }
+
+            List<String> supplierUnits = trialSampleInfos.stream().map(TrialSampleInfo::getSupplierUnit).collect(Collectors.toList());
+            String supplierUnit = supplierUnits.stream().findAny().orElse(null);
+            if (supplierUnits.size() > 1 && StringUtils.isNotEmpty(supplierUnit)) {
+                supplierUnit = supplierUnit + "等" + supplierUnits.size() + "个单位";
+            } else if (StringUtils.isEmpty(supplierUnit)) {
+                supplierUnit = "单位为空";
+            }
+
+            List<String> specificationNumbers = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationNumber).collect(Collectors.toList());
+            String specificationNumber = supplierUnits.stream().findAny().orElse(null);
+            if (specificationNumbers.size() > 1 && StringUtils.isNotEmpty(specificationNumber)) {
+                specificationNumber = specificationNumber + "等" + specificationNumbers.size() + "个样品编号";
+            } else if (StringUtils.isEmpty(specificationNumber)) {
+                specificationNumber = "样品编号为空";
+            }
+
+            List<String> specificationModels = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationModel).collect(Collectors.toList());
+            String specificationModel = supplierUnits.stream().findAny().orElse(null);
+            if (specificationModels.size() > 1 && StringUtils.isNotEmpty(specificationModel)) {
+                specificationModel = specificationModel + "等" + specificationModels.size() + "个规格类型";
+            } else if (StringUtils.isEmpty(specificationModel)) {
+                specificationModel = "规格类型为空";
+            }
+
+            //更新
+            this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
+                    .set(TrialSelfInspectionRecord::getSamplingLocation, samplingLocation)
+                    .set(TrialSelfInspectionRecord::getCompany, supplierUnit)
+                    .set(TrialSelfInspectionRecord::getSpecificationNumber, specificationNumber)
+                    .set(TrialSelfInspectionRecord::getSpecificationModel, specificationModel)
+                    .eq(TrialSelfInspectionRecord::getId, dto.getId())
+            );
         }
         return true;
     }
@@ -773,7 +816,7 @@ public class TrialSelfInspectionRecordServiceImpl
 
     private void buildNumber(TrialSelfInspectionRecordDTO dto) {
         StringSPUtils spUtils = new StringSPUtils();
-        List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectAll(dto.getNodeId());
+        List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectAll(dto.getNodeId(), dto.getContractId());
         //获取记录表最大编号
         List<String> recordNos = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getRecordNo).collect(Collectors.toList());
         String maxRecordNo;
@@ -823,7 +866,7 @@ public class TrialSelfInspectionRecordServiceImpl
             String str1 = "JL" +
                     "-" + contract.getContractNumber() +
                     "-" + year +
-                    "-" + spUtils.getStringSP(wbsTreePrivate.getNodeName()) +
+                    "-" + spUtils.getStringSP(wbsTreePrivate.getNodeName().trim()) +
                     "-" + maxRecordNo;
             dto.setRecordNo(str1);
 
@@ -831,7 +874,7 @@ public class TrialSelfInspectionRecordServiceImpl
             String str2 = "BG" +
                     "-" + contract.getContractNumber() +
                     "-" + year +
-                    "-" + spUtils.getStringSP(wbsTreePrivate.getNodeName()) +
+                    "-" + spUtils.getStringSP(wbsTreePrivate.getNodeName().trim()) +
                     "-" + maxReportNo;
             dto.setReportNo(str2);
         }

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

@@ -114,7 +114,7 @@ public class FileUtils {
             anchor.setRow2(ca.getLastRow());
         }
         int dx=(int)(sheet.getColumnWidthInPixels(anchor.getCol2())+3);
-        int dy=Units.pointsToPixel(sheet.getRow(anchor.getRow2()).getHeightInPoints())-5;
+        int dy=Units.pointsToPixel(sheet.getRow(anchor.getRow2()).getHeightInPoints())-50;
         anchor.setDx2(Units.pixelToEMU(dx));
         anchor.setDy2(Units.pixelToEMU(dy));
     }

+ 136 - 59
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/FirstController.java

@@ -27,6 +27,7 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.*;
 import org.springblade.manager.entity.*;
 import org.springblade.manager.service.*;
+import org.springblade.manager.service.impl.ContractInfoServiceImpl;
 import org.springblade.manager.utils.FileUtils;
 import org.springblade.resource.feign.CommonFileClient;
 import org.springblade.resource.feign.IOSSClient;
@@ -61,25 +62,17 @@ import java.util.stream.Collectors;
 @Api(value = "首件基础数据表", tags = "首件基础数据表接口")
 public class FirstController extends BladeController {
 
-    // 元素信息表-
     private final IWbsTreeContractService wbsTreeContractService;
     private final IOSSClient iossClient;
     private final CommonFileClient commonFileClient;
-    // 表单附件信息
     private final ITableFileService tableFileService;
-
     private final NewIOSSClient newIOSSClient;
-
-    // excel 基本信息表
     private final IExcelTabService excelTabService;
-
     private final JdbcTemplate jdbcTemplate;
-
     private final InformationQueryClient informationQueryClient;
-
     private final ITextdictInfoService textdictInfoService;
-    // 项目信息
     private final IProjectInfoService projectInfoService;
+    private final ContractInfoServiceImpl contractInfoService;
 
     /**
      * 首件表单获取 html页面
@@ -93,23 +86,22 @@ public class FirstController extends BladeController {
     public R getFirstExcelHtml(Long contractId) throws IOException {
 
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
-                .eq(WbsTreeContract::getContractId,contractId).eq(WbsTreeContract::getTableType,"111"));
-        if(wbsTreeContract ==null ){
+                .eq(WbsTreeContract::getContractId, contractId).eq(WbsTreeContract::getTableType, "111"));
+        if (wbsTreeContract == null) {
             return R.fail("该数据下无此节点!");
         }
-        if(wbsTreeContract .getHtmlUrl()==null){
+        if (wbsTreeContract.getHtmlUrl() == null) {
             return R.fail("请上传清表!");
         }
 
         File file1 = ResourceUtil.getFile(wbsTreeContract.getHtmlUrl());
         FileInputStream fileInputStream = new FileInputStream(file1);
-        String htmlString =   IoUtil.readToString(fileInputStream);
+        String htmlString = IoUtil.readToString(fileInputStream);
         htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
         htmlString = htmlString.replaceAll("title", "titlexx");
         // 解析 style
         Document doc = Jsoup.parse(htmlString);
 
-
         ProjectInfo projectInfo = projectInfoService.getById(wbsTreeContract.getProjectId());
         // 添加标题显示
         Element table = doc.select("table").first();
@@ -133,8 +125,8 @@ public class FirstController extends BladeController {
         doc.select("Col").remove();
         fileInputStream.close();
         JSONObject reData = new JSONObject();
-        reData.put("id",wbsTreeContract.getPKeyId());
-        reData.put("data",table+"");
+        reData.put("id", wbsTreeContract.getPKeyId());
+        reData.put("data", table + "");
         return R.data(reData);
     }
 
@@ -164,17 +156,17 @@ public class FirstController extends BladeController {
         String fileExtension = StringUtils.isNotEmpty(file.getOriginalFilename()) ? file.getOriginalFilename() : FileUtil.getFileExtension(sourceFile.getName());
 
         NewBladeFile newBladeFile = null;
-        if(fileExtension.contains("pdf")){
+        if (fileExtension.contains("pdf")) {
             pdfUrl = sourceUrl;
-        } else if(fileExtension.contains("xls") || fileExtension.contains("xlsx")){
+        } else if (fileExtension.contains("xls") || fileExtension.contains("xlsx")) {
             newBladeFile = this.commonFileClient.excelToPdf(file);
-        } else if(fileExtension.contains("docx")){
+        } else if (fileExtension.contains("docx")) {
             newBladeFile = this.commonFileClient.wordToPdf(file);
-        } else if(fileExtension.contains("png") || (StringUtils.isNotEmpty(file.getOriginalFilename()) && file.getOriginalFilename().contains("jpg"))){
+        } else if (fileExtension.contains("png") || (StringUtils.isNotEmpty(file.getOriginalFilename()) && file.getOriginalFilename().contains("jpg"))) {
             newBladeFile = this.commonFileClient.pngOrJpgToPdf(file);
         }
 
-        if(newBladeFile != null){
+        if (newBladeFile != null) {
             pdfUrl = newBladeFile.getPdfUrl();
         }
 
@@ -188,13 +180,12 @@ public class FirstController extends BladeController {
     }
 
 
-
     @GetMapping("/get-first-buss-pdfInfo")
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "首件-pdf预览", notes = "首件列表ID")
     @ApiImplicitParam(name = "firstId", value = "首件ID", required = true)
     public R<String> getBussPdfInfo(String firstId) {
-        if(StringUtils.isNotEmpty(firstId)){
+        if (StringUtils.isNotEmpty(firstId)) {
             //PDF路径集合
             List<String> pdfUrls = new ArrayList<>();
 
@@ -202,19 +193,19 @@ public class FirstController extends BladeController {
             String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
             //获取数据
             JSONObject firstJson = this.informationQueryClient.queryFirstBusinessDataByFirstId(firstId);
-            if(firstJson != null){
-                if(StringUtils.isNotEmpty(firstJson.getString("eVisaPdfUrl")) || StringUtils.isNotEmpty(firstJson.getString("pdfUrl"))){
+            if (firstJson != null) {
+                if (StringUtils.isNotEmpty(firstJson.getString("eVisaPdfUrl")) || StringUtils.isNotEmpty(firstJson.getString("pdfUrl"))) {
                     pdfUrls.add(StringUtils.isNotEmpty(firstJson.getString("eVisaPdfUrl")) ? firstJson.getString("eVisaPdfUrl") : firstJson.getString("pdfUrl"));
                 } else {
                     //没有生成拼接的记录,生成
                     //获取html
                     WbsTreeContract tableNode = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, firstJson.getString("tableId")));
 
-                    if(tableNode == null){
+                    if (tableNode == null) {
                         return R.fail("该数据下无此节点!");
                     }
 
-                    if(StringUtils.isEmpty(tableNode.getHtmlUrl())){
+                    if (StringUtils.isEmpty(tableNode.getHtmlUrl())) {
                         return R.fail("请关联清表!");
                     }
 
@@ -225,11 +216,11 @@ public class FirstController extends BladeController {
                     }
 
                     //获取填报数据
-                    List<Map<String, Object>> businessDataMapList = this.getFirstBusinessData(firstId).getData().get("data");
+                    List<Map<String, Object>> businessDataMapList = this.getFirstBusinessData(firstId, tableNode.getContractId()).getData().get("data");
 
-                    try{
+                    try {
                         //处理数据
-                        for(Map<String, Object> dataMap : businessDataMapList){
+                        for (Map<String, Object> dataMap : businessDataMapList) {
                             // 获取excel流 和 html流
                             Workbook wb = new Workbook();
                             wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
@@ -344,7 +335,7 @@ public class FirstController extends BladeController {
 
                             sheet.saveToPdf(onePdfPath);
 
-                            BladeFile bladeFile = this.newIOSSClient.uploadFile( fileName + ".pdf", onePdfPath);
+                            BladeFile bladeFile = this.newIOSSClient.uploadFile(fileName + ".pdf", onePdfPath);
 
                             pdfUrls.add(bladeFile.getLink());
 
@@ -354,19 +345,19 @@ public class FirstController extends BladeController {
 
                             wb.dispose();
                         }
-                    }catch (Exception e){
+                    } catch (Exception e) {
                         e.printStackTrace();
                     }
                 }
 
-                if(pdfUrls.size() > 0){
-                    try{
+                if (pdfUrls.size() > 0) {
+                    try {
                         //关联的数据
-                        if(StringUtils.isNotEmpty(firstJson.getString("linkMergePdfUrl"))){
+                        if (StringUtils.isNotEmpty(firstJson.getString("linkMergePdfUrl"))) {
                             pdfUrls.add(firstJson.getString("linkMergePdfUrl"));
                         }
                         //总结报告
-                        if(StringUtils.isNotEmpty(firstJson.getString("uploadFile"))){
+                        if (StringUtils.isNotEmpty(firstJson.getString("uploadFile"))) {
                             pdfUrls.add(firstJson.getString("uploadFile"));
                         }
 
@@ -384,7 +375,7 @@ public class FirstController extends BladeController {
                         //返回
                         return R.data(mergeFile.getLink());
 
-                    }catch (Exception e){
+                    } catch (Exception e) {
                         e.printStackTrace();
                     }
                 }
@@ -398,40 +389,129 @@ public class FirstController extends BladeController {
     @ApiOperationSupport(order = 4)
     @ApiOperation(value = "获取首件用户保存数据", notes = "获取首件用户保存数据")
     @ApiImplicitParams(value = {
-            @ApiImplicitParam(name = "firstId", value = "pkeyId", required = true)
+            @ApiImplicitParam(name = "firstId", value = "pkeyId", required = true),
+            @ApiImplicitParam(name = "contractId", value = "contractId", required = true)
     })
-    public R<Map<String, List<Map<String, Object>>>> getFirstBusinessData(String firstId) {
-        if(StringUtils.isNotEmpty(firstId)){
+    public R<Map<String, List<Map<String, Object>>>> getFirstBusinessData(String firstId, String contractId) {
+        if (StringUtils.isNotEmpty(firstId) && StringUtils.isNotEmpty(contractId)) {
+            //数据结果
             Map<String, List<Map<String, Object>>> result = new HashMap<>();
+            List<Map<String, Object>> dataResult = new ArrayList<>();
+            Map<String, Object> reData = new HashMap<>();
+
+            WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda().eq(WbsTreeContract::getContractId, contractId).eq(WbsTreeContract::getTableType, "111"));
+            if (wbsTreeContract == null) {
+                return R.fail("该数据下无此节点!");
+            }
+            if (wbsTreeContract.getHtmlUrl() == null) {
+                return R.fail("请上传清表!");
+            }
+
+            //匹配关联Title等
+            try {
+                File file1 = ResourceUtil.getFile(wbsTreeContract.getHtmlUrl());
+                String htmlString = IoUtil.readToString(new FileInputStream(file1));
+                Document doc = Jsoup.parse(htmlString);
+
+                // 模糊匹配
+                Elements dwTitle = doc.select("el-input[placeholder~=.*承包单位]");
+                Elements sgTitle = doc.select("el-input[placeholder~=^施工单位]");
+                Elements sgTitle1 = doc.select("el-input[placeholder=安装单位]");
+                sgTitle.addAll(sgTitle1);
+                Elements htdTitle = doc.select("el-input[placeholder~=.*合同段.*]");
+                Elements htdTitle1 = doc.select("el-input[placeholder~=合同名称.*]");
+                htdTitle.addAll(htdTitle1);
+                Elements jlTitle = doc.select("el-input[placeholder~=监理单位.*]");
+                Elements bhTitle = doc.select("el-input[placeholder~=^编号]");
+                Elements bhTitle1 = doc.select("el-input[placeholder~=合同编号.*]");
+                bhTitle.addAll(bhTitle1);
+                Elements xmTitle = doc.select("el-input[placeholder~=^项目名称]");
+
+                ContractInfo contractInfo = contractInfoService.getById(wbsTreeContract.getContractId());
+                // 施工单位名称
+                if (dwTitle.size() >= 1) {
+                    int y = Integer.parseInt(dwTitle.attr("trindex"));
+                    if (y <= 10) {
+                        reData.put(dwTitle.attr("keyName"), contractInfo.getConstructionUnitName());
+                    }
+
+                }
+                if (sgTitle.size() >= 1) {
+                    int y = Integer.parseInt(sgTitle.attr("trindex"));
+                    if (y <= 10) {
+                        reData.put(sgTitle.attr("keyName"), contractInfo.getConstructionUnitName());
+                    }
+                }
+
+                // 合同段名称
+                if (htdTitle.size() >= 1) {
+                    for (Element element : htdTitle) {
+                        int trIndex = Integer.parseInt(element.attr("trindex"));
+                        if (trIndex <= 8) {
+                            reData.put(element.attr("keyName"), contractInfo.getContractName());
+                        }
+                    }
+                }
+                // 监理单位名称
+                if (jlTitle.size() >= 1) {
+                    for (Element element : jlTitle) {
+                        int trIndex = Integer.parseInt(element.attr("trindex"));
+                        if (trIndex <= 10) {
+                            reData.put(element.attr("keyName"), contractInfo.getSupervisionUnitName());
+                        }
+                    }
+                }
+                // 编号
+                if (bhTitle.size() >= 1 && contractInfo.getIsReferenceNumber() == 1) {
+                    for (Element element : bhTitle) {
+                        int trIndex = Integer.parseInt(element.attr("trindex"));
+                        if (trIndex <= 10) {
+                            reData.put(element.attr("keyName"), contractInfo.getContractNumber());
+                        }
+                    }
+                }
+
+                // 项目名称
+                if (xmTitle.size() >= 1) {
+                    for (Element element : xmTitle) {
+                        int trIndex = Integer.parseInt(element.attr("trindex"));
+                        if (trIndex <= 6) {
+                            ProjectInfo projectInfo = projectInfoService.getById(wbsTreeContract.getProjectId());
+                            reData.put(element.attr("keyName"), projectInfo.getProjectName());
+                        }
+                    }
+                }
+
+                //入参
+                if (reData.size() > 0){
+                    dataResult.add(reData);
+                }
+            } catch (FileNotFoundException e) {
+                e.printStackTrace();
+            }
 
             JSONObject json = this.informationQueryClient.queryFirstBusinessDataByFirstId(firstId);
-            if(json != null){
+            //解析数据Data
+            if (json != null) {
                 //获取数据所在表格
                 WbsTreeContract tableNode = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, json.getString("tableId")));
-                if(tableNode != null && StringUtils.isNotEmpty(tableNode.getInitTableName())){
+                if (tableNode != null && StringUtils.isNotEmpty(tableNode.getInitTableName())) {
                     //获取填报数据
                     List<Map<String, Object>> businessDataMapList = this.jdbcTemplate.queryForList("SELECT * FROM " + tableNode.getInitTableName() + " WHERE group_id = " + json.getString("id"));
-                    if(businessDataMapList.size() > 0){
-                        List<Map<String, Object>> dataResult = new ArrayList<>();
-
-                        for(Map<String, Object> mysqlData : businessDataMapList){
-                            //数据结果
-                            Map<String, Object> reData = new HashMap<>();
-
+                    if (businessDataMapList.size() > 0) {
+                        for (Map<String, Object> mysqlData : businessDataMapList) {
                             for (String key : mysqlData.keySet()) {
                                 String tabVal = mysqlData.get(key) + "";
                                 // 时间段处理
                                 if (StringUtils.isNotEmpty(tabVal) && !tabVal.equals("null")) {
                                     if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z]") >= 0) {
                                         String[] tabData = tabVal.split("_\\^_");
-
                                         if (reData.containsKey("pickerKey")) {
                                             String pickerKey = reData.get("pickerKey") + "," + key + "__" + tabData[1];
                                             reData.put("pickerKey", pickerKey);
                                         } else {
                                             reData.put("pickerKey", key + "__" + tabData[1]);
                                         }
-
                                         String sql = tabData[0];
                                         sql = sql.replaceAll("\\[", "['");
                                         sql = sql.replaceAll("]", "']");
@@ -440,10 +520,8 @@ public class FirstController extends BladeController {
                                         sql = sql.replaceAll("'", "");
                                         reData.put(key + "__" + tabData[1], sql);
                                     } else if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z") >= 0) { //时间
-
                                         String[] tabData = tabVal.split("_\\^_");
                                         reData.put(key + "__" + tabData[1], tabData[0]);
-
                                     } else if (tabVal.indexOf("☆") >= 0) {
                                         String[] mysql = tabVal.split("☆");
                                         for (String data : mysql) {
@@ -467,19 +545,18 @@ public class FirstController extends BladeController {
 
                             dataResult.add(reData);
                         }
-
-                        //设置表格数据
-                        result.put("data", dataResult);
-
                         //获取关联
                         List<Map<String, Object>> linkMapList = this.jdbcTemplate.queryForList("SELECT link_id AS id,title AS name FROM u_first_link_data WHERE first_id = " + firstId + " and is_deleted = 0");
                         //设置关联数据
                         result.put("link", linkMapList);
-
-                        return R.data(result);
                     }
                 }
             }
+
+            //设置表格数据
+            result.put("data", dataResult);
+
+            return R.data(result);
         }
 
         return R.data(300, null, "未找到对应的业务数据");

+ 47 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -642,15 +642,61 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             }
         }
 
+        //获取文件题名
+        String fileTitleNames = this.getFileTitleNames(firstNodeId);
+
         try {
             //新增或修改首件记录
-            return this.informationQueryClient.saveOrUpdateInformationQueryData(firstNodeId, table.getPKeyId() + "", firstId, "文件名称", Integer.parseInt(tableInfoList.get(0).getClassify()), 2, "true", sourceUrl, pdfUrl, firstFileName, linkProcessList);
+            return this.informationQueryClient.saveOrUpdateInformationQueryData(firstNodeId, table.getPKeyId() + "", firstId, StringUtils.isNotEmpty(fileTitleNames) ? fileTitleNames : "首件文件名称为空", Integer.parseInt(tableInfoList.get(0).getClassify()), 2, "true", sourceUrl, pdfUrl, firstFileName, linkProcessList);
         } catch (Exception e) {
             e.printStackTrace();
         }
         return null;
     }
 
+    //首件文件题名
+    private String getFileTitleNames(String firstNodeId) {
+        WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, Long.parseLong(firstNodeId)));
+        //获取到该项目的首件节点以及上级的单位工程节点、分项工程节点
+        List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateService.getBaseMapper().selectList(Wrappers.<WbsTreePrivate>lambdaQuery()
+                .eq(WbsTreePrivate::getProjectId, wbsTreeContract.getProjectId())
+                .eq(WbsTreePrivate::getWbsId, wbsTreeContract.getWbsId())
+                .eq(WbsTreePrivate::getType, 1)
+                .and(f -> f.eq(WbsTreePrivate::getNodeType, 111).or().eq(WbsTreePrivate::getNodeType, 1).or().eq(WbsTreePrivate::getNodeType, 4))
+        );
+
+        WbsTreePrivate firstNode = wbsTreePrivates.stream().filter(f -> f.getNodeType().equals(111)).findAny().orElse(null);
+
+        List<WbsTreePrivate> collect1 = wbsTreePrivates.stream().filter(f -> f.getNodeType().equals(1)).collect(Collectors.toList());
+
+        List<WbsTreePrivate> collect4 = wbsTreePrivates.stream().filter(f -> f.getNodeType().equals(4)).collect(Collectors.toList());
+
+        StringBuilder fileTitleNames = new StringBuilder();
+
+        if (ObjectUtil.isNotEmpty(firstNode)) {
+            for (WbsTreePrivate obj1 : collect1) {
+                assert firstNode != null;
+                if (firstNode.getAncestors().contains(obj1.getId().toString())) {
+                    fileTitleNames.append(obj1.getNodeName());
+                    break;
+                }
+            }
+
+            for (WbsTreePrivate obj4 : collect4) {
+                assert firstNode != null;
+                if (firstNode.getAncestors().contains(obj4.getId().toString())) {
+                    fileTitleNames.append(obj4.getNodeName());
+                    break;
+                }
+            }
+
+            assert firstNode != null;
+            return fileTitleNames.append(firstNode.getNodeName()).toString();
+        }
+
+        return "";
+    }
+
     @Override
     @Transactional
     public R saveOrUpdateInfo(List<TableInfo> tableInfoList) {

+ 8 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

@@ -1397,6 +1397,14 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
                 tree.setInitTableId(tableInfo.getId());
 
                 tree.setTableType(tableInfo.getTabType());
+
+                //解决试验关联表单类型问题
+                if (tableInfo.getTabType().equals(9)) {
+                    tree.setTableType(1);
+                } else if (tableInfo.getTabType().equals(10)) {
+                    tree.setTableType(2);
+                }
+
                 tree.setInitTableName(tableInfo.getTabEnName());
                 tree.setNodeName(tableInfo.getTabChName());
                 tree.setFullName(tableInfo.getTabChName());