Bladeren bron

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

yangyj 8 maanden geleden
bovenliggende
commit
8af9823bea
24 gewijzigde bestanden met toevoegingen van 734 en 36 verwijderingen
  1. 2 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/TableFile.java
  2. 24 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/dto/LinkMeterTreeAndWbsTreeDTO.java
  3. 5 1
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/MeterContractInfo.java
  4. 15 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/MeterTreeContract.java
  5. 43 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/MeterTreeLinkWbsTree.java
  6. 3 2
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/feign/MeterContractInfoClient.java
  7. 31 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/feign/MeterContractInfoClientFallback.java
  8. 70 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/MeterFullTreeVO.java
  9. 20 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/MeterTreeAndWbsTreeVO.java
  10. 3 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/MeterTreeContractVO.java
  11. 34 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/MeterTreeLinkWbsTreeVO.java
  12. 28 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/NodePartVO.java
  13. 2 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java
  14. 13 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java
  15. 46 20
      blade-service/blade-meter/src/main/java/org/springblade/meter/controller/MeterTreeController.java
  16. 3 1
      blade-service/blade-meter/src/main/java/org/springblade/meter/feign/MeterContractInfoClientImpl.java
  17. 17 4
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/MeterTreeContractMapper.java
  18. 36 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/MeterTreeContractMapper.xml
  19. 37 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/MeterTreeLinkWbsTreeMapper.java
  20. 13 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/MeterTreeLinkWbsTreeMapper.xml
  21. 40 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/IMeterTreeLinkWbsTreeService.java
  22. 12 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/MeterTreeContractService.java
  23. 172 6
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/MeterTreeContractServiceImpl.java
  24. 65 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/MeterTreeLinkWbsTreeServiceImpl.java

+ 2 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/TableFile.java

@@ -91,4 +91,6 @@ public class TableFile implements Serializable {
      */
     private Long trialRecordId;
 
+    private Long contractId;
+
 }

+ 24 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/dto/LinkMeterTreeAndWbsTreeDTO.java

@@ -0,0 +1,24 @@
+package org.springblade.meter.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Param
+ * @Author wangwl
+ * @Date 2024/3/11 14:35
+ **/
+@Data
+public class LinkMeterTreeAndWbsTreeDTO {
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+
+    @ApiModelProperty(value = "合同id")
+    private Long contractId;
+
+    @ApiModelProperty(value = "合同计量单元ids,逗号拼接")
+    private String meterIds;
+
+    @ApiModelProperty(value = "WBS树PkeyId,逗号拼接")
+    private String wbsIds;
+}

+ 5 - 1
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/MeterContractInfo.java

@@ -81,6 +81,10 @@ public class MeterContractInfo extends BaseEntity {
     private String farmersBankAccountNumber;
 
     @ApiModelProperty(value = "农民工工资专户 银行账户名称")
-    private String farmerBankAccountName;
+    private String farmersBankAccountName;
+
+    @ApiModelProperty(value = "中期计量最高支付比例")
+    private BigDecimal middlePayRatio;
 
 }
+

+ 15 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/MeterTreeContract.java

@@ -95,4 +95,19 @@ public class MeterTreeContract extends BaseEntity {
     @ApiModelProperty(value = "最高支付比例")
     private BigDecimal upPayRatio;
 
+    @ApiModelProperty(value = "是否自动计量1是0否")
+    private Integer isAutoMeter;
+
+    @ApiModelProperty(value = "是否混泥土节点1是0否")
+    private Integer isConcreteNode;
+
+    @ApiModelProperty(value = "7天强度")
+    private BigDecimal sevenRatio;
+
+    @ApiModelProperty(value = "28天强度")
+    private BigDecimal twentyEightRatio;
+
+    @ApiModelProperty(value = "计算式")
+    private String calculateFormula;
+
 }

+ 43 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/MeterTreeLinkWbsTree.java

@@ -0,0 +1,43 @@
+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;
+
+/**
+ * @Param
+ * @Author wangwl
+ * @Date 2024/3/11 14:57
+ **/
+@Data
+@TableName("s_meter_tree_link_wbs_tree")
+@EqualsAndHashCode(callSuper = true)
+public class MeterTreeLinkWbsTree extends BaseEntity {
+
+    /**
+     * 项目id
+     */
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+    /**
+     * 合同段id
+     */
+    @ApiModelProperty(value = "合同段id")
+    private Long contractId;
+
+    /**
+     * 合同计量单元id
+     */
+    @ApiModelProperty(value = "合同计量单元id")
+    private Long meterTreeId;
+    /**
+     * 合同WBS树id
+     */
+    @ApiModelProperty(value = "合同WBS树id")
+    private Long wbsTreeId;
+
+    @ApiModelProperty(value = "部位")
+    private String part;
+}

+ 3 - 2
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/feign/MeterContractInfoClient.java

@@ -1,5 +1,6 @@
 package org.springblade.meter.feign;
 
+import org.springblade.core.tool.api.R;
 import org.springblade.meter.entity.MeterContractInfo;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -7,7 +8,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 
 import static org.springblade.core.launch.constant.AppConstant.APPLICATION_NAME_PREFIX;
 
-@FeignClient(value = APPLICATION_NAME_PREFIX + "meter")
+@FeignClient(value = APPLICATION_NAME_PREFIX + "meter",fallbackFactory = MeterContractInfoClientFallback.class)
 public interface MeterContractInfoClient {
 
     /**
@@ -16,6 +17,6 @@ public interface MeterContractInfoClient {
      * @param meterContractInfo
      */
     @PostMapping("/api/meter/contract/saveOrUpdate")
-    void saveOrUpdate(@RequestBody MeterContractInfo meterContractInfo);
+    R saveOrUpdate(@RequestBody MeterContractInfo meterContractInfo);
 
 }

+ 31 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/feign/MeterContractInfoClientFallback.java

@@ -0,0 +1,31 @@
+package org.springblade.meter.feign;
+
+import feign.hystrix.FallbackFactory;
+import org.springblade.core.tool.api.R;
+import org.springblade.meter.entity.MeterContractInfo;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Param
+ * @Author wangwl
+ * @Date 2024/3/8 11:30
+ **/
+@Component
+public class MeterContractInfoClientFallback implements FallbackFactory<MeterContractInfoClient> {
+
+
+    @Override
+    public MeterContractInfoClient create(Throwable cause) {
+        return new MeterContractInfoClient() {
+            @Override
+            public R saveOrUpdate(MeterContractInfo meterContractInfo) {
+                if (cause.getMessage().contains("com.netflix.client.ClientException")){
+                    return R.fail("计量服务未启动");
+                }else {
+                    System.out.println(cause.getLocalizedMessage());
+                    return R.fail("计量服务执行中出现异常");
+                }
+            }
+        };
+    }
+}

+ 70 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/MeterFullTreeVO.java

@@ -0,0 +1,70 @@
+package org.springblade.meter.vo;
+
+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 java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @Param   合同计量单元,全加载树返回
+ * @Author wangwl
+ * @Date 2024/3/8 16:40
+ **/
+@Data
+public class MeterFullTreeVO implements INode<MeterFullTreeVO> {
+    /**
+     * 主键ID
+     */
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long id;
+
+    /**
+     * 父节点ID
+     */
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long parentId;
+
+    /**
+     * 子孙节点
+     */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private List<MeterFullTreeVO> children;
+
+    /**
+     * 是否有子孙节点
+     */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private Boolean hasChildren;
+
+    @Override
+    public List<MeterFullTreeVO> getChildren() {
+        if (this.children == null) {
+            this.children = new ArrayList<>();
+        }
+        return this.children;
+    }
+    @ApiModelProperty(value = "是否存在子节点")
+    private Boolean hasChild;
+    @ApiModelProperty(value = "节点名称")
+    private String nodeName;
+    private Long pKeyId;
+
+//    @Override
+//    public boolean equals(Object o) {
+//        if (this == o) return true;
+//        if (o == null || getClass() != o.getClass()) return false;
+//        MeterFullTreeVO that = (MeterFullTreeVO) o;
+//        return id.equals(that.id);
+//    }
+//
+//    @Override
+//    public int hashCode() {
+//        return Objects.hash(id);
+//    }
+}

+ 20 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/MeterTreeAndWbsTreeVO.java

@@ -0,0 +1,20 @@
+package org.springblade.meter.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Param   返回合同计量单元和质检WBS的全加载树
+ * @Author wangwl
+ * @Date 2024/3/8 16:57
+ **/
+@Data
+public class MeterTreeAndWbsTreeVO {
+    @ApiModelProperty(value = "计量全加载树")
+    private List<MeterFullTreeVO> meterTree;
+
+    @ApiModelProperty(value = "WBS全加载树")
+    private List<MeterFullTreeVO> wbsTree;
+}

+ 3 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/MeterTreeContractVO.java

@@ -15,6 +15,9 @@ public class MeterTreeContractVO extends MeterTreeContract {
     @ApiModelProperty(value = "分解清单列表详情")
     private List<ContractFromVO> decompositionList;
 
+    @ApiModelProperty(value = "关联节点列表详情")
+    private List<MeterTreeLinkWbsTreeVO> linkNodeList;
+
     @ApiModelProperty(value = "桩号类型名称")
     private String stakeTypeName;
 

+ 34 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/MeterTreeLinkWbsTreeVO.java

@@ -0,0 +1,34 @@
+package org.springblade.meter.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Param
+ * @Author wangwl
+ * @Date 2024/3/11 15:48
+ **/
+@Data
+public class MeterTreeLinkWbsTreeVO {
+
+    @ApiModelProperty(value = "id")
+    private Long id;
+
+    @ApiModelProperty(value = "合同计量单元id")
+    private Long meterTreeId;
+
+    @ApiModelProperty(value = "wbs树pKeyId")
+    private Long wbsTreeId;
+
+    @ApiModelProperty(value = "部位")
+    private String part;
+
+    @ApiModelProperty(value = "审核状态")
+    private Integer appStatus;
+
+    @ApiModelProperty(value = "审核状态名称")
+    private String appStatusName;
+
+    @ApiModelProperty(value = "wbs树pkeyId,字符串拼接")
+    private String wbsTreeIds;
+}

+ 28 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/NodePartVO.java

@@ -0,0 +1,28 @@
+package org.springblade.meter.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Param   wbs树节点,生成分项子分项部位
+ * @Author wangwl
+ * @Date 2024/3/11 17:07
+ **/
+@Data
+public class NodePartVO {
+
+    @ApiModelProperty(value = "pKeyId")
+    private Long pKeyId;
+
+    @ApiModelProperty(value = "id")
+    private Long id;
+
+    @ApiModelProperty(value = "父id")
+    private Long parentId;
+
+    @ApiModelProperty(value = "节点名称")
+    private String nodeName;
+
+    @ApiModelProperty(value = "节点类型")
+    private Integer nodeType;
+}

+ 2 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -3921,7 +3921,7 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "nodeId", value = "nodeId", required = true),
 
     })
-    public R addBussFile(@RequestParam("file") MultipartFile[] file, String nodeId,Integer type) {
+    public R addBussFile(@RequestParam("file") MultipartFile[] file, String nodeId,Integer type,Long contractId) {
         List<TableFile> fileList = new ArrayList<>();
         if (file != null && file.length >= 1) {
             for (MultipartFile multipartFile : file) {
@@ -3932,6 +3932,7 @@ public class ExcelTabController extends BladeController {
 
                 String fileExtension = FileUtil.getFileExtension(bladeFile1.getName()).toLowerCase();
                 tableFile.setTabId(nodeId + "");
+                tableFile.setContractId(contractId);
                 tableFile.setName(multipartFile.getOriginalFilename());
                 tableFile.setType(type); //10 代表附件
                 tableFile.setDomainUrl(bladeFile1.getLink());

+ 13 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -38,8 +38,10 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -785,6 +787,7 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
     }
 
     @Override
+    @Transactional
     public boolean saveAndUpdateContract(ContractInfoVO contractInfo) {
         if (contractInfo.getId() == null) {
             List<ContractInfo> contractInfos = baseMapper.selectList(Wrappers.<ContractInfo>query().lambda()
@@ -894,7 +897,16 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
             if (ObjectUtil.isNotEmpty(contractInfo.getMeterContractInfo())) {
                 MeterContractInfo meterContractInfo = contractInfo.getMeterContractInfo();
                 meterContractInfo.setContractId(contractInfo.getId());
-                meterContractInfoClient.saveOrUpdate(meterContractInfo);
+                //校验比例是否在范围之内
+                if (meterContractInfo.getMiddlePayRatio() != null){
+                    if (meterContractInfo.getMiddlePayRatio().compareTo(BigDecimal.ZERO) < 0 || meterContractInfo.getMiddlePayRatio().compareTo(new BigDecimal("100")) > 0) {
+                        throw new ServiceException("请检查整体结算比例是否在规定范围");
+                    }
+                }
+                R r = meterContractInfoClient.saveOrUpdate(meterContractInfo);
+                if (r.getCode() != 200){
+                    throw new ServiceException("保存合同计量相关信息失败,原因:"+r.getMsg());
+                }
             }
             //}
 

+ 46 - 20
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/MeterTreeController.java

@@ -1,7 +1,6 @@
 package org.springblade.meter.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
@@ -21,6 +20,7 @@ import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.entity.ProjectInfo;
+import org.springblade.meter.dto.LinkMeterTreeAndWbsTreeDTO;
 import org.springblade.meter.dto.MeterTreeContractDTO;
 import org.springblade.meter.dto.MeterTreeContractSaveBatchDTO;
 import org.springblade.meter.entity.*;
@@ -32,12 +32,10 @@ import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.datasource.DataSourceTransactionManager;
 import org.springframework.transaction.TransactionDefinition;
 import org.springframework.transaction.TransactionStatus;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.support.DefaultTransactionDefinition;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -56,6 +54,7 @@ public class MeterTreeController extends BladeController {
     private final IContractInventoryFormService contractInventoryFormService;
     private final IInventoryFormMeterService inventoryFormMeterService;
     private final DataSourceTransactionManager transactionManager;
+    private final IMeterTreeLinkWbsTreeService meterTreeLinkWbsTreeService;
 
     @GetMapping("/template/detail")
     @ApiOperationSupport(order = 1)
@@ -621,23 +620,7 @@ public class MeterTreeController extends BladeController {
     @ApiOperationSupport(order = 24)
     @ApiOperation(value = "合同段树节点修改", notes = "传入MeterTreeContractDTO")
     public R<Object> contractUpdate(@RequestBody MeterTreeContractDTO dto) {
-        //先校验节点编号是否唯一
-        if (StringUtils.isNotBlank(dto.getNodeCode())){
-            long count = meterTreeContractService.count(new LambdaUpdateWrapper<MeterTreeContract>()
-                    .eq(MeterTreeContract::getNodeCode, dto.getNodeCode())
-                    .eq(MeterTreeContract::getContractId,dto.getContractId())
-                    .ne(MeterTreeContract::getId, dto.getId()));
-            if (count > 0){
-                throw new ServiceException("修改失败,当前工程编号已经存在");
-            }
-        }
         if (ObjectUtil.isNotEmpty(dto.getDecompositionList()) && dto.getDecompositionList().size() > 0) {
-            //校验比例是否在范围之内
-            if (dto.getUpPayRatio() == null){
-                dto.setUpPayRatio(new BigDecimal(80));
-            }else if (dto.getUpPayRatio().compareTo(BigDecimal.ZERO) < 0 || dto.getUpPayRatio().compareTo(new BigDecimal("100")) > 0){
-                throw new ServiceException("修改失败,请检查支付比例是否在规定范围");
-            }
             /*最底层节点修改*/
             dto.setUpdateStatus(1); //编辑
             //控制层手动管理事务,判断未引用清单比例是否超过合同计量单元
@@ -646,7 +629,8 @@ public class MeterTreeController extends BladeController {
             boolean b1 = false;
             boolean b2 = false;
             try {
-                b1 = meterTreeContractService.updateById(dto);
+//                b1 = meterTreeContractService.updateById(dto);
+                b1 = meterTreeContractService.contractUpdate(dto);
                 b2 = inventoryFormMeterService.updateInfo(dto.getDecompositionList(), dto.getId(),dto.getUpPayRatio());
                 transactionManager.commit(status);
             }catch (Exception e){
@@ -717,8 +701,12 @@ public class MeterTreeController extends BladeController {
                     .eq(MeterTreeContract::getContractId, basicInfo.getContractId())
                     .eq(MeterTreeContract::getParentId, basicInfo.getId()));
             if (count == 0) {
+                //设置清单
                 List<ContractFromVO> contrFormAllByContrId = contractInventoryFormService.getNodeResolveForm(basicInfo.getContractId(), basicInfo.getId());
                 vo.setDecompositionList(contrFormAllByContrId);
+                //设置关联节点信息
+                List<MeterTreeLinkWbsTreeVO> wbsTreeVOS = meterTreeLinkWbsTreeService.getWbsListByMeterId(basicInfo.getContractId(), basicInfo.getId());
+                vo.setLinkNodeList(wbsTreeVOS);
             } else {
                 meterTreeContractService.getAllChildNodeMoney(vo);
             }
@@ -882,4 +870,42 @@ public class MeterTreeController extends BladeController {
         return R.fail("操作失败");
     }
 
+    /**
+     * 获取计量和WBS全加载树
+     * @param projectId
+     * @param contractId
+     * @return
+     */
+    @GetMapping("/contract/meterTreeAndWbsTree")
+    @ApiOperationSupport(order = 34)
+    @ApiOperation(value = "获取计量和WBS全加载树", notes = "传入项目id和合同id,返回两棵全加载树")
+    public R<MeterTreeAndWbsTreeVO> meterTreeAndWbsTree(Long projectId, Long contractId) {
+        MeterTreeAndWbsTreeVO vo = meterTreeContractService.meterTreeAndWbsTree(projectId,contractId);
+        return R.data(vo);
+    }
+
+    /**
+     * 关联计量和WBS全加载树
+     * @return
+     */
+    @PostMapping("/contract/LinkMeterTreeAndWbsTree")
+    @ApiOperationSupport(order = 35)
+    @ApiOperation(value = "关联计量和WBS全加载树", notes = "传入项目id和合同id,计量树id拼接的字符串,wbs树pKeyId拼接的字符串")
+    public R<String> LinkMeterTreeAndWbsTree(@RequestBody LinkMeterTreeAndWbsTreeDTO dto) {
+        String info = meterTreeContractService.LinkMeterTreeAndWbsTree(dto);
+        return R.success("关联成功,"+info);
+    }
+
+    /**
+     * 删除合同计量单元关联WBS节点
+     * @return
+     */
+    @PostMapping("/contract/deleteLinkWbsTree")
+    @ApiOperationSupport(order = 36)
+    @ApiOperation(value = "删除合同计量单元关联WBS节点", notes = "传入wbs节点ids,逗号拼接")
+    public R<String> deleteLinkWbsTree(@RequestBody Map<String, String> params) {
+        meterTreeContractService.deleteLinkWbsTree(params);
+        return R.success("删除成功");
+    }
+
 }

+ 3 - 1
blade-service/blade-meter/src/main/java/org/springblade/meter/feign/MeterContractInfoClientImpl.java

@@ -1,6 +1,7 @@
 package org.springblade.meter.feign;
 
 import lombok.AllArgsConstructor;
+import org.springblade.core.tool.api.R;
 import org.springblade.meter.entity.MeterContractInfo;
 import org.springblade.meter.service.impl.MeterContractInfoServiceImpl;
 import org.springframework.web.bind.annotation.RestController;
@@ -12,8 +13,9 @@ public class MeterContractInfoClientImpl implements MeterContractInfoClient {
     private final MeterContractInfoServiceImpl meterContractInfoServiceImpl;
 
     @Override
-    public void saveOrUpdate(MeterContractInfo meterContractInfo) {
+    public R saveOrUpdate(MeterContractInfo meterContractInfo) {
         meterContractInfoServiceImpl.saveOrUpdate(meterContractInfo);
+        return R.success("成功");
     }
 
 }

+ 17 - 4
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/MeterTreeContractMapper.java

@@ -3,10 +3,11 @@ package org.springblade.meter.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
-import org.springblade.meter.entity.InventoryFormApply;
-import org.springblade.meter.entity.InventoryFormMeter;
-import org.springblade.meter.entity.MeterTreeContract;
-import org.springblade.meter.entity.MiddleMeterApply;
+import org.springblade.meter.dto.MeterTreeContractDTO;
+import org.springblade.meter.entity.*;
+import org.springblade.meter.vo.MeterFullTreeVO;
+import org.springblade.meter.vo.MeterTreeLinkWbsTreeVO;
+import org.springblade.meter.vo.NodePartVO;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -29,4 +30,16 @@ public interface MeterTreeContractMapper extends BaseMapper<MeterTreeContract> {
     void batchUpdateFormByNumber(@Param("contractId") Long contractId,@Param("map") Map<String, BigDecimal> map);
 
     List<InventoryFormApply> getMeterInfo(@Param("meterId") Long aLong, @Param("formId") Long id);
+
+    void updateMiddleMeter(@Param("dto") MeterTreeContractDTO dto);
+
+    List<MeterFullTreeVO> getMeterTree(@Param("projectId") Long projectId,@Param("contractId") Long contractId);
+
+    List<MeterFullTreeVO> getWBSTree(@Param("projectId") Long projectId,@Param("contractId") Long contractId);
+
+    String getContractName(@Param("projectId") Long projectId,@Param("contractId") Long contractId);
+
+    List<MeterTreeLinkWbsTreeVO> getAllLinkByContractId(@Param("contractId") Long contractId, @Param("ids") List<Long> meterIds);
+
+    List<NodePartVO> getAllWbsNode(@Param("projectId") Long projectId,@Param("contractId") Long contractId);
 }

+ 36 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/MeterTreeContractMapper.xml

@@ -21,6 +21,9 @@
             where contract_id = #{contractId} and form_number = #{key}
         </foreach>
     </update>
+    <update id="updateMiddleMeter">
+        update s_middle_meter_apply set calculate_formula = #{dto.calculateFormula} where contract_id = #{dto.contractId} and contract_unit_id = #{dto.id}
+    </update>
 
     <select id="getAllChildNodeMoney" resultType="org.springblade.meter.entity.MeterTreeContract">
         select ifnull(sum(build_picture_money),0) as build_picture_money,
@@ -45,5 +48,38 @@
     <select id="getMeterInfo" resultType="org.springblade.meter.entity.InventoryFormApply">
         select * from s_inventory_form_apply where contract_meter_id = #{meterId} and contract_form_id = #{formId} and is_deleted = 0
     </select>
+    <select id="getMeterTree" resultType="org.springblade.meter.vo.MeterFullTreeVO">
+        select id,node_name as nodeName,parent_id,
+               if((select count(1) from s_meter_tree_contract mtc2 where mtc2.project_id = #{projectId}
+                    and mtc2.contract_id = #{contractId} and is_deleted = 0 and mtc2.parent_id = mtc1.id) = 0,'false','true') as hasChild
+        from s_meter_tree_contract mtc1 where project_id = #{projectId} and contract_id = #{contractId} and is_deleted = 0
+    </select>
+    <select id="getWBSTree" resultType="org.springblade.meter.vo.MeterFullTreeVO">
+        select p_key_id,id,node_name as nodeName,parent_id,
+               if((select count(1) from m_wbs_tree_contract mtc2 where mtc2.project_id = #{projectId}
+                   and mtc2.contract_id = #{contractId} and mtc2.type = 1  and is_deleted = 0 and mtc2.parent_id = mtc1.id) = 0,'false','true') as hasChild
+        from m_wbs_tree_contract mtc1 where project_id = #{projectId} and contract_id = #{contractId} and mtc1.type = 1 and node_type != 111 and is_deleted = 0
+        group by id
+        order by sort asc
+    </select>
+    <select id="getContractName" resultType="java.lang.String">
+        select contract_name from m_contract_info where id = #{contractId}
+    </select>
+    <select id="getAllLinkByContractId" resultType="org.springblade.meter.vo.MeterTreeLinkWbsTreeVO">
+        select meter_tree_id,GROUP_CONCAT(wbs_tree_id) as wbsTreeIds
+        from s_meter_tree_link_wbs_tree smtlwt1
+        where contract_id = #{contractId}  and is_deleted = 0
+        and meter_tree_id in
+        <foreach item="id" collection="ids" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+        group by meter_tree_id
+    </select>
+    <select id="getAllWbsNode" resultType="org.springblade.meter.vo.NodePartVO">
+        select p_key_id,id,parent_id,node_type,node_name
+        from m_wbs_tree_contract where project_id = #{projectId} and contract_id = #{contractId} and type = 1 and is_deleted = 0
+        group by id
+    </select>
+
 
 </mapper>

+ 37 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/MeterTreeLinkWbsTreeMapper.java

@@ -0,0 +1,37 @@
+/*
+ *      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 com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.meter.entity.*;
+import org.springblade.meter.vo.*;
+
+import java.util.List;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2023-11-29
+ */
+public interface MeterTreeLinkWbsTreeMapper extends BaseMapper<MeterTreeLinkWbsTree> {
+
+
+    List<MeterTreeLinkWbsTreeVO> getWbsListByMeterId(@Param("contractId") Long contractId,@Param("meterId") Long id);
+}

+ 13 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/MeterTreeLinkWbsTreeMapper.xml

@@ -0,0 +1,13 @@
+<?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.MeterTreeLinkWbsTreeMapper">
+
+
+    <select id="getWbsListByMeterId" resultType="org.springblade.meter.vo.MeterTreeLinkWbsTreeVO">
+        select id,part,wbs_tree_id as wbsTreeId,
+            ( select MAX(status) from u_information_query uiq
+               WHERE uiq.wbs_id = lwt.wbs_tree_id and uiq.is_deleted = 0 and uiq.status != 3) as appStatus
+        from s_meter_tree_link_wbs_tree lwt
+        where contract_id = #{contractId} and meter_tree_id = #{meterId} and is_deleted = 0
+    </select>
+</mapper>

+ 40 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/IMeterTreeLinkWbsTreeService.java

@@ -0,0 +1,40 @@
+/*
+ *      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 com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.core.mp.support.Query;
+import org.springblade.meter.dto.MeterPeriodDTO;
+import org.springblade.meter.entity.MeterPeriod;
+import org.springblade.meter.entity.MeterTreeLinkWbsTree;
+import org.springblade.meter.vo.MeterPeriodVO;
+import org.springblade.meter.vo.MeterTreeLinkWbsTreeVO;
+
+import java.util.List;
+
+/**
+ * 材料开工计量期表 服务类
+ *
+ * @author BladeX
+ * @since 2023-11-29
+ */
+public interface IMeterTreeLinkWbsTreeService extends BaseService<MeterTreeLinkWbsTree> {
+
+    //通过合同计量id获取其关联的质检节点信息
+    List<MeterTreeLinkWbsTreeVO> getWbsListByMeterId(Long contractId, Long id);
+}

+ 12 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/MeterTreeContractService.java

@@ -2,14 +2,18 @@ package org.springblade.meter.service;
 
 import org.springblade.core.mp.base.BaseService;
 import org.springblade.core.tool.api.R;
+import org.springblade.meter.dto.LinkMeterTreeAndWbsTreeDTO;
+import org.springblade.meter.dto.MeterTreeContractDTO;
 import org.springblade.meter.dto.MeterTreeContractSaveBatchDTO;
 import org.springblade.meter.entity.MeterTreeContract;
 import org.springblade.meter.entity.MeterTreeProject;
 import org.springblade.meter.vo.ChangeNodeVO;
 import org.springblade.meter.vo.MeterTreeContractVO;
+import org.springblade.meter.vo.MeterTreeAndWbsTreeVO;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
+import java.util.Map;
 
 public interface MeterTreeContractService extends BaseService<MeterTreeContract> {
 
@@ -32,4 +36,12 @@ public interface MeterTreeContractService extends BaseService<MeterTreeContract>
     R<String> contractTreeNodeImport2(String id, MultipartFile file);
     //只导入一层
     R<String> contractTreeNodeImport1(String id, MultipartFile file);
+
+    boolean contractUpdate(MeterTreeContractDTO dto);
+
+    MeterTreeAndWbsTreeVO meterTreeAndWbsTree(Long projectId, Long contractId);
+
+    String LinkMeterTreeAndWbsTree(LinkMeterTreeAndWbsTreeDTO dto);
+
+    void deleteLinkWbsTree(Map<String, String> ids);
 }

+ 172 - 6
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/MeterTreeContractServiceImpl.java

@@ -1,6 +1,7 @@
 package org.springblade.meter.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
@@ -14,7 +15,10 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.meter.dto.LinkMeterTreeAndWbsTreeDTO;
+import org.springblade.meter.dto.MeterTreeContractDTO;
 import org.springblade.meter.dto.MeterTreeContractSaveBatchDTO;
 import org.springblade.meter.dto.MeterTreeContractSaveDTO;
 import org.springblade.meter.entity.*;
@@ -22,15 +26,13 @@ import org.springblade.meter.mapper.ContractInventoryFormMapper;
 import org.springblade.meter.mapper.InventoryFormMeterMapper;
 import org.springblade.meter.mapper.MeterTreeContractMapper;
 import org.springblade.meter.mapper.MeterTreeProjectMapper;
+import org.springblade.meter.service.IMeterTreeLinkWbsTreeService;
 import org.springblade.meter.service.MeterTreeContractService;
-import org.springblade.meter.vo.ChangeNodeVO;
-import org.springblade.meter.vo.ContractFromVO;
-import org.springblade.meter.vo.InventoryFormMeterVO;
-import org.springblade.meter.vo.MeterTreeContractVO;
+import org.springblade.meter.utils.ForestNodeMerger;
+import org.springblade.meter.vo.*;
 import org.springblade.system.entity.Dict;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
@@ -41,7 +43,6 @@ import java.math.BigDecimal;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 @Service
 @AllArgsConstructor
@@ -51,6 +52,7 @@ public class MeterTreeContractServiceImpl extends BaseServiceImpl<MeterTreeContr
     private final MeterTreeProjectMapper meterTreeProjectMapper;
     private final InventoryFormMeterMapper inventoryFormMeterMapper;
     private final ContractInventoryFormMapper contractInventoryFormMapper;
+    private final IMeterTreeLinkWbsTreeService meterTreeLinkWbsTreeService;
 
     @Override
     public Integer selectMaxSort(Long parentId) {
@@ -1780,6 +1782,170 @@ public class MeterTreeContractServiceImpl extends BaseServiceImpl<MeterTreeContr
         return R.success("成功导入:节点("+addNode+")个,"+"新增清单("+addForm+")条,"+"修改清单("+updateForm+")条.");
     }
 
+    @Override
+    @Transactional
+    public boolean contractUpdate(MeterTreeContractDTO dto) {
+        //先校验节点编号是否唯一
+        if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(dto.getNodeCode())){
+            long count = this.count(new LambdaUpdateWrapper<MeterTreeContract>()
+                    .eq(MeterTreeContract::getNodeCode, dto.getNodeCode())
+                    .eq(MeterTreeContract::getContractId,dto.getContractId())
+                    .ne(MeterTreeContract::getId, dto.getId()));
+            if (count > 0){
+                throw new ServiceException("修改失败,当前工程编号已经存在");
+            }
+        }
+        //校验如果为混泥土节点
+        if (dto.getIsConcreteNode() == 1){
+            if ( (dto.getSevenRatio() == null || dto.getTwentyEightRatio() == null)) {
+                throw new ServiceException("修改失败,混泥土节点必须填写强度比例");
+            }
+            if ((dto.getSevenRatio().compareTo(BigDecimal.ZERO) < 0 || dto.getSevenRatio().compareTo(new BigDecimal("100")) > 0)
+                    || (dto.getTwentyEightRatio().compareTo(BigDecimal.ZERO) < 0 || dto.getTwentyEightRatio().compareTo(new BigDecimal("100")) > 0)){
+                throw new ServiceException("修改失败,强度比例必须在0-100范围内");
+            }
+        }
+        //校验比例是否在范围之内
+        if (dto.getUpPayRatio() == null){
+            dto.setUpPayRatio(new BigDecimal(80));
+        }else if (dto.getUpPayRatio().compareTo(BigDecimal.ZERO) < 0 || dto.getUpPayRatio().compareTo(new BigDecimal("100")) > 0){
+            throw new ServiceException("修改失败,请检查支付比例是否在规定范围");
+        }
+        //如果计算式有值,就同步去修改所有中间计量申请的
+        if (StringUtils.isNotBlank(dto.getCalculateFormula())){
+            baseMapper.updateMiddleMeter(dto);
+        }
+        boolean b = this.updateById(dto);
+        return b;
+    }
+
+    /**
+     * 获取计量和WBS全加载树
+     * @return
+     */
+    @Override
+    public MeterTreeAndWbsTreeVO meterTreeAndWbsTree(Long projectId, Long contractId) {
+        MeterTreeAndWbsTreeVO vo = new MeterTreeAndWbsTreeVO();
+        //获取合同计量全加载树
+        List<MeterFullTreeVO> vos = baseMapper.getMeterTree(projectId,contractId);
+        List<MeterFullTreeVO> list = ForestNodeMerger.merge(vos);
+        vo.setMeterTree(list);
+        //获取WBS全加载树
+        List<MeterFullTreeVO> vos2 = baseMapper.getWBSTree(projectId,contractId);
+//        List<MeterFullTreeVO> treeVOS = vos2.stream().collect(Collectors.toList());
+//        //因为结构设计错误,id有重复,需要去重id,会丢失少许节点。如果后期需要完整节点,则先排除重复,再生成树,再把重复接在树上,再生成树。
+//        List<MeterFullTreeVO> treeVOS = vos2.stream().collect(Collectors.toMap(MeterFullTreeVO::getId, l -> l, (st1, st2) -> st1))
+//                .values().stream().collect(Collectors.toList());
+//        //去除没有找到父信息的
+//        treeVOS = treeVOS.stream().filter(l->l.getHasFather() || l.getParentId() == 0).collect(Collectors.toList());
+        List<MeterFullTreeVO> list2 = ForestNodeMerger.merge(vos2);
+        List<MeterFullTreeVO> list3 = new ArrayList<>();
+        //查询合同名称
+        String name = baseMapper.getContractName(projectId,contractId);
+        //会出现很多首节点,筛选出实际的
+        for (MeterFullTreeVO treeVO : list2) {
+            if (treeVO.getParentId() == 0){
+               treeVO.setNodeName(name);
+                list3.add(treeVO);
+                break;
+            }
+        }
+        if (list3.size() == 0){
+            throw new ServiceException("未找到WBS树首节点");
+        }
+        vo.setWbsTree(list3);
+        return vo;
+    }
+
+    /**
+     * 关联计量和WBS全加载树
+     * @return
+     */
+    @Override
+    public String LinkMeterTreeAndWbsTree(LinkMeterTreeAndWbsTreeDTO dto) {
+        //校验数据
+        if (StringUtils.isBlank(dto.getMeterIds()) || StringUtils.isBlank(dto.getWbsIds())){
+            throw new ServiceException("请选择节点");
+        };
+        List<MeterTreeLinkWbsTree> list = new ArrayList<>();
+        //转换为id集合
+        List<Long> meterIds = Func.toLongList(dto.getMeterIds());
+        List<Long> wbsIds = Func.toLongList(dto.getWbsIds());
+        //根据合同段查询出WBS树所有树节点,用于生成分项部位
+        List<NodePartVO> wbsNodes = baseMapper.getAllWbsNode(dto.getProjectId(),dto.getContractId());
+        //转换为map,key为Id
+        Map<Long, NodePartVO> voMap = wbsNodes.stream().collect(Collectors.toMap(l -> l.getId(), l -> l));
+        //转换为map,key为pKeyId
+        Map<Long, NodePartVO> voMap2 = wbsNodes.stream().collect(Collectors.toMap(l -> l.getPKeyId(), l -> l));
+        Map<Long,String> partMaps = new HashMap<>();
+        //循环节点,为每个节点设置部位信息
+        for (Long wbsId : wbsIds) {
+            //获取原节点信息
+            NodePartVO vo = voMap2.get(wbsId);
+            StringBuilder str = new StringBuilder(vo.getNodeName()+",");
+            //循环获取,直到<= 4为止,4为分项
+            while (vo.getNodeType() > 4){
+                //获取父级节点信息
+                NodePartVO partVO = voMap.get(vo.getParentId());
+                if (partVO == null){
+                    break;
+                }
+                str.append(partVO.getNodeName()+",");
+                vo = partVO;
+            }
+            str.deleteCharAt(str.length()-1); // 删除最后一个分隔符
+            // 拆分字符串
+            String[] parts = str.toString().split(",");
+            // 排序字符串数组
+            List<String> list2 = Arrays.asList(parts);
+            Collections.reverse(list2);
+            // 重新拼接字符串
+            StringBuilder sb = new StringBuilder();
+            for (String s : list2) {
+                sb.append(s+"/");
+            }
+            if (sb.length() > 0) {
+                sb.deleteCharAt(sb.length()-1); // 添加最后一个元素但不加分隔符
+            }
+            //设置进map
+            partMaps.put(wbsId,sb.toString());
+
+        }
+        //查询出当前合同段当前选择的合同计量单元所有关联信息
+        List<MeterTreeLinkWbsTreeVO> linkList = baseMapper.getAllLinkByContractId(dto.getContractId(),meterIds);
+        Boolean isLinkInfo = true;
+        Map<Long, String> map = new HashMap<>();
+        if (linkList.size() > 0){
+            isLinkInfo = false;
+            map = linkList.stream().collect(Collectors.toMap(l -> l.getMeterTreeId(), l -> l.getWbsTreeIds()));
+        }
+        //循环
+        for (Long meterId : meterIds) {
+            for (Long wbsId : wbsIds) {
+                //如果不存在,则新增
+                if (isLinkInfo || StringUtils.isBlank(map.get(meterId)) || !map.get(meterId).contains(wbsId+"")){
+                    MeterTreeLinkWbsTree tree = new MeterTreeLinkWbsTree();
+                    tree.setProjectId(dto.getProjectId());
+                    tree.setContractId(dto.getContractId());
+                    tree.setMeterTreeId(meterId);
+                    tree.setWbsTreeId(wbsId);
+                    tree.setPart(partMaps.get(wbsId));
+                    list.add(tree);
+                }
+            }
+        }
+        meterTreeLinkWbsTreeService.saveBatch(list);
+        return "一共关联"+list.size()+"条数据";
+    }
+
+    @Override
+    public void deleteLinkWbsTree(Map<String, String> map) {
+        if (StringUtils.isBlank(map.get("ids"))){
+            throw new ServiceException("请选择数据后再提交");
+        }
+        meterTreeLinkWbsTreeService.removeBatchByIds(Func.toLongList(map.get("ids")));
+    }
+
     /**
      *  通过清单信息和合同计量单元节点,施工图数量,返回组装好的中间表对象
      */

+ 65 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/MeterTreeLinkWbsTreeServiceImpl.java

@@ -0,0 +1,65 @@
+/*
+ *      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.apache.commons.lang.StringUtils;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.meter.entity.InventoryFormApply;
+import org.springblade.meter.entity.MeterTreeLinkWbsTree;
+import org.springblade.meter.mapper.InventoryFormApplyMapper;
+import org.springblade.meter.mapper.MeterTreeLinkWbsTreeMapper;
+import org.springblade.meter.service.IInventoryFormApplyService;
+import org.springblade.meter.service.IMeterTreeLinkWbsTreeService;
+import org.springblade.meter.vo.ChangeFormVO2;
+import org.springblade.meter.vo.InventoryFormApplyVO;
+import org.springblade.meter.vo.MeterTreeLinkWbsTreeVO;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 工程清单与中间计量申请	中间表 服务实现类
+ *
+ * @author BladeX
+ * @since 2023-11-29
+ */
+@Service
+public class MeterTreeLinkWbsTreeServiceImpl extends BaseServiceImpl<MeterTreeLinkWbsTreeMapper, MeterTreeLinkWbsTree> implements IMeterTreeLinkWbsTreeService {
+
+
+    @Override
+    public List<MeterTreeLinkWbsTreeVO> getWbsListByMeterId(Long contractId, Long id) {
+        List<MeterTreeLinkWbsTreeVO> list = baseMapper.getWbsListByMeterId(contractId, id);
+        for (MeterTreeLinkWbsTreeVO vo : list) {
+            if (vo.getAppStatus() == null){
+                vo.setAppStatusName("未填报");
+            }else if (vo.getAppStatus() == 0){
+                vo.setAppStatusName("已填报-未上报");
+            }else if (vo.getAppStatus() == 1){
+                vo.setAppStatusName("已填报-待审批");
+            }else if (vo.getAppStatus() == 2){
+                vo.setAppStatusName("已审批");
+            }
+        }
+        return list;
+    }
+}