Эх сурвалжийг харах

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

# Conflicts:
#	blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.java
#	blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java
LHB 1 долоо хоног өмнө
parent
commit
313d439393
36 өөрчлөгдсөн 2548 нэмэгдсэн , 237 устгасан
  1. 52 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialCyAccessories.java
  2. 115 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialCyFinishTestReport.java
  3. 43 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialCyTestType.java
  4. 230 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialCyThirdReport.java
  5. 84 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/APIWbsContractSubdivisionVo.java
  6. 90 0
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialCyController.java
  7. 18 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyAccessoriesMapper.java
  8. 19 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyAccessoriesMapper.xml
  9. 18 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyFinishTestReportMapper.java
  10. 6 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyFinishTestReportMapper.xml
  11. 18 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyTestTypeMapper.java
  12. 6 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyTestTypeMapper.xml
  13. 18 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyThirdReportMapper.java
  14. 6 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyThirdReportMapper.xml
  15. 628 0
      blade-service/blade-business/src/main/java/org/springblade/business/scheduled/ChenYuTestScheduled.java
  16. 462 0
      blade-service/blade-business/src/main/java/org/springblade/business/scheduled/ChenYuTestScheduled01.java
  17. 57 0
      blade-service/blade-business/src/main/java/org/springblade/business/scheduled/vo/GetFinishTestReport.java
  18. 57 0
      blade-service/blade-business/src/main/java/org/springblade/business/scheduled/vo/GetThirdReport.java
  19. 25 0
      blade-service/blade-business/src/main/java/org/springblade/business/scheduled/vo/Result.java
  20. 25 0
      blade-service/blade-business/src/main/java/org/springblade/business/scheduled/vo/ResultPost.java
  21. 28 0
      blade-service/blade-business/src/main/java/org/springblade/business/scheduled/vo/ThirdLogin.java
  22. 13 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/TrialCyAccessoriesService.java
  23. 13 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/TrialCyFinishTestReportService.java
  24. 20 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/TrialCyService.java
  25. 13 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/TrialCyTestTypeService.java
  26. 13 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/TrialCyThirdReportService.java
  27. 22 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialCyAccessoriesServiceImpl.java
  28. 22 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialCyFinishTestReportServiceImpl.java
  29. 75 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialCyServiceImpl.java
  30. 22 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialCyTestTypeServiceImpl.java
  31. 22 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialCyThirdReportServiceImpl.java
  32. 13 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/APIController.java
  33. 16 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.java
  34. 48 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml
  35. 2 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java
  36. 229 237
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

+ 52 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialCyAccessories.java

@@ -0,0 +1,52 @@
+package org.springblade.business.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * 成渝-附件信息
+ * @author LHB
+ * @TableName u_trial_cy_accessories
+ */
+@TableName(value ="u_trial_cy_accessories")
+@Data
+public class TrialCyAccessories {
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.INPUT)
+    private Long id;
+
+    /**
+     * 报告id,已签章的报告/是第三方检测报告/外委检测报告/上传报告
+     */
+    private Long reportId;
+
+    /**
+     * 成渝接口返回的id
+     */
+    @TableField("acc_id")
+    private String AccID;
+
+    /**
+     * 类型名称
+     */
+
+    @TableField("acc_type")
+    private String AccType;
+
+    /**
+     * 文件名称
+     */
+    @TableField("file_name")
+    private String FileName;
+
+    /**
+     * 文件路径
+     */
+    @TableField("file_path")
+    private String FilePath;
+}

+ 115 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialCyFinishTestReport.java

@@ -0,0 +1,115 @@
+package org.springblade.business.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 已完成(已签章完成)的检测报告接受对象
+ *
+ * @author LHB
+ */
+@TableName("u_trial_cy_finish_test_report")
+@Data
+public class TrialCyFinishTestReport {
+
+    @TableId(type = IdType.INPUT)
+    private Long id;
+    /**
+     * 合同ID
+     */
+    @TableField("contract_id")
+    private Long contractId;
+    /**
+     * 任务ID
+     */
+    private Integer taskId;
+    /**
+     * 合同段编码
+     */
+    private String contractNumber;
+    /**
+     * 单位类型
+     * 0 施工
+     * 1 监理
+     * 2 中试
+     */
+    private Integer cs;
+    /**
+     * 记录编号
+     */
+    private String number;
+    /**
+     * 报告编号
+     */
+    private String reportNumber;
+    /**
+     * 试验项目名称
+     */
+    private String name;
+    /**
+     * 试验工序名称
+     */
+    private String processName;
+    /**
+     * 取样地点
+     */
+    @TableField("sampling_place")
+    private String SamplingPlace;
+    /**
+     * 样品信息 同试验检测查询界面
+     */
+    @TableField("sample_info")
+    private String SampleInfo;
+    /**
+     * 类型规格 规格型号
+     */
+    @TableField("specification")
+    private String Specification;
+    /**
+     * 合格证上传情况 已上传、未上传
+     */
+    @TableField("hash_gz")
+    private String HasHGZ;
+    /**
+     * 所检参数信息 同试验检测查询界面
+     */
+    @TableField("test_param_info")
+    private String TestParamInfo;
+    /**
+     * 报告时间
+     */
+    private String reportDate;
+    /**
+     * 是否合格 True 合格,False不合格
+     */
+    private String experimentResult;
+    /**
+     * 报告人
+     */
+    @TableField("user_name")
+    private String username;
+    /**
+     * 使用部位
+     */
+    private String position;
+    /**
+     * 报告文件路径
+     */
+    @TableField("report_file_path")
+    private String ReportFilePath;
+    /**
+     * 记录文件路径
+     */
+    @TableField("record_file_path")
+    private String RecordFilePath;
+    /**
+     * 附件
+     */
+    @TableField(exist = false)
+    private List<TrialCyAccessories> Accessories;
+}

+ 43 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialCyTestType.java

@@ -0,0 +1,43 @@
+package org.springblade.business.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * 获取检测项目树(包括自建试验、外委、第三方、上传报告) 接受对象
+ *
+ * @author LHB
+ */
+@TableName("u_trial_cy_test_type")
+@Data
+public class TrialCyTestType {
+    @TableId(type = IdType.INPUT)
+    private Long pKeyId;
+    /**
+     * 项目id
+     */
+    private Long projectId;
+    /**
+     * ID唯一标识
+     */
+    @TableField("id")
+    private String ID;
+    /**
+     * 名称
+     */
+    @TableField("name")
+    private String Name;
+    /**
+     * 父级ID
+     */
+    @TableField("father_id")
+    private String FatherID;
+    /**
+     * 顺序号
+     */
+    @TableField("order_index")
+    private String OrderIndex;
+}

+ 230 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialCyThirdReport.java

@@ -0,0 +1,230 @@
+package org.springblade.business.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 获取已上传的外委检测报告/第三方检测报告/上传报告 接受对象
+ *
+ * @author LHB
+ */
+@TableName("u_trial_cy_third_report")
+@Data
+public class TrialCyThirdReport {
+    @TableId(type = IdType.INPUT)
+    private Long pKeyId;
+    /**
+     * 合同id
+     */
+    private Long contractId;
+    /**
+     * ID
+     */
+    @TableField("id")
+    public String ID;
+    /**
+     * 报告类型(0:外委检测,1:第三方检测,2:扫描上传报告)
+     */
+    public Integer thirdType;
+    /**
+     * 委托编号
+     */
+    @TableField("consign_no")
+    public String ConsignNo;
+    /**
+     * 报告编号
+     */
+    @TableField("report_no")
+    public String ReportNo;
+    /**
+     * 取样时间 格式如:“2022-06-21”
+     */
+    @TableField("take_sampling_date")
+    public String TakeSamplingDate;
+    /**
+     * 送样时间 格式如:“2022-06-21”
+     */
+    @TableField("send_sample_date")
+    public String SendSampleDate;
+    /**
+     * 检测时间 格式如:“2022-06-21”
+     */
+    @TableField("test_date")
+    public String TestDate;
+    /**
+     * 报告时间 格式如:“2022-06-21”
+     */
+    @TableField("report_date")
+    public String ReportDate;
+    /**
+     * 委托单位
+     */
+    @TableField("consign_unit")
+    public String ConsignUnit;
+    /**
+     * 检测机构
+     */
+    @TableField("accept_test_unit")
+    public String AcceptTestUnit;
+    /**
+     * 送样人
+     */
+    @TableField("send_sample_person")
+    public String SendSamplePerson;
+    /**
+     * 接样人
+     */
+    @TableField("witness_person")
+    public String WitnessPerson;
+    /**
+     * 工程部位
+     */
+    @TableField("project_part")
+    public String ProjectPart;
+    /**
+     * 取样地点
+     */
+    @TableField("sampling_place")
+    public String SamplingPlace;
+    /**
+     * 样品名称
+     */
+    @TableField("sample_name")
+    public String SampleName;
+    /**
+     * 委托单文件下载地址
+     */
+    @TableField("consign_doc_file_path")
+    public String ConsignDocFilePath;
+    /**
+     * 记录单文件下载地址
+     */
+    @TableField("record_doc_file_path")
+    public String RecordDocFilePath;
+    /**
+     * 报告单文件下载地址
+     */
+    @TableField("report_doc_file_path")
+    public String ReportDocFilePath;
+    /**
+     * 检测依据
+     */
+    @TableField("test_standard")
+    public String TestStandard;
+    /**
+     * 评定标准
+     */
+    @TableField("assess_standard")
+    public String AssessStandard;
+    /**
+     * 检测结论
+     */
+    @TableField("test_conclusion")
+    public String TestConclusion;
+    /**
+     * 备注
+     */
+    @TableField("memo")
+    public String Memo;
+    /**
+     * 期数
+     */
+    @TableField("period_num")
+    public String PeriodNum;
+    /**
+     * 是否合格
+     */
+    @TableField("is_qualified")
+    public String IsQualified;
+    /**
+     * 样品编号
+     */
+    @TableField("sample_code")
+    public String SampleCode;
+    /**
+     * 规格型号
+     */
+    @TableField("gui_ge_xing_hao")
+    public String GuiGeXingHao;
+    /**
+     * 生产厂家
+     */
+    @TableField("sheng_chan_cj")
+    public String ShengChanCJ;
+    /**
+     * 产地
+     */
+    @TableField("chan_di")
+    public String ChanDi;
+    /**
+     * 样品数量
+     */
+    @TableField("sample_num")
+    public String SampleNum;
+    /**
+     * 检测机构资质证书编号
+     */
+    @TableField("consign_unit_ability")
+    public String ConsignUnitAbility;
+    /**
+     * 批号
+     */
+    @TableField("batch_num")
+    public String BatchNum;
+    /**
+     * 代表数量
+     */
+    @TableField("quantity")
+    public String Quantity;
+    /**
+     * 单位
+     */
+    @TableField("unit")
+    public String Unit;
+    /**
+     * 类型ID
+     */
+    @TableField("consign_test_cls_id")
+    public String ConsignTestClsID;
+    /**
+     * 结论
+     */
+    @TableField("result")
+    public String Result;
+    /**
+     * 是否已删除
+     * Null:未删除
+     * 0:未删除
+     * 1:已删除
+     */
+    @TableField("is_deleted")
+    public String IsDeleted;
+    /**
+     * 删除时间
+     */
+    @TableField("delete_time")
+    public String DeleteTime;
+    /**
+     * 快报/正式报告
+     * 1 快报
+     * 2 正式报告
+     */
+    @TableField("report_type")
+    public Integer ReportType;
+    /**
+     * 创建时间 格式如:“2022-06-21 13:44:33 235”
+     */
+    @TableField("create_time")
+    public String CreateTime;
+
+    /**
+     * 附件
+     */
+    @TableField(exist = false)
+    private List<TrialCyAccessories> Accessories;
+}

+ 84 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/APIWbsContractSubdivisionVo.java

@@ -0,0 +1,84 @@
+package org.springblade.manager.vo;
+
+import lombok.Data;
+import org.springblade.manager.entity.WbsTreeContract;
+
+/**
+ * 合同段分部分项划分节点试图
+ * 包含各个状态
+ * | 01   | 交工证书     | 所有子节点存在一个的major_data_type = 3   值为 true     |
+ * | 02   | 7天强度报告  | 所有最小节点中在m_table_file 中type = 11  存在一个true  |
+ * | 03   | 28天强度报告 | 所有最小节点中在m_table_file 中type = 12   存在一个true |
+ * | 04   | 监理收验资料 | 监理 major_data_type = 4  全部已审批                    |
+ * | 05   | 桩检报告     | 所有最小节点中在m_table_file 中type = 13   存在一个true |
+ * | 06   | 质检资料     | 质检 major_data_type = 4  全部已审批                    |
+ * | 07   | 评定资料     | major_data_type = 2  全部已审批                         |
+ * @author LHB
+ */
+@Data
+public class APIWbsContractSubdivisionVo {
+    /**
+     * 主键
+     */
+    private Long id;
+    /**
+     * 编码 空
+     */
+    private String code;
+    /**
+     * 节点名称
+     */
+    private String name;
+    /**
+     * 桩号
+     */
+    private String stake;
+    /**
+     * 父节点id
+     */
+    private Long pid;
+    /**
+     * 1表示单位工程 2表示分部工程 3表示分项工程
+     */
+    private Integer nodeType;
+    /**
+     * 层级编码 空
+     */
+    private String levelCode;
+    /**
+     * 专业工程id
+     */
+    private String partitionCatagID;
+    /**
+     * 专业工程名称
+     */
+    private String partitionCatagName;
+    /**
+     * 交工证书
+     */
+    private Boolean completionCertificate = false;
+    /**
+     * 7天强度报告
+     */
+    private Boolean strengthReportSeven = false;
+    /**
+     * 28天强度报告
+     */
+    private Boolean strengthReportTwentyEight = false;
+    /**
+     * 监理资料
+     */
+    private Boolean supervisionData = false;
+    /**
+     * 桩检报告
+     */
+    private Boolean pileInspectionReport = false;
+    /**
+     * 质检资料
+     */
+    private Boolean qualityInspectionData = false;
+    /**
+     * 评定资料
+     */
+    private Boolean evaluationData = false;
+}

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

@@ -0,0 +1,90 @@
+package org.springblade.business.controller;
+
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.business.entity.TrialContainerClassification;
+import org.springblade.business.entity.TrialCyFinishTestReport;
+import org.springblade.business.entity.TrialCyTestType;
+import org.springblade.business.entity.TrialCyThirdReport;
+import org.springblade.business.service.TrialCyService;
+import org.springblade.business.service.TrialCyTestTypeService;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 成渝试验数据接口
+ * @author LHB
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/cyTrial")
+@Api(value = "成渝试验数据接口", tags = "成渝试验数据接口")
+public class TrialCyController {
+
+    private TrialCyService trialCyService;
+
+
+    /**
+     * 根据合同段id验证当前合同段是否未成渝项目下未开启试验功能的合同段
+     * @return
+     */
+    @GetMapping("/isCyAndTestModule")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "验证是否使用成渝那边的树", notes = "传入合同段id")
+    public R<Boolean> isCyAndTestModule(Long projectId,Long contractId){
+        return R.data(trialCyService.isCyAndTestModule(projectId, contractId));
+    }
+
+    /**
+     * 获取成渝那边的树
+     * @return
+     */
+    @GetMapping("/getTree")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "获取成渝那边的树", notes = "传入项目id")
+    public R<List<TrialCyTestType>> getTree(Long projectId, String parentId){
+        return R.data(trialCyService.getTree(projectId,parentId));
+    }
+
+    /**
+     * 获取试验检测报告
+     * @return
+     */
+    @GetMapping("/getTrialDetectionReport")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "获取试验检测报告", notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "contractId", value = "合同段id", required = true),
+            @ApiImplicitParam(name = "pKeyId", value = "树节点pKeyId", required = true)
+    })
+    public R<List<TrialCyFinishTestReport>> getTrialDetectionReport(Long contractId, Long pKeyId){
+        return R.data(trialCyService.getTrialDetectionReport(contractId,pKeyId));
+    }
+
+
+    /**
+     * 获取第三方/外委 检测报告
+     * @return
+     */
+    @GetMapping("/getThirdReport")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "获取第三方/外委 检测报告", notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "contractId", value = "合同段id", required = true),
+            @ApiImplicitParam(name = "pKeyId", value = "树节点pKeyId", required = true),
+            @ApiImplicitParam(name = "type", value = "类型:0-外委检测,1-第三方", required = true)
+    })
+    public R<List<TrialCyThirdReport>> getThirdReport(Long contractId, Long pKeyId, Integer type){
+        return R.data(trialCyService.getThirdReport(contractId,pKeyId,type));
+    }
+
+
+}

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

@@ -0,0 +1,18 @@
+package org.springblade.business.mapper;
+
+import org.springblade.business.entity.TrialCyAccessories;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author LHB
+* @description 针对表【u_trial_cy_accessories(成渝-附件信息)】的数据库操作Mapper
+* @createDate 2025-08-04 14:39:16
+* @Entity generator.domain.UTrialCyAccessories
+*/
+public interface TrialCyAccessoriesMapper extends BaseMapper<TrialCyAccessories> {
+
+}
+
+
+
+

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

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.business.mapper.TrialCyAccessoriesMapper">
+
+    <resultMap id="BaseResultMap" type="org.springblade.business.entity.TrialCyAccessories">
+            <id property="id" column="id" />
+            <result property="reportId" column="report_id" />
+            <result property="accId" column="acc_id" />
+            <result property="accType" column="acc_type" />
+            <result property="fileName" column="file_name" />
+            <result property="filePath" column="file_path" />
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,report_id,acc_id,acc_type,file_name,file_path
+    </sql>
+</mapper>

+ 18 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyFinishTestReportMapper.java

@@ -0,0 +1,18 @@
+package org.springblade.business.mapper;
+
+import org.springblade.business.entity.TrialCyFinishTestReport;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author LHB
+* @description 针对表【u_trial_cy_finish_test_report(成渝-获取标段已完成(已签章完成)的检测报告)】的数据库操作Mapper
+* @createDate 2025-08-01 09:05:03
+* @Entity generator.domain.UTrialCyFinishTestReport
+*/
+public interface TrialCyFinishTestReportMapper extends BaseMapper<TrialCyFinishTestReport> {
+
+}
+
+
+
+

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

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.business.mapper.TrialCyFinishTestReportMapper">
+</mapper>

+ 18 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyTestTypeMapper.java

@@ -0,0 +1,18 @@
+package org.springblade.business.mapper;
+
+import org.springblade.business.entity.TrialCyTestType;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author LHB
+* @description 针对表【u_trial_cy_test_type(成渝-试验检测树)】的数据库操作Mapper
+* @createDate 2025-08-01 09:05:07
+* @Entity generator.domain.UTrialCyTestType
+*/
+public interface TrialCyTestTypeMapper extends BaseMapper<TrialCyTestType> {
+
+}
+
+
+
+

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

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.business.mapper.TrialCyTestTypeMapper">
+</mapper>

+ 18 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyThirdReportMapper.java

@@ -0,0 +1,18 @@
+package org.springblade.business.mapper;
+
+import org.springblade.business.entity.TrialCyThirdReport;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author LHB
+* @description 针对表【u_trial_cy_third_report(成渝-已上传的外委检测报告/第三方检测报告/上传报告)】的数据库操作Mapper
+* @createDate 2025-08-01 09:05:10
+* @Entity generator.domain.UTrialCyThirdReport
+*/
+public interface TrialCyThirdReportMapper extends BaseMapper<TrialCyThirdReport> {
+
+}
+
+
+
+

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

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.business.mapper.TrialCyThirdReportMapper">
+</mapper>

+ 628 - 0
blade-service/blade-business/src/main/java/org/springblade/business/scheduled/ChenYuTestScheduled.java

@@ -0,0 +1,628 @@
+package org.springblade.business.scheduled;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.nacos.common.utils.MD5Utils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.Consts;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+import org.springblade.business.entity.TrialCyAccessories;
+import org.springblade.business.entity.TrialCyFinishTestReport;
+import org.springblade.business.entity.TrialCyTestType;
+import org.springblade.business.entity.TrialCyThirdReport;
+import org.springblade.business.scheduled.vo.*;
+import org.springblade.business.service.TrialCyAccessoriesService;
+import org.springblade.business.service.TrialCyFinishTestReportService;
+import org.springblade.business.service.TrialCyTestTypeService;
+import org.springblade.business.service.TrialCyThirdReportService;
+import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.common.utils.SystemUtils;
+import org.springblade.core.redis.cache.BladeRedis;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.CollectionUtil;
+import org.springblade.core.tool.utils.DigestUtil;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.manager.entity.ContractInfo;
+import org.springblade.manager.entity.ProjectInfo;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Collectors;
+
+/**
+ * 成渝试验第三方接口获取数据
+ * 定时任务
+ *
+ * @author LHB
+ */
+@Component
+@Slf4j
+public class ChenYuTestScheduled {
+
+    // 接口URL常量
+    private static final String THIRD_LOGIN_URL = "/api/ThirdSystem/ThirdLogin";
+    private static final String CONTRACT_SECT_URL = "/api/CQHCZC/MesureSystem/GetContractSectByProjCode";
+    private static final String FINISH_TEST_REPORT_URL = "/open/TestReport/GetFinishTestReport";
+    private static final String THIRD_REPORT_URL = "/open/ThirdReport/GetThirdReport";
+    private static final String ALL_TEST_TYPE_URL = "/open/ThirdReport/GetAllTestType";
+
+    // SQL常量
+    private static final String PROJECT_ID_SQL = "select id from m_project_info where project_number = ? and is_deleted = 0 limit 1";
+    private static final String APP_KEY_SQL = "select param_value from blade_param where param_key = 'cy.trial.appKey' and is_deleted = 0";
+    private static final String APP_SECRET_SQL = "select param_value from blade_param where param_key = 'cy.trial.appSecret' and is_deleted = 0";
+
+    @Resource
+    private JdbcTemplate jdbcTemplate;
+
+    @Resource
+    private BladeRedis bladeRedis;
+
+    @Resource
+    private TrialCyFinishTestReportService trialCyFinishTestReportService;
+
+    @Resource
+    private TrialCyTestTypeService trialCyTestTypeService;
+
+    @Resource
+    private TrialCyThirdReportService trialCyThirdReportService;
+
+    @Resource
+    private TrialCyAccessoriesService trialCyAccessoriesService;
+
+    private CloseableHttpClient httpClient;
+    private static final String TOKEN_REDIS_KEY = "blade:cqcy:token";
+    private static final String PROJECT_CODE = "cqcyfx";
+    private static Long PROJECT_ID = null;
+    private static final String BASE_URL = "https://apicqcyfx.qdm123.com";
+    private final Map<String, Long> contractCodeMap = new ConcurrentHashMap<>();
+
+    @PostConstruct
+    public void init() {
+        this.httpClient = HttpClientBuilder.create().build();
+    }
+
+    @PreDestroy
+    public void destroy() {
+        if (httpClient != null) {
+            try {
+                httpClient.close();
+                log.info("HTTP client closed successfully");
+            } catch (IOException e) {
+                log.error("Error closing HTTP client", e);
+            }
+        }
+    }
+
+    /**
+     * 确保项目ID已初始化
+     */
+    private synchronized void ensureProjectIdInitialized() {
+        if (PROJECT_ID != null) return;
+
+        try {
+            List<ProjectInfo> projectList = jdbcTemplate.query(
+                    PROJECT_ID_SQL,
+                    new Object[]{PROJECT_CODE},
+                    new BeanPropertyRowMapper<>(ProjectInfo.class)
+            );
+
+            if (projectList != null && !projectList.isEmpty()) {
+                PROJECT_ID = projectList.get(0).getId();
+                log.info("Project ID initialized: {}", PROJECT_ID);
+            } else {
+                log.error("Project not found for code: {}", PROJECT_CODE);
+            }
+        } catch (Exception e) {
+            log.error("Error initializing project ID", e);
+        }
+    }
+
+    /**
+     * 获取有效的Token
+     */
+    private String getToken() {
+        String token = bladeRedis.get(TOKEN_REDIS_KEY);
+        if (token != null) {
+            return token;
+        }
+        return thirdLogin();
+    }
+
+    /**
+     * 登录获取Token
+     */
+    private String thirdLogin() {
+        ensureProjectIdInitialized();
+        if (PROJECT_ID == null) {
+            log.error("Project ID not available for login");
+            return null;
+        }
+
+        try {
+            String appKey = jdbcTemplate.queryForObject(APP_KEY_SQL, String.class);
+            String appSecret = jdbcTemplate.queryForObject(APP_SECRET_SQL, String.class);
+
+            if (StringUtil.isBlank(appKey) || StringUtil.isBlank(appSecret)) {
+                log.error("Missing appKey or appSecret configuration");
+                return null;
+            }
+
+            Long time = System.currentTimeMillis();
+            String md5Hex = MD5Utils.md5Hex(time + appKey + appSecret, "UTF-8");
+
+            ThirdLogin thirdLogin = new ThirdLogin();
+            thirdLogin.setAppKey(appKey);
+            thirdLogin.setTimestamp(time);
+            thirdLogin.setSecret(md5Hex);
+
+            Result result = postToken(BASE_URL + THIRD_LOGIN_URL, thirdLogin);
+            if (result == null || result.getState() != 1) {
+                log.error("Login failed: {}", result != null ? result.getMessage() : "No response");
+                return null;
+            }
+
+            JSONObject data = (JSONObject) result.getData();
+            String newToken = data.getString("token");
+            long expire = data.getLong("expireSecond") - 60;
+            bladeRedis.setEx(TOKEN_REDIS_KEY, newToken, expire);
+            return newToken;
+        } catch (Exception e) {
+            log.error("Login process failed", e);
+            return null;
+        }
+    }
+
+    /**
+     * 获取合同段列表
+     */
+    @Scheduled(cron = "0 0 * * * ?")
+    public void getContractSectByProjCode() {
+        if (!SystemUtils.isLinux()) {
+            return;
+        }
+
+        contractCodeMap.clear();
+        String token = getToken();
+        ensureProjectIdInitialized();
+
+        if (token == null || PROJECT_ID == null) {
+            log.error("Invalid token or project ID");
+            return;
+        }
+
+        try {
+            //获取合同段列表接口
+            Result result = getContractList();
+            if (result == null || result.getState() != 1) {
+                log.error("Failed to get contract sections: {}",
+                        result != null ? result.getMessage() : "No response");
+                return;
+            }
+
+            JSONArray data = (JSONArray) result.getData();
+            if (CollectionUtil.isEmpty(data)) {
+                log.warn("No contract sections found");
+                return;
+            }
+
+            List<String> codes = new ArrayList<>();
+            for (int i = 0; i < data.size(); i++) {
+                JSONObject obj = data.getJSONObject(i);
+                String name = obj.getString("Name");
+                if (StringUtil.isNotBlank(name)) {
+                    codes.add(name);
+                }
+            }
+
+            if (CollectionUtil.isEmpty(codes)) {
+                log.info("No valid contract codes found");
+                return;
+            }
+
+            // 构建参数化查询
+            String placeholders = String.join(",", Collections.nCopies(codes.size(), "?"));
+            String sql = "SELECT * FROM m_contract_info WHERE contract_number IN (" + placeholders + ")";
+
+            List<ContractInfo> contracts = jdbcTemplate.query(
+                    sql,
+                    codes.toArray(),
+                    new BeanPropertyRowMapper<>(ContractInfo.class)
+            );
+
+            for (ContractInfo contract : contracts) {
+                contractCodeMap.put(contract.getContractNumber(), contract.getId());
+            }
+
+            log.info("Loaded {} contract mappings", contractCodeMap.size());
+        } catch (Exception e) {
+            log.error("Error processing contract sections", e);
+        }
+    }
+
+    /**
+     * 获取已完成的检测报告
+     */
+    @Scheduled(cron = "0 0 * * * ?")
+    public void getFinishTestReport() {
+        if (!SystemUtils.isLinux()) {
+            return;
+        }
+
+        String token = getToken();
+        ensureProjectIdInitialized();
+
+        if (token == null || PROJECT_ID == null || contractCodeMap.isEmpty()) {
+            log.error("Preconditions not met for finish test report");
+            return;
+        }
+
+        for (Map.Entry<String, Long> entry : contractCodeMap.entrySet()) {
+            String contractCode = entry.getKey();
+            Long contractId = entry.getValue();
+
+            //查询旧数据
+            List<TrialCyFinishTestReport> list = trialCyFinishTestReportService.list(Wrappers.<TrialCyFinishTestReport>lambdaQuery()
+                    .eq(TrialCyFinishTestReport::getContractId, contractId));
+            //等会准备删除的历史数据
+            List<Long> ids = list.stream().map(TrialCyFinishTestReport::getId).collect(Collectors.toList());
+
+            int pageIndex = 0;
+            final int pageSize = 100;
+            boolean hasMore = true;
+
+            while (hasMore) {
+                try {
+                    List<NameValuePair> params = new ArrayList<NameValuePair>();
+                    params.add(new BasicNameValuePair("ProjectCode", PROJECT_CODE));
+                    params.add(new BasicNameValuePair("ContractsectCode", contractCode));
+                    //这些参数未找到传递的值
+                    if (false) {
+                        params.add(new BasicNameValuePair("BeginTime", null));
+                        params.add(new BasicNameValuePair("EndTime", null));
+                        params.add(new BasicNameValuePair("FinishBeginTime", null));
+                        params.add(new BasicNameValuePair("FinishEndTime", null));
+                    }
+                    params.add(new BasicNameValuePair("PageIndex", String.valueOf(pageIndex)));
+                    params.add(new BasicNameValuePair("PageSize", String.valueOf(pageSize)));
+
+                    ResultPost result = post(BASE_URL + FINISH_TEST_REPORT_URL, params);
+
+                    if (result == null) {
+                        log.error("Request failed for contract: {}", contractCode);
+                        break;
+                    }
+
+                    if (result.getCode() != 200) {
+                        log.error("API error for contract {}: {}", contractCode, result.getMsg());
+                        break;
+                    }
+
+                    JSONArray data = (JSONArray) result.getResult();
+                    if (CollectionUtil.isEmpty(data)) {
+                        break;
+                    }
+
+                    List<TrialCyFinishTestReport> reports = data.toJavaList(TrialCyFinishTestReport.class);
+                    for (TrialCyFinishTestReport report : reports) {
+                        Long id = SnowFlakeUtil.getId();
+                        report.setId(id);
+                        report.setContractId(contractId);
+                        //处理boolean值
+                        report.setExperimentResult(String.valueOf(report.getExperimentResult() == null ? 0 : "True".equals(report.getExperimentResult()) ? 1 : 0));
+
+                        //处理附件
+                        List<TrialCyAccessories> accessories = report.getAccessories();
+                        if (CollectionUtil.isNotEmpty(accessories)) {
+                            accessories.forEach(f -> {
+                                f.setId(SnowFlakeUtil.getId());
+                                f.setReportId(id);
+                            });
+
+                            if (CollectionUtil.isNotEmpty(ids)) {
+                                trialCyAccessoriesService.remove(Wrappers.<TrialCyAccessories>lambdaQuery()
+                                        .in(TrialCyAccessories::getReportId, ids));
+                            }
+
+                            trialCyAccessoriesService.saveBatch(accessories);
+                        }
+                    }
+                    if (CollectionUtil.isNotEmpty(ids)) {
+                        trialCyFinishTestReportService.removeBatchByIds(ids);
+                    }
+
+                    trialCyFinishTestReportService.saveBatch(reports);
+                    hasMore = reports.size() >= pageSize;
+                    pageIndex++;
+                } catch (Exception e) {
+                    log.error("Error processing contract {} page {}", contractCode, pageIndex, e);
+                    break;
+                }
+            }
+        }
+    }
+
+    /**
+     * 获取第三方报告
+     */
+    @Scheduled(cron = "0 0 * * * ?")
+    public void getThirdReport() {
+        if (!SystemUtils.isLinux()) {
+            return;
+        }
+
+        Integer[] thirdTypes = {0,1,2};
+
+        String token = getToken();
+        ensureProjectIdInitialized();
+
+        if (token == null || PROJECT_ID == null || contractCodeMap.isEmpty()) {
+            log.error("Preconditions not met for third report");
+            return;
+        }
+
+        for (Map.Entry<String, Long> entry : contractCodeMap.entrySet()) {
+            String contractCode = entry.getKey();
+            Long contractId = entry.getValue();
+
+
+            //获取旧id
+            List<TrialCyThirdReport> list = trialCyThirdReportService.list(Wrappers.<TrialCyThirdReport>lambdaQuery()
+                    .eq(TrialCyThirdReport::getContractId, contractId));
+            //等会要删除的id
+            List<Long> ids = list.stream().map(TrialCyThirdReport::getPKeyId).collect(Collectors.toList());
+
+
+            int pageIndex = 0;
+            final int pageSize = 100;
+            boolean hasMore = true;
+
+            for (Integer thirdType : thirdTypes) {
+                while (hasMore) {
+                    try {
+                        List<NameValuePair> params = new ArrayList<NameValuePair>();
+                        params.add(new BasicNameValuePair("ProjectCode", PROJECT_CODE));
+                        params.add(new BasicNameValuePair("ContractsectCode", contractCode));
+                        params.add(new BasicNameValuePair("ThirdType", String.valueOf(thirdType)));
+                        //这些参数为找到传递值
+                        if (false) {
+                            params.add(new BasicNameValuePair("BeginTime", null));
+                            params.add(new BasicNameValuePair("EndTime", null));
+                        }
+                        params.add(new BasicNameValuePair("PageIndex", String.valueOf(pageIndex)));
+                        params.add(new BasicNameValuePair("PageSize", String.valueOf(pageSize)));
+
+
+                        ResultPost result = post(BASE_URL + THIRD_REPORT_URL, params);
+
+                        if (result == null) {
+                            log.error("Request failed for contract: {}", contractCode);
+                            break;
+                        }
+
+                        if (result.getCode() != 200) {
+                            log.error("API error for contract {}: {}", contractCode, result.getMsg());
+                            break;
+                        }
+
+                        JSONArray data = (JSONArray) result.getResult();
+                        if (CollectionUtil.isEmpty(data)) {
+                            break;
+                        }
+
+                        List<TrialCyThirdReport> reports = data.toJavaList(TrialCyThirdReport.class);
+                        for (TrialCyThirdReport report : reports) {
+                            Long id = SnowFlakeUtil.getId();
+                            report.setPKeyId(id);
+                            report.setContractId(contractId);
+                            //报告类型
+                            report.setThirdType(thirdType);
+                            //处理boolean值
+                            report.setIsDeleted(String.valueOf(report.getIsDeleted() == null ? '1' : "True".equals(report.getIsDeleted()) ? '1' : '0'));
+                            report.setIsQualified(String.valueOf(report.getIsQualified() == null ? '0' : "True".equals(report.getIsQualified()) ? '1' : '0'));
+
+                            //处理附件
+                            List<TrialCyAccessories> accessories = report.getAccessories();
+                            if (CollectionUtil.isNotEmpty(accessories)) {
+                                accessories.forEach(f -> {
+                                    f.setId(SnowFlakeUtil.getId());
+                                    f.setReportId(id);
+                                });
+                                //删除旧数据
+                                if (CollectionUtil.isNotEmpty(ids)) {
+                                    trialCyAccessoriesService.remove(Wrappers.<TrialCyAccessories>lambdaQuery()
+                                            .in(TrialCyAccessories::getReportId, ids));
+                                }
+                                //添加新数据
+                                trialCyAccessoriesService.saveBatch(accessories);
+                            }
+                        }
+                        //删除旧数据
+                        if (CollectionUtil.isNotEmpty(ids)) {
+                            trialCyThirdReportService.removeBatchByIds(ids);
+                        }
+
+                        //添加新数据
+                        trialCyThirdReportService.saveBatch(reports);
+                        hasMore = reports.size() >= pageSize;
+                        pageIndex++;
+                    } catch (Exception e) {
+                        log.error("Error processing contract {} page {}", contractCode, pageIndex, e);
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * 获取检测项目树  TODO 第三方接口未开发完(待调试)
+     */
+    @Scheduled(cron = "0 0 * * * ?")
+    public void getAllTestType() {
+        if (!SystemUtils.isLinux()) {
+            return;
+        }
+
+        try {
+            String token = getToken();
+            ensureProjectIdInitialized();
+
+            if (token == null || PROJECT_ID == null) {
+                log.error("Invalid token or project ID");
+                return;
+            }
+
+            List<NameValuePair> params = new ArrayList<NameValuePair>();
+            params.add(new BasicNameValuePair("ProjectCode", PROJECT_CODE));
+
+            ResultPost result = post(BASE_URL + ALL_TEST_TYPE_URL, params);
+            if (result == null || result.getCode() != 200) {
+                log.error("Failed to get test types: {}",
+                        result != null ? result.getMsg() : "No response");
+                return;
+            }
+
+            JSONArray data = (JSONArray) result.getResult();
+            if (CollectionUtil.isEmpty(data)) {
+                log.info("No test types found");
+                return;
+            }
+
+            List<TrialCyTestType> testTypes = data.toJavaList(TrialCyTestType.class);
+            for (TrialCyTestType type : testTypes) {
+                type.setPKeyId(SnowFlakeUtil.getId());
+                type.setProjectId(PROJECT_ID);
+                type.setFatherID(type.getFatherID() == null || type.getFatherID().isEmpty() ? "0" : type.getFatherID());
+            }
+            //先删除旧数据
+            trialCyTestTypeService.remove(Wrappers.<TrialCyTestType>lambdaQuery()
+                    .eq(TrialCyTestType::getProjectId, PROJECT_ID));
+            trialCyTestTypeService.saveOrUpdateBatch(testTypes);
+            log.info("Saved {} test types", testTypes.size());
+        } catch (Exception e) {
+            log.error("Error processing test types", e);
+        }
+    }
+
+    /**
+     * HTTP POST请求 获取token
+     */
+    private Result postToken(String url, ThirdLogin payload) {
+        HttpPost httpPost = new HttpPost(url);
+        httpPost.setHeader("Content-Type", "application/json");
+        try {
+            httpPost.setEntity(new StringEntity(JSON.toJSONString(payload), StandardCharsets.UTF_8));
+        } catch (Exception e) {
+            log.error("Failed to set request entity", e);
+            return null;
+        }
+
+        try (ByteArrayOutputStream output = new ByteArrayOutputStream()) {
+            HttpResponse response = httpClient.execute(httpPost);
+            int status = response.getStatusLine().getStatusCode();
+
+            if (status != 200) {
+                log.warn("HTTP error: {} - {}", status, response.getStatusLine().getReasonPhrase());
+                return null;
+            }
+
+            try (InputStream input = response.getEntity().getContent()) {
+                byte[] buffer = new byte[1024];
+                int bytesRead;
+                while ((bytesRead = input.read(buffer)) != -1) {
+                    output.write(buffer, 0, bytesRead);
+                }
+            }
+
+            String responseString = new String(output.toByteArray(), StandardCharsets.UTF_8);
+            return JSON.parseObject(responseString, Result.class);
+        } catch (Exception e) {
+            log.error("HTTP request failed: {}", url, e);
+            return null;
+        }
+    }
+
+    /**
+     * HTTP POST请求
+     */
+    private ResultPost post(String url, List<NameValuePair> params) {
+        HttpPost httpPost = new HttpPost(url);
+        httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
+        httpPost.setHeader("token", getToken());
+        try {
+            httpPost.setEntity(new UrlEncodedFormEntity(params, Consts.UTF_8));
+        } catch (Exception e) {
+            log.error("Failed to set request entity", e);
+            return null;
+        }
+
+        try (ByteArrayOutputStream output = new ByteArrayOutputStream()) {
+            HttpResponse response = httpClient.execute(httpPost);
+            int status = response.getStatusLine().getStatusCode();
+
+            if (status != 200) {
+                log.warn("HTTP error: {} - {}", status, response.getStatusLine().getReasonPhrase());
+                return null;
+            }
+
+            try (InputStream input = response.getEntity().getContent()) {
+                byte[] buffer = new byte[1024];
+                int bytesRead;
+                while ((bytesRead = input.read(buffer)) != -1) {
+                    output.write(buffer, 0, bytesRead);
+                }
+            }
+
+            String responseString = new String(output.toByteArray(), StandardCharsets.UTF_8);
+            return JSON.parseObject(responseString, ResultPost.class);
+        } catch (Exception e) {
+            log.error("HTTP request failed: {}", url, e);
+            return null;
+        }
+    }
+
+    /**
+     * HTTP get 请求 获取合同段数据
+     */
+    private Result getContractList() {
+        try {
+            CloseableHttpClient client = HttpClients.createDefault();
+            HttpGet httpGet = new HttpGet(BASE_URL + CONTRACT_SECT_URL + "?token=" + getToken() + "&ProjectCode=" + PROJECT_CODE);
+            CloseableHttpResponse response = client.execute(httpGet);
+
+            //5、获取实体
+            HttpEntity entity = response.getEntity();
+            //将实体装成字符串
+            String string = EntityUtils.toString(entity);
+            return JSON.parseObject(string, Result.class);
+        } catch (IOException e) {
+            log.error("HTTP request failed: {}", BASE_URL + CONTRACT_SECT_URL, e);
+            return null;
+        }
+    }
+}

+ 462 - 0
blade-service/blade-business/src/main/java/org/springblade/business/scheduled/ChenYuTestScheduled01.java

@@ -0,0 +1,462 @@
+package org.springblade.business.scheduled;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.nacos.common.utils.MD5Utils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.springblade.business.entity.TrialCyFinishTestReport;
+import org.springblade.business.entity.TrialCyTestType;
+import org.springblade.business.entity.TrialCyThirdReport;
+import org.springblade.business.scheduled.vo.GetFinishTestReport;
+import org.springblade.business.scheduled.vo.GetThirdReport;
+import org.springblade.business.scheduled.vo.Result;
+import org.springblade.business.scheduled.vo.ThirdLogin;
+import org.springblade.business.service.TrialCyFinishTestReportService;
+import org.springblade.business.service.TrialCyTestTypeService;
+import org.springblade.business.service.TrialCyThirdReportService;
+import org.springblade.common.utils.SystemUtils;
+import org.springblade.core.redis.cache.BladeRedis;
+import org.springblade.core.tool.utils.CollectionUtil;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.manager.entity.ContractInfo;
+import org.springblade.manager.entity.ProjectInfo;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 成渝试验第三方接口获取数据
+ * 定时任务
+ *
+ * @author LHB
+ */
+@Component
+@Slf4j
+public class ChenYuTestScheduled01 {
+
+    @Resource
+    private JdbcTemplate jdbcTemplate;
+
+    @Resource
+    private BladeRedis bladeRedis;
+    /**
+     * 成渝-获取标段已完成(已签章完成)的检测报告
+     */
+    @Resource
+    private TrialCyFinishTestReportService trialCyFinishTestReportService;
+    /**
+     * 成渝-试验检测树
+     */
+    @Resource
+    private TrialCyTestTypeService trialCyTestTypeService;
+    /**
+     * 成渝-已上传的外委检测报告/ 第三方检测报告/ 上传报告
+     */
+    @Resource
+    private TrialCyThirdReportService trialCyThirdReportService;
+
+    // HTTP客户端复用
+    private CloseableHttpClient httpClient;
+
+    @PostConstruct
+    public void init() {
+        this.httpClient = HttpClientBuilder.create().build();
+    }
+
+    //token缓存key
+    private static final String TOKEN_REDIS_KEY = "blade:cqcy:token";
+
+    //项目编码
+    private static final String PROJECT_CODE = "cqcyfx";
+
+    //项目id
+    private static Long PROJECT_ID = null;
+
+    //接口域名
+    private final String URL = "https://apicqcyfx.qdm123.com";
+
+    //合同编码缓存
+    private final Map<String, Long> contractCodeMap = new ConcurrentHashMap<>();
+
+    /**
+     * 登录 获取token
+     */
+
+    public String thirdLogin() {
+        //TODO 从后台管理的配置中心获取
+        String url = "/api/ThirdSystem/ThirdLogin";
+
+
+        //获取项目id
+        String sql = "select id from m_project_info where project_number = ? and is_deleted = 0 limit 1";
+        ProjectInfo projectInfo = jdbcTemplate.queryForObject(sql, ProjectInfo.class, PROJECT_CODE);
+        PROJECT_ID = projectInfo.getId();
+
+
+        String getAppKeySql = "select param_value from blade_param where param_key = 'cy.trial.appKey' and is_deleted = 0";
+        String getAppSecretSql = "select param_value from blade_param where param_key = 'cy.trial.appSecret' and is_deleted = 0";
+        //后管配置 appKey
+        String appKey = jdbcTemplate.queryForObject(getAppKeySql, String.class);
+        //后管配置 appSecret
+        String appSecret = jdbcTemplate.queryForObject(getAppSecretSql, String.class);
+        if (StringUtil.isBlank(appKey) || StringUtil.isBlank(appSecret)) {
+            log.error("---------#后管未配置成渝-试验-授权码或私钥");
+            return null;
+        }
+        //当前时间戳
+        Long time = System.currentTimeMillis();
+
+        //加密
+        String md5Hex = MD5Utils.md5Hex(time + appKey + appSecret, "UTF-8");
+
+        ThirdLogin thirdLogin = new ThirdLogin();
+        thirdLogin.setAppKey(appKey);
+        thirdLogin.setTimestamp(time);
+        thirdLogin.setSecret(md5Hex);
+
+
+        Result post = this.post(URL + url, thirdLogin);
+        if (post == null) {
+            log.error("---------#成渝第三方接口访问失败");
+            return null;
+        }
+        Integer state = post.getState();
+        //成功
+        if (state == 1) {
+            JSONObject data = (JSONObject) post.getData();
+            bladeRedis.setEx(TOKEN_REDIS_KEY, data.getString("token"), data.getLong("expireSecond") - 60);
+            return data.getString("token");
+        } else {
+            log.error("---------#成渝第三方接口访问失败:" + post.getMessage());
+            return null;
+        }
+    }
+
+
+    /**
+     * 获取合同段列表接口
+     */
+    @Scheduled(cron = "0 0 * * * ?")
+    public void getContractSectByProjCode()     {
+        if(!SystemUtils.isLinux()){
+            return;
+        }
+        //清空缓存
+        contractCodeMap.clear();
+
+        String url = "/api/CQHCZC/MesureSystem/GetContractSectByProjCode";
+
+        String token = bladeRedis.get(TOKEN_REDIS_KEY);
+        if (token == null) {
+            token = thirdLogin();
+        }
+        if (token == null) {
+            log.error("---------#成渝第三方接口访问失败:token为空");
+            return;
+        }
+        if (PROJECT_ID == null) {
+            log.error("---------#成渝第三方接口访问失败:项目不存在");
+            return;
+        }
+
+
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("token", token);
+        jsonObject.put("ProjectCode", PROJECT_CODE);
+
+        Result post = this.post(URL + url, jsonObject);
+
+        if (post == null) {
+            log.error("---------#成渝第三方接口访问失败");
+            return;
+        }
+        Integer state = post.getState();
+        //成功
+        if (state == 1) {
+            //合同段列表数据
+            JSONArray data = (JSONArray) post.getData();
+
+            List<String> codes = new ArrayList<>();
+
+            //返回的数据不能为空
+            if (CollectionUtil.isNotEmpty(data)) {
+                for (Object datum : data) {
+                    JSONObject jsonObject1 = (JSONObject) datum;
+                    String code = jsonObject1.getString("Code");
+                    //编码不能为空
+                    if (StringUtil.isNotBlank(code)) {
+                        codes.add(code);
+                    }
+                }
+            }
+            //封装需要查询的合同段
+            if (CollectionUtil.isNotEmpty(codes)) {
+                //使用参数化查询防止SQL注入
+                StringBuilder sqlBuilder = new StringBuilder("select * from m_contract_info where contract_number in (");
+                for (int i = 0; i < codes.size(); i++) {
+                    sqlBuilder.append(i == 0 ? "?" : ",?");
+                }
+                sqlBuilder.append(")");
+
+                //查询数据
+                List<ContractInfo> contractInfoList = jdbcTemplate.queryForList(sqlBuilder.toString(), ContractInfo.class, codes.toArray());
+                contractInfoList.forEach(f -> {
+                    contractCodeMap.put(f.getContractNumber(), f.getId());
+                });
+            }
+        } else {
+            log.error("---------#成渝第三方接口访问失败:" + post.getMessage());
+        }
+    }
+
+    /**
+     * 获取标段已完成(已签章完成)的检测报告
+     */
+    @Scheduled(cron = "0 0 * * * ?")
+    public void getFinishTestReport() {
+        if(!SystemUtils.isLinux()){
+            return;
+        }
+        String url = "/open/TestReport/GetFinishTestReport";
+
+        String token = bladeRedis.get(TOKEN_REDIS_KEY);
+        if (token == null) {
+            token = thirdLogin();
+        }
+        if (token == null) {
+            log.error("---------#成渝第三方接口访问失败:token为空");
+            return;
+        }
+        if (PROJECT_ID == null) {
+            log.error("---------#成渝第三方接口访问失败:项目不存在");
+            return;
+        }
+        //获取需要同步的合同段信息
+        Set<String> contractCodes = contractCodeMap.keySet();
+        if (CollectionUtil.isEmpty(contractCodes)) {
+            log.error("---------#成渝第三方接口访问失败:合同段编码无数据");
+            return;
+        }
+        for (String contractCode : contractCodes) {
+            GetFinishTestReport getFinishTestReport = new GetFinishTestReport(token, PROJECT_CODE, contractCode);
+
+            Integer pageIndex = 0;
+            Integer pageSize = 100;
+
+            do {
+                getFinishTestReport.setPageIndex(pageIndex);
+                getFinishTestReport.setPageSize(pageSize);
+
+                Result post = this.post(URL + url, getFinishTestReport);
+                if (post == null) {
+                    log.error("---------#成渝第三方接口访问失败:接口访问失败, contractCode: {}", contractCode);
+                    break; // 继续处理下一个合同段
+                }
+                Integer state = post.getState();
+                //成功
+                if (state == 1) {
+                    //检测报告列表
+                    JSONArray data = (JSONArray) post.getData();
+                    List<TrialCyFinishTestReport> list = data.toJavaList(TrialCyFinishTestReport.class);
+                    //退出循环
+                    if (CollectionUtil.isEmpty(list)) {
+                        break;
+                    }
+                    list.forEach(f -> f.setContractId(contractCodeMap.get(contractCode)));
+                    //处理数据
+                    trialCyFinishTestReportService.saveBatch(list);
+                    if (list.size() < pageSize) {
+                        break;
+                    }
+                    pageIndex++;
+                } else {
+                    log.error("---------#成渝第三方接口访问失败:{}, contractCode: {}", post.getMessage(), contractCode);
+                    break; // 继续处理下一个合同段
+                }
+            } while (true);
+        }
+    }
+
+    /**
+     * 获取已上传的外委检测报告/第三方检测报告/上传报告
+     */
+    @Scheduled(cron = "0 0 * * * ?")
+    public void getThirdReport() {
+        if(!SystemUtils.isLinux()){
+            return;
+        }
+        String url = "/open/ThirdReport/GetThirdReport";
+
+        String token = bladeRedis.get(TOKEN_REDIS_KEY);
+        if (token == null) {
+            token = thirdLogin();
+        }
+        if (token == null) {
+            log.error("---------#成渝第三方接口访问失败:token为空");
+            return;
+        }
+        if (PROJECT_ID == null) {
+            log.error("---------#成渝第三方接口访问失败:项目不存在");
+            return;
+        }
+        //获取需要同步的合同段信息
+        Set<String> contractCodes = contractCodeMap.keySet();
+        if (CollectionUtil.isEmpty(contractCodes)) {
+            log.error("---------#成渝第三方接口访问失败:合同段编码无数据");
+            return;
+        }
+        for (String contractCode : contractCodes) {
+            GetThirdReport getThirdReport = new GetThirdReport(token, PROJECT_CODE, contractCode);
+
+            Integer pageIndex = 0;
+            int pageSize = 100;
+
+            do {
+                getThirdReport.setPageIndex(pageIndex);
+                getThirdReport.setPageSize(pageSize);
+
+                Result post = this.post(URL + url, getThirdReport);
+                if (post == null) {
+                    log.error("---------#成渝第三方接口访问失败:接口访问失败, contractCode: {}", contractCode);
+                    break; // 继续处理下一个合同段
+                }
+                Integer state = post.getState();
+                //成功
+                if (state == 1) {
+                    //已上传的外委检测报告/第三方检测报告/上传报告
+                    JSONArray data = (JSONArray) post.getData();
+                    List<TrialCyThirdReport> list = data.toJavaList(TrialCyThirdReport.class);
+                    //退出循环
+                    if (CollectionUtil.isEmpty(list)) {
+                        break;
+                    }
+                    list.forEach(f -> f.setContractId(contractCodeMap.get(contractCode)));
+                    //处理数据
+                    trialCyThirdReportService.saveBatch(list);
+
+                    if (list.size() < pageSize) {
+                        break;
+                    }
+
+                    pageIndex++;
+                } else {
+                    log.error("---------#成渝第三方接口访问失败:{}, contractCode: {}", post.getMessage(), contractCode);
+                    break; // 继续处理下一个合同段
+                }
+            } while (true);
+        }
+    }
+
+    /**
+     * 获取检测项目树(包括自建试验、外委、第三方、上传报告)
+     */
+    @Scheduled(cron = "0 0 * * * ?")
+    public void getAllTestType() {
+        if(!SystemUtils.isLinux()){
+            return;
+        }
+
+        String url = "/open/ThirdReport/GetAllTestType";
+        String token = bladeRedis.get(TOKEN_REDIS_KEY);
+        if (token == null) {
+            token = thirdLogin();
+        }
+        if (token == null) {
+            log.error("---------#成渝第三方接口访问失败:token为空");
+            return;
+        }
+        if (PROJECT_ID == null) {
+            log.error("---------#成渝第三方接口访问失败:项目不存在");
+            return;
+        }
+
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("token", token);
+        jsonObject.put("ProjectCode", PROJECT_CODE);
+
+        Result post = this.post(URL + url, jsonObject);
+
+        if (post == null) {
+            log.error("---------#成渝第三方接口访问失败:接口访问失败");
+            return;
+        }
+
+
+        Integer state = post.getState();
+        //成功
+        if (state == 1) {
+            //合同段列表数据
+            JSONArray data = (JSONArray) post.getData();
+            List<TrialCyTestType> list = data.toJavaList(TrialCyTestType.class);
+            //退出循环
+            if (CollectionUtil.isEmpty(list)) {
+                return;
+            }
+            list.forEach(f -> f.setProjectId(PROJECT_ID));
+            //处理数据
+            trialCyTestTypeService.saveOrUpdateBatch(list);
+        } else {
+            log.error("---------#成渝第三方接口访问失败:" + post.getMessage());
+        }
+    }
+
+
+    /**
+     * 封装请求参数
+     */
+    public Result post(String url, Object object) {
+        HttpPost httpPost = new HttpPost(url);
+        httpPost.setHeader("Content-Type", "application/json");
+
+        // 对象转json
+        StringEntity json = new StringEntity(JSON.toJSONString(object), "utf-8");
+        httpPost.setEntity(json);
+
+        try {
+            HttpResponse httpResponse = httpClient.execute(httpPost);
+
+            // 检查响应状态码
+            int statusCode = httpResponse.getStatusLine().getStatusCode();
+            if (statusCode != 200) {
+                log.warn("HTTP request failed with status code: {}", statusCode);
+                // 可以根据具体业务需求调整错误处理方式
+                return null;
+            }
+
+            try (InputStream inputStream = httpResponse.getEntity().getContent();
+                 ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
+
+                byte[] buffer = new byte[1024];
+                int index = 0;
+                while ((index = inputStream.read(buffer)) != -1) {
+                    outputStream.write(buffer, 0, index);
+                }
+                // 响应参数 - 指定明确的字符编码
+                Result result = JSON.parseObject(outputStream.toString("utf-8"), Result.class);
+                return result;
+            }
+        } catch (IOException e) {
+            log.error("HTTP request failed: ", e);
+            // 返回错误结果或抛出异常,根据业务需求决定
+            return null;
+        }
+    }
+
+}

+ 57 - 0
blade-service/blade-business/src/main/java/org/springblade/business/scheduled/vo/GetFinishTestReport.java

@@ -0,0 +1,57 @@
+package org.springblade.business.scheduled.vo;
+
+import lombok.Data;
+
+/**
+ * 获取标段已完成(已签章完成)的检测报告的接口实体类
+ *
+ * @author LHB
+ */
+@Data
+public class GetFinishTestReport {
+    /**
+     * 登录接口返回的token
+     */
+    private String token;
+    /**
+     * 工程项目编码,数据约定具体见附件
+     */
+    private String ProjectCode;
+    /**
+     * 合同段/工区编码,数据约定具体见附件
+     */
+    private String ContractsectCode;
+    /**
+     * 报告起始时间
+     */
+    private String BeginTime;
+    /**
+     * 报告截止时间,注意:此字段实际执行时间包含传入时间当天,截止至当天24:00
+     */
+    private String EndTime;
+    /**
+     * 签章完成时间范围-起
+     */
+    private String FinishBeginTime;
+    /**
+     * 签章完成时间范围-止,截止至当天24:00
+     */
+    private String FinishEndTime;
+    /**
+     * 页码,默认为0
+     */
+    private Integer PageIndex;
+    /**
+     * 获取数据条数,不大于1000
+     */
+    private Integer PageSize;
+
+    public GetFinishTestReport(String token, String projectCode, String contractsectCode) {
+        this.token = token;
+        ProjectCode = projectCode;
+        ContractsectCode = contractsectCode;
+    }
+
+    public GetFinishTestReport() {
+    }
+}

+ 57 - 0
blade-service/blade-business/src/main/java/org/springblade/business/scheduled/vo/GetThirdReport.java

@@ -0,0 +1,57 @@
+package org.springblade.business.scheduled.vo;
+
+import lombok.Data;
+
+/**
+ * 获取已上传的外委检测报告/第三方检测报告/上传报告的请求参数对象
+ *
+ * @author LHB
+ */
+@Data
+public class GetThirdReport {
+    /**
+     * 登录接口返回的token
+     */
+    private String token;
+    /**
+     * 工程项目编码,数据约定具体见附件
+     */
+    private String ProjectCode;
+    /**
+     * 合同段/工区编码,数据约定具体见附件
+     */
+    private String ContractsectCode;
+    /**
+     * 0:外委检测
+     * 1:第三方检测
+     * 2:扫描上传报告
+     */
+    private Integer ThirdType;
+    /**
+     * 上传起始时间
+     * 注意:此字段实际执行时间为当天0点
+     */
+    private String BeginTime;
+    /**
+     * 上传截止时间,注意:此字段实际执行时间为当天24:00
+     */
+    private String EndTime;
+    /**
+     * 页码,默认为0
+     */
+    private Integer PageIndex;
+    /**
+     * 获取数据条数,不大于100
+     */
+    private Integer PageSize;
+
+
+    public GetThirdReport(String token, String projectCode, String contractsectCode) {
+        this.token = token;
+        ProjectCode = projectCode;
+        ContractsectCode = contractsectCode;
+    }
+
+    public GetThirdReport() {
+    }
+}

+ 25 - 0
blade-service/blade-business/src/main/java/org/springblade/business/scheduled/vo/Result.java

@@ -0,0 +1,25 @@
+package org.springblade.business.scheduled.vo;
+
+import lombok.Data;
+
+/**
+ * 成渝第三方接口响应结构
+ * @author LHB
+ */
+@Data
+public class Result {
+    /**
+     * 请求结果
+     * 0:请求失败
+     * 1:请求成功
+     */
+    private Integer state;
+    /**
+     * 操作提示信息;
+     */
+    private String message;
+    /**
+     * 接口返回的数据对象包体,由每个接口根据业务逻辑决定,可为JSON对象或JSON数组对象。
+     */
+    private Object data;
+}

+ 25 - 0
blade-service/blade-business/src/main/java/org/springblade/business/scheduled/vo/ResultPost.java

@@ -0,0 +1,25 @@
+package org.springblade.business.scheduled.vo;
+
+import lombok.Data;
+
+/**
+ * 成渝第三方接口响应结构
+ * @author LHB
+ */
+@Data
+public class ResultPost {
+    /**
+     * 请求结果
+     * 0:请求失败
+     * 1:请求成功
+     */
+    private Integer code;
+    /**
+     * 操作提示信息;
+     */
+    private String msg;
+    /**
+     * 接口返回的数据对象包体,由每个接口根据业务逻辑决定,可为JSON对象或JSON数组对象。
+     */
+    private Object result;
+}

+ 28 - 0
blade-service/blade-business/src/main/java/org/springblade/business/scheduled/vo/ThirdLogin.java

@@ -0,0 +1,28 @@
+package org.springblade.business.scheduled.vo;
+
+import lombok.Data;
+
+/**
+ * 成渝获取token接口参数
+ *
+ * @author LHB
+ */
+@Data
+public class ThirdLogin {
+    /**
+     * 授权第三方KEY(成渝那边提供)
+     */
+    private String appKey;
+    /**
+     * 空
+     */
+    private String account;
+    /**
+     * 时间截(1970-01-01至当前时间的总毫秒数)
+     */
+    private Long timestamp;
+    /**
+     * MD5(timestamp + appKey + account + appSecret)
+     */
+    private String secret;
+}

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

@@ -0,0 +1,13 @@
+package org.springblade.business.service;
+
+import org.springblade.business.entity.TrialCyAccessories;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author LHB
+* @description 针对表【u_trial_cy_accessories(成渝-附件信息)】的数据库操作Service
+* @createDate 2025-08-04 14:39:16
+*/
+public interface TrialCyAccessoriesService extends IService<TrialCyAccessories> {
+
+}

+ 13 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/TrialCyFinishTestReportService.java

@@ -0,0 +1,13 @@
+package org.springblade.business.service;
+
+import org.springblade.business.entity.TrialCyFinishTestReport;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author LHB
+* @description 针对表【u_trial_cy_finish_test_report(成渝-获取标段已完成(已签章完成)的检测报告)】的数据库操作Service
+* @createDate 2025-08-01 09:05:03
+*/
+public interface TrialCyFinishTestReportService extends IService<TrialCyFinishTestReport> {
+
+}

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

@@ -0,0 +1,20 @@
+package org.springblade.business.service;
+
+import org.springblade.business.entity.TrialCyFinishTestReport;
+import org.springblade.business.entity.TrialCyTestType;
+import org.springblade.business.entity.TrialCyThirdReport;
+
+import java.util.List;
+
+/**
+ * @author LHB
+ */
+public interface TrialCyService {
+    Boolean isCyAndTestModule(Long projectId, Long contractId);
+
+    List<TrialCyTestType> getTree(Long projectId, String parentId);
+
+    List<TrialCyFinishTestReport> getTrialDetectionReport(Long contractId, Long pKeyId);
+
+    List<TrialCyThirdReport> getThirdReport(Long contractId, Long pKeyId, Integer type);
+}

+ 13 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/TrialCyTestTypeService.java

@@ -0,0 +1,13 @@
+package org.springblade.business.service;
+
+import org.springblade.business.entity.TrialCyTestType;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author LHB
+* @description 针对表【u_trial_cy_test_type(成渝-试验检测树)】的数据库操作Service
+* @createDate 2025-08-01 09:05:07
+*/
+public interface TrialCyTestTypeService extends IService<TrialCyTestType> {
+
+}

+ 13 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/TrialCyThirdReportService.java

@@ -0,0 +1,13 @@
+package org.springblade.business.service;
+
+import org.springblade.business.entity.TrialCyThirdReport;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author LHB
+* @description 针对表【u_trial_cy_third_report(成渝-已上传的外委检测报告/第三方检测报告/上传报告)】的数据库操作Service
+* @createDate 2025-08-01 09:05:10
+*/
+public interface TrialCyThirdReportService extends IService<TrialCyThirdReport> {
+
+}

+ 22 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialCyAccessoriesServiceImpl.java

@@ -0,0 +1,22 @@
+package org.springblade.business.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.business.entity.TrialCyAccessories;
+import org.springblade.business.service.TrialCyAccessoriesService;
+import org.springblade.business.mapper.TrialCyAccessoriesMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author LHB
+* @description 针对表【u_trial_cy_accessories(成渝-附件信息)】的数据库操作Service实现
+* @createDate 2025-08-04 14:39:16
+*/
+@Service
+public class TrialCyAccessoriesServiceImpl extends ServiceImpl<TrialCyAccessoriesMapper, TrialCyAccessories>
+    implements TrialCyAccessoriesService {
+
+}
+
+
+
+

+ 22 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialCyFinishTestReportServiceImpl.java

@@ -0,0 +1,22 @@
+package org.springblade.business.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.business.entity.TrialCyFinishTestReport;
+import org.springblade.business.service.TrialCyFinishTestReportService;
+import org.springblade.business.mapper.TrialCyFinishTestReportMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author LHB
+* @description 针对表【u_trial_cy_finish_test_report(成渝-获取标段已完成(已签章完成)的检测报告)】的数据库操作Service实现
+* @createDate 2025-08-01 09:05:03
+*/
+@Service
+public class TrialCyFinishTestReportServiceImpl extends ServiceImpl<TrialCyFinishTestReportMapper, TrialCyFinishTestReport>
+    implements TrialCyFinishTestReportService {
+
+}
+
+
+
+

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

@@ -0,0 +1,75 @@
+package org.springblade.business.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import org.springblade.business.entity.TrialCyFinishTestReport;
+import org.springblade.business.entity.TrialCyTestType;
+import org.springblade.business.entity.TrialCyThirdReport;
+import org.springblade.business.service.*;
+import org.springblade.manager.entity.ContractInfo;
+import org.springblade.manager.entity.ProjectInfo;
+import org.springblade.manager.feign.ContractClient;
+import org.springblade.manager.feign.ProjectClient;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * 成渝数据获取
+ * @author LHB
+ */
+@Service
+public class TrialCyServiceImpl implements TrialCyService {
+    @Resource
+    private TrialCyAccessoriesService trialCyAccessoriesService;
+    @Resource
+    private TrialCyFinishTestReportService trialCyFinishTestReportService;
+    @Resource
+    private TrialCyTestTypeService trialCyTestTypeService;
+    @Resource
+    private TrialCyThirdReportService trialCyThirdReportService;
+
+    @Resource
+    private ProjectClient projectClient;
+    @Resource
+    private ContractClient contractClient;
+
+    @Override
+    public Boolean isCyAndTestModule(Long projectId, Long contractId) {
+        ProjectInfo byId = projectClient.getById(String.valueOf(projectId));
+        if(!"cqcyfx".equals(byId.getProjectNumber())){
+            return false;
+        }
+        ContractInfo contractById = contractClient.getContractById(contractId);
+        return contractById.getIsTestModule() == 0;
+    }
+
+    @Override
+    public List<TrialCyTestType> getTree(Long projectId, String parentId) {
+        List<TrialCyTestType> list = trialCyTestTypeService.list(Wrappers.<TrialCyTestType>lambdaQuery()
+                .eq(TrialCyTestType::getProjectId, projectId)
+                .eq(TrialCyTestType::getFatherID, parentId)
+        );
+        return list;
+    }
+
+    @Override
+    public List<TrialCyFinishTestReport> getTrialDetectionReport(Long contractId, Long pKeyId) {
+        TrialCyTestType byId = trialCyTestTypeService.getById(pKeyId);
+
+        return trialCyFinishTestReportService.list(Wrappers.<TrialCyFinishTestReport>lambdaQuery()
+                .eq(TrialCyFinishTestReport::getContractId, contractId)
+                .eq(TrialCyFinishTestReport::getProcessName, byId.getName()));
+    }
+
+    @Override
+    public List<TrialCyThirdReport> getThirdReport(Long contractId, Long pKeyId, Integer type) {
+        TrialCyTestType byId = trialCyTestTypeService.getById(pKeyId);
+        return trialCyThirdReportService.list(Wrappers.<TrialCyThirdReport>lambdaQuery()
+                .eq(TrialCyThirdReport::getContractId, contractId)
+                .eq(TrialCyThirdReport::getThirdType, type)
+                .eq(TrialCyThirdReport::getIsDeleted, 0)
+                .eq(TrialCyThirdReport::getSampleName, byId.getName()));
+    }
+}

+ 22 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialCyTestTypeServiceImpl.java

@@ -0,0 +1,22 @@
+package org.springblade.business.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.business.entity.TrialCyTestType;
+import org.springblade.business.service.TrialCyTestTypeService;
+import org.springblade.business.mapper.TrialCyTestTypeMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author LHB
+* @description 针对表【u_trial_cy_test_type(成渝-试验检测树)】的数据库操作Service实现
+* @createDate 2025-08-01 09:05:07
+*/
+@Service
+public class TrialCyTestTypeServiceImpl extends ServiceImpl<TrialCyTestTypeMapper, TrialCyTestType>
+    implements TrialCyTestTypeService {
+
+}
+
+
+
+

+ 22 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialCyThirdReportServiceImpl.java

@@ -0,0 +1,22 @@
+package org.springblade.business.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.business.entity.TrialCyThirdReport;
+import org.springblade.business.service.TrialCyThirdReportService;
+import org.springblade.business.mapper.TrialCyThirdReportMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author LHB
+* @description 针对表【u_trial_cy_third_report(成渝-已上传的外委检测报告/第三方检测报告/上传报告)】的数据库操作Service实现
+* @createDate 2025-08-01 09:05:10
+*/
+@Service
+public class TrialCyThirdReportServiceImpl extends ServiceImpl<TrialCyThirdReportMapper, TrialCyThirdReport>
+    implements TrialCyThirdReportService {
+
+}
+
+
+
+

+ 13 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/APIController.java

@@ -13,6 +13,7 @@ import org.springblade.core.tool.utils.Func;
 import org.springblade.manager.service.IWbsTreeContractService;
 import org.springblade.manager.vo.APIWbsContractNodeHzrcVo;
 import org.springblade.manager.vo.APIWbsContractNodeVo;
+import org.springblade.manager.vo.APIWbsContractSubdivisionVo;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.web.bind.annotation.*;
 
@@ -93,4 +94,16 @@ public class APIController extends BladeController {
         }
         return R.fail(200, "未查询到信息");
     }
+
+    /**
+     * 获取某一合同段的分部分项划分
+     */
+    @GetMapping("/getWbsContractSubdivision")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "获取某一合同段的分部分项划分", notes = "合同")
+    @ApiImplicitParam(name = "sectionId", value = "合同段Id", required = true)
+    public R<List<APIWbsContractSubdivisionVo>> getWbsContractSubdivision(String sectionId){
+        List<APIWbsContractSubdivisionVo> list = iWbsTreeContractService.getWbsContractSubdivision(sectionId);
+        return R.data(list);
+    }
 }

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

@@ -7,6 +7,7 @@ import org.springblade.manager.entity.*;
 import org.springblade.manager.injector.EasyBaseMapper;
 import org.springblade.manager.vo.*;
 
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -159,4 +160,19 @@ public interface WbsTreeContractMapper extends EasyBaseMapper<WbsTreeContract> {
     List<WbsTreeContract> selectListForcheckAllNodeDate(@Param("projectId") Long projectId, @Param("contractId") Long contractId);
 
     Integer findIsExistTreeNode(List<String> ids);
+
+    /**
+     * 获取只当合同段下的分部分项划分节点
+     * @param contractId
+     * @return
+     */
+    List<APIWbsContractSubdivisionVo> getWbsContractSubdivision(@Param("contractId") String contractId);
+
+    /**
+     * 获取只当合同段下的分部分项划分节点的祖级节点
+     * @param ids
+     * @return
+     */
+    List<APIWbsContractSubdivisionVo> getWbsContractSubdivisionParentNode(@Param("contractId") String contractId,
+                                                                          @Param("ids") Set<Long> ids);
 }

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

@@ -993,5 +993,53 @@
         and is_deleted=0 and is_buss_show !=2 and init_table_name is not null and html_url is not null and LENGTH(init_table_name) > 10 and LENGTH(html_url) > 10
         and p_id is not null and type=2
     </select>
+    <select id="getWbsContractSubdivision" resultType="org.springblade.manager.vo.APIWbsContractSubdivisionVo">
+        SELECT
+            p_key_id id,
+            p_key_id code,
+            node_name name,
+            null stake,
+            p_id pid,
+            CASE
+                WHEN node_type = 18 THEN 1
+                WHEN node_type = 2 THEN 2
+                ELSE 3
+                END nodeType,
+            null levelCode,
+            null partitionCatagID,
+            null partitionCatagName
+        FROM
+            `m_wbs_tree_contract`
+        WHERE
+            node_type IN ( 2, 4, 18 )
+          AND is_deleted = 0
+          AND status = 1
+          AND contract_id = #{contractId}
+    </select>
+    <select id="getWbsContractSubdivisionParentNode"
+            resultType="org.springblade.manager.vo.APIWbsContractSubdivisionVo">
+        SELECT p_key_id       id,
+               p_key_id       code,
+               node_name      name,
+               null           stake,
+               p_id           pid,
+               CASE
+                   WHEN node_type = 18 THEN 1
+                   WHEN node_type = 2 THEN 2
+                   ELSE 3
+                   END        nodeType,
+               null           levelCode,
+               null           partitionCatagID,
+               null           partitionCatagName
+        FROM `m_wbs_tree_contract`
+        WHERE is_deleted = 0
+          AND status = 1
+          AND contract_id = #{contractId}
+          AND p_key_id in
+          <foreach item="id" collection="ids" separator="," close=")" open="(" index="index">
+              #{id}
+          </foreach>
+
+    </select>
 
 </mapper>

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

@@ -94,4 +94,6 @@ public interface IWbsTreeContractService extends BaseService<WbsTreeContract> {
     Integer findIsExistTreeNode(List<String> ids);
 
     List<WbsTreeContract> queryListByPIds(List<Long> pIds);
+
+    List<APIWbsContractSubdivisionVo> getWbsContractSubdivision(String contractId);
 }

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 229 - 237
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно