Selaa lähdekoodia

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

huangtf 7 kuukautta sitten
vanhempi
commit
775801dfc1
24 muutettua tiedostoa jossa 770 lisäystä ja 49 poistoa
  1. 57 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/dto/ContractMaterialValidityDTO.java
  2. 22 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/dto/MaterialListDTO.java
  3. 3 1
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/InterimPayCertificate.java
  4. 61 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/InventoryFormMaterial.java
  5. 1 9
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/ContractMaterialVO.java
  6. 51 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/ContractMaterialVO3.java
  7. 47 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/ContractMaterialVO4.java
  8. 56 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/ContractMaterialValidityVO.java
  9. 1 1
      blade-service/blade-meter/src/main/java/org/springblade/meter/controller/ContractInventoryFormController.java
  10. 39 25
      blade-service/blade-meter/src/main/java/org/springblade/meter/controller/ContractMaterialController.java
  11. 80 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/controller/ContractMaterialValidityController.java
  12. 50 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/controller/InventoryFormMaterialController.java
  13. 9 4
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialMapper.java
  14. 14 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialMapper.xml
  15. 11 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialValidityMapper.java
  16. 20 2
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialValidityMapper.xml
  17. 36 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/InventoryFormMaterialMapper.java
  18. 7 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/InventoryFormMaterialMapper.xml
  19. 6 3
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/IContractMaterialService.java
  20. 9 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/IContractMaterialValidityService.java
  21. 33 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/IInventoryFormMaterialService.java
  22. 14 4
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ContractMaterialServiceImpl.java
  23. 103 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ContractMaterialValidityServiceImpl.java
  24. 40 0
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/InventoryFormMaterialServiceImpl.java

+ 57 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/dto/ContractMaterialValidityDTO.java

@@ -0,0 +1,57 @@
+package org.springblade.meter.dto;
+
+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 javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Param   新增材料价格有效期
+ * @Author wangwl
+ * @Date 2024/4/19 15:07
+ **/
+@Data
+public class ContractMaterialValidityDTO {
+
+    @ApiModelProperty(value = "项目id")
+    @NotNull(message = "未获取到项目id!")
+    private Long projectId;
+
+    @ApiModelProperty(value = "合同段id")
+    @NotNull(message = "未获取到合同段id!")
+    private Long contractId;
+
+    @ApiModelProperty(value = "开始日期")
+    @NotNull(message = "请填写开始日期!")
+    private LocalDate startDate;
+
+    @ApiModelProperty(value = "结束日期")
+    @NotNull(message = "请填写结束日期!")
+    private LocalDate endDate;
+
+    @ApiModelProperty(value = "材料集合")
+    @NotNull(message = "没有材料数据!")
+    @Valid
+    private List<Material> materials;
+
+    @Data
+    public static class Material{
+        @ApiModelProperty(value = "材料id")
+        @NotNull(message = "材料没有id!")
+        private Long id;
+
+        @ApiModelProperty(value = "单价")
+        @NotNull(message = "请填写完所有单价!")
+        private BigDecimal price;
+    }
+
+}

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

@@ -0,0 +1,22 @@
+package org.springblade.meter.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Param   材料不分页列表搜索-调差系数使用
+ * @Author wangwl
+ * @Date 2024/4/22 15:15
+ **/
+public class MaterialListDTO {
+
+    @ApiModelProperty(value = "合同段id")
+    @NotNull(message = "未获取到合同段id!")
+    private Long contractId;
+    @ApiModelProperty(value = "材料编号")
+    private String materialNumber;
+
+    @ApiModelProperty(value = "材料名称")
+    private String materialName;
+}

+ 3 - 1
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/InterimPayCertificate.java

@@ -44,7 +44,9 @@ import org.springblade.core.tool.utils.Func;
 @Data
 @TableName("s_interim_pay_certificate")
 @EqualsAndHashCode(callSuper = true)
-public class InterimPayCertificate extends BaseEntity {
+public class
+
+InterimPayCertificate extends BaseEntity {
 
     private static final long serialVersionUID = 1L;
 

+ 61 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/InventoryFormMaterial.java

@@ -0,0 +1,61 @@
+/*
+ *      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_inventory_form_material")
+@EqualsAndHashCode(callSuper = true)
+public class InventoryFormMaterial 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 contractFormId;
+
+    @ApiModelProperty(value = "调差系数")
+    private BigDecimal adjustFactor;
+
+}

+ 1 - 9
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/ContractMaterialVO.java

@@ -24,7 +24,7 @@ import lombok.EqualsAndHashCode;
 import java.math.BigDecimal;
 
 /**
- * 合同材料表视图实体类
+ * 合同材料表视图实体类-备用
  *
  * @author BladeX
  * @since 2023-11-29
@@ -34,14 +34,6 @@ import java.math.BigDecimal;
 public class ContractMaterialVO extends ContractMaterial {
 	private static final long serialVersionUID = 1L;
 
-	@ApiModelProperty(value = "项目id")
-	private Long projectId;
-
-	@ApiModelProperty(value = "合同段id")
-	private Long contractId;
-
-	@ApiModelProperty(value = "材料编号")
-	private String materialNumber;
 
 
 }

+ 51 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/ContractMaterialVO3.java

@@ -0,0 +1,51 @@
+/*
+ *      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.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.meter.entity.ContractMaterial;
+
+import java.math.BigDecimal;
+
+/**
+ * 材料实时价格-材料列表不分页
+ *
+ * @author BladeX
+ * @since 2023-11-29
+ */
+@Data
+public class ContractMaterialVO3 {
+	private static final long serialVersionUID = 1L;
+
+	@ApiModelProperty(value = "材料id")
+	private Long id;
+
+	@ApiModelProperty(value = "材料编号")
+	private String materialNumber;
+
+	@ApiModelProperty(value = "材料名称")
+	private String materialName;
+
+	@ApiModelProperty(value = "单位")
+	private String unit;
+
+	@ApiModelProperty(value = "单价")
+	private BigDecimal price;
+
+}

+ 47 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/ContractMaterialVO4.java

@@ -0,0 +1,47 @@
+/*
+ *      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.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 材料实时价格-材料列表不分页
+ *
+ * @author BladeX
+ * @since 2023-11-29
+ */
+@Data
+public class ContractMaterialVO4 {
+	private static final long serialVersionUID = 1L;
+
+	@ApiModelProperty(value = "材料id")
+	private Long id;
+
+	@ApiModelProperty(value = "材料编号")
+	private String materialNumber;
+
+	@ApiModelProperty(value = "材料名称")
+	private String materialName;
+
+	@ApiModelProperty(value = "单位")
+	private String unit;
+
+
+}

+ 56 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/ContractMaterialValidityVO.java

@@ -0,0 +1,56 @@
+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;
+
+/**
+ * @Param   返回材料价格有效期树
+ * @Author wangwl
+ * @Date 2024/4/19 15:07
+ **/
+@Data
+public class ContractMaterialValidityVO implements INode<ContractMaterialValidityVO> {
+
+    /**
+     * 主键ID
+     */
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long id;
+
+    /**
+     * 父节点ID
+     */
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long parentId;
+
+    /**
+     * 子孙节点
+     */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private List<ContractMaterialValidityVO> children;
+
+    /**
+     * 是否有子孙节点
+     */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private Boolean hasChildren;
+
+    @Override
+    public List<ContractMaterialValidityVO> getChildren() {
+        if (this.children == null) {
+            this.children = new ArrayList<>();
+        }
+        return this.children;
+    }
+
+    @ApiModelProperty(value = "节点名称")
+    private String nodeName;
+
+}

+ 1 - 1
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/ContractInventoryFormController.java

@@ -188,7 +188,7 @@ public class ContractInventoryFormController extends BladeController {
 	 * 分解获取合同段清单列表
 	 */
 	@GetMapping("getContrInFormAllByConId")
-	@ApiOperationSupport(order = 8)
+	@ApiOperationSupport(order = 9)
 	@ApiOperation(value = "获取合同工程清单表", notes = "返回获取合同工程清单表列表")
 	@ApiImplicitParams(value = {
 			@ApiImplicitParam(name = "contractId", value = "合同id", required = true),

+ 39 - 25
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/ContractMaterialController.java

@@ -25,9 +25,8 @@ 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.vo.ContractMaterialTreeVO;
-import org.springblade.meter.vo.ContractMaterialVO2;
-import org.springblade.meter.vo.SyncMaterialVO;
+import org.springblade.meter.dto.MaterialListDTO;
+import org.springblade.meter.vo.*;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RequestParam;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -80,8 +79,30 @@ public class ContractMaterialController extends BladeController {
 		return R.data(pages);
 	}
 
-	@GetMapping("/getSyncData")
+	
+	/**
+	 * 删除 合同材料表
+	 */
+	@PostMapping("/remove")
 	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		contractMaterialService.delete(ids);
+		return R.success("删除成功");
+	}
+
+	/**
+	 * 材料树 合同材料表
+	 */
+	@GetMapping("/materialTree")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "材料树", notes = "传入合同id")
+	public R<List<ContractMaterialTreeVO>> materialTree(Long contractId) {
+		return R.data(contractMaterialService.materialTree(contractId));
+	}
+
+	@GetMapping("/get-sync-data")
+	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "获取同步数据", notes = "传入项目id合同段id和材料编号")
 	@ApiImplicitParams(value = {
 			@ApiImplicitParam(name = "projectId", value = "项目id", required = true),
@@ -93,8 +114,8 @@ public class ContractMaterialController extends BladeController {
 		return R.data(list);
 	}
 
-	@GetMapping("/syncMaterial")
-	@ApiOperationSupport(order = 4)
+	@GetMapping("/sync-material")
+	@ApiOperationSupport(order = 6)
 	@ApiOperation(value = "同步材料", notes = "传入材料id,和选中行id")
 	@ApiImplicitParams(value = {
 			@ApiImplicitParam(name = "id", value = "材料id", required = true),
@@ -105,27 +126,20 @@ public class ContractMaterialController extends BladeController {
 		return R.success("同步成功");
 	}
 
-	
-	/**
-	 * 删除 合同材料表
-	 */
-	@PostMapping("/remove")
-	@ApiOperationSupport(order = 9)
-	@ApiOperation(value = "删除", notes = "传入ids")
-	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
-		contractMaterialService.delete(ids);
-		return R.success("删除成功");
+	@GetMapping("/get-all-material")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "实时价格-获取材料列表不分页", notes = "传入合同id")
+	public R<List<ContractMaterialVO3>> getAllMaterial(Long contractId) {
+		List<ContractMaterialVO3> list = contractMaterialService.getAllMaterial(contractId);
+		return R.data(list);
 	}
 
-	/**
-	 * 材料树 合同材料表
-	 */
-	@GetMapping("/materialTree")
-	@ApiOperationSupport(order = 10)
-	@ApiOperation(value = "材料树", notes = "传入合同id")
-	public R<List<ContractMaterialTreeVO>> materialTree(Long contractId) {
-		return R.data(contractMaterialService.materialTree(contractId));
+	@PostMapping("/get-all-material2")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "材料调差-获取材料列表不分页", notes = "传入合同id,搜索条件")
+	public R<List<ContractMaterialVO4>> getAllMaterial2(@RequestBody MaterialListDTO dto) {
+		List<ContractMaterialVO4> list = contractMaterialService.getAllMaterial2(dto);
+		return R.data(list);
 	}
-
 	
 }

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

@@ -0,0 +1,80 @@
+/*
+ *      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.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.core.tool.utils.Func;
+import org.springblade.meter.dto.ContractMaterialValidityDTO;
+import org.springblade.meter.entity.AttachmentForm;
+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.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ *
+ * @author BladeX
+ * @since 2023-11-29
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/materialValidity")
+@Api(value = "材料价格有效期", tags = "材料价格有效期接口")
+public class ContractMaterialValidityController extends BladeController {
+
+	private final IContractMaterialValidityService validityService;
+
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "有效期列表", notes = "传入项目id,合同id")
+	public R<List<ContractMaterialValidityVO>> list(Long projectId,Long contractId) {
+		List<ContractMaterialValidityVO> list = validityService.list2(projectId,contractId);
+		return R.data(list);
+	}
+
+	@PostMapping("/add")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "新增", notes = "传入attachmentForm")
+	public R add(@Valid @RequestBody ContractMaterialValidityDTO dto) {
+		validityService.add(dto);
+		return R.success("新增成功");
+	}
+
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "详情", notes = "传入价格有效期id")
+	public R<List<ContractMaterialVO3>> detail(Long id) {
+		List<ContractMaterialVO3> list = validityService.detail(id);
+		return R.data(list);
+	}
+
+
+	
+}

+ 50 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/InventoryFormMaterialController.java

@@ -0,0 +1,50 @@
+/*
+ *      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.controller;
+
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+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.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ *
+ * @author BladeX
+ * @since 2023-11-29
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/inventoryFormMaterial")
+@Api(value = "材料调差", tags = "材料调差接口")
+public class InventoryFormMaterialController extends BladeController {
+
+	private final IInventoryFormMaterialService formMaterialService;
+
+
+	
+}

+ 9 - 4
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialMapper.java

@@ -18,12 +18,10 @@ package org.springblade.meter.mapper;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Param;
+import org.springblade.meter.dto.MaterialListDTO;
 import org.springblade.meter.entity.ContractMaterial;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.springblade.meter.vo.ContractMaterialTreeVO;
-import org.springblade.meter.vo.ContractMaterialVO;
-import org.springblade.meter.vo.ContractMaterialVO2;
-import org.springblade.meter.vo.SyncMaterialVO;
+import org.springblade.meter.vo.*;
 
 import java.util.List;
 
@@ -36,9 +34,16 @@ import java.util.List;
 public interface ContractMaterialMapper extends BaseMapper<ContractMaterial> {
 
 
+    //全加载树,查询全部材料带合并名称
     List<ContractMaterialVO> getALLMaterial(@Param("contractId") Long contractId);
 
     IPage<ContractMaterialVO2> page2(IPage<ContractMaterialVO2> iPage,@Param("material") ContractMaterial material);
 
     List<SyncMaterialVO> getSyncData(@Param("material") ContractMaterial material);
+
+    //实时价格,查询全部材料
+    List<ContractMaterialVO3> getALLMaterial2(@Param("contractId") Long contractId);
+
+    //调差系数,条件查询所有材料
+    List<ContractMaterialVO4> getALLMaterial3(@Param("dto") MaterialListDTO dto);
 }

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

@@ -40,6 +40,20 @@
           and contract_id != #{material.contractId}
           and scm.material_number = #{material.materialNumber}
     </select>
+    <select id="getALLMaterial2" resultType="org.springblade.meter.vo.ContractMaterialVO3">
+        select id,material_number,material_name,unit
+        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}
+        <if test="dto.materialNumber != null and dto.materialNumber != ''">
+            and u.material_number like concat('%',#{dto.materialNumber},'%')
+        </if>
+        <if test="dto.materialName != null and dto.materialName != ''">
+            and u.material_name like concat('%',#{dto.materialName},'%')
+        </if>
+    </select>
 
 
 </mapper>

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

@@ -20,7 +20,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 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 java.time.LocalDate;
+import java.util.List;
 import java.util.Set;
 
 /**
@@ -32,4 +36,11 @@ import java.util.Set;
 public interface ContractMaterialValidityMapper extends BaseMapper<ContractMaterialValidity> {
 
 
+    //获取所有节点
+    List<ContractMaterialValidityVO> allNode(@Param("contractId") Long contractId);
+
+    //获取最新的结束日期
+    LocalDate getNewestEndDate(@Param("contractId") Long contractId);
+
+    List<ContractMaterialVO3> detail(@Param("id") Long id);
 }

+ 20 - 2
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialValidityMapper.xml

@@ -3,6 +3,24 @@
 <mapper namespace="org.springblade.meter.mapper.ContractMaterialValidityMapper">
 
 
-
-
+    <select id="allNode" resultType="org.springblade.meter.vo.ContractMaterialValidityVO">
+        select id,parent_id,node_name,
+               if((select count(1) from s_contract_material_validity cmv2 where  cmv2.contract_id = #{contractId}
+                         and is_deleted = 0 and cmv2.parent_id = cmv.id) = 0,'false','true') as hasChildren
+        from s_contract_material_validity cmv
+        where is_deleted = 0 and contract_id = #{contractId}
+        order by end_date desc
+    </select>
+    <select id="getNewestEndDate" resultType="java.time.LocalDate">
+        select end_date
+        from s_contract_material_validity
+        where is_deleted = 0 and contract_id = #{contractId}
+        order by end_date desc
+        limit 1
+    </select>
+    <select id="detail" resultType="org.springblade.meter.vo.ContractMaterialVO3">
+        select scmp.id,scm.material_number,scm.material_name,scm.unit,scmp.current_price as price
+        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>
 </mapper>

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

@@ -0,0 +1,36 @@
+/*
+ *      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.InventoryFormMaterial;
+
+import java.util.Set;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2023-11-29
+ */
+public interface InventoryFormMaterialMapper extends BaseMapper<InventoryFormMaterial> {
+
+
+
+}

+ 7 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/InventoryFormMaterialMapper.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.InventoryFormMaterialMapper">
+
+
+
+</mapper>

+ 6 - 3
blade-service/blade-meter/src/main/java/org/springblade/meter/service/IContractMaterialService.java

@@ -18,11 +18,10 @@ package org.springblade.meter.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.core.mp.support.Query;
+import org.springblade.meter.dto.MaterialListDTO;
 import org.springblade.meter.entity.ContractMaterial;
 import org.springblade.core.mp.base.BaseService;
-import org.springblade.meter.vo.ContractMaterialTreeVO;
-import org.springblade.meter.vo.ContractMaterialVO2;
-import org.springblade.meter.vo.SyncMaterialVO;
+import org.springblade.meter.vo.*;
 
 import java.util.List;
 
@@ -46,4 +45,8 @@ public interface IContractMaterialService extends BaseService<ContractMaterial>
     List<SyncMaterialVO> getSyncData(ContractMaterial material);
 
     void delete(String ids);
+
+    List<ContractMaterialVO3> getAllMaterial(Long contractId);
+
+    List<ContractMaterialVO4> getAllMaterial2(MaterialListDTO dto);
 }

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

@@ -17,9 +17,13 @@
 package org.springblade.meter.service;
 
 import org.springblade.core.mp.base.BaseService;
+import org.springblade.meter.dto.ContractMaterialValidityDTO;
 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 java.util.List;
 import java.util.Set;
 
 /**
@@ -31,4 +35,9 @@ import java.util.Set;
 public interface IContractMaterialValidityService extends BaseService<ContractMaterialValidity> {
 
 
+    List<ContractMaterialValidityVO> list2(Long projectId,Long contractId);
+
+    void add(ContractMaterialValidityDTO dto);
+
+    List<ContractMaterialVO3> detail(Long id);
 }

+ 33 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/IInventoryFormMaterialService.java

@@ -0,0 +1,33 @@
+/*
+ *      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.InventoryFormMaterial;
+
+import java.util.Set;
+
+/**
+ * 附件表 服务类
+ *
+ * @author BladeX
+ * @since 2023-11-29
+ */
+public interface IInventoryFormMaterialService extends BaseService<InventoryFormMaterial> {
+
+}

+ 14 - 4
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ContractMaterialServiceImpl.java

@@ -24,6 +24,7 @@ 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.MaterialListDTO;
 import org.springblade.meter.entity.ContractInventoryForm;
 import org.springblade.meter.entity.ContractMaterial;
 import org.springblade.meter.entity.ContractMaterialAdjust;
@@ -33,10 +34,7 @@ import org.springblade.meter.service.IContractMaterialAdjustService;
 import org.springblade.meter.service.IContractMaterialPriceService;
 import org.springblade.meter.service.IContractMaterialService;
 import org.springblade.core.mp.base.BaseServiceImpl;
-import org.springblade.meter.vo.ContractMaterialTreeVO;
-import org.springblade.meter.vo.ContractMaterialVO;
-import org.springblade.meter.vo.ContractMaterialVO2;
-import org.springblade.meter.vo.SyncMaterialVO;
+import org.springblade.meter.vo.*;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -188,4 +186,16 @@ public class ContractMaterialServiceImpl extends BaseServiceImpl<ContractMateria
         //删除材料信息
         this.removeBatchByIds(list);
     }
+
+    @Override
+    public List<ContractMaterialVO3> getAllMaterial(Long contractId) {
+        List<ContractMaterialVO3> vo3List = baseMapper.getALLMaterial2(contractId);
+        return vo3List;
+    }
+
+    @Override
+    public List<ContractMaterialVO4> getAllMaterial2(MaterialListDTO dto) {
+        List<ContractMaterialVO4> vo3List = baseMapper.getALLMaterial3(dto);
+        return vo3List;
+    }
 }

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

@@ -16,15 +16,30 @@
  */
 package org.springblade.meter.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import lombok.AllArgsConstructor;
+import org.jetbrains.annotations.NotNull;
+import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.meter.dto.ContractMaterialValidityDTO;
 import org.springblade.meter.entity.AttachmentForm;
+import org.springblade.meter.entity.ContractMaterialPrice;
 import org.springblade.meter.entity.ContractMaterialValidity;
 import org.springblade.meter.mapper.AttachmentFormMapper;
 import org.springblade.meter.mapper.ContractMaterialValidityMapper;
 import org.springblade.meter.service.IAttachmentFormService;
+import org.springblade.meter.service.IContractMaterialPriceService;
 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.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Set;
 
 /**
@@ -34,7 +49,95 @@ import java.util.Set;
  * @since 2023-11-29
  */
 @Service
+@AllArgsConstructor
 public class ContractMaterialValidityServiceImpl extends BaseServiceImpl<ContractMaterialValidityMapper, ContractMaterialValidity> implements IContractMaterialValidityService {
 
+    private final IContractMaterialPriceService priceService;
 
+
+    @Override
+    public List<ContractMaterialValidityVO> list2(Long projectId,Long contractId) {
+        //获取合同下所有数据
+        List<ContractMaterialValidityVO> list = baseMapper.allNode(contractId);
+        //如果为空则直接创建目录,并且返回
+        if (list.size() == 0){
+            ContractMaterialValidity validity = new ContractMaterialValidity();
+            validity.setId(SnowFlakeUtil.getId());
+            validity.setParentId(0L);
+            validity.setNodeName("材料价格有效期");
+            validity.setProjectId(projectId);
+            validity.setContractId(contractId);
+            this.save(validity);
+            ContractMaterialValidityVO vo = new ContractMaterialValidityVO();
+            vo.setId(validity.getId());
+            vo.setParentId(0L);
+            vo.setNodeName(validity.getNodeName());
+            vo.setHasChildren(false);
+            list.add(vo);
+        }else {
+            //存在数据,直接转换为树
+            list = ForestNodeMerger.merge(list);
+        }
+        return list;
+    }
+
+    @Override
+    @Transactional
+    public void add(ContractMaterialValidityDTO dto) {
+        //判断开始日期是否大于结束日期
+        if (dto.getStartDate().compareTo(dto.getEndDate()) > 0){
+            throw new ServiceException("开始日期不能大于结束日期");
+        }
+        //获取最新的一期结束时间
+        LocalDate end = baseMapper.getNewestEndDate(dto.getContractId());
+        //如果存在,则判断是否开始时间为结束时间后一天
+        if (end != null && end.plusDays(1).compareTo(dto.getStartDate()) != 0){
+            throw new ServiceException("开始日期必须为上一个结束日期后一天");
+        }
+        //获取根节点
+        ContractMaterialValidity rootNode = this.getOne(new LambdaQueryWrapper<ContractMaterialValidity>()
+                .eq(ContractMaterialValidity::getContractId, dto.getContractId())
+                .eq(ContractMaterialValidity::getParentId, 0));
+        if (rootNode == null){
+            throw new ServiceException("请选择节点");
+        }
+        //先生成价格有效期
+        ContractMaterialValidity validity = new ContractMaterialValidity();
+        validity.setId(SnowFlakeUtil.getId());
+        validity.setProjectId(dto.getProjectId());
+        validity.setContractId(dto.getContractId());
+        validity.setParentId(rootNode.getId());
+        validity.setStartDate(dto.getStartDate());
+        validity.setEndDate(dto.getEndDate());
+        validity.setNodeName(dto.getStartDate()+"至"+dto.getEndDate());
+        this.save(validity);
+        //生成实时价格
+        List<ContractMaterialPrice> priceList = getContractMaterialPrices(dto, validity);
+        priceService.saveBatch(priceList);
+    }
+
+    @Override
+    public List<ContractMaterialVO3> detail(Long id) {
+        if (id == null){
+            throw new ServiceException("请选择价格有效期");
+        }
+        List<ContractMaterialVO3> vo3s = baseMapper.detail(id);
+        return vo3s;
+    }
+
+    @NotNull
+    private static List<ContractMaterialPrice> getContractMaterialPrices(ContractMaterialValidityDTO dto, ContractMaterialValidity validity) {
+        List<ContractMaterialValidityDTO.Material> list = dto.getMaterials();
+        List<ContractMaterialPrice> priceList = new ArrayList<>();
+        for (ContractMaterialValidityDTO.Material material : list) {
+            ContractMaterialPrice price = new ContractMaterialPrice();
+            price.setProjectId(dto.getProjectId());
+            price.setContractId(dto.getContractId());
+            price.setContractMaterialId(material.getId());
+            price.setMaterialValidityId(validity.getId());
+            price.setCurrentPrice(material.getPrice());
+            priceList.add(price);
+        }
+        return priceList;
+    }
 }

+ 40 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/InventoryFormMaterialServiceImpl.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.impl;
+
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.meter.entity.AttachmentForm;
+import org.springblade.meter.entity.InventoryFormMaterial;
+import org.springblade.meter.mapper.AttachmentFormMapper;
+import org.springblade.meter.mapper.InventoryFormMaterialMapper;
+import org.springblade.meter.service.IAttachmentFormService;
+import org.springblade.meter.service.IInventoryFormMaterialService;
+import org.springframework.stereotype.Service;
+
+import java.util.Set;
+
+/**
+ * 附件表 服务实现类
+ *
+ * @author BladeX
+ * @since 2023-11-29
+ */
+@Service
+public class InventoryFormMaterialServiceImpl extends BaseServiceImpl<InventoryFormMaterialMapper, InventoryFormMaterial> implements IInventoryFormMaterialService {
+
+
+}