合同管理相关
This commit is contained in:
@@ -15,4 +15,5 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode CONTRACT_NUM_TRANSFINITE = new ErrorCode(1_027_000_000, "系统合同编号超限,最大合同编号:999999");
|
||||
ErrorCode CONTRACT_NAME_EXISTS = new ErrorCode(1_027_000_001, "合同名已存在");
|
||||
ErrorCode CONTRACT_PAPER_NUMBER_EXISTS = new ErrorCode(1_027_000_002, "合同编号已存在");
|
||||
ErrorCode CONTRACT_NOT_EXISTS = new ErrorCode(1_027_000_003, "合同不存在");
|
||||
}
|
||||
|
||||
@@ -4,12 +4,14 @@ import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton.ContractPageReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton.ContractRespVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton.ContractSaveReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractPageReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractRespVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractSaveReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractViewRespVO;
|
||||
import com.zt.plat.module.contractorder.dal.dataobject.contract.ContractMainDO;
|
||||
import com.zt.plat.module.contractorder.service.contract.ContractService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -32,17 +34,92 @@ public class ContractController implements BusinessControllerMarker {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得合同分页列表")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract-main:query')")
|
||||
public CommonResult<PageResult<ContractRespVO>> getContractPage(@Valid ContractPageReqVO pageReqVO) {
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:query')")
|
||||
public CommonResult<PageResult<ContractRespVO>> getPage(@Valid ContractPageReqVO pageReqVO) {
|
||||
PageResult<ContractMainDO> pageResult = contractService.getContractPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ContractRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "新增合同")
|
||||
@PreAuthorize("@ss.hasPermission('system:contract-main:create')")
|
||||
public CommonResult<Long> createContract(@Valid @RequestBody ContractSaveReqVO reqVO) {
|
||||
@PreAuthorize("@ss.hasPermission('system:contract:create')")
|
||||
public CommonResult<Long> create(@Valid @RequestBody ContractSaveReqVO reqVO) {
|
||||
Long id = contractService.createContract(reqVO);
|
||||
return success(id);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得合同详情")
|
||||
@Parameter(name = "id", description = "合同ID", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:contract:get')")
|
||||
public CommonResult<ContractViewRespVO> get(@RequestParam("id") Long id) {
|
||||
ContractViewRespVO contractViewRespVO = contractService.get(id);
|
||||
return success(contractViewRespVO);
|
||||
}
|
||||
|
||||
// TODO
|
||||
@PutMapping("update")
|
||||
@Operation(summary = "修改合同")
|
||||
@PreAuthorize("@ss.hasPermission('system:contract:update')")
|
||||
public CommonResult<Boolean> update(@Valid @RequestBody ContractSaveReqVO reqVO) {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
// TODO
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除合同")
|
||||
@Parameter(name = "ids", description = "合同ID集合", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:contract:delete')")
|
||||
public CommonResult<Boolean> delete(@RequestParam("ids") Long[] ids) {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
// TODO
|
||||
@PostMapping("/download")
|
||||
@Operation(summary = "下载文件")
|
||||
@PreAuthorize("@ss.hasPermission('system:contract:download')")
|
||||
public void download() {
|
||||
}
|
||||
|
||||
// TODO
|
||||
@PostMapping("/preview")
|
||||
@Operation(summary = "预览文件")
|
||||
@PreAuthorize("@ss.hasPermission('system:contract:preview')")
|
||||
public void preview() {
|
||||
}
|
||||
|
||||
// TODO
|
||||
@PostMapping("/complete")
|
||||
@Operation(summary = "完结")
|
||||
@PreAuthorize("@ss.hasPermission('system:contract:complete')")
|
||||
public void complete() {
|
||||
}
|
||||
|
||||
// TODO
|
||||
@PostMapping("/archive")
|
||||
@Operation(summary = "归档")
|
||||
@PreAuthorize("@ss.hasPermission('system:contract:archive')")
|
||||
public void archive() {
|
||||
}
|
||||
|
||||
// TODO
|
||||
@PostMapping("/submit/approval")
|
||||
@Operation(summary = "提交审批")
|
||||
@PreAuthorize("@ss.hasPermission('system:contract:approval')")
|
||||
public void submitApproval() {
|
||||
}
|
||||
|
||||
// TODO
|
||||
@PostMapping("/view/approval")
|
||||
@Operation(summary = "查看审批")
|
||||
@PreAuthorize("@ss.hasPermission('system:contract:approval')")
|
||||
public void viewApproval() {
|
||||
}
|
||||
|
||||
// TODO
|
||||
@PostMapping("/submit/ERP")
|
||||
@Operation(summary = "提交ERP")
|
||||
@PreAuthorize("@ss.hasPermission('system:contract:erp')")
|
||||
public void submitERP() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton;
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton;
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton;
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton;
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
@@ -33,7 +33,7 @@ public class ContractFormulaSaveReqVO {
|
||||
private String materialNumber;
|
||||
|
||||
@Schema(description = "计算小数位")
|
||||
private Long decimal;
|
||||
private Long decimalBit;
|
||||
|
||||
@Schema(description = "金属元素编码")
|
||||
private String elementNumber;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton;
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton;
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton;
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton;
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton;
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -49,5 +49,5 @@ public class ContractPriceSaveReqVO {
|
||||
private String averageType;
|
||||
|
||||
@Schema(description = "网价小数位")
|
||||
private BigDecimal decimal;
|
||||
private BigDecimal decimalBit;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton;
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton;
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.zt.plat.module.base.controller.admin.templtp.vo.TemplateInstanceDataSaveReqVO;
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 基础系数配置 Response VO")
|
||||
@Data
|
||||
public class ContractViewCoefficientRespVO {
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "31657")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "配置主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "6534")
|
||||
private Long parameterId;
|
||||
|
||||
@Schema(description = "条款主键", example = "29652")
|
||||
private Long formulaId;
|
||||
|
||||
@Schema(description = "金属元素编码")
|
||||
private String elementNumber;
|
||||
|
||||
@Schema(description = "金属元素缩写")
|
||||
private String elementAbbreviation;
|
||||
|
||||
@Schema(description = "金属元素名称", example = "芋艿")
|
||||
private String elementName;
|
||||
|
||||
@Schema(description = "系数值")
|
||||
private String settlementCoefficient;
|
||||
|
||||
@Schema(description = "系数上限")
|
||||
private BigDecimal coefficientUp;
|
||||
|
||||
@Schema(description = "系数下限")
|
||||
private BigDecimal coefficientDown;
|
||||
|
||||
@Schema(description = "是否包含上限")
|
||||
private String isInUp;
|
||||
|
||||
@Schema(description = "是否包含下限")
|
||||
private String isInDown;
|
||||
|
||||
@Schema(description = "是否省内", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "是否省内不能为空")
|
||||
private String inState;
|
||||
|
||||
@Schema(description = "类型", example = "1")
|
||||
private String type;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 调整价配置 Response VO")
|
||||
@Data
|
||||
public class ContractViewDeductRespVO {
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25312")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "配置主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "21114")
|
||||
@NotNull(message = "配置主键不能为空")
|
||||
private Long parameterId;
|
||||
|
||||
@Schema(description = "条款主键", example = "29909")
|
||||
private Long formulaId;
|
||||
|
||||
@Schema(description = "物料编码;推送ERP")
|
||||
private String materialNumber;
|
||||
|
||||
@Schema(description = "物料名称", example = "张三")
|
||||
private String materialName;
|
||||
|
||||
@Schema(description = "上限", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "上限不能为空")
|
||||
private BigDecimal gradeUp;
|
||||
|
||||
@Schema(description = "下限")
|
||||
private BigDecimal gradeDown;
|
||||
|
||||
@Schema(description = "是否包含上限")
|
||||
private String isInUp;
|
||||
|
||||
@Schema(description = "是否包含下限")
|
||||
private String isInDown;
|
||||
|
||||
@Schema(description = "方式")
|
||||
private String way;
|
||||
|
||||
@Schema(description = "类型", example = "1")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "是否省内", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "是否省内不能为空")
|
||||
private String inState;
|
||||
|
||||
@Schema(description = "调整价")
|
||||
private BigDecimal gradeAmount;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 合同明细 Response VO")
|
||||
@Data
|
||||
public class ContractViewDetailRespVO {
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "物料名称", example = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
@Schema(description = "物料编码", example = "物料编码")
|
||||
private String materialNumber;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private BigDecimal quantity;
|
||||
|
||||
@Schema(description = "计量单位", example = "吨")
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "含税单价", example = "28579")
|
||||
private BigDecimal inTaxUnitPrice;
|
||||
|
||||
@Schema(description = "金属元素缩写", example = "金属元素缩写")
|
||||
private String elementAbbreviation;
|
||||
|
||||
@Schema(description = "金属元素名称", example = "金属元素名称")
|
||||
private String elementName;
|
||||
|
||||
@Schema(description = "金属元素编码", example = "金属元素编码")
|
||||
private String elementNumber;
|
||||
|
||||
// 交货计划
|
||||
private List<ContractViewPlanRespVO> plans;
|
||||
|
||||
// 价款结算条款
|
||||
private List<ContractViewFormulaRespVO> formulas;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 价款结算条款 Response VO")
|
||||
@Data
|
||||
public class ContractViewFormulaRespVO {
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "28539")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "合同明细主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "8181")
|
||||
private Long contractDetailId;
|
||||
|
||||
@Schema(description = "公式类型;单价/总价/水扣款/加工费", example = "UNIT_PRICE")
|
||||
private String formulaType;
|
||||
|
||||
@Schema(description = "公式")
|
||||
private String formulaCalculate;
|
||||
|
||||
@Schema(description = "编码公式")
|
||||
private String numberFormula;
|
||||
|
||||
@Schema(description = "物料名称", example = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
@Schema(description = "物料编码")
|
||||
private String materialNumber;
|
||||
|
||||
@Schema(description = "计算小数位")
|
||||
private Long decimalBit;
|
||||
|
||||
@Schema(description = "金属元素编码")
|
||||
private String elementNumber;
|
||||
|
||||
@Schema(description = "金属元素缩写")
|
||||
private String elementAbbreviation;
|
||||
|
||||
@Schema(description = "金属元素名称", example = "金属元素名称")
|
||||
private String elementName;
|
||||
|
||||
// 基础系数配置
|
||||
private List<ContractViewCoefficientRespVO> coefficients;
|
||||
// 品位等级价配置
|
||||
private List<ContractViewGradeRespVO> grades;
|
||||
// 调整价配置
|
||||
private List<ContractViewDeductRespVO> deducts;
|
||||
// 市场价配置
|
||||
private List<ContractViewPriceRespVO> prices;
|
||||
// 品位不计价配置
|
||||
private List<ContractViewNotRespVO> nots;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 品位等级价配置 Response VO")
|
||||
@Data
|
||||
public class ContractViewGradeRespVO {
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "15414")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "配置主键", example = "16734")
|
||||
private Long parameterId;
|
||||
|
||||
@Schema(description = "条款主键", example = "15344")
|
||||
private Long formulaId;
|
||||
|
||||
@Schema(description = "金属元素编码")
|
||||
private String elementNumber;
|
||||
|
||||
@Schema(description = "金属元素缩写")
|
||||
private String elementAbbreviation;
|
||||
|
||||
@Schema(description = "金属元素名称", example = "芋艿")
|
||||
private String elementName;
|
||||
|
||||
@Schema(description = "品位单位")
|
||||
private String gradeUnit;
|
||||
|
||||
@Schema(description = "品位上限")
|
||||
private BigDecimal gradeUp;
|
||||
|
||||
@Schema(description = "品位下限")
|
||||
private BigDecimal gradeDown;
|
||||
|
||||
@Schema(description = "是否包含上限;包含则是大于等于,不包含则是大于")
|
||||
private String isInUp;
|
||||
|
||||
@Schema(description = "是否包含下限;包含则是小于等于,不包含则是小于")
|
||||
private String isInDown;
|
||||
|
||||
@Schema(description = "默认计价品位;计价方式为加时,默认为为下限,计价方式为减时,默认为为上限,可手动填写")
|
||||
private BigDecimal gradeDefault;
|
||||
|
||||
@Schema(description = "系数;计价类型为阶梯价使用,标识没上升多少系数进行加款还是减款")
|
||||
private BigDecimal settlementCoefficient;
|
||||
|
||||
@Schema(description = "不足系数值按比例计算")
|
||||
private String useCoefficient;
|
||||
|
||||
@Schema(description = "计价类型", example = "2")
|
||||
private String priceType;
|
||||
|
||||
@Schema(description = "是否省内", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "是否省内不能为空")
|
||||
private String inState;
|
||||
|
||||
@Schema(description = "等级单价", example = "26237")
|
||||
private BigDecimal unitPrice;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 品位不计价配置 Response VO")
|
||||
@Data
|
||||
public class ContractViewNotRespVO {
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "21132")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "配置主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "3781")
|
||||
@NotNull(message = "配置主键不能为空")
|
||||
private Long parameterId;
|
||||
|
||||
@Schema(description = "条款主键", example = "5722")
|
||||
private Long formulaId;
|
||||
|
||||
@Schema(description = "金属元素编码")
|
||||
private String elementNumber;
|
||||
|
||||
@Schema(description = "金属元素缩写")
|
||||
private String elementAbbreviation;
|
||||
|
||||
@Schema(description = "金属元素名称", example = "张三")
|
||||
private String elementName;
|
||||
|
||||
@Schema(description = "上限", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "上限不能为空")
|
||||
private BigDecimal gradeUp;
|
||||
|
||||
@Schema(description = "下限")
|
||||
private BigDecimal gradeDown;
|
||||
|
||||
@Schema(description = "是否包含上限")
|
||||
private String isInUp;
|
||||
|
||||
@Schema(description = "是否包含下限")
|
||||
private String isInDown;
|
||||
|
||||
@Schema(description = "是否省内", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "是否省内不能为空")
|
||||
private String inState;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 交货计划 Response VO")
|
||||
@Data
|
||||
public class ContractViewPlanRespVO {
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "交货年份", example = "2025")
|
||||
private Long contractDeliveryYear;
|
||||
|
||||
@Schema(description = "交货月份", example = "9")
|
||||
private Long contractPlanDeliveryMonth;
|
||||
|
||||
@Schema(description = "计划交货数量")
|
||||
private BigDecimal contractPlanDeliveryQuantity;
|
||||
|
||||
@Schema(description = "交货开始日期")
|
||||
private String contractDeliveryStartDate;
|
||||
|
||||
@Schema(description = "交货结束日期")
|
||||
private String contractDeliveryEndDate;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 市场价配置新 Response VO")
|
||||
@Data
|
||||
public class ContractViewPriceRespVO {
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "13654")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "配置主键", example = "1590")
|
||||
private Long parameterId;
|
||||
|
||||
@Schema(description = "条款主键", example = "24677")
|
||||
private Long formulaId;
|
||||
|
||||
@Schema(description = "市场价")
|
||||
private BigDecimal value;
|
||||
|
||||
@Schema(description = "计算方式;均价/高位价/地位价")
|
||||
private String calculateWay;
|
||||
|
||||
@Schema(description = "数据来源网价代码;数据字典")
|
||||
private String dataOrigin;
|
||||
|
||||
@Schema(description = "计价开始日期")
|
||||
private LocalDateTime calculateStartDate;
|
||||
|
||||
@Schema(description = "计价截止日期")
|
||||
private LocalDateTime calculateEndDate;
|
||||
|
||||
@Schema(description = "包含开始日期")
|
||||
private String inStartDate;
|
||||
|
||||
@Schema(description = "包含结束日期")
|
||||
private String inEndDate;
|
||||
|
||||
@Schema(description = "价格品种元素的明细分类")
|
||||
private String priceGrade;
|
||||
|
||||
@Schema(description = "品种分类", example = "1")
|
||||
private String gradeType;
|
||||
|
||||
@Schema(description = "取价方式;区间价/固定价", example = "2")
|
||||
private String averageType;
|
||||
|
||||
@Schema(description = "网价小数位")
|
||||
private BigDecimal decimalBit;
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.zt.plat.module.base.controller.admin.templtp.vo.TemplateInstanceDataRespVO;
|
||||
import com.zt.plat.module.base.controller.admin.templtp.vo.TemplateInstanceItemRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 合同详情 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ContractViewRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2090")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模板实例主键", example = "10196")
|
||||
@ExcelProperty("模板实例主键")
|
||||
private Long instanceId;
|
||||
|
||||
@Schema(description = "系统合同编号;自动生成,校验唯一")
|
||||
@ExcelProperty("系统合同编号;自动生成,校验唯一")
|
||||
private String systemContractNumber;
|
||||
|
||||
@Schema(description = "状态", example = "1")
|
||||
@ExcelProperty("状态")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "合同名称;与ERP(HTMC)对应,校验唯一", example = "芋艿")
|
||||
@ExcelProperty("合同名称;与ERP(HTMC)对应,校验唯一")
|
||||
private String contractName;
|
||||
|
||||
@Schema(description = "合同编号;与ERP(HTBH)对应,校验唯一")
|
||||
@ExcelProperty("合同编号;与ERP(HTBH)对应,校验唯一")
|
||||
private String contractPaperNumber;
|
||||
|
||||
@Schema(description = "是否虚拟合同;与ERP(SFXNHT)对应")
|
||||
@ExcelProperty("是否虚拟合同;与ERP(SFXNHT)对应")
|
||||
private String contractVirtual;
|
||||
|
||||
@Schema(description = "是否先款后货")
|
||||
@ExcelProperty("是否先款后货")
|
||||
private String hasPayable;
|
||||
|
||||
@Schema(description = "收支性质;与ERP(SZXZ)对应")
|
||||
@ExcelProperty("收支性质;与ERP(SZXZ)对应")
|
||||
private String direction;
|
||||
|
||||
@Schema(description = "合同类型", example = "1")
|
||||
@ExcelProperty("合同类型")
|
||||
private String contractType;
|
||||
|
||||
@Schema(description = "签署日期;与ERP(HTQDRQ)对应")
|
||||
@ExcelProperty("签署日期;与ERP(HTQDRQ)对应")
|
||||
private LocalDateTime signDate;
|
||||
|
||||
@Schema(description = "开始日期;与ERP(HTQSRQ)对应")
|
||||
@ExcelProperty("开始日期;与ERP(HTQSRQ)对应")
|
||||
private LocalDateTime startDate;
|
||||
|
||||
@Schema(description = "结束日期;与ERP(HTZZRQ)对应")
|
||||
@ExcelProperty("结束日期;与ERP(HTZZRQ)对应")
|
||||
private LocalDateTime endDate;
|
||||
|
||||
@Schema(description = "签署地")
|
||||
@ExcelProperty("签署地")
|
||||
private String signPlace;
|
||||
|
||||
@Schema(description = "甲方公司编号;如果是采购合同,查询组织机构自动带出,且与ERP(HTQDZTBH)对应,如果是销售合同,手动选择,且与ERP(WLDWBH)对应。")
|
||||
@ExcelProperty("甲方公司编号;如果是采购合同,查询组织机构自动带出,且与ERP(HTQDZTBH)对应,如果是销售合同,手动选择,且与ERP(WLDWBH)对应。")
|
||||
private String purchaseCompanyNumber;
|
||||
|
||||
@Schema(description = "甲方公司名称", example = "王五")
|
||||
@ExcelProperty("甲方公司名称")
|
||||
private String purchaseCompanyName;
|
||||
|
||||
@Schema(description = "甲方地址")
|
||||
@ExcelProperty("甲方地址")
|
||||
private String purchaseAddress;
|
||||
|
||||
@Schema(description = "甲方法定代表人")
|
||||
@ExcelProperty("甲方法定代表人")
|
||||
private String purchaseLeader;
|
||||
|
||||
@Schema(description = "乙方公司编号;如果是销售合同,查询组织机构自动带出,且与ERP(HTQDZTBH)对应,如果是采购合同,手动选择,且与ERP(WLDWBH)对应。")
|
||||
@ExcelProperty("乙方公司编号;如果是销售合同,查询组织机构自动带出,且与ERP(HTQDZTBH)对应,如果是采购合同,手动选择,且与ERP(WLDWBH)对应。")
|
||||
private String salesCompanyNumber;
|
||||
|
||||
@Schema(description = "乙方公司名称", example = "王五")
|
||||
@ExcelProperty("乙方公司名称")
|
||||
private String salesCompanyName;
|
||||
|
||||
@Schema(description = "乙方地址")
|
||||
@ExcelProperty("乙方地址")
|
||||
private String salesAddress;
|
||||
|
||||
@Schema(description = "乙方企业负责人")
|
||||
@ExcelProperty("乙方企业负责人")
|
||||
private String salesPurchaseLeader;
|
||||
|
||||
@Schema(description = "币种;与ERP(BZBH)对应")
|
||||
@ExcelProperty("币种;与ERP(BZBH)对应")
|
||||
private String currency;
|
||||
|
||||
@Schema(description = "原币金额;与ERP(HTYBZJE)对应,币种不是人民币时,显示并手动填写,如果是人民币,隐藏且等于本币金额")
|
||||
@ExcelProperty("原币金额;与ERP(HTYBZJE)对应,币种不是人民币时,显示并手动填写,如果是人民币,隐藏且等于本币金额")
|
||||
private BigDecimal cooAmount;
|
||||
|
||||
@Schema(description = "本币金额;与ERP(HTBWBZJE)对应")
|
||||
@ExcelProperty("本币金额;与ERP(HTBWBZJE)对应")
|
||||
private BigDecimal basicAmount;
|
||||
|
||||
@Schema(description = "是否有履约保证金;为是,则保证金必填。")
|
||||
@ExcelProperty("是否有履约保证金;为是,则保证金必填。")
|
||||
private String hasDeposit;
|
||||
|
||||
@Schema(description = "原币履约保证金;与ERP(LYBZJBGQYB)对应,币种不是人民币时,显示并手动填写,如果是人民币,隐藏且等于本币金额")
|
||||
@ExcelProperty("原币履约保证金;与ERP(LYBZJBGQYB)对应,币种不是人民币时,显示并手动填写,如果是人民币,隐藏且等于本币金额")
|
||||
private BigDecimal cooAmountDeposit;
|
||||
|
||||
@Schema(description = "本币履约保证金;与ERP(LYBZJBGQBWB)对应")
|
||||
@ExcelProperty("本币履约保证金;与ERP(LYBZJBGQBWB)对应")
|
||||
private BigDecimal basicAmountDeposit;
|
||||
|
||||
@Schema(description = "是否有预付款;与ERP(SFYYFK)对应")
|
||||
@ExcelProperty("是否有预付款;与ERP(SFYYFK)对应")
|
||||
private String hasPrepayment;
|
||||
|
||||
@Schema(description = "预付款比例;与ERP(YFKBL)对应")
|
||||
@ExcelProperty("预付款比例;与ERP(YFKBL)对应")
|
||||
private BigDecimal prepaymentRatio;
|
||||
|
||||
@Schema(description = "预付款金额;与ERP(YFKJE)对应")
|
||||
@ExcelProperty("预付款金额;与ERP(YFKJE)对应")
|
||||
private BigDecimal prepaymentAmount;
|
||||
|
||||
@Schema(description = "是否有质保金;与ERP(SFHZBJ)对应")
|
||||
@ExcelProperty("是否有质保金;与ERP(SFHZBJ)对应")
|
||||
private String hasQualityAmount;
|
||||
|
||||
@Schema(description = "质保金比例;与ERP(ZBJBL)对应")
|
||||
@ExcelProperty("质保金比例;与ERP(ZBJBL)对应")
|
||||
private BigDecimal qualityRatio;
|
||||
|
||||
@Schema(description = "质保金金额;与ERP(BZJJE)对应")
|
||||
@ExcelProperty("质保金金额;与ERP(BZJJE)对应")
|
||||
private BigDecimal qualityAmount;
|
||||
|
||||
@Schema(description = "补充协议类型;变更协议/增加条款", example = "1")
|
||||
@ExcelProperty("补充协议类型;变更协议/增加条款")
|
||||
private String replenishAgreementType;
|
||||
|
||||
@Schema(description = "备注;与ERP(BZXX)对应")
|
||||
@ExcelProperty("备注;与ERP(BZXX)对应")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "施工类型编号;与ERP(HTLXBH)对应,拓展信息")
|
||||
@ExcelProperty("施工类型编号;与ERP(HTLXBH)对应,拓展信息")
|
||||
private String constructionTypeNumber;
|
||||
|
||||
@Schema(description = "施工类型名称;与ERP(HTLXMC)对应,拓展信息", example = "张三")
|
||||
@ExcelProperty("施工类型名称;与ERP(HTLXMC)对应,拓展信息")
|
||||
private String constructionTypeName;
|
||||
|
||||
@Schema(description = "代理方;与ERP(ZLIFNR)对应,拓展信息")
|
||||
@ExcelProperty("代理方;与ERP(ZLIFNR)对应,拓展信息")
|
||||
private String agent;
|
||||
|
||||
@Schema(description = "类别;与ERP(HTLB)对应,拓展信息")
|
||||
@ExcelProperty("类别;与ERP(HTLB)对应,拓展信息")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "原币金额-变更后;与ERP(BGHHTYBZJE)对应,拓展信息")
|
||||
@ExcelProperty("原币金额-变更后;与ERP(BGHHTYBZJE)对应,拓展信息")
|
||||
private BigDecimal changeCooAmount;
|
||||
|
||||
@Schema(description = "本币金额-变更后;与ERP(BGHHTBWBZJE)对应,拓展信息")
|
||||
@ExcelProperty("本币金额-变更后;与ERP(BGHHTBWBZJE)对应,拓展信息")
|
||||
private BigDecimal changeBasicAmount;
|
||||
|
||||
@Schema(description = "原币履约保证金-变更后;与ERP(LYBZJBGHYB)对应,拓展信息")
|
||||
@ExcelProperty("原币履约保证金-变更后;与ERP(LYBZJBGHYB)对应,拓展信息")
|
||||
private BigDecimal changeCooAmountDeposit;
|
||||
|
||||
@Schema(description = "本币履约保证金-变更后;与ERP(LYBZJBGHBWB)对应,拓展信息")
|
||||
@ExcelProperty("本币履约保证金-变更后;与ERP(LYBZJBGHBWB)对应,拓展信息")
|
||||
private BigDecimal changeBasicAmountDeposit;
|
||||
|
||||
@Schema(description = "是否框架合同;与ERP(SFKJHT)对应,拓展信息")
|
||||
@ExcelProperty("是否框架合同;与ERP(SFKJHT)对应,拓展信息")
|
||||
private String isFramework;
|
||||
|
||||
@Schema(description = "境内/境外;与ERP(JNJW)对应,拓展信息")
|
||||
@ExcelProperty("境内/境外;与ERP(JNJW)对应,拓展信息")
|
||||
private String isDomestic;
|
||||
|
||||
@Schema(description = "建筑服务发生地;与ERP(JZFWFSD)对应,拓展信息,销售合同,且类型为SAP02COSR必填")
|
||||
@ExcelProperty("建筑服务发生地;与ERP(JZFWFSD)对应,拓展信息,销售合同,且类型为SAP02COSR必填")
|
||||
private String architectureServicePlace;
|
||||
|
||||
@Schema(description = "达到收款条件金额;与ERP(DDSKJE)对应,拓展信息,销售合同,且类型为SAP02COSR必填")
|
||||
@ExcelProperty("达到收款条件金额;与ERP(DDSKJE)对应,拓展信息,销售合同,且类型为SAP02COSR必填")
|
||||
private BigDecimal payeeConditionAmount;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "步骤")
|
||||
@ExcelProperty("步骤")
|
||||
private Integer step;
|
||||
|
||||
// 物料信息
|
||||
private List<ContractViewDetailRespVO> detail;
|
||||
|
||||
// 合同动态表单
|
||||
private List<TemplateInstanceDataRespVO> dynamicsFields;
|
||||
|
||||
// 合同动态条款
|
||||
private List<TemplateInstanceItemRespVO> dynamicsItems;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class ContractFormulaDO extends BusinessBaseDO {
|
||||
* 计算小数位
|
||||
*/
|
||||
@TableField("DEC")
|
||||
private Long decimal;
|
||||
private Long decimalBit;
|
||||
/**
|
||||
* 金属元素编码
|
||||
*/
|
||||
|
||||
@@ -94,5 +94,5 @@ public class ContractPriceDO extends BusinessBaseDO {
|
||||
* 网价小数位
|
||||
*/
|
||||
@TableField("DEC")
|
||||
private BigDecimal decimal;
|
||||
private BigDecimal decimalBit;
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package com.zt.plat.module.contractorder.dal.mysql.contract;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton.ContractPageReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractPageReqVO;
|
||||
import com.zt.plat.module.contractorder.dal.dataobject.contract.ContractMainDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.zt.plat.module.contractorder.service.contract;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton.ContractPageReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton.ContractSaveReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractPageReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractSaveReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractViewRespVO;
|
||||
import com.zt.plat.module.contractorder.dal.dataobject.contract.ContractMainDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
@@ -28,4 +29,12 @@ public interface ContractService {
|
||||
* @return 合同ID
|
||||
*/
|
||||
Long createContract(@Valid ContractSaveReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获得合同详情
|
||||
*
|
||||
* @param id 合同ID
|
||||
* @return 合同信息
|
||||
*/
|
||||
ContractViewRespVO get(Long id);
|
||||
}
|
||||
|
||||
@@ -4,10 +4,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.framework.tenant.core.context.CompanyContextHolder;
|
||||
import com.zt.plat.module.base.controller.admin.templtp.vo.TemplateInstanceDataRespVO;
|
||||
import com.zt.plat.module.base.controller.admin.templtp.vo.TemplateInstanceItemRespVO;
|
||||
import com.zt.plat.module.base.dal.dataobject.tmpltp.TemplateInstanceDataDO;
|
||||
import com.zt.plat.module.base.dal.dataobject.tmpltp.TemplateInstanceItemDO;
|
||||
import com.zt.plat.module.base.dal.mysql.tmpltp.TemplateInstanceDataMapper;
|
||||
import com.zt.plat.module.base.dal.mysql.tmpltp.TemplateInstanceItemMapper;
|
||||
import com.zt.plat.module.base.service.tmpltp.TemplateInstanceDataService;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton.ContractPageReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.preparaton.ContractSaveReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.*;
|
||||
import com.zt.plat.module.contractorder.dal.dataobject.contract.*;
|
||||
import com.zt.plat.module.contractorder.dal.mysql.contract.*;
|
||||
import com.zt.plat.module.contractorder.enums.contract.ContractStatusEnum;
|
||||
@@ -44,6 +48,10 @@ public class ContractServiceImpl implements ContractService {
|
||||
@Resource
|
||||
private TemplateInstanceDataService templateInstanceDataService;
|
||||
@Resource
|
||||
private TemplateInstanceDataMapper templateInstanceDataMapper;
|
||||
@Resource
|
||||
private TemplateInstanceItemMapper templateInstanceItemMapper;
|
||||
@Resource
|
||||
private ContractFormulaMapper contractFormulaMapper;
|
||||
@Resource
|
||||
private ContractCoefficientMapper contractCoefficientMapper;
|
||||
@@ -92,99 +100,201 @@ public class ContractServiceImpl implements ContractService {
|
||||
// 合同主信息ID
|
||||
Long contractId = contractMainDO.getId();
|
||||
// 合同明细
|
||||
reqVO.getDetail().forEach(detail -> {
|
||||
// 合同明细DO
|
||||
ContractDetailDO detailDO = BeanUtils.toBean(detail, ContractDetailDO.class);
|
||||
// 设置合同主信息ID
|
||||
detailDO.setContractMainId(contractId);
|
||||
// 保存合同明细
|
||||
contractDetailMapper.insert(detailDO);
|
||||
if (reqVO.getDetail() != null && !reqVO.getDetail().isEmpty()) {
|
||||
reqVO.getDetail().forEach(detail -> {
|
||||
// 合同明细DO
|
||||
ContractDetailDO detailDO = BeanUtils.toBean(detail, ContractDetailDO.class);
|
||||
// 设置合同主信息ID
|
||||
detailDO.setContractMainId(contractId);
|
||||
// 保存合同明细
|
||||
contractDetailMapper.insert(detailDO);
|
||||
|
||||
// 合同明细ID
|
||||
Long detailDOId = detailDO.getId();
|
||||
// 交货计划
|
||||
detail.getPlans().forEach(plan -> {
|
||||
// 交货计划DO
|
||||
ContractPlanDO planDO = BeanUtils.toBean(plan, ContractPlanDO.class);
|
||||
// 合同明细主键
|
||||
planDO.setContractDetailId(detailDOId);
|
||||
// 保存交货计划
|
||||
contractPlanMapper.insert(planDO);
|
||||
// 合同明细ID
|
||||
Long detailDOId = detailDO.getId();
|
||||
// 交货计划
|
||||
if (detail.getPlans() != null && !detail.getPlans().isEmpty()) {
|
||||
detail.getPlans().forEach(plan -> {
|
||||
// 交货计划DO
|
||||
ContractPlanDO planDO = BeanUtils.toBean(plan, ContractPlanDO.class);
|
||||
// 合同明细主键
|
||||
planDO.setContractDetailId(detailDOId);
|
||||
// 保存交货计划
|
||||
contractPlanMapper.insert(planDO);
|
||||
});
|
||||
}
|
||||
|
||||
// 价款结算条款
|
||||
if (detail.getFormulas() != null && !detail.getFormulas().isEmpty()) {
|
||||
detail.getFormulas().forEach(formula -> {
|
||||
// 价款结算条款DO
|
||||
ContractFormulaDO formulaDO = BeanUtils.toBean(formula, ContractFormulaDO.class);
|
||||
// 合同明细主键
|
||||
formulaDO.setContractDetailId(detailDOId);
|
||||
// 保存价款结算条款
|
||||
contractFormulaMapper.insert(formulaDO);
|
||||
|
||||
// 价款结算条款ID
|
||||
Long formulaDOId = formulaDO.getId();
|
||||
// 基础系数配置
|
||||
if (formula.getCoefficients() != null && !formula.getCoefficients().isEmpty()) {
|
||||
formula.getCoefficients().forEach(coefficient -> {
|
||||
// 基础系数配置DO
|
||||
ContractCoefficientDO coefficientDO = BeanUtils.toBean(coefficient, ContractCoefficientDO.class);
|
||||
// 条款主键
|
||||
coefficientDO.setFormulaId(formulaDOId);
|
||||
// 保存基础系数配置
|
||||
contractCoefficientMapper.insert(coefficientDO);
|
||||
});
|
||||
}
|
||||
// 品位等级价配置
|
||||
if (formula.getGrades() != null && !formula.getGrades().isEmpty()) {
|
||||
formula.getGrades().forEach(grade -> {
|
||||
// 品位等级价配置DO
|
||||
ContractGradeDO gradeDO = BeanUtils.toBean(grade, ContractGradeDO.class);
|
||||
// 条款主键
|
||||
gradeDO.setFormulaId(formulaDOId);
|
||||
// 保存品位等级价配置
|
||||
contractGradeMapper.insert(gradeDO);
|
||||
});
|
||||
}
|
||||
// 调整价配置
|
||||
if (formula.getDeducts() != null && !formula.getDeducts().isEmpty()) {
|
||||
formula.getDeducts().forEach(deduct -> {
|
||||
// 调整价配置DO
|
||||
ContractDeductDO deductDO = BeanUtils.toBean(deduct, ContractDeductDO.class);
|
||||
// 条款主键
|
||||
deductDO.setFormulaId(formulaDOId);
|
||||
// 保存品位等级价配置
|
||||
contractDeductMapper.insert(deductDO);
|
||||
});
|
||||
}
|
||||
// 市场价配置
|
||||
if (formula.getPrices()!= null && !formula.getPrices().isEmpty()) {
|
||||
formula.getPrices().forEach(price -> {
|
||||
// 市场价配置DO
|
||||
ContractPriceDO priceDO = BeanUtils.toBean(price, ContractPriceDO.class);
|
||||
// 条款主键
|
||||
priceDO.setFormulaId(formulaDOId);
|
||||
// 保存市场价配置
|
||||
contractPriceMapper.insert(priceDO);
|
||||
});
|
||||
}
|
||||
// 品位不计价配置
|
||||
if (formula.getNots() != null && !formula.getNots().isEmpty()) {
|
||||
formula.getNots().forEach(not -> {
|
||||
// 品位不计价配置DO
|
||||
ContractNotDO notDO = BeanUtils.toBean(not, ContractNotDO.class);
|
||||
// 条款主键
|
||||
notDO.setFormulaId(formulaDOId);
|
||||
// 保存品位不计价配置
|
||||
contractNotMapper.insert(notDO);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 价款结算条款
|
||||
detail.getFormulas().forEach(formula -> {
|
||||
// 价款结算条款DO
|
||||
ContractFormulaDO formulaDO = BeanUtils.toBean(formula, ContractFormulaDO.class);
|
||||
// 合同明细主键
|
||||
formulaDO.setContractDetailId(detailDOId);
|
||||
// 保存价款结算条款
|
||||
contractFormulaMapper.insert(formulaDO);
|
||||
|
||||
// 价款结算条款ID
|
||||
Long formulaDOId = formulaDO.getId();
|
||||
// 基础系数配置
|
||||
formula.getCoefficients().forEach(coefficient -> {
|
||||
// 基础系数配置DO
|
||||
ContractCoefficientDO coefficientDO = BeanUtils.toBean(coefficient, ContractCoefficientDO.class);
|
||||
// 条款主键
|
||||
coefficientDO.setFormulaId(formulaDOId);
|
||||
// 保存基础系数配置
|
||||
contractCoefficientMapper.insert(coefficientDO);
|
||||
});
|
||||
// 品位等级价配置
|
||||
formula.getGrades().forEach(grade -> {
|
||||
// 品位等级价配置DO
|
||||
ContractGradeDO gradeDO = BeanUtils.toBean(grade, ContractGradeDO.class);
|
||||
// 条款主键
|
||||
gradeDO.setFormulaId(formulaDOId);
|
||||
// 保存品位等级价配置
|
||||
contractGradeMapper.insert(gradeDO);
|
||||
});
|
||||
// 调整价配置
|
||||
formula.getDeducts().forEach(deduct -> {
|
||||
// 调整价配置DO
|
||||
ContractDeductDO deductDO = BeanUtils.toBean(deduct, ContractDeductDO.class);
|
||||
// 条款主键
|
||||
deductDO.setFormulaId(formulaDOId);
|
||||
// 保存品位等级价配置
|
||||
contractDeductMapper.insert(deductDO);
|
||||
});
|
||||
// 市场价配置
|
||||
formula.getPrices().forEach(price -> {
|
||||
// 市场价配置DO
|
||||
ContractPriceDO priceDO = BeanUtils.toBean(price, ContractPriceDO.class);
|
||||
// 条款主键
|
||||
priceDO.setFormulaId(formulaDOId);
|
||||
// 保存市场价配置
|
||||
contractPriceMapper.insert(priceDO);
|
||||
});
|
||||
// 品位不计价配置
|
||||
formula.getNots().forEach(not -> {
|
||||
// 品位不计价配置DO
|
||||
ContractNotDO notDO = BeanUtils.toBean(not, ContractNotDO.class);
|
||||
// 条款主键
|
||||
notDO.setFormulaId(formulaDOId);
|
||||
// 保存品位不计价配置
|
||||
contractNotMapper.insert(notDO);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 合同动态表单
|
||||
List<TemplateInstanceDataDO> templateInstanceDataDOS = new ArrayList<>();
|
||||
reqVO.getDynamicsFields().forEach(dynamicsField -> {
|
||||
TemplateInstanceDataDO templateInstanceDataDO = new TemplateInstanceDataDO();
|
||||
BeanUtils.copyProperties(dynamicsField, templateInstanceDataDO);
|
||||
templateInstanceDataDO.setInscId(reqVO.getInstanceId().toString());
|
||||
templateInstanceDataDOS.add(templateInstanceDataDO);
|
||||
});
|
||||
if (reqVO.getDynamicsFields() != null && !reqVO.getDynamicsFields().isEmpty()) {
|
||||
reqVO.getDynamicsFields().forEach(dynamicsField -> {
|
||||
TemplateInstanceDataDO templateInstanceDataDO = new TemplateInstanceDataDO();
|
||||
BeanUtils.copyProperties(dynamicsField, templateInstanceDataDO);
|
||||
templateInstanceDataDO.setInscId(reqVO.getInstanceId().toString());
|
||||
templateInstanceDataDOS.add(templateInstanceDataDO);
|
||||
});
|
||||
}
|
||||
// 更新合同动态表单值
|
||||
templateInstanceDataService.setTemplateInstanceData(templateInstanceDataDOS);
|
||||
if (!templateInstanceDataDOS.isEmpty()) {
|
||||
templateInstanceDataService.setTemplateInstanceData(templateInstanceDataDOS);
|
||||
}
|
||||
|
||||
return contractMainDO.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContractViewRespVO get(Long id) {
|
||||
|
||||
// 返回结果
|
||||
ContractViewRespVO respVO = new ContractViewRespVO();
|
||||
|
||||
// 查询并设置合同主信息
|
||||
ContractMainDO contractMainDO = contractMainMapper.selectById(id);
|
||||
if (contractMainDO == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
BeanUtils.copyProperties(contractMainDO, respVO);
|
||||
|
||||
// 查询并设置物料信息
|
||||
List<ContractDetailDO> detailDOS = contractDetailMapper
|
||||
.selectList("CTRT_MAIN_ID", contractMainDO.getId());
|
||||
if (detailDOS != null && !detailDOS.isEmpty()) {
|
||||
respVO.setDetail(BeanUtils.toBean(detailDOS, ContractViewDetailRespVO.class));
|
||||
respVO.getDetail().forEach(detail -> {
|
||||
|
||||
// 查询并设置交货计划
|
||||
List<ContractPlanDO> planDOS = contractPlanMapper.selectList("CTRT_DTL_ID", detail.getId());
|
||||
if (planDOS != null && !planDOS.isEmpty()) {
|
||||
detail.setPlans(BeanUtils.toBean(planDOS, ContractViewPlanRespVO.class));
|
||||
}
|
||||
|
||||
// 查询并设置价款结算条款
|
||||
List<ContractFormulaDO> formulaDOS = contractFormulaMapper
|
||||
.selectList("CTRT_DTL_ID", detail.getId());
|
||||
if (formulaDOS != null && !formulaDOS.isEmpty()) {
|
||||
detail.setFormulas(BeanUtils.toBean(formulaDOS, ContractViewFormulaRespVO.class));
|
||||
|
||||
detail.getFormulas().forEach(formula -> {
|
||||
|
||||
// 查询并设置基础系数配置
|
||||
List<ContractCoefficientDO> coefficientDOS = contractCoefficientMapper
|
||||
.selectList("FMU_ID", formula.getId());
|
||||
if (coefficientDOS != null && !coefficientDOS.isEmpty()) {
|
||||
formula.setCoefficients(BeanUtils.toBean(coefficientDOS, ContractViewCoefficientRespVO.class));
|
||||
}
|
||||
// 查询并设置品位等级价配置
|
||||
List<ContractGradeDO> gradeDOS = contractGradeMapper.selectList("FMU_ID", formula.getId());
|
||||
if (gradeDOS != null && !gradeDOS.isEmpty()) {
|
||||
formula.setGrades(BeanUtils.toBean(gradeDOS, ContractViewGradeRespVO.class));
|
||||
}
|
||||
// 查询并设置调整价配置
|
||||
List<ContractDeductDO> deductDOS = contractDeductMapper.selectList("FMU_ID", formula.getId());
|
||||
if (deductDOS != null && !deductDOS.isEmpty()) {
|
||||
formula.setDeducts(BeanUtils.toBean(deductDOS, ContractViewDeductRespVO.class));
|
||||
}
|
||||
// 查询并设置市场价配置
|
||||
List<ContractPriceDO> priceDOS = contractPriceMapper.selectList("FMU_ID", formula.getId());
|
||||
if (priceDOS != null && !priceDOS.isEmpty()) {
|
||||
formula.setPrices(BeanUtils.toBean(priceDOS, ContractViewPriceRespVO.class));
|
||||
}
|
||||
// 查询并设置品位不计价配置
|
||||
List<ContractNotDO> notDOS = contractNotMapper.selectList("FMU_ID", formula.getId());
|
||||
if (notDOS != null && !notDOS.isEmpty()) {
|
||||
formula.setNots(BeanUtils.toBean(notDOS, ContractViewNotRespVO.class));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 查询并设置合同动态表单
|
||||
List<TemplateInstanceDataDO> templateInstanceDataDOS = templateInstanceDataMapper
|
||||
.selectList("INSC_ID", contractMainDO.getInstanceId());
|
||||
if (templateInstanceDataDOS != null && !templateInstanceDataDOS.isEmpty()) {
|
||||
respVO.setDynamicsFields(BeanUtils.toBean(templateInstanceDataDOS, TemplateInstanceDataRespVO.class));
|
||||
}
|
||||
|
||||
// 查询并设置合同动态条款
|
||||
List<TemplateInstanceItemDO> templateInstanceItemDOS = templateInstanceItemMapper
|
||||
.selectList("INSC_ID", contractMainDO.getInstanceId());
|
||||
if (templateInstanceItemDOS != null && !templateInstanceItemDOS.isEmpty()) {
|
||||
respVO.setDynamicsItems(BeanUtils.toBean(templateInstanceItemDOS, TemplateInstanceItemRespVO.class));
|
||||
}
|
||||
|
||||
return respVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成系统合同编号
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user