Quellcode durchsuchen

Merge branch 'refs/heads/feature-lihb-20250731' into test-merge

# Conflicts:
#	blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java
LHB vor 1 Tag
Ursprung
Commit
c4242b817e
13 geänderte Dateien mit 216 neuen und 10 gelöschten Zeilen
  1. 24 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/TrialCyAccessoriesClient.java
  2. 7 4
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/TableFile.java
  3. 14 0
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialCyController.java
  4. 118 0
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/TrialCyAccessoriesClientImpl.java
  5. 3 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyAccessoriesMapper.java
  6. 3 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyAccessoriesMapper.xml
  7. 3 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSelfInspectionRecordMapper.java
  8. 6 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSelfInspectionRecordMapper.xml
  9. 1 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/TrialCyAccessoriesService.java
  10. 2 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/TrialCyService.java
  11. 4 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialCyAccessoriesServiceImpl.java
  12. 5 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialCyServiceImpl.java
  13. 26 5
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

+ 24 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/TrialCyAccessoriesClient.java

@@ -0,0 +1,24 @@
+package org.springblade.business.feign;
+
+import com.alibaba.fastjson.JSONObject;
+import org.springblade.common.constant.BusinessConstant;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+/**
+ * @author LHB
+ */
+
+@FeignClient(value = BusinessConstant.APPLICATION_WEATHER_NAME)
+public interface TrialCyAccessoriesClient {
+    /**
+     * 接口前缀
+     */
+    String API_PREFIX = "/api/business/detection";
+
+    @PostMapping(API_PREFIX + "/getTrialFilePdfRecord")
+    List<JSONObject> getTrialFilePdfRecord(@RequestParam String primaryKeyId,@RequestParam List<Integer> list);
+}

+ 7 - 4
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/TableFile.java

@@ -16,10 +16,7 @@
  */
 package org.springblade.manager.entity;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.*;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import io.swagger.annotations.ApiModel;
@@ -98,4 +95,10 @@ public class TableFile implements Serializable {
 
     private Integer sort;
 
+    /**
+     * 文件是否为关联的试验文件
+     */
+    @TableField(exist = false)
+    private Boolean isTrial = false;
+
 }

+ 14 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialCyController.java

@@ -83,4 +83,18 @@ public class TrialCyController {
     }
 
 
+    /**
+     * 清除成渝试验关联
+     * @return
+     */
+    @GetMapping("/clearTrialAssociation")
+    @ApiOperation(value = "清除成渝试验关联", notes = "")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "nodeId", value = "节点", required = true),
+            @ApiImplicitParam(name = "recordId", value = "pkeyId", required = true)
+    })
+    public R<Boolean> clearTrialAssociation(Long nodeId, Long recordId){
+        return R.data(trialCyService.clearTrialAssociation(nodeId,recordId));
+    }
+
 }

+ 118 - 0
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/TrialCyAccessoriesClientImpl.java

@@ -0,0 +1,118 @@
+package org.springblade.business.feignClient;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.AllArgsConstructor;
+import org.springblade.business.entity.TrialCyFinishTestReport;
+import org.springblade.business.entity.TrialCyThirdReport;
+import org.springblade.business.feign.TrialCyAccessoriesClient;
+import org.springblade.business.mapper.TrialSelfInspectionRecordMapper;
+import org.springblade.business.service.TrialCyFinishTestReportService;
+import org.springblade.business.service.TrialCyThirdReportService;
+import org.springblade.core.tool.utils.CollectionUtil;
+import org.springblade.manager.entity.TableFile;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author LHB
+ */
+@RestController
+@AllArgsConstructor
+public class TrialCyAccessoriesClientImpl implements TrialCyAccessoriesClient {
+
+    private final TrialSelfInspectionRecordMapper trialSelfInspectionRecordMapper;
+
+    /**
+     * 第三方、外委
+     */
+    private final TrialCyThirdReportService trialCyThirdReportService;
+
+    /**
+     * 试验报告
+     */
+    private final TrialCyFinishTestReportService trialCyFinishTestReportService;
+
+    @Override
+    public List<JSONObject> getTrialFilePdfRecord(String primaryKeyId, List<Integer> list) {
+        //获取id
+        List<Map<String, Object>> trialFilePdfRecord = trialSelfInspectionRecordMapper.getTrialFilePdfRecord(primaryKeyId, list);
+
+        if (CollectionUtil.isNotEmpty(trialFilePdfRecord)) {
+
+            //试验报告ids
+            List<Long> listOne = new ArrayList<>();
+            //第三方外委ids
+            List<Long> listTwo = new ArrayList<>();
+
+            for (Map<String, Object> stringObjectMap : trialFilePdfRecord) {
+
+                Integer type = (Integer) stringObjectMap.get("type");
+                Long recordId = (Long) stringObjectMap.get("record_id");
+                //试验报告
+                if (type == 11) {
+                    listOne.add(recordId);
+                } else {
+                    //第三方、外委
+                    listTwo.add(recordId);
+                }
+            }
+
+            List<JSONObject> result = new ArrayList<>();
+
+            if (CollectionUtil.isNotEmpty(listOne)) {
+                List<TrialCyFinishTestReport> list1 = trialCyFinishTestReportService.list(Wrappers.<TrialCyFinishTestReport>lambdaQuery()
+                        .isNotNull(TrialCyFinishTestReport::getAssembleFile)
+                        .in(TrialCyFinishTestReport::getTaskId, listOne)
+                );
+
+                if (CollectionUtil.isNotEmpty(list1)) {
+                    list1.forEach(f -> {
+                        String[] split = f.getAssembleFile().split("/");
+                        JSONObject jsonObject = new JSONObject();
+                        jsonObject.put("id", f.getTaskId());
+                        jsonObject.put("name", split[split.length - 1]);
+                        jsonObject.put("contractId", f.getContractId());
+                        jsonObject.put("domainUrl", f.getAssembleFile());
+                        jsonObject.put("domainPdfUrl", f.getAssembleFile());
+                        jsonObject.put("tabId", primaryKeyId);
+                        jsonObject.put("extension", "pdf");
+                        //是否为试验关联的附件
+                        jsonObject.put("isTrial", true);
+                        result.add(jsonObject);
+                    });
+                }
+            }
+            if (CollectionUtil.isNotEmpty(listTwo)) {
+                List<TrialCyThirdReport> list1 = trialCyThirdReportService.list(Wrappers.<TrialCyThirdReport>lambdaQuery()
+                        .isNotNull(TrialCyThirdReport::getAssembleFile)
+                        .in(TrialCyThirdReport::getId, listTwo)
+                );
+
+                if (CollectionUtil.isNotEmpty(list1)) {
+                    list1.forEach(f -> {
+                        String[] split = f.getAssembleFile().split("/");
+                        JSONObject jsonObject = new JSONObject();
+                        jsonObject.put("id", f.getId());
+                        jsonObject.put("name", split[split.length - 1]);
+                        jsonObject.put("contractId", f.getContractId());
+                        jsonObject.put("domainUrl", f.getAssembleFile());
+                        jsonObject.put("domainPdfUrl", f.getAssembleFile());
+                        jsonObject.put("tabId", primaryKeyId);
+                        jsonObject.put("extension", "pdf");
+                        //是否为试验关联的附件
+                        jsonObject.put("isTrial", true);
+                        result.add(jsonObject);
+                    });
+                }
+            }
+            return result;
+        }
+
+        return null;
+    }
+}

+ 3 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyAccessoriesMapper.java

@@ -1,5 +1,6 @@
 package org.springblade.business.mapper;
 
+import org.apache.ibatis.annotations.Param;
 import org.springblade.business.entity.TrialCyAccessories;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
@@ -11,6 +12,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 */
 public interface TrialCyAccessoriesMapper extends BaseMapper<TrialCyAccessories> {
 
+    Boolean clearTrialAssociation(@Param("nodeId") Long nodeId,
+                                  @Param("recordId") Long recordId);
 }
 
 

+ 3 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyAccessoriesMapper.xml

@@ -16,4 +16,7 @@
     <sql id="Base_Column_List">
         id,report_id,acc_id,acc_type,file_name,file_path
     </sql>
+    <delete id="clearTrialAssociation">
+        delete from u_trial_file_pdf_record where node_id = #{nodeId} and record_id=#{recordId}
+    </delete>
 </mapper>

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

@@ -7,6 +7,7 @@ import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.manager.entity.WbsTreeContract;
 
 import java.util.List;
+import java.util.Map;
 
 public interface TrialSelfInspectionRecordMapper extends BaseMapper<TrialSelfInspectionRecord> {
 
@@ -45,4 +46,6 @@ public interface TrialSelfInspectionRecordMapper extends BaseMapper<TrialSelfIns
     @Select("select self_id from u_trial_self_quality_project where quality_node_id = #{pKeyId}")
     List<String> selectTrialIdByNodeId(Long pKeyId);
 
+    List<Map<String,Object>> getTrialFilePdfRecord(@Param("nodeId") String nodeId,
+                                                   @Param("types") List<Integer> types);
 }

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

@@ -108,5 +108,11 @@
             </if>
         </where>
     </select>
+    <select id="getTrialFilePdfRecord" resultType="java.util.Map">
+        select record_id,type from u_trial_file_pdf_record where node_id = #{nodeId} and `type` in
+       <foreach collection="types" item="type" open="(" close=")" separator=",">
+           #{type}
+       </foreach>
+    </select>
 
 </mapper>

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

@@ -10,4 +10,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
 */
 public interface TrialCyAccessoriesService extends IService<TrialCyAccessories> {
 
+    Boolean clearTrialAssociation(Long nodeId, Long recordId);
 }

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

@@ -20,4 +20,6 @@ public interface TrialCyService {
     Page<ThirdReportVo> getTrialDetectionReport(TrialCyThirdReportQueryVo queryVo);
 
     Page<ThirdReportVo> getThirdReport(TrialCyThirdReportQueryVo queryVo);
+
+    Boolean clearTrialAssociation(Long nodeId, Long recordId);
 }

+ 4 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialCyAccessoriesServiceImpl.java

@@ -14,7 +14,10 @@ import org.springframework.stereotype.Service;
 @Service
 public class TrialCyAccessoriesServiceImpl extends ServiceImpl<TrialCyAccessoriesMapper, TrialCyAccessories>
     implements TrialCyAccessoriesService {
-
+    @Override
+    public Boolean clearTrialAssociation(Long nodeId, Long recordId) {
+        return baseMapper.clearTrialAssociation(nodeId,recordId);
+    }
 }
 
 

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

@@ -78,4 +78,9 @@ public class TrialCyServiceImpl implements TrialCyService {
         Page<ThirdReportVo> page = trialCyThirdReportService.myPage(new Page<ThirdReportVo>(queryVo.getCurrent(), queryVo.getSize()), queryVo);
         return page;
     }
+
+    @Override
+    public Boolean clearTrialAssociation(Long nodeId, Long recordId) {
+        return trialCyAccessoriesService.clearTrialAssociation(nodeId, recordId);
+    }
 }

+ 26 - 5
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -1,8 +1,7 @@
 package org.springblade.manager.service.impl;
 
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.lang.func.LambdaUtil;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -36,6 +35,7 @@ import org.springblade.business.entity.InformationQuery;
 import org.springblade.business.feign.ConstructionLedgerFeignClient;
 import org.springblade.business.feign.InformationQueryClient;
 import org.springblade.business.feign.WbsTreeContractStatisticsClient;
+import org.springblade.business.feign.TrialCyAccessoriesClient;
 import org.springblade.business.vo.QueryProcessDataVO;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.utils.Colour;
@@ -57,19 +57,16 @@ import org.springblade.manager.excel.WbsExcelUtil;
 import org.springblade.manager.feign.ContractClient;
 import org.springblade.manager.mapper.*;
 import org.springblade.manager.service.ITableFileService;
-import org.springblade.manager.service.IWbsParamService;
 import org.springblade.manager.service.IWbsTreeContractService;
 import org.springblade.manager.utils.CompositeKey;
 import org.springblade.manager.vo.*;
 import org.springblade.system.cache.ParamCache;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Lazy;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.jdbc.BadSqlGrammarException;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.SingleColumnRowMapper;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
@@ -116,6 +113,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
     private final ITableFileService tableFileService;
     private final TableInfoMapper tableInfoMapper;
     private final WbsFormElementMapper wbsFormElementMapper;
+    private final TrialCyAccessoriesClient trialCyAccessoriesClient;
     private final WbsTreeContractStatisticsClient wbsTreeContractStatisticsClient;
 
 
@@ -1257,6 +1255,29 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
             vo.setFileList(files2);
             voList.add(vo);
         }
+        //质检绑定成渝那边的类型
+        Integer[] types = {11, 12, 13};
+        //查询节点绑定试验数据
+        List<JSONObject> ids = trialCyAccessoriesClient.getTrialFilePdfRecord(primaryKeyId, Arrays.asList(types));
+        if (CollectionUtil.isNotEmpty(ids) ) {
+            List<TableFile> tableFiles = JSONUtil.toList(JSONUtil.toJsonStr(ids), TableFile.class);
+
+            if (CollectionUtil.isNotEmpty(voList)) {
+                //原先的附件是否为空
+                List<TableFile> fileList = voList.get(0).getFileList();
+                if (CollectionUtil.isNotEmpty(fileList)) {
+                    fileList.addAll(tableFiles);
+                } else {
+                    voList.get(0).setFileList(tableFiles);
+                }
+            } else {
+                WbsTreeContract treeContract = this.getOne(new LambdaQueryWrapper<WbsTreeContract>()
+                        .eq(WbsTreeContract::getPKeyId, primaryKeyId));
+                AppWbsTreeContractVO vo = BeanUtil.copyProperties(treeContract, AppWbsTreeContractVO.class);
+                vo.setFileList(tableFiles);
+                voList.add(vo);
+            }
+        }
         return voList;
     }