计划管理相关功能实现

This commit is contained in:
潘荣晟
2026-01-21 16:09:35 +08:00
parent 4007160524
commit 1bb5c117d2
12 changed files with 170 additions and 39 deletions

View File

@@ -0,0 +1,34 @@
package com.zt.plat.module.contractorder.api.dto.contract;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "金额分配响应DTO")
@Data
public class AmountSplitRespDTO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "17357")
private Long id;
@Schema(description = "物料名称", example = "赵六")
private String materialName;
@Schema(description = "物料编码")
private String materialCode;
@Schema(description = "元素缩写")
private String elementAbbreviation;
@Schema(description = "元素名称", example = "张三")
private String elementName;
@Schema(description = "元素编码")
private String elementCode;
@Schema(description = "占比")
private BigDecimal ratio;
@Schema(description = "合同id", example = "3781")
private Long contractId;
}

View File

@@ -286,4 +286,7 @@ public class ContractRespDTO {
@Schema(description = "收发货规则")
private List<ContractReceiveSendRespDTO> contractReceiveSends;
@Schema(description = "金额拆分")
private List<AmountSplitRespDTO> amountSplits;
}

View File

@@ -125,11 +125,13 @@ public class ContractServiceImpl implements ContractService {
private ContractReceiveSendService contractReceiveSendService;
@Resource
private AmountDismantleService amountDismantleService;
@Override
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
return contractMainMapper.selectContractPage(pageReqVO);
}
boolean isContractReceiveSendValid(List<ContractReceiveSendSaveReqVO> contractReceiveSends){
boolean isContractReceiveSendValid(List<ContractReceiveSendSaveReqVO> contractReceiveSends) {
if (CollectionUtils.isEmpty(contractReceiveSends)) {
return true;
}
@@ -320,7 +322,7 @@ public class ContractServiceImpl implements ContractService {
});
}
//插入资金拆分表
if(reqVO.getAmountSplit() != null && !reqVO.getAmountSplit().isEmpty()){
if (reqVO.getAmountSplit() != null && !reqVO.getAmountSplit().isEmpty()) {
reqVO.getAmountSplit().forEach(amountDismantle -> {
amountDismantle.setContractId(contractId);
amountDismantleService.createAmountDismantle(amountDismantle);
@@ -961,22 +963,22 @@ public class ContractServiceImpl implements ContractService {
submitErp(newContractMainDO.getId());
}
//更新收发货规则
if (reqVO.getContractReceiveSends() != null && !reqVO.getContractReceiveSends().isEmpty()){
if (reqVO.getContractReceiveSends() != null && !reqVO.getContractReceiveSends().isEmpty()) {
//通过合同id删除收发货规则
List<ContractReceiveSendRespVO> contractReceiveSendListByContract = contractReceiveSendService.getContractReceiveSendListByContractId(id);
contractReceiveSendService.deleteContractReceiveSendListByIds(contractReceiveSendListByContract.stream().map(ContractReceiveSendRespVO::getId).toList());
//重新插入收发货规则
reqVO.getContractReceiveSends().forEach(item->{
reqVO.getContractReceiveSends().forEach(item -> {
item.setContractId(id);
item.setId(null);
contractReceiveSendService.createContractReceiveSend(item);
});
}
//更新资金拆分表(直接先删除后面再插入)
if (reqVO.getAmountSplit()!=null &&!reqVO.getAmountSplit().isEmpty()){
if (reqVO.getAmountSplit() != null && !reqVO.getAmountSplit().isEmpty()) {
List<AmountDismantleDO> amountDismantleList = amountDismantleService.getAmountDismantleListByContractId(id);
amountDismantleService.deleteAmountDismantleListByIds(amountDismantleList.stream().map(AmountDismantleDO::getId).toList());
reqVO.getAmountSplit().forEach(item->{
reqVO.getAmountSplit().forEach(item -> {
item.setContractId(id);
item.setId(null);
amountDismantleService.createAmountDismantle(item);
@@ -1420,10 +1422,14 @@ public class ContractServiceImpl implements ContractService {
}
//收发货
List<ContractReceiveSendRespVO> contractReceiveSendListByContractId = contractReceiveSendService.getContractReceiveSendListByContractId(contractMainDO.getId());
if (contractReceiveSendListByContractId!=null&&!contractReceiveSendListByContractId.isEmpty()){
if (contractReceiveSendListByContractId != null && !contractReceiveSendListByContractId.isEmpty()) {
respDTO.setContractReceiveSends(BeanUtils.toBean(contractReceiveSendListByContractId, ContractReceiveSendRespDTO.class));
}
//金额拆分
List<AmountDismantleDO> amountDismantleListByContractId = amountDismantleService.getAmountDismantleListByContractId(contractMainDO.getId());
if (amountDismantleListByContractId != null && !amountDismantleListByContractId.isEmpty()) {
respDTO.setAmountSplits(BeanUtils.toBean(amountDismantleListByContractId,AmountSplitRespDTO.class));
}
return respDTO;
}
@@ -1513,16 +1519,19 @@ public class ContractServiceImpl implements ContractService {
}
//收发货
List<ContractReceiveSendRespVO> contractReceiveSendListByContractId = contractReceiveSendService.getContractReceiveSendListByContractId(contractMainDO.getId());
if (contractReceiveSendListByContractId!=null&&!contractReceiveSendListByContractId.isEmpty()){
if (contractReceiveSendListByContractId != null && !contractReceiveSendListByContractId.isEmpty()) {
respDTO.setContractReceiveSends(BeanUtils.toBean(contractReceiveSendListByContractId, ContractReceiveSendRespDTO.class));
}
//金额拆分
List<AmountDismantleDO> amountDismantleListByContractId = amountDismantleService.getAmountDismantleListByContractId(contractMainDO.getId());
if (amountDismantleListByContractId != null && !amountDismantleListByContractId.isEmpty()) {
respDTO.setAmountSplits(BeanUtils.toBean(amountDismantleListByContractId,AmountSplitRespDTO.class));
}
return respDTO;
}
@Override
public JSONObject submitErp(Long id) {