Browse Source

试验bug

liuyc 2 năm trước cách đây
mục cha
commit
8cd3cad006
16 tập tin đã thay đổi với 180 bổ sung135 xóa
  1. 6 3
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ExcelTabClient.java
  2. 10 2
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ExcelTabClientFallBack.java
  3. 26 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/TrialRecordZJTreeLazyVO.java
  4. 3 3
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java
  5. 2 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialSelfInspectionRecordService.java
  6. 1 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDetectionDataServiceImpl.java
  7. 16 19
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java
  8. 9 9
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ContractInfoController.java
  9. 11 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/TableFileController.java
  10. 8 4
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ExcelTabClientImpl.java
  11. 1 13
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/SaveUserInfoByProjectClientImpl.java
  12. 2 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.java
  13. 67 35
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.xml
  14. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IContractInfoService.java
  15. 10 32
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java
  16. 7 11
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

+ 6 - 3
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ExcelTabClient.java

@@ -29,9 +29,11 @@ public interface ExcelTabClient {
                        @RequestParam String tabIds) throws RuntimeException;
 
     @PostMapping(API_PREFIX + "/getBussPDFTrial")
-    void getBussPDFTrial(@RequestParam Long pkeyId,
+    String getBussPDFTrial(@RequestParam Long pkeyId,
                          @RequestParam String contractId,
-                         @RequestParam String id) throws Exception;
+                         @RequestParam String id,
+                         @RequestBody TrialSelfInspectionRecordDTO dto) throws Exception;
+
 
     @PostMapping(API_PREFIX + "/getBussPDFSTrial")
     String getBussPDFSTrial(@RequestParam String nodeId,
@@ -40,7 +42,8 @@ public interface ExcelTabClient {
                             @RequestParam String contractId,
                             @RequestParam String projectId,
                             @RequestParam String id,
-                            @RequestParam String tabIds) throws Exception;
+                            @RequestParam String tabIds,
+                            @RequestBody TrialSelfInspectionRecordDTO dto) throws Exception;
 
 
 }

+ 10 - 2
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ExcelTabClientFallBack.java

@@ -2,11 +2,16 @@ package org.springblade.manager.feign;
 
 import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
 import org.springblade.manager.entity.ExcelTab;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Component;
 
 @Component
 public class ExcelTabClientFallBack implements ExcelTabClient {
 
+    @Autowired
+    private JdbcTemplate jdbcTemplate;
+
     @Override
     public ExcelTab getById(String id) {
         return null;
@@ -14,15 +19,18 @@ public class ExcelTabClientFallBack implements ExcelTabClient {
 
     @Override
     public String saveTabData(TrialSelfInspectionRecordDTO dto, Integer isBatchSave, Integer type, String tableType, Long id, String tabIds) throws RuntimeException {
+        jdbcTemplate.execute("delete from u_information_query where wbs_id = " + id);
         throw new RuntimeException("试验数据保存失败,原因:ExcelTabClient#saveTabDataError...");
     }
 
     @Override
-    public void getBussPDFTrial(Long pkeyId, String contractId, String id) throws Exception {
+    public String getBussPDFTrial(Long pkeyId, String contractId, String id, TrialSelfInspectionRecordDTO dto) throws Exception {
+        return null;
     }
 
     @Override
-    public String getBussPDFSTrial(String nodeId, String tableType, String classify, String contractId, String projectId, String id, String tabIds) throws Exception {
+    public String getBussPDFSTrial(String nodeId, String tableType, String classify, String contractId, String projectId, String id, String tabIds, TrialSelfInspectionRecordDTO dto) throws Exception {
         return null;
     }
+
 }

+ 26 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/TrialRecordZJTreeLazyVO.java

@@ -0,0 +1,26 @@
+package org.springblade.manager.vo;
+
+import lombok.Data;
+import java.io.Serializable;
+
+@Data
+public class TrialRecordZJTreeLazyVO implements Serializable {
+
+    private Long id;
+
+    private String primaryKeyId;
+
+    private String fullName;
+
+    private Long parentId;
+
+    //判断条件状态
+    private Integer status;
+
+    //是否有子级
+    private Boolean hasChildren;
+
+    //是否是最下级
+    private Boolean notExsitChild;
+
+}

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

@@ -368,8 +368,8 @@ public class TrialDetectionController extends BladeController {
             @ApiImplicitParam(name = "id", value = "当前自检记录id", required = true),
             @ApiImplicitParam(name = "tableType", value = "表单类型", required = true)
     })
-    public R<String> addBussFile(@RequestParam("file") MultipartFile file, Long pkeyId, String nodeId, String contractId, String projectId, String classify, String id, String tableType) {
-        return R.data(iTrialSelfInspectionRecordService.addBussFile(file, pkeyId, nodeId, contractId, projectId, classify, id, tableType));
+    public R addBussFile(@RequestParam("file") MultipartFile file, Long pkeyId, String nodeId, String contractId, String projectId, String classify, String id, String tableType) {
+        return iTrialSelfInspectionRecordService.addBussFile(file, pkeyId, nodeId, contractId, projectId, classify, id, tableType);
     }
 
     @GetMapping("/self/file-list")
@@ -380,7 +380,7 @@ public class TrialDetectionController extends BladeController {
             @ApiImplicitParam(name = "id", value = "试验记录id")
     })
     public R fileList(Long pkeyid, Long id) {
-        String sql = "select *,domain_url as url from m_table_file where is_deleted = 0 and type = 2 and tab_id = " + pkeyid + " and trial_record_id = " + id;
+        String sql = "select *,domain_url as url from m_table_file where is_deleted = 0 and type = 2 and tab_id = '" + pkeyid + "' and trial_record_id = '" + id + "'";
         List<TableFileVO> fileVOList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TableFileVO.class));
         if (fileVOList.size() > 0) {
             return R.data(fileVOList);

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

@@ -5,6 +5,7 @@ import org.springblade.business.dto.*;
 import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.business.vo.*;
 import org.springblade.core.mp.base.BaseService;
+import org.springblade.core.tool.api.R;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.FileNotFoundException;
@@ -36,7 +37,7 @@ public interface ITrialSelfInspectionRecordService extends BaseService<TrialSelf
 
     void updateTrialSelfInspectionRecordStatusFC(TaskApprovalVO obj);
 
-    String addBussFile(MultipartFile file, Long pkeyId, String nodeId, String contractId, String projectId, String classify, String id, String tableType) throws Exception;
+    R addBussFile(MultipartFile file, Long pkeyId, String nodeId, String contractId, String projectId, String classify, String id, String tableType) throws Exception;
 
     IPage<TrialSelfInspectionRecordVO> trialDataPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto);
 

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

@@ -262,6 +262,7 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
                     if (gcBW.size() >= 1) {
                         for (Element element : gcBW) {
                             map.put(element.attr("keyname"), ObjectUtils.isNotEmpty(proposedPositionStr) ? StringUtils.join(proposedPositionStr, "、") : "");
+                            map.put("取样对应工程部位Key", element.attr("keyname"));
                             break;
                         }
                     }

+ 16 - 19
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -742,7 +742,15 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
     }
 
     @Override
-    public String addBussFile(MultipartFile file, Long pkeyId, String nodeId, String contractId, String projectId, String classify, String id, String tableType) throws Exception {
+    public R addBussFile(MultipartFile file, Long pkeyId, String nodeId, String contractId, String projectId, String classify, String id, String tableType) throws Exception {
+        //查找当前记录下所关联的表,用于合并时查询
+        TrialSelfInspectionRecord obj = this.getBaseMapper().selectById(id);
+        TrialSelfInspectionRecordDTO dto = BeanUtil.copyProperties(obj, TrialSelfInspectionRecordDTO.class);
+        if (ObjectUtil.isEmpty(dto)) {
+            throw new ServiceException("请先保存填报资料后再上传附件文件信息");
+        }
+
+        //上传当前附件
         R<BladeFile> bladeFile = iossClient.addFileInfo(file);
         BladeFile bladeFile1 = bladeFile.getData();
         TableFile tableFile = new TableFile();
@@ -753,9 +761,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
         tableFile.setDomainUrl(bladeFile1.getLink());
         tableFile.setIsDeleted(0);
         tableFile.setExtension(fileExtension);
-
         tableFile.setTrialRecordId(Long.parseLong(id));
-
         NewBladeFile newBladeFile;
         if (fileExtension.contains("xlsx")) {
             newBladeFile = this.commonFileClient.excelToPdf(file);
@@ -772,23 +778,15 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
         } else if (fileExtension.contains("pdf")) {
             tableFile.setDomainPdfUrl(bladeFile1.getLink());
         }
-
         tableFile.setStatus("finished");
         tableFileClient.saveFile(tableFile);
 
-        //单个pdf
-        excelTabClient.getBussPDFTrial(pkeyId, contractId, id);
-
-        //查找当前记录下所关联的表,用于合并时查询
-        TrialSelfInspectionRecord selfInspectionRecord = this.getBaseMapper().selectById(id);
-
-        String url = "";
-        if (StringUtils.isNotEmpty(selfInspectionRecord.getTableIds())) {
+        if (StringUtils.isNotEmpty(dto.getTableIds())) {
             //合并pdf
-            url = excelTabClient.getBussPDFSTrial(nodeId, tableType, classify, contractId, projectId, id, selfInspectionRecord.getTableIds());
+            String url = excelTabClient.getBussPDFSTrial(nodeId, tableType, classify, contractId, projectId, id, dto.getTableIds(), dto);
 
             //修改按钮状态 is_tab_file_type = 2 、is_tab_pdf = 2
-            String sql = "select tab_id from m_table_file where type = 2 and trial_record_id = " + id + " and tab_id in(" + selfInspectionRecord.getTableIds() + ") group by tab_id";
+            String sql = "select tab_id from m_table_file where type = 2 and trial_record_id = " + id + " and tab_id in(" + dto.getTableIds() + ") group by tab_id";
             List<TableFile> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TableFile.class));
             if (query.size() > 0) {
                 for (TableFile tf : query) {
@@ -796,13 +794,12 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                     jdbcTemplate.execute(sqlUpdate);
                 }
             }
+            //修改合并后的url路径地址
+            obj.setPdfUrl(url);
+            this.updateById(obj);
         }
 
-        //修改合并后的url路径地址
-        selfInspectionRecord.setPdfUrl(url);
-        this.updateById(selfInspectionRecord);
-
-        return String.valueOf(tableFile.getId());
+        return R.data(String.valueOf(tableFile.getId()));
     }
 
     private String getTrialPdfUrl(WbsTreePrivate wbsTreePrivate) throws Exception {

+ 9 - 9
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ContractInfoController.java

@@ -1,6 +1,5 @@
 package org.springblade.manager.controller;
 
-import cn.hutool.core.date.LocalDateTimeUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import io.swagger.annotations.*;
@@ -17,14 +16,12 @@ import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.manager.dto.FindAllUserByConditionDTO;
 import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
 import org.springblade.manager.dto.WbsTreeContractDTO;
 import org.springblade.manager.entity.ContractRelationJlyz;
-import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.mapper.SaveUserInfoByProjectMapper;
 import org.springblade.manager.service.IWbsTreeContractService;
 import org.springblade.manager.service.SaveUserInfoByProjectService;
@@ -44,7 +41,6 @@ import org.springblade.manager.service.IContractInfoService;
 import org.springblade.core.boot.ctrl.BladeController;
 
 
-import java.time.LocalDateTime;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -611,19 +607,23 @@ public class ContractInfoController extends BladeController {
     }
 
     /**
-     * 查询合同段私有Wbs节点树形结构 --- 试验关联工程节点树
+     * 查询合同段私有Wbs节点树形结构 --- 试验关联工程节点树 懒加载
      */
     @GetMapping("/trial/relation/tree")
     @ApiOperationSupport(order = 18)
-    @ApiOperation(value = "查询合同段私有Wbs节点树形结构", notes = "传入wbsId,项目id,合同段id,自检记录id")
+    @ApiOperation(value = "查询合同段私有Wbs节点树形结构 懒加载", notes = "传入wbsId,项目id,合同段id,自检记录id")
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "wbsId", value = "wbsId", required = true),
             @ApiImplicitParam(name = "项目id", value = "projectId", required = true),
             @ApiImplicitParam(name = "合同段id", value = "contractId", required = true),
-            @ApiImplicitParam(name = "自检记录id", value = "selfId", required = true)
+            @ApiImplicitParam(name = "自检记录id", value = "selfId", required = true),
+            @ApiImplicitParam(name = "当前节点id", value = "id", required = true)
     })
-    public R trialRelationTree(String wbsId, String projectId, String contractId, String selfId) {
-        Map<String, Object> tree = contractInfoService.trialRelationTree(wbsId, projectId, contractId, selfId);
+    public R trialRelationTree(String wbsId, String projectId, String contractId, String selfId, String id) {
+        if (ObjectUtil.isEmpty(id)) {
+            id = "0";
+        }
+        List<TrialRecordZJTreeLazyVO> tree = contractInfoService.trialRelationTree(wbsId, projectId, contractId, selfId, id);
         if (tree != null && tree.size() > 0) {
             return R.data(tree);
         }

+ 11 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/TableFileController.java

@@ -23,8 +23,10 @@ import io.swagger.annotations.*;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
 
+import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
 import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.manager.entity.ExcelTab;
@@ -125,12 +127,19 @@ public class TableFileController extends BladeController {
             throw new ServerException("未获取到对应元素表信息");
         }
 
+        TrialSelfInspectionRecord trialSelfInspectionRecord = jdbcTemplate.query("select * from u_trial_self_inspection_record where id = " + id, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class)).stream().findAny().orElse(null);
+        TrialSelfInspectionRecordDTO dto = BeanUtil.copyProperties(trialSelfInspectionRecord, TrialSelfInspectionRecordDTO.class);
+        if (ObjectUtil.isEmpty(dto)) {
+            throw new ServerException("未获取到当前试验记录信息");
+        }
+
         //删除数据
         tableFileService.delDataById(ids, id);
 
         Long pkeyId = Long.parseLong(tableFile.getTabId() + "");
+
         //单pdf
-        excelTabService.getBussPDFTrial(pkeyId, contractId, id, 0, 0, null);
+        excelTabService.getBussPDFTrial(pkeyId, contractId, id, 0, 0, dto);
 
         WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
                 .eq(WbsTreePrivate::getPKeyId, pkeyId));
@@ -154,7 +163,7 @@ public class TableFileController extends BladeController {
         List<String> collect = query.stream().map(TrialSelfInspectionRecord::getTableIds).collect(Collectors.toList());
 
         //合并pdf
-        String bussPDFSTrial = excelTabService.getBussPDFSTrial(wbsTreePrivate1.getPKeyId() + "", tableType, classify, contractId, wbsTreePrivate.getProjectId(), id, org.apache.commons.lang.StringUtils.join(collect, ","), null);
+        String bussPDFSTrial = excelTabService.getBussPDFSTrial(wbsTreePrivate1.getPKeyId() + "", tableType, classify, contractId, wbsTreePrivate.getProjectId(), id, org.apache.commons.lang.StringUtils.join(collect, ","), dto);
 
         if (StringUtils.isNotEmpty(bussPDFSTrial)) {
             //修改合并pdf

+ 8 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ExcelTabClientImpl.java

@@ -8,9 +8,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
 import org.springblade.business.entity.InformationQuery;
+import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.business.feign.InformationQueryClient;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.core.oss.model.BladeFile;
+import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.core.tool.utils.ResourceUtil;
 import org.springblade.manager.bean.TableInfo;
@@ -23,9 +25,11 @@ 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.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.io.File;
+import java.rmi.ServerException;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -116,13 +120,13 @@ public class ExcelTabClientImpl implements ExcelTabClient {
     }
 
     @Override
-    public void getBussPDFTrial(Long pkeyId, String contractId, String id) throws Exception {
-        excelTabService.getBussPDFTrial(pkeyId, contractId, Long.parseLong(id), 0, 0, null);
+    public String getBussPDFTrial(Long pkeyId, String contractId, String id, TrialSelfInspectionRecordDTO dto) throws Exception {
+        return excelTabService.getBussPDFTrial(pkeyId, contractId, Long.parseLong(id), 0, 0, dto);
     }
 
     @Override
-    public String getBussPDFSTrial(String nodeId, String tableType, String classify, String contractId, String projectId, String id, String tabIds) throws Exception {
-        return excelTabService.getBussPDFSTrial(nodeId, tableType, classify, contractId, projectId, Long.parseLong(id), tabIds, null);
+    public String getBussPDFSTrial(String nodeId, String tableType, String classify, String contractId, String projectId, String id, String tabIds, TrialSelfInspectionRecordDTO dto) throws Exception {
+        return excelTabService.getBussPDFSTrial(nodeId, tableType, classify, contractId, projectId, Long.parseLong(id), tabIds, dto);
     }
 
 

+ 1 - 13
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/SaveUserInfoByProjectClientImpl.java

@@ -54,19 +54,7 @@ public class SaveUserInfoByProjectClientImpl implements SaveUserInfoByProjectCli
         obj.setContractId(String.valueOf(contractId));
         obj.setRoleId(String.valueOf(roleId));
         obj.setStatus(1);
-
-        List<SaveUserInfoByProjectDTO> saveUserInfozList = saveUserInfoByProjectService.getBaseMapper().selectList(Wrappers.<SaveUserInfoByProjectDTO>query().lambda()
-                .eq(SaveUserInfoByProjectDTO::getUserId, userId)
-                .isNull(SaveUserInfoByProjectDTO::getPostId)
-                .eq(SaveUserInfoByProjectDTO::getContractId, contractId));
-
-        if(saveUserInfozList ==null && saveUserInfozList.size()==0){
-            saveUserInfoByProjectService.getBaseMapper().delete(Wrappers.<SaveUserInfoByProjectDTO>query().lambda()
-                    .eq(SaveUserInfoByProjectDTO::getUserId, userId)
-                    .isNull(SaveUserInfoByProjectDTO::getPostId)
-                    .eq(SaveUserInfoByProjectDTO::getContractId, contractId));
-            saveUserInfoByProjectService.save(obj);
-        }
+        saveUserInfoByProjectService.save(obj);
     }
 
 

+ 2 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.java

@@ -66,4 +66,6 @@ public interface ContractInfoMapper extends BaseMapper<ContractInfo> {
 
     List<UserContractInfoVO> userListByIds(@Param("ids") List<String> ids);
 
+    List<TrialRecordZJTreeLazyVO> trialRelationTreeLazy(String projectId, String contractId, String wbsId, String id);
+
 }

+ 67 - 35
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.xml

@@ -111,7 +111,9 @@
     </insert>
 
     <delete id="deleteContractRelationJLYZ">
-        delete from m_contract_relation_jlyz where contract_id_jlyz = #{id}
+        delete
+        from m_contract_relation_jlyz
+        where contract_id_jlyz = #{id}
     </delete>
 
     <select id="selectContractByProjectIds" resultMap="contractInfoResultMap">
@@ -388,7 +390,12 @@
     </select>
 
     <select id="selectContractIdByProjectId" resultType="org.springblade.manager.entity.ContractInfo">
-        SELECT id FROM m_contract_info WHERE p_id = #{project_id} AND contract_type = 1  AND is_deleted = 0 AND status = 1
+        SELECT id
+        FROM m_contract_info
+        WHERE p_id = #{project_id}
+          AND contract_type = 1
+          AND is_deleted = 0
+          AND status = 1
     </select>
 
     <select id="tree4" resultType="org.springblade.manager.vo.WbsTreeContractVO">
@@ -411,7 +418,11 @@
     </select>
 
     <select id="selectContractUserInfo" resultType="org.springblade.manager.entity.SaveUserInfoByProject">
-        select * from m_project_assignment_user where contract_id = #{contractId} and is_deleted = 0 and status = 1
+        select *
+        from m_project_assignment_user
+        where contract_id = #{contractId}
+          and is_deleted = 0
+          and status = 1
     </select>
 
     <select id="userListByIds" resultType="org.springblade.system.user.vo.UserContractInfoVO">
@@ -422,25 +433,23 @@
     </select>
 
     <select id="tree5" resultType="org.springblade.manager.vo.WbsTreeContractTreeAllVO">
-        SELECT
-        d.p_key_id AS "primaryKeyId",
-        d.id,
-        d.parent_id AS "parentId",
-        IFNULL(if(length(trim(full_name)) > 0, full_name, node_name),node_name) AS title,
-        partition_code,
-        node_type,
-        sort,
-        d.contract_id AS contractIdRelation,
-        d.type,
-        d.major_data_type AS majorDataType,
-        d.create_time
+        SELECT d.p_key_id                                                               AS "primaryKeyId",
+               d.id,
+               d.parent_id                                                              AS "parentId",
+               IFNULL(if(length(trim(full_name)) > 0, full_name, node_name), node_name) AS title,
+               partition_code,
+               node_type,
+               sort,
+               d.contract_id                                                            AS contractIdRelation,
+               d.type,
+               d.major_data_type                                                        AS majorDataType,
+               d.create_time
         FROM m_wbs_tree_contract d
-        WHERE
-         contract_id = #{contractId}
-        AND d.type = 1
-        AND d.status = 1
-        AND d.is_deleted = 0
-        ORDER BY d.sort,title,d.create_time
+        WHERE contract_id = #{contractId}
+          AND d.type = 1
+          AND d.status = 1
+          AND d.is_deleted = 0
+        ORDER BY d.sort, title, d.create_time
     </select>
 
     <select id="tree6" resultMap="treeNodeResultMap6">
@@ -473,21 +482,44 @@
     </select>
 
     <select id="trialRelationTree" resultType="org.springblade.manager.vo.TrialRecordZJTreeVO">
-        SELECT
-            d.p_key_id AS "primaryKeyId",
-            d.id AS id,
-            IFNULL(if(length(trim(d.full_name)) > 0, d.full_name, d.node_name),d.node_name) AS fullName,
-            d.parent_id AS "parentId"
+        SELECT d.p_key_id                                                                       AS "primaryKeyId",
+               d.id                                                                             AS id,
+               IFNULL(if(length(trim(d.full_name)) > 0, d.full_name, d.node_name), d.node_name) AS fullName,
+               d.parent_id                                                                      AS "parentId"
         FROM m_wbs_tree_contract d
-        WHERE
-            d.is_deleted = 0
-        AND d.status = 1
-        AND d.type = 1
-        AND wbs_type = 1
-        AND project_id = #{projectId}
-        AND contract_id = #{contractId}
-        AND wbs_id = #{wbsId}
-        ORDER BY d.sort,d.create_time
+        WHERE d.is_deleted = 0
+          AND d.status = 1
+          AND d.type = 1
+          AND wbs_type = 1
+          AND project_id = #{projectId}
+          AND contract_id = #{contractId}
+          AND wbs_id = #{wbsId}
+        ORDER BY d.sort, d.create_time
+    </select>
+
+    <select id="trialRelationTreeLazy" resultType="org.springblade.manager.vo.TrialRecordZJTreeLazyVO">
+        SELECT d.p_key_id                                                                       AS "primaryKeyId",
+               d.id                                                                             AS id,
+               IFNULL(if(length(trim(d.full_name)) > 0, d.full_name, d.node_name), d.node_name) AS fullName,
+               d.parent_id                                                                      AS "parentId",
+               (select case when count(1) > 0 then 1 else 0 end
+                from m_wbs_tree_contract
+                where parent_id = d.id
+                  and is_deleted = 0
+                  and project_id = #{projectId}
+                  and contract_id = #{contractId}
+                  and wbs_id = #{wbsId})                                                        AS "status"
+        FROM m_wbs_tree_contract d
+        WHERE d.is_deleted = 0
+          AND d.status = 1
+          AND d.type = 1
+          AND wbs_type = 1
+          AND project_id = #{projectId}
+          AND contract_id = #{contractId}
+          AND wbs_id = #{wbsId}
+          AND parent_id = #{id}
+          AND node_type in (1, 2, 3, 4, 5, 6)
+        ORDER BY d.sort, d.create_time
     </select>
 
 </mapper>

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

@@ -70,7 +70,7 @@ public interface IContractInfoService extends BaseService<ContractInfo> {
 
     List<UserContractInfoVO> getContractUserInfo(String contractId);
 
-    Map<String, Object> trialRelationTree(String wbsId, String projectId, String contractId, String selfId);
+    List<TrialRecordZJTreeLazyVO> trialRelationTree(String wbsId, String projectId, String contractId, String selfId, String id);
 
     Map<Long, List<WbsTreeContractTreeAllVO>> treeAllJL(String contractId, Integer type);
 

+ 10 - 32
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -11,12 +11,8 @@ import org.springblade.business.feign.InformationQueryClient;
 import org.springblade.common.utils.BaiduApiUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
-import org.springblade.core.mp.base.BaseEntity;
-import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.node.ForestNodeMerger;
 import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.manager.dto.FindAllUserByConditionDTO;
 import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
 import org.springblade.manager.entity.*;
@@ -36,11 +32,9 @@ import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
 import java.util.*;
-import java.util.function.Function;
 import java.util.stream.Collectors;
 
 @Service
@@ -620,38 +614,22 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
     }
 
     @Override
-    public Map<String, Object> trialRelationTree(String wbsId, String projectId, String contractId, String selfId) {
-        //当前合同段施工质检树
-        List<TrialRecordZJTreeVO> wbsTreeContractVOS = baseMapper.trialRelationTree(Long.parseLong(projectId), Long.parseLong(contractId), Long.parseLong(wbsId));
-        List<TrialRecordZJTreeVO> trialRecordZJTreeVOS = buildWbsTreeByStreamTrialRecordZJTree(wbsTreeContractVOS);
+    public List<TrialRecordZJTreeLazyVO> trialRelationTree(String wbsId, String projectId, String contractId, String selfId, String id) {
+        List<TrialRecordZJTreeLazyVO> wbsTreeContractVOSLazy = baseMapper.trialRelationTreeLazy(projectId, contractId, wbsId, id);
         ContractInfo contractInfo = jdbcTemplate.query("select contract_name from m_contract_info where id = " + contractId, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
-        for (TrialRecordZJTreeVO node : trialRecordZJTreeVOS) {
+        for (TrialRecordZJTreeLazyVO node : wbsTreeContractVOSLazy) {
             if (node.getParentId() == 0 && contractInfo != null) {
                 node.setFullName(contractInfo.getContractName());
-                break;
             }
-        }
-        Map<String, Object> maps = new HashMap<>();
-        maps.put("treeContractAll", trialRecordZJTreeVOS);
-        return maps;
-    }
-
-    private List<TrialRecordZJTreeVO> buildWbsTreeByStreamTrialRecordZJTree(List<TrialRecordZJTreeVO> wbsTreeVO2s) {
-        List<TrialRecordZJTreeVO> list = wbsTreeVO2s.stream().filter(f -> f.getParentId() == 0L).collect(Collectors.toList());
-        Map<Long, List<TrialRecordZJTreeVO>> map = wbsTreeVO2s.stream().collect(Collectors.groupingBy(TrialRecordZJTreeVO::getParentId));
-        this.recursionFnTreeTrialRecordZJTree(list, map);
-        return list;
-    }
-
-    private void recursionFnTreeTrialRecordZJTree(List<TrialRecordZJTreeVO> list, Map<Long, List<TrialRecordZJTreeVO>> map) {
-        for (TrialRecordZJTreeVO trialRecordZJTreeVO : list) {
-            List<TrialRecordZJTreeVO> childrenList = map.get(trialRecordZJTreeVO.getId());
-            if (childrenList != null && childrenList.size() > 0) {
-                trialRecordZJTreeVO.setChildren(childrenList);
-                trialRecordZJTreeVO.setHasChildren(true);
-                recursionFnTreeTrialRecordZJTree(childrenList, map);
+            if (node.getStatus() == 0) {
+                node.setHasChildren(false);
+                node.setNotExsitChild(true);
+            } else if (node.getStatus() == 1) {
+                node.setHasChildren(true);
+                node.setNotExsitChild(false);
             }
         }
+        return wbsTreeContractVOSLazy;
     }
 
 

+ 7 - 11
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -2340,11 +2340,10 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     }
                 }
 
-
                 // 组装电签设置
                 QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
                 queryWrapper.select("col_key", "id");
-                queryWrapper.in("type", 2);
+                queryWrapper.in("type", 2, 6);
                 queryWrapper.eq("tab_id", wbsTreePrivate.getPKeyId());
 
                 List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
@@ -2405,11 +2404,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
 
         if (bladeFile != null) {
-            //附件
-            TableFile tableFile1 = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getType, 1)).stream().findAny().orElse(null);
+            //附件,type=1表示表单,如果表单pdf存在就修改最新pdf,没有就新增
+            TableFile tableFile1 = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getType, 1).eq(TableFile::getTrialRecordId, id)).stream().findAny().orElse(null);
             if (tableFile1 != null) {
-            /*tableFile1.setDomainPdfUrl(bladeFile.getLink());
-            tableFileService.saveOrUpdate(tableFile1);*/
                 tableFileService.update(Wrappers.<TableFile>lambdaUpdate().set(TableFile::getDomainPdfUrl, bladeFile.getLink()).eq(TableFile::getId, tableFile1.getId()));
             } else {
                 TableFile tableFile = new TableFile();
@@ -2425,23 +2422,22 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 tableFileService.saveOrUpdate(tableFile);
             }
 
-            //获取当前试验记录的中的元素表附件文件
+            //获取当前试验记录的中的元素表附件文件,所有的包括表单pdf+附件pdf
             List<TableFile> tableFileList = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getTrialRecordId, id));
-            if (tableFileList.size() > 0) {
+            if (tableFileList.size() >= 2) { //表示有附件信息,重新合并
                 tableFileList.sort(Comparator.comparing(TableFile::getType));
                 List<String> dataListPdf = tableFileList.stream().filter(tableFile ->
                         tableFile.getDomainPdfUrl() != null
                                 && (tableFile.getType() == 1 || tableFile.getType() == 2)
                 ).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
 
+                //合并
                 String pdfPath2 = file_path + "/pdf//" + pkeyId + "_2.pdf";
-
                 File tabPdf2 = ResourceUtil.getFile(pdfPath2);
                 if (tabPdf2.exists()) {
                     tabPdf2.delete();
                 }
                 FileUtils.mergePdfPublicMethods(dataListPdf, pdfPath2);
-
                 BladeFile bladeFile2 = newIOSSClient.uploadFile(pkeyId + "2.pdf", pdfPath2);
                 if (bladeFile2 != null) {
                     bladeFile.setLink(bladeFile2.getLink());
@@ -2527,7 +2523,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             String querySql = "select id from u_information_query where classify ='" + classify + "' and wbs_id ='" + id + "' and contract_id ='" + contractId + "'";
             List<InformationQuery> query = jdbcTemplate.query(querySql, new BeanPropertyRowMapper<>(InformationQuery.class));
             if (query.size() > 0) {
-                String updateSql = "update u_information_query set pdf_url ='" + bladeFile.getLink() + "', name ='" + (StringUtils.isNotEmpty(dto.getTrialProjectName()) ? dto.getTrialProjectName() : "") + "'  where classify='" + classify + "' and  wbs_id='" + id + "' and contract_id ='" + contractId + "'";
+                String updateSql = "update u_information_query set pdf_url ='" + bladeFile.getLink() + "', name ='" + (StringUtils.isNotEmpty(dto.getTrialProjectName()) ? dto.getTrialProjectName() : "") + "' where classify='" + classify + "' and wbs_id='" + id + "' and contract_id ='" + contractId + "'";
                 jdbcTemplate.execute(updateSql);
             } else {
                 informationQueryClient.saveData(id.toString(), projectId, contractId, classify, bladeFile.getLink(), StringUtils.isNotEmpty(dto.getTrialProjectName()) ? dto.getTrialProjectName() : "");