Forráskód Böngészése

Merge branch 'master' of http://39.108.216.210:3000/zhuwei/bladex

huangtf 7 hónapja
szülő
commit
1a9c1c3ad7
34 módosított fájl, 760 hozzáadás és 42 törlés
  1. 12 0
      blade-ops-api/blade-resource-api/src/main/java/org/springblade/resource/vo/NewBladeFile.java
  2. 28 0
      blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java
  3. 2 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/MaterialPriceDifferential.java
  4. 9 9
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/MaterialsArrival.java
  5. 2 1
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/MeterInfo.java
  6. 47 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/dto/MaterialLinkFormDTO.java
  7. 3 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/dto/MaterialListDTO.java
  8. 6 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/AttachmentForm.java
  9. 86 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/ContractMaterialAdjustDetail.java
  10. 76 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/FormTreeVO2.java
  11. 21 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/GetAdjustFormTreeVO.java
  12. 31 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/GetLinkAllFormVO.java
  13. 41 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/GetMaterialCurrentPriceVO.java
  14. 8 4
      blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorInit.java
  15. 67 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorMeter.java
  16. 10 11
      blade-service/blade-meter/src/main/java/org/springblade/meter/controller/ContractMaterialAdjustController.java
  17. 35 2
      blade-service/blade-meter/src/main/java/org/springblade/meter/controller/ContractMaterialController.java
  18. 10 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/controller/ContractMaterialValidityController.java
  19. 2 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractInventoryFormMapper.java
  20. 5 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractInventoryFormMapper.xml
  21. 35 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialAdjustDetailMapper.java
  22. 7 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialAdjustDetailMapper.xml
  23. 2 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialMapper.java
  24. 10 2
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialMapper.xml
  25. 4 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialValidityMapper.java
  26. 12 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialValidityMapper.xml
  27. 3 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/IContractInventoryFormService.java
  28. 34 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/IContractMaterialAdjustDetailService.java
  29. 9 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/IContractMaterialService.java
  30. 4 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/IContractMaterialValidityService.java
  31. 40 4
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ContractInventoryFormServiceImpl.java
  32. 41 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ContractMaterialAdjustDetailImpl.java
  33. 50 7
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ContractMaterialServiceImpl.java
  34. 8 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ContractMaterialValidityServiceImpl.java

+ 12 - 0
blade-ops-api/blade-resource-api/src/main/java/org/springblade/resource/vo/NewBladeFile.java

@@ -1,7 +1,10 @@
 package org.springblade.resource.vo;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.time.LocalDateTime;
+
 @Data
 public class NewBladeFile {
     private String link;
@@ -13,4 +16,13 @@ public class NewBladeFile {
     private Integer page;
     private Long fileSize;
     private Long fileType;
+    @ApiModelProperty(value = "附件大小带符号")
+    private String fileSizeName;
+
+    @ApiModelProperty(value = "附件后缀")
+    private String fileSuffix;
+
+    @ApiModelProperty(value = "附件上传时间")
+    private LocalDateTime fileDate;
+
 }

+ 28 - 0
blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java

@@ -43,6 +43,9 @@ import java.awt.*;
 import java.awt.image.BufferedImage;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.text.DecimalFormat;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.util.Objects;
 
 /**
@@ -227,6 +230,9 @@ public class OssEndpoint {
 
         BeanUtils.copyProperties(bladeFile, newBladeFile);
         newBladeFile.setFileSize(file.getSize() / 1024);
+        newBladeFile.setFileSizeName(formatSize(file.getSize()));
+        newBladeFile.setFileDate(LocalDateTime.now());
+        newBladeFile.setFileSuffix(bladeFile.getOriginalName().substring(bladeFile.getOriginalName().lastIndexOf(".")+1));
 
         //入库
         String fileExtension = FileUtil.getFileExtension(bladeFile.getOriginalName());
@@ -374,4 +380,26 @@ public class OssEndpoint {
         return R.success("操作成功");
     }
 
+    /**
+     * 根据字节返回文件大小
+     */
+    private String formatSize(long fileS) {
+        DecimalFormat df = new DecimalFormat("#.00");
+        String fileSizeString = "";
+        String wrongSize = "0B";
+        if (fileS == 0) {
+            return wrongSize;
+        }
+        if (fileS < 1024) {
+            fileSizeString = df.format((double) fileS) + "B";
+        } else if (fileS < 1048576) {
+            fileSizeString = df.format((double) fileS / 1024) + "KB";
+        } else if (fileS < 1073741824) {
+            fileSizeString = df.format((double) fileS / 1048576) + "MB";
+        } else {
+            fileSizeString = df.format((double) fileS / 1073741824) + "GB";
+        }
+        return fileSizeString;
+    }
+
 }

+ 2 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/MaterialPriceDifferential.java

@@ -1,12 +1,14 @@
 package org.springblade.manager.vo;
 
 import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
 
 /**
  * @author yangyj
  * @Date 2024/4/19 10:50
  * @description 永久性工程材料差价金额预览表
  */
+@Data
 public class MaterialPriceDifferential implements  DataModel{
     public static final String ID="20310000000";
     public static final String TBN="MtPiDf";

+ 9 - 9
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/MaterialsArrival.java

@@ -18,26 +18,26 @@ public class MaterialsArrival implements  DataModel{
     private String periodNumber;
     @JSONField(name = "key_2",label="材料名称",ordinal = 1)
     private String name;
-    @JSONField(name = "key_1",label="单位",ordinal = 1)
+    @JSONField(name = "key_3",label="单位",ordinal = 1)
     private String unit;
-    @JSONField(name = "key_2",label="数量",ordinal = 1)
+    @JSONField(name = "key_4",label="数量",ordinal = 1)
     private String quantity;
 
-    @JSONField(name = "key_2",label="单价",ordinal = 1)
+    @JSONField(name = "key_5",label="单价",ordinal = 1)
     private String price;
 
-    @JSONField(name = "key_1",label="金额",ordinal = 1)
+    @JSONField(name = "key_6",label="金额",ordinal = 1)
     private String amount;
-    @JSONField(name = "key_2",label="按合同规定预付总金额",ordinal = 1)
+    @JSONField(name = "key_7",label="按合同规定预付总金额",ordinal = 1)
     private String total;
-    @JSONField(name = "key_1",label="材料来源",ordinal = 1)
+    @JSONField(name = "key_8",label="材料来源",ordinal = 1)
     private String source;
-    @JSONField(name = "key_2",label="发票",ordinal = 1)
+    @JSONField(name = "key_9",label="发票",ordinal = 1)
     private String Invoice;
 
-    @JSONField(name = "key_1",label="质保书编号",ordinal = 1)
+    @JSONField(name = "key_10",label="质保书编号",ordinal = 1)
     private String warrantyNumber;
-    @JSONField(name = "key_2",label="监抽报告编号",ordinal = 1)
+    @JSONField(name = "key_11",label="监抽报告编号",ordinal = 1)
     private String ssr;
 
 

+ 2 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/MeterInfo.java

@@ -27,6 +27,7 @@ public class MeterInfo {
     BaseInfo baseInfo;
     /**计量期信息*/
     LinkedHashMap<Long,MeterPeriodInfo> meterPeriodInfoLinkedHashMap= new LinkedHashMap<>();
-
+    /**加载合同材料、材料清单*/
+    List<Material> materialsAll;
 
 }

+ 47 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/dto/MaterialLinkFormDTO.java

@@ -0,0 +1,47 @@
+package org.springblade.meter.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @Param   材料关联清单专用
+ * @Author wangwl
+ * @Date 2024/4/22 17:09
+ **/
+@Data
+public class MaterialLinkFormDTO {
+
+    @ApiModelProperty(value = "项目id")
+    @NotNull(message = "未获取到项目id!")
+    private Long projectId;
+
+    @ApiModelProperty(value = "合同段id")
+    @NotNull(message = "未获取到合同段id!")
+    private Long contractId;
+
+    @ApiModelProperty(value = "材料id")
+    @NotNull(message = "未获取到材料id!")
+    private Long materialId;
+
+
+    @ApiModelProperty(value = "节点集合")
+    @NotNull(message = "未选择节点!")
+    @Valid
+    private List<form> forms;
+
+    @Data
+    public static class form{
+        @ApiModelProperty(value = "节点id")
+        @NotNull(message = "未找到节点id!")
+        private Long id;
+
+        @NotNull(message = "请填写完所有关联的调差系数!")
+        @ApiModelProperty(value = "调差系数")
+        private BigDecimal adjustFactor;
+    }
+}

+ 3 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/dto/MaterialListDTO.java

@@ -1,6 +1,7 @@
 package org.springblade.meter.dto;
 
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 import javax.validation.constraints.NotNull;
 
@@ -9,11 +10,13 @@ import javax.validation.constraints.NotNull;
  * @Author wangwl
  * @Date 2024/4/22 15:15
  **/
+@Data
 public class MaterialListDTO {
 
     @ApiModelProperty(value = "合同段id")
     @NotNull(message = "未获取到合同段id!")
     private Long contractId;
+
     @ApiModelProperty(value = "材料编号")
     private String materialNumber;
 

+ 6 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/AttachmentForm.java

@@ -80,5 +80,11 @@ public class AttachmentForm extends BaseEntity {
     @ApiModelProperty(value = "中间计量申请专用字段 质检文件的Id(query)")
     private Long selectId;
 
+    @ApiModelProperty(value = "文件后缀")
+    private Long fileSuffix;
+
+    @ApiModelProperty(value = "文件大小名称")
+    private Long fileSizeName;
+
 
 }

+ 86 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/ContractMaterialAdjustDetail.java

@@ -0,0 +1,86 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.meter.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ * 合同材料表实体类
+ *
+ * @author BladeX
+ * @since 2023-11-29
+ */
+@Data
+@TableName("s_contract_material_adjust_detail")
+@EqualsAndHashCode(callSuper = true)
+public class ContractMaterialAdjustDetail extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 项目id
+     */
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+    /**
+     * 合同段id
+     */
+    @ApiModelProperty(value = "合同段id")
+    private Long contractId;
+
+    @ApiModelProperty(value = "合同材料id")
+    private Long contractMaterialId;
+
+    @ApiModelProperty(value = "中间计量申请id")
+    private Long middleMeterId;
+
+    @ApiModelProperty(value = "计量单编号")
+    private Long meterNumber;
+
+    @ApiModelProperty(value = "合同工程清单id")
+    private Long contractFormId;
+
+    @ApiModelProperty(value = "清单编号")
+    private String formNumber;
+
+    @ApiModelProperty(value = "清单名称")
+    private String formName;
+
+    @ApiModelProperty(value = "单位")
+    private String unit;
+
+    @ApiModelProperty(value = "计量数量")
+    private BigDecimal meterTotal;
+
+    @ApiModelProperty(value = "可调数量")
+    private BigDecimal changeTotal;
+
+    @ApiModelProperty(value = "调差系数")
+    private BigDecimal adjustFactor;
+
+    @ApiModelProperty(value = "调差数量")
+    private BigDecimal adjustTotal;
+
+
+}

+ 76 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/FormTreeVO2.java

@@ -0,0 +1,76 @@
+package org.springblade.meter.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springblade.core.tool.node.INode;
+import org.springblade.meter.config.IsConverter;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Param   材料调差返回所有允许调差节点
+ * @Author wangwl
+ * @Date 2023/11/29 15:25
+ **/
+@Data
+public class FormTreeVO2 implements INode<FormTreeVO2> {
+
+    /**
+     * 主键ID
+     */
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long id;
+
+    /**
+     * 父节点ID
+     */
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long parentId;
+
+    /**
+     * 子孙节点
+     */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private List<FormTreeVO2> children;
+
+    /**
+     * 是否有子孙节点
+     */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private Boolean hasChildren;
+
+    @Override
+    public List<FormTreeVO2> getChildren() {
+        if (this.children == null) {
+            this.children = new ArrayList<>();
+        }
+        return this.children;
+    }
+
+    @ApiModelProperty(value = "清单名称")
+    private String formName;
+
+    @ApiModelProperty(value = "是否选择0否1是")
+    private Integer isSelect;
+
+    @ApiModelProperty(value = "调差系数")
+    private BigDecimal adjustFactor;
+
+    @ApiModelProperty(value = "是否清单节点0否1是")
+    private Integer isFormNode;
+
+    @ApiModelProperty(value = "是否允许材料调差0否1是")
+    private Integer isAdjust;
+
+    @ApiModelProperty(value = "是否被引用0否1是,被引用后不允许取消")
+    private Integer isQuote;
+
+
+}

+ 21 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/GetAdjustFormTreeVO.java

@@ -0,0 +1,21 @@
+package org.springblade.meter.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Param
+ * @Author wangwl
+ * @Date 2024/4/23 15:49
+ **/
+@Data
+public class GetAdjustFormTreeVO {
+
+    @ApiModelProperty(value = "已经关联的节点id")
+    private List<Long> ids;
+
+    @ApiModelProperty(value = "材料编号")
+    private List<FormTreeVO2> vo2s;
+}

+ 31 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/GetLinkAllFormVO.java

@@ -0,0 +1,31 @@
+package org.springblade.meter.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+/**
+ * @Param   材料调差-编辑获取清单列表
+ * @Author wangwl
+ * @Date 2024/4/23 10:52
+ **/
+@Data
+public class GetLinkAllFormVO {
+    @ApiModelProperty(value = "材料和清单绑定关系id")
+    private Long id;
+
+    @ApiModelProperty(value = "清单编号")
+    private String formNumber;
+
+    @ApiModelProperty(value = "清单名称")
+    private String formName;
+
+    @ApiModelProperty(value = "材料名称")
+    private String materialName;
+
+    @ApiModelProperty(value = "调差系数")
+    private BigDecimal adjustFactor;
+}

+ 41 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/GetMaterialCurrentPriceVO.java

@@ -0,0 +1,41 @@
+package org.springblade.meter.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ * @Param
+ * @Author wangwl
+ * @Date 2024/4/23 11:21
+ **/
+@Data
+public class GetMaterialCurrentPriceVO {
+
+    @ApiModelProperty(value = "材料实时价格id")
+    private Long id;
+
+    @ApiModelProperty(value = "节点名称")
+    private String nodeName;
+
+    @ApiModelProperty(value = "材料编号")
+    private String materialNumber;
+
+    @ApiModelProperty(value = "材料名称")
+    private String materialName;
+
+    @ApiModelProperty(value = "单位")
+    private String unit;
+
+    @ApiModelProperty(value = "实时单价")
+    private BigDecimal currentPrice;
+
+    @ApiModelProperty(value = "开始日期")
+    private LocalDate startDate;
+
+    @ApiModelProperty(value = "结束日期")
+    private LocalDate endDate;
+
+}

+ 8 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorInit.java

@@ -31,8 +31,9 @@ public class ExecutorInit extends FormulaExecutor {
     private Function<Long, MeterPeriodInfo>  meterPeriodFc;
     private Function<Long, List<MeterTree>> meterTreeFc;
     /*private Function<Long, MeterPeriodInfo> interimMeterPeriodFc;*/
+    private Function<Long, List<Material>> materialFormFc;
     private Function<Long,List<MeterPeriodInfo>> interimMeterPeriodAllFc;
-
+    public static final String SZ="[ 一二三四五六七八九十]+";
 
 
     public void handle() {
@@ -48,6 +49,8 @@ public class ExecutorInit extends FormulaExecutor {
         if(MeterType.MATERIAL.equals(tec.getMeterType())||MeterType.START.equals(tec.getMeterType())){
             /*加载计量期信息*/
             tec.periodInfo=meterPeriodFc.apply(tec.getReportId());
+            /*加载合同材料、材料清单*/
+            tec.meterInfo.setMaterialsAll(materialFormFc.apply(tec.getContractId()));
         }else if(MeterType.INTERIM.equals(tec.getMeterType())||MeterType.INTERIM_JL.equals(tec.getMeterType())){
             /*计量期*/
             List<MeterPeriodInfo> meterPeriodInfoList = interimMeterPeriodAllFc.apply(tec.getContractId());
@@ -67,15 +70,16 @@ public class ExecutorInit extends FormulaExecutor {
         tec.setPeriodId(tec.periodInfo.getId());
         String periodNumber = tec.periodInfo.getPeriodNumber();
         if(!BaseUtils.isNumber(periodNumber)){
-            periodNumber= RegexUtil.findResult("[ 一二三四五六七八九十]+",periodNumber);
+            periodNumber= RegexUtil.findResult(SZ,periodNumber);
             if(periodNumber!=null){
-                if(RegexUtil.find("[ 一二三四五六七八九十]+",periodNumber)){
+                if(RegexUtil.find(SZ,periodNumber)){
                     periodNumber=String.valueOf(FormulaUtils.chineseToArabic(periodNumber));
                 }
                 tec.periodInfo.setPeriodNumber(periodNumber);
             }
         }
-        LinkedHashMap<String, FormData> periodMap=  FormulaUtils.toFormDataMap(tec.periodInfo);
+        LinkedHashMap<String, FormData> periodMap = FormulaUtils.toFormDataMap(tec.periodInfo);
+        /*每页内容都一样*/
         tec.getRepeatKeys().addAll(periodMap.keySet());
         tec.formDataMap.putAll(periodMap);
     }

+ 67 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorMeter.java

@@ -35,7 +35,7 @@ import java.util.stream.IntStream;
 @EqualsAndHashCode(callSuper = true)
 @Data
 public class ExecutorMeter extends FormulaExecutor {
-    private Function<Long, List<Material>> materialFormFc;
+  /*  private Function<Long, List<Material>> materialFormFc;*/
     private Function<Long, List<Payment>> paymentListFc;
     private Function<Long, List<MidPayItem>> midPayItemListFc;
     private Function<Long, List<InventoryForm>> inventoryFormFc;
@@ -53,6 +53,9 @@ public class ExecutorMeter extends FormulaExecutor {
     /**累计到本期末支付信息*/
     private List<Payment>   paymentsPeriodEnd =new ArrayList<>();
 
+    /*本期材料支付信息*/
+    List<Material>materials;
+
     private List<InterimPaymentCertificate> interimPaymentCertificates =new ArrayList<>();
     /*分项中期汇总*/
     private List<SubprojectInterimPaymentSummary> subprojectInterimPaymentSummary =new ArrayList<>();
@@ -110,6 +113,7 @@ public class ExecutorMeter extends FormulaExecutor {
         if(MeterType.MATERIAL.equals(tec.getMeterType())){
             /*材料预付款支付申请表处理*/
             this.specialList.add(new MaterialCalc());
+            this.specialList.add(new MaterialSp());
         }else if(MeterType.INTERIM.equals(tec.getMeterType())){
             this.specialList.add(new InterimPayCert());
             this.specialList.add(new InterimSum());
@@ -219,7 +223,7 @@ public class ExecutorMeter extends FormulaExecutor {
 
         public void parse(){
             /*加载合同材料、材料清单*/
-            List<Material> materialsAll = materialFormFc.apply(tec.getContractId());
+            List<Material> materialsAll =tec.getMeterInfo().getMaterialsAll();
             /*本期*/
             List<Material>materials=materialsAll.stream().filter(m->tec.getPeriodId().equals(m.getPeriodId())).collect(Collectors.toList());
             /*本期,往期累计,本期累计*/
@@ -283,7 +287,68 @@ public class ExecutorMeter extends FormulaExecutor {
             }
         }
     }
+    @Data
+    @EqualsAndHashCode(callSuper = true)
+    public  class MaterialSp extends   BaseSpecial<MaterialPriceDifferential> implements Special{
+
+        @Override
+        public boolean ready() {
+            return MeterInfo.MB_ZJ.equals(tec.getMeterInfo().getConfig());
+        }
+
+        @Override
+        public void parse() {
+            /*本期材料*/
+            materials=tec.meterInfo.getMaterialsAll().stream().filter(e->tec.getPeriodId().equals(e.getPeriodId())).collect(Collectors.toList());
+            if(materials.size()>0){
+                dataList.addAll(materials.stream().map(e->{
+                    MaterialPriceDifferential mpd = new MaterialPriceDifferential();
+                    mpd.setPeriodNumber(tec.periodInfo.getPeriodNumber());
+                    mpd.setName(e.getMaterialName());
+                    mpd.setUnit(e.getUnit());
+                    mpd.setQuantity(e.getMeterAmount());
+                    mpd.setPriceBase(e.getPrice());
+                    mpd.setAmountBase(e.getSum());
+                    mpd.setPrice(e.getPrice());
+                    mpd.setAmountBase(e.getSum());
+                    return mpd;
+                 }
+                ).collect(Collectors.toList()));
+            }
+            putOut();
+        }
+    }
 
+    @Data
+    @EqualsAndHashCode(callSuper = true)
+    public  class MaterialsArrivalSp extends   BaseSpecial<MaterialsArrival> implements Special{
+
+        @Override
+        public boolean ready() {
+            return MeterInfo.MB_ZJ.equals(tec.getMeterInfo().getConfig());
+        }
+
+        @Override
+        public void parse() {
+            builderFormDatas(MaterialsArrival.class);
+            if(materials.size()>0){
+                dataList.addAll(materials.stream().map(e->{
+                            MaterialsArrival ma = new MaterialsArrival();
+                            ma.setPeriodNumber(tec.periodInfo.getPeriodNumber());
+                            ma.setName(e.getMaterialName());
+                            ma.setUnit(e.getUnit());
+                            ma.setQuantity(e.getMeterAmount());
+                            ma.setPrice(e.getPrice());
+                            ma.setAmount(e.getMeterAmount());
+                            ma.setTotal(e.getAdvancePayment());
+                            ma.setSource(e.getSource());
+                            return ma;
+                        }
+                ).collect(Collectors.toList()));
+            }
+            putOut();
+        }
+    }
 
     @Data
     @EqualsAndHashCode(callSuper = true)

+ 10 - 11
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/InventoryFormMaterialController.java → blade-service/blade-meter/src/main/java/org/springblade/meter/controller/ContractMaterialAdjustController.java

@@ -16,35 +16,34 @@
  */
 package org.springblade.meter.controller;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import lombok.AllArgsConstructor;
 import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
-import org.springblade.meter.dto.ContractMaterialValidityDTO;
-import org.springblade.meter.service.IContractMaterialValidityService;
-import org.springblade.meter.service.IInventoryFormMaterialService;
-import org.springblade.meter.vo.ContractMaterialVO3;
-import org.springblade.meter.vo.ContractMaterialValidityVO;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.meter.entity.AttachmentForm;
+import org.springblade.meter.service.IAttachmentFormService;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
-import java.util.List;
 
 /**
+ * 附件表 控制器
  *
  * @author BladeX
  * @since 2023-11-29
  */
 @RestController
 @AllArgsConstructor
-@RequestMapping("/inventoryFormMaterial")
+@RequestMapping("/contractMaterialAdjust")
 @Api(value = "材料调差", tags = "材料调差接口")
-public class InventoryFormMaterialController extends BladeController {
-
-	private final IInventoryFormMaterialService formMaterialService;
-
+public class ContractMaterialAdjustController extends BladeController {
 
 	
 }

+ 35 - 2
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/ContractMaterialController.java

@@ -25,6 +25,7 @@ import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.meter.dto.MaterialLinkFormDTO;
 import org.springblade.meter.dto.MaterialListDTO;
 import org.springblade.meter.vo.*;
 import org.springframework.web.bind.annotation.*;
@@ -135,11 +136,43 @@ public class ContractMaterialController extends BladeController {
 	}
 
 	@PostMapping("/get-all-material2")
-	@ApiOperationSupport(order = 7)
-	@ApiOperation(value = "材料调差-获取材料列表不分页", notes = "传入合同id,搜索条件")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "调差系数-获取材料列表不分页", notes = "传入合同id,搜索条件")
 	public R<List<ContractMaterialVO4>> getAllMaterial2(@RequestBody MaterialListDTO dto) {
 		List<ContractMaterialVO4> list = contractMaterialService.getAllMaterial2(dto);
 		return R.data(list);
 	}
+
+	@GetMapping("/get-adjust-form-tree")
+	@ApiOperationSupport(order = 9)
+	@ApiOperation(value = "调差系数-绑定清单-获取清单树", notes = "传入合同id,材料id")
+	public R<GetAdjustFormTreeVO> getAdjustFormTree(Long contractId,Long materialId) {
+		GetAdjustFormTreeVO vo = contractMaterialService.getAdjustFormTree(contractId,materialId);
+		return R.data(vo);
+	}
+
+	@PostMapping("/material-link-form")
+	@ApiOperationSupport(order = 10)
+	@ApiOperation(value = "调差系数-绑定清单-确定绑定", notes = "传入项目id,合同id,材料id,节点数组")
+	public R materialLinkForm(@Valid @RequestBody MaterialLinkFormDTO dto) {
+		contractMaterialService.materialLinkForm(dto);
+		return R.success("绑定成功");
+	}
+
+	@GetMapping("/get-link-all-form")
+	@ApiOperationSupport(order = 11)
+	@ApiOperation(value = "调差系数-编辑获取清单列表", notes = "传入合同id,材料id")
+	public R<List<GetLinkAllFormVO>> getLinkAllForm(Long contractId,Long materialId) {
+		List<GetLinkAllFormVO> vos = contractMaterialService.getLinkAllForm(contractId,materialId);
+		return R.data(vos);
+	}
+
+	@GetMapping("/remove-link-form")
+	@ApiOperationSupport(order = 12)
+	@ApiOperation(value = "调差系数-解除绑定关系", notes = "传入材料和清单绑定关系id")
+	public R removeLinkForm(Long id) {
+		contractMaterialService.removeLinkForm(id);
+		return R.success("解除成功");
+	}
 	
 }

+ 10 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/ContractMaterialValidityController.java

@@ -33,9 +33,11 @@ import org.springblade.meter.service.IAttachmentFormService;
 import org.springblade.meter.service.IContractMaterialValidityService;
 import org.springblade.meter.vo.ContractMaterialVO3;
 import org.springblade.meter.vo.ContractMaterialValidityVO;
+import org.springblade.meter.vo.GetMaterialCurrentPriceVO;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
+import java.time.YearMonth;
 import java.util.List;
 
 /**
@@ -75,6 +77,14 @@ public class ContractMaterialValidityController extends BladeController {
 		return R.data(list);
 	}
 
+	@GetMapping("/get-material-current-price")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "材料调差-选择实时价格", notes = "传入合同id,材料id,传入年月")
+	public R<List<GetMaterialCurrentPriceVO>> getMaterialCurrentPrice(Long contractId, Long materialId, YearMonth yearMonth) {
+		List<GetMaterialCurrentPriceVO> list = validityService.getMaterialCurrentPrice(contractId,materialId,yearMonth);
+		return R.data(list);
+	}
+
 
 	
 }

+ 2 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractInventoryFormMapper.java

@@ -69,4 +69,6 @@ public interface ContractInventoryFormMapper extends BaseMapper<ContractInventor
     List<String> getAllEqualsNumber(@Param("contractId") Long contractId,@Param("numbers") List<String> collect);
 
     List<FormNodeSortVO> getAllForm(@Param("contractId") Long contractId);
+
+    List<FormTreeVO2> getAllForm2(@Param("contractId") Long contractId);
 }

+ 5 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractInventoryFormMapper.xml

@@ -173,5 +173,10 @@
         from s_contract_inventory_form where contract_id = #{contractId} and is_deleted = 0
         order by -sort desc,create_time
     </select>
+    <select id="getAllForm2" resultType="org.springblade.meter.vo.FormTreeVO2">
+        select id ,parent_id,form_name,is_form_node,is_adjust,0 as isSelect,0 as isQuote
+        from s_contract_inventory_form scif where contract_id = #{contractId} and is_deleted = 0
+        order by -sort desc,create_time
+    </select>
 
 </mapper>

+ 35 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialAdjustDetailMapper.java

@@ -0,0 +1,35 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.meter.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.meter.entity.AttachmentForm;
+import org.springblade.meter.entity.ContractMaterialAdjustDetail;
+
+import java.util.Set;
+
+/**
+ * 附件表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2023-11-29
+ */
+public interface ContractMaterialAdjustDetailMapper extends BaseMapper<ContractMaterialAdjustDetail> {
+
+
+}

+ 7 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialAdjustDetailMapper.xml

@@ -0,0 +1,7 @@
+<?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.meter.mapper.ContractMaterialAdjustDetailMapper">
+
+
+
+</mapper>

+ 2 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialMapper.java

@@ -46,4 +46,6 @@ public interface ContractMaterialMapper extends BaseMapper<ContractMaterial> {
 
     //调差系数,条件查询所有材料
     List<ContractMaterialVO4> getALLMaterial3(@Param("dto") MaterialListDTO dto);
+
+    List<GetLinkAllFormVO> getLinkAllForm(@Param("contractId") Long contractId,@Param("materialId") Long materialId);
 }

+ 10 - 2
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialMapper.xml

@@ -45,8 +45,8 @@
         from s_contract_material where is_deleted = 0 and contract_id = #{contractId}
     </select>
     <select id="getALLMaterial3" resultType="org.springblade.meter.vo.ContractMaterialVO4">
-        select id,material_number,material_name,unit
-        from s_contract_material where is_deleted = 0 and contract_id = #{contractId}
+        select id,material_number,material_name,unit,price
+        from s_contract_material where is_deleted = 0 and contract_id = #{dto.contractId}
         <if test="dto.materialNumber != null and dto.materialNumber != ''">
             and u.material_number like concat('%',#{dto.materialNumber},'%')
         </if>
@@ -54,6 +54,14 @@
             and u.material_name like concat('%',#{dto.materialName},'%')
         </if>
     </select>
+    <select id="getLinkAllForm" resultType="org.springblade.meter.vo.GetLinkAllFormVO">
+        select id,adjust_factor,
+               (select form_number from s_contract_inventory_form cif where cif.id = ifm.contract_form_id) as formNumber,
+               (select form_name from s_contract_inventory_form cif where cif.id = ifm.contract_form_id) as formName,
+               (select material_name from s_contract_material scm where scm.id = ifm.contract_material_id) as materialName
+        from s_inventory_form_material ifm
+        where  is_deleted = 0 and contract_id = #{contractId} and contract_material_id = #{materialId}
+    </select>
 
 
 </mapper>

+ 4 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialValidityMapper.java

@@ -22,8 +22,10 @@ import org.springblade.meter.entity.AttachmentForm;
 import org.springblade.meter.entity.ContractMaterialValidity;
 import org.springblade.meter.vo.ContractMaterialVO3;
 import org.springblade.meter.vo.ContractMaterialValidityVO;
+import org.springblade.meter.vo.GetMaterialCurrentPriceVO;
 
 import java.time.LocalDate;
+import java.time.YearMonth;
 import java.util.List;
 import java.util.Set;
 
@@ -43,4 +45,6 @@ public interface ContractMaterialValidityMapper extends BaseMapper<ContractMater
     LocalDate getNewestEndDate(@Param("contractId") Long contractId);
 
     List<ContractMaterialVO3> detail(@Param("id") Long id);
+
+    List<GetMaterialCurrentPriceVO> getMaterialCurrentPrice(@Param("contractId") Long contractId,@Param("materialId") Long materialId,@Param("yearMonth") YearMonth yearMonth);
 }

+ 12 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialValidityMapper.xml

@@ -23,4 +23,16 @@
         from s_contract_material_price scmp left join s_contract_material scm on scmp.contract_material_id = scm.id
         where scmp.is_deleted = 0 and scmp.material_validity_id = #{id}
     </select>
+    <select id="getMaterialCurrentPrice" resultType="org.springblade.meter.vo.GetMaterialCurrentPriceVO">
+        select scmv.node_name ,scmp.current_price,scmp.id,scmv.start_date,scmv.end_date,
+        (select material_number from s_contract_material scm where scm.id = scmp.contract_material_id) as materialNumber,
+        (select material_name from s_contract_material scm where scm.id = scmp.contract_material_id) as materialName,
+        (select unit from s_contract_material scm where scm.id = scmp.contract_material_id) as unit
+        from s_contract_material_validity scmv inner join s_contract_material_price scmp on scmv.id = scmp.material_validity_id
+        where scmp.contract_material_id = #{materialId} and scmp.is_deleted = 0 and scmv.is_deleted = 0
+        <if test="yearMonth != null">
+          and #{yearMonth} between date_format(scmv.start_date,'%Y-%m') and date_format(scmv.end_date ,'%Y-%m')
+        </if>
+        order by end_date desc
+    </select>
 </mapper>

+ 3 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/IContractInventoryFormService.java

@@ -62,4 +62,7 @@ public interface IContractInventoryFormService extends BaseService<ContractInven
 
     //清单公共方法,返回当前清单编号顺序集合
     List<String> getAllFormNumberBySort(Long contractId);
+
+    //材料调差-获取允许调差清单树,并且回显已经选择的
+    GetAdjustFormTreeVO getAdjustFormTree(Long contractId, Long materialId);
 }

+ 34 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/IContractMaterialAdjustDetailService.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.meter.service;
+
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.meter.entity.AttachmentForm;
+import org.springblade.meter.entity.ContractMaterialAdjustDetail;
+
+import java.util.Set;
+
+/**
+ * 附件表 服务类
+ *
+ * @author BladeX
+ * @since 2023-11-29
+ */
+public interface IContractMaterialAdjustDetailService extends BaseService<ContractMaterialAdjustDetail> {
+
+
+}

+ 9 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/IContractMaterialService.java

@@ -18,6 +18,7 @@ package org.springblade.meter.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.core.mp.support.Query;
+import org.springblade.meter.dto.MaterialLinkFormDTO;
 import org.springblade.meter.dto.MaterialListDTO;
 import org.springblade.meter.entity.ContractMaterial;
 import org.springblade.core.mp.base.BaseService;
@@ -49,4 +50,12 @@ public interface IContractMaterialService extends BaseService<ContractMaterial>
     List<ContractMaterialVO3> getAllMaterial(Long contractId);
 
     List<ContractMaterialVO4> getAllMaterial2(MaterialListDTO dto);
+
+    GetAdjustFormTreeVO getAdjustFormTree(Long contractId, Long materialId);
+
+    void materialLinkForm(MaterialLinkFormDTO dto);
+
+    List<GetLinkAllFormVO> getLinkAllForm(Long contractId, Long materialId);
+
+    void removeLinkForm(Long id);
 }

+ 4 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/IContractMaterialValidityService.java

@@ -22,7 +22,9 @@ import org.springblade.meter.entity.AttachmentForm;
 import org.springblade.meter.entity.ContractMaterialValidity;
 import org.springblade.meter.vo.ContractMaterialVO3;
 import org.springblade.meter.vo.ContractMaterialValidityVO;
+import org.springblade.meter.vo.GetMaterialCurrentPriceVO;
 
+import java.time.YearMonth;
 import java.util.List;
 import java.util.Set;
 
@@ -40,4 +42,6 @@ public interface IContractMaterialValidityService extends BaseService<ContractMa
     void add(ContractMaterialValidityDTO dto);
 
     List<ContractMaterialVO3> detail(Long id);
+
+    List<GetMaterialCurrentPriceVO> getMaterialCurrentPrice(Long contractId, Long materialId, YearMonth yearMonth);
 }

+ 40 - 4
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ContractInventoryFormServiceImpl.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.meter.service.impl;
 
+import com.alibaba.druid.sql.visitor.functions.If;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -28,13 +29,11 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.meter.entity.ChangeTokenInventory;
 import org.springblade.meter.entity.ContractInventoryForm;
+import org.springblade.meter.entity.InventoryFormMaterial;
 import org.springblade.meter.entity.InventoryFormMeter;
 import org.springblade.meter.mapper.ContractInventoryFormMapper;
-import org.springblade.meter.service.IChangeTokenFormService;
-import org.springblade.meter.service.IChangeTokenInventoryService;
-import org.springblade.meter.service.IContractInventoryFormService;
+import org.springblade.meter.service.*;
 import org.springblade.core.mp.base.BaseServiceImpl;
-import org.springblade.meter.service.IInventoryFormMeterService;
 import org.springblade.meter.utils.ForestNodeMerger;
 import org.springblade.meter.vo.*;
 import org.springframework.stereotype.Service;
@@ -59,6 +58,8 @@ public class ContractInventoryFormServiceImpl extends BaseServiceImpl<ContractIn
 
         private final IChangeTokenInventoryService tokenInventoryService;
 
+        private final IInventoryFormMaterialService formMaterialService;
+
     /**
      * 导入excel
      * @param file
@@ -650,6 +651,41 @@ public class ContractInventoryFormServiceImpl extends BaseServiceImpl<ContractIn
         return forms;
     }
 
+    @Override
+    public GetAdjustFormTreeVO getAdjustFormTree(Long contractId, Long materialId) {
+        GetAdjustFormTreeVO vo = new GetAdjustFormTreeVO();
+        //获取已经关联的节点
+        List<InventoryFormMaterial> formMaterials = formMaterialService.list(new LambdaQueryWrapper<InventoryFormMaterial>()
+                .eq(InventoryFormMaterial::getContractId, contractId)
+                .eq(InventoryFormMaterial::getContractMaterialId, materialId));
+        Map<Long, BigDecimal> map = formMaterials.stream().collect(Collectors.toMap(l -> l.getContractFormId(), l -> l.getAdjustFactor()));
+        //获取所有清单节点
+        List<FormTreeVO2> vo2s = baseMapper.getAllForm2(contractId);
+        List<FormTreeVO2> list = new ArrayList<>();
+        List<Long> ids = new ArrayList<>();
+        //循环清单节点,把最底层节点不允许调差的删除,并且标识已关联的节点
+        for (FormTreeVO2 vo2 : vo2s) {
+            if (vo2.getIsFormNode() == 1){
+                if (vo2.getIsAdjust() == 1){
+                    BigDecimal decimal = map.get(vo2.getId());
+                    if(decimal != null) {
+                        vo2.setAdjustFactor(decimal);
+                        vo2.setIsSelect(1);
+                        ids.add(vo2.getId());
+                    }
+                    list.add(vo2);
+                }
+            }else {
+                list.add(vo2);
+            }
+        }
+        //转换为树
+        list = ForestNodeMerger.merge(list);
+        vo.setVo2s(list);
+        vo.setIds(ids);
+        return vo;
+    }
+
     /**
      * 判断当前清单是否已经分解或变更过,变更过返回true
      */

+ 41 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ContractMaterialAdjustDetailImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.meter.service.impl;
+
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.meter.entity.AttachmentForm;
+import org.springblade.meter.entity.ContractMaterialAdjustDetail;
+import org.springblade.meter.mapper.AttachmentFormMapper;
+import org.springblade.meter.mapper.ContractMaterialAdjustDetailMapper;
+import org.springblade.meter.service.IAttachmentFormService;
+import org.springblade.meter.service.IContractMaterialAdjustDetailService;
+import org.springframework.stereotype.Service;
+
+import java.util.Set;
+
+/**
+ * 附件表 服务实现类
+ *
+ * @author BladeX
+ * @since 2023-11-29
+ */
+@Service
+public class ContractMaterialAdjustDetailImpl extends BaseServiceImpl<ContractMaterialAdjustDetailMapper, ContractMaterialAdjustDetail> implements IContractMaterialAdjustDetailService {
+
+
+
+}

+ 50 - 7
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ContractMaterialServiceImpl.java

@@ -24,15 +24,11 @@ import org.apache.commons.lang.StringUtils;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.meter.dto.MaterialLinkFormDTO;
 import org.springblade.meter.dto.MaterialListDTO;
-import org.springblade.meter.entity.ContractInventoryForm;
-import org.springblade.meter.entity.ContractMaterial;
-import org.springblade.meter.entity.ContractMaterialAdjust;
-import org.springblade.meter.entity.ContractMaterialPrice;
+import org.springblade.meter.entity.*;
 import org.springblade.meter.mapper.ContractMaterialMapper;
-import org.springblade.meter.service.IContractMaterialAdjustService;
-import org.springblade.meter.service.IContractMaterialPriceService;
-import org.springblade.meter.service.IContractMaterialService;
+import org.springblade.meter.service.*;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.meter.vo.*;
 import org.springframework.stereotype.Service;
@@ -57,6 +53,10 @@ public class ContractMaterialServiceImpl extends BaseServiceImpl<ContractMateria
 
     private final IContractMaterialPriceService priceService;
 
+    private final IContractInventoryFormService formService;
+
+    private final IInventoryFormMaterialService formMaterialService;
+
 
 
     /**
@@ -198,4 +198,47 @@ public class ContractMaterialServiceImpl extends BaseServiceImpl<ContractMateria
         List<ContractMaterialVO4> vo3List = baseMapper.getALLMaterial3(dto);
         return vo3List;
     }
+
+    @Override
+    public GetAdjustFormTreeVO getAdjustFormTree(Long contractId, Long materialId) {
+        return formService.getAdjustFormTree(contractId,materialId);
+    }
+
+    @Override
+    @Transactional
+    public void materialLinkForm(MaterialLinkFormDTO dto) {
+        //校验材料是否存在
+        ContractMaterial m = this.getById(dto.getMaterialId());
+        if (m == null){
+            throw new ServiceException("获取材料信息错误");
+        }
+        //先删除当前材料绑定的节点
+        formMaterialService.remove(new LambdaQueryWrapper<InventoryFormMaterial>()
+                .eq(InventoryFormMaterial::getContractId,dto.getContractId())
+                .eq(InventoryFormMaterial::getContractMaterialId,dto.getMaterialId()));
+        //再保存当前选择的节点
+        List<InventoryFormMaterial> addList = new ArrayList<>();
+        List<MaterialLinkFormDTO.form> forms = dto.getForms();
+        for (MaterialLinkFormDTO.form form : forms) {
+            InventoryFormMaterial material = new InventoryFormMaterial();
+            material.setProjectId(dto.getProjectId());
+            material.setContractId(dto.getContractId());
+            material.setContractMaterialId(dto.getMaterialId());
+            material.setContractFormId(form.getId());
+            material.setAdjustFactor(form.getAdjustFactor());
+            addList.add(material);
+        }
+        formMaterialService.saveBatch(addList);
+    }
+
+    @Override
+    public List<GetLinkAllFormVO> getLinkAllForm(Long contractId, Long materialId) {
+        List<GetLinkAllFormVO> vos = baseMapper.getLinkAllForm(contractId,materialId);
+        return vos;
+    }
+
+    @Override
+    public void removeLinkForm(Long id) {
+        formMaterialService.removeById(id);
+    }
 }

+ 8 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ContractMaterialValidityServiceImpl.java

@@ -34,10 +34,12 @@ import org.springblade.meter.service.IContractMaterialValidityService;
 import org.springblade.meter.utils.ForestNodeMerger;
 import org.springblade.meter.vo.ContractMaterialVO3;
 import org.springblade.meter.vo.ContractMaterialValidityVO;
+import org.springblade.meter.vo.GetMaterialCurrentPriceVO;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDate;
+import java.time.YearMonth;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
@@ -125,6 +127,12 @@ public class ContractMaterialValidityServiceImpl extends BaseServiceImpl<Contrac
         return vo3s;
     }
 
+    @Override
+    public List<GetMaterialCurrentPriceVO> getMaterialCurrentPrice(Long contractId, Long materialId, YearMonth yearMonth) {
+        List<GetMaterialCurrentPriceVO> vos = baseMapper.getMaterialCurrentPrice(contractId,materialId,yearMonth);
+        return vos;
+    }
+
     @NotNull
     private static List<ContractMaterialPrice> getContractMaterialPrices(ContractMaterialValidityDTO dto, ContractMaterialValidity validity) {
         List<ContractMaterialValidityDTO.Material> list = dto.getMaterials();