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

# Conflicts:
#	zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/ContractApi.java
#	zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/api/ContractApiImpl.java
This commit is contained in:
潘荣晟
2025-10-13 16:43:37 +08:00
23 changed files with 590 additions and 85 deletions

View File

@@ -7,6 +7,7 @@ import com.zt.plat.module.contractorder.api.dto.PrchOrdDtlDTO;
import com.zt.plat.module.contractorder.api.dto.PurchaseOrderWithDetailsDTO;
import com.zt.plat.module.contractorder.controller.admin.purchaseorder.vo.PurchaseOrderDetailsRespVO;
import com.zt.plat.module.contractorder.controller.admin.purchaseorder.vo.PurchaseOrderWithDetailsVO;
import com.zt.plat.module.contractorder.api.dto.contract.ContractRespDTO;
import com.zt.plat.module.contractorder.service.contract.ContractService;
import com.zt.plat.module.contractorder.service.purchaseorder.PurchaseOrderService;
import jakarta.annotation.Resource;
@@ -30,7 +31,7 @@ public class ContractApiImpl implements ContractApi {
private PurchaseOrderService purchaseOrderService;
@Override
public List<ContractFormulaRespDTO> getFormulas(String contractPaperNumber) {
public ContractRespDTO getContractByPaperNumber(String contractPaperNumber) {
return contractService.getFormulasByPaperNumber(contractPaperNumber);
}

View File

@@ -1,7 +1,7 @@
package com.zt.plat.module.contractorder.service.contract;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.contractorder.api.dto.ContractFormulaRespDTO;
import com.zt.plat.module.contractorder.api.dto.contract.ContractRespDTO;
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.*;
import com.zt.plat.module.contractorder.dal.dataobject.contract.ContractMainDO;
import jakarta.validation.Valid;
@@ -88,12 +88,12 @@ public interface ContractService {
List<FormulaRespVO> getFormulas(FormulasQueryReqVO queryReqVO);
/**
* 通过合同编号获取对应的结算条款数据
* 通过合同编号获取对应的合同信息
*
* @param contractPaperNumber 合同编号
* @return 结算条款数据
*/
List<ContractFormulaRespDTO> getFormulasByPaperNumber(String contractPaperNumber);
ContractRespDTO getFormulasByPaperNumber(String contractPaperNumber);
/**
* 提交ERP

View File

@@ -17,7 +17,7 @@ import com.zt.plat.module.bpm.api.task.BpmProcessInstanceApi;
import com.zt.plat.module.bpm.api.task.BpmTaskApi;
import com.zt.plat.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
import com.zt.plat.module.bpm.api.task.dto.BpmTaskRespDTO;
import com.zt.plat.module.contractorder.api.dto.*;
import com.zt.plat.module.contractorder.api.dto.contract.*;
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.*;
@@ -26,8 +26,10 @@ import com.zt.plat.module.contractorder.enums.DateConstants;
import com.zt.plat.module.contractorder.enums.ProcessConstants;
import com.zt.plat.module.contractorder.enums.TableFieldConstants;
import com.zt.plat.module.contractorder.enums.contract.DictEnum;
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractPageReqVO;
import com.zt.plat.module.erp.dal.dataobject.erp.ErpContractDO;
import com.zt.plat.module.erp.service.erp.ErpCompanyService;
import com.zt.plat.module.erp.service.erp.ErpContractService;
import com.zt.plat.module.system.api.user.AdminUserApi;
import com.zt.plat.module.system.api.user.dto.AdminUserRespDTO;
import jakarta.annotation.Resource;
@@ -90,6 +92,8 @@ public class ContractServiceImpl implements ContractService {
private ContractDemoteMapper contractDemoteMapper;
@Resource
private ErpCompanyService erpCompanyService;
@Resource
private ErpContractService erpContractService;
@Override
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
@@ -736,7 +740,7 @@ public class ContractServiceImpl implements ContractService {
}
@Override
public List<ContractFormulaRespDTO> getFormulasByPaperNumber(String contractPaperNumber) {
public ContractRespDTO getFormulasByPaperNumber(String contractPaperNumber) {
// 通过合同编号查询合同信息
ContractMainDO contractMainDO = contractMainMapper
@@ -750,43 +754,76 @@ public class ContractServiceImpl implements ContractService {
// 合同ID
Long contractId = contractMainDO.getId();
// 返回结果
ContractRespDTO respDTO = new ContractRespDTO();
BeanUtils.copyProperties(contractMainDO, respDTO);
// 查询并设置合同明细
List<ContractDetailDO> detailDOS = contractDetailMapper
.selectList(TableFieldConstants.BSE_CTRT_DTL_CTRT_MAIN_ID, contractMainDO.getId());
if (detailDOS != null && !detailDOS.isEmpty()) {
respDTO.setDetail(BeanUtils.toBean(detailDOS, DetailRespDTO.class));
respDTO.getDetail().forEach(detail -> {
// 查询并设置交货计划
List<ContractPlanDO> planDOS = contractPlanMapper
.selectList(TableFieldConstants.BSE_CTRT_PLN_CTRT_DTL_ID, detail.getId());
if (planDOS != null && !planDOS.isEmpty()) {
detail.setPlans(BeanUtils.toBean(planDOS, PlanRespDTO.class));
}
});
}
// 查询并设置价款结算条款
List<ContractFormulaRespDTO> formulas = new ArrayList<>();
List<ContractFormulaDO> formulaDOS = contractFormulaMapper
.selectList(TableFieldConstants.BSE_CTRT_FMU_CTRT_ID, contractId);
if (formulaDOS != null && !formulaDOS.isEmpty()) {
formulas = BeanUtils.toBean(formulaDOS, ContractFormulaRespDTO.class);
respDTO.setFormulas(BeanUtils.toBean(formulaDOS, FormulaRespDTO.class));
formulas.forEach(formula -> {
respDTO.getFormulas().forEach(formula -> {
// 查询并设置基础系数配置
List<ContractCoefficientDO> coefficientDOS = contractCoefficientMapper
.selectList(TableFieldConstants.BSE_CTRT_COEF_FMU_ID, formula.getId());
if (coefficientDOS != null && !coefficientDOS.isEmpty()) {
formula.setCoefficients(BeanUtils.toBean(coefficientDOS, ContractCoefficientRespDTO.class));
formula.setCoefficients(BeanUtils.toBean(coefficientDOS, CoefficientRespDTO.class));
}
// 查询并设置品位等级价配置
List<ContractGradeDO> gradeDOS = contractGradeMapper
.selectList(TableFieldConstants.BSE_CTRT_GRD_FMU_ID, formula.getId());
if (gradeDOS != null && !gradeDOS.isEmpty()) {
formula.setGrades(BeanUtils.toBean(gradeDOS, ContractGradeRespDTO.class));
formula.setGrades(BeanUtils.toBean(gradeDOS, GradeRespDTO.class));
}
// 查询并设置调整价配置
List<ContractDeductDO> deductDOS = contractDeductMapper
.selectList(TableFieldConstants.BSE_CTRT_DDCT_FMU_ID, formula.getId());
if (deductDOS != null && !deductDOS.isEmpty()) {
formula.setDeducts(BeanUtils.toBean(deductDOS, ContractDeductRespDTO.class));
formula.setDeducts(BeanUtils.toBean(deductDOS, DeductRespDTO.class));
}
// 查询并设置市场价配置
List<ContractPriceDO> priceDOS = contractPriceMapper
.selectList(TableFieldConstants.BSE_CTRT_PRC_FMU_ID, formula.getId());
if (priceDOS != null && !priceDOS.isEmpty()) {
formula.setPrices(BeanUtils.toBean(priceDOS, ContractPriceRespDTO.class));
formula.setPrices(BeanUtils.toBean(priceDOS, PriceRespDTO.class));
}
});
}
return formulas;
// 查询并设置参数降级规则
List<ContractDemoteDO> demoteDOS = contractDemoteMapper
.selectList(TableFieldConstants.BSE_CTRT_DMOT_CTRT_ID, contractMainDO.getId());
if (demoteDOS != null && !demoteDOS.isEmpty()) {
respDTO.setDemotes(BeanUtils.toBean(demoteDOS, DemoteRespDTO.class));
}
// 查询并设置品位不计价规则
List<ContractNotDO> notDOS = contractNotMapper
.selectList(TableFieldConstants.BSE_CTRT_NT_CTRT_ID, contractMainDO.getId());
if (notDOS != null && !notDOS.isEmpty()) {
respDTO.setNots(BeanUtils.toBean(notDOS, NotRespDTO.class));
}
return respDTO;
}
@Override
@@ -804,12 +841,39 @@ public class ContractServiceImpl implements ContractService {
ErpContractDO erpContractDO = new ErpContractDO();
// 合同主信息表主键:BSE_CTRT_MAIN
erpContractDO.setContractMainId(id);
// 操作标识:OPTN_ID TODO
/*
1、先调用009ERP接口查询合同信息
2、如果009接口返回值中“合同编号”字段存在值并且与传入的相同则OPTN_ID值为“1”
3、如果009接口返回值中“合同编号”字段不存在值根据合同主键查询映射表中是否存在没有删除的数据如果有值为“1”如果没有值为“0”
*/
// 操作标识:OPTN_ID
// 1、先调用009ERP接口查询合同信息
ErpContractPageReqVO pageReqVO = new ErpContractPageReqVO();
// BUKRS 合同签订主体公司代码 收支方向判断如果为“支出”传“ERP甲方公司编码”反之传“ERP乙方公司编码”
// PARTNER 对方客商编号 收支方向判断如果为“支出”传“ERP乙方公司编码”反之传“ERP甲方公司编码”
// INEDR 1-借(销售合同)2-贷(采购合同) 收支方向判断如果为“支出”传“2”反之传“1”
if (DictEnum.ERP_RCV_DLVY_EXPENSES.getCode().equals(contractMainDO.getDirection())) {
pageReqVO.setContractSignNumber(contractMainDO.getSalesCompanyNumber());
pageReqVO.setSupplierNumber(contractMainDO.getSalesCompanyNumber());
pageReqVO.setContractCategory("2");
} else if (DictEnum.ERP_RCV_DLVY_INCOME.getCode().equals(contractMainDO.getDirection())) {
pageReqVO.setContractSignNumber(contractMainDO.getSalesCompanyNumber());
pageReqVO.setSupplierNumber(contractMainDO.getSalesCompanyNumber());
pageReqVO.setContractCategory("1");
}
// ZHTBH 合同编号 合同编号:CTRT_PPR_NUM
pageReqVO.setContractTypeNumber(contractMainDO.getContractPaperNumber());
// ZHTMC 合同名称 合同名称:CTRT_NAME
pageReqVO.setContractName(contractMainDO.getContractName());
PageResult<ErpContractDO> erpContractPage = erpContractService.getErpContractPage(pageReqVO);
if (erpContractPage.getTotal() > 0) {
// 2、如果009接口返回值中“合同编号”字段存在值并且与传入的相同则OPTN_ID值为“1”
erpContractDO.setOperationId("1");
} else {
// 3、如果009接口返回值中“合同编号”字段不存在值根据合同主键查询映射表中是否存在没有删除的数据如果有值为“1”如果没有值为“0”
/*ErpContractDO erpContract = erpContractService.getErpContractByMainId(id);
if (erpContract != null) {
erpContractDO.setOperationId("1");
} else {
erpContractDO.setOperationId("0");
}*/
}
// erpContractDO.setOperationId();
// 合同编号:CTRT_PPR_NUM
erpContractDO.setContractPaperNumber(contractMainDO.getContractPaperNumber());
// 合同名称:CTRT_NAME
@@ -823,15 +887,25 @@ public class ContractServiceImpl implements ContractService {
// 是否虚拟合同:IS_VRTL_CTRT
erpContractDO.setIsVirtualContract(contractMainDO.getContractVirtual());
// 客商编号:SPLR_NUM 根据合同主表的收支方向判断如果为“支出”值为“ERP乙方公司编码”反之为“ERP甲方公司编码”
// erpContractDO.setSupplierNumber();
// 客商名称:SPLR_NAME 根据合同主表的收支方向判断如果为“支出”值为“ERP乙方公司名称”反之为“ERP甲方公司名称”
// erpContractDO.setSupplierName();
if (DictEnum.ERP_RCV_DLVY_EXPENSES.getCode().equals(contractMainDO.getDirection())) {
erpContractDO.setSupplierNumber(contractMainDO.getSalesCompanyNumber());
erpContractDO.setSupplierName(contractMainDO.getSalesCompanyName());
} else if (DictEnum.ERP_RCV_DLVY_INCOME.getCode().equals(contractMainDO.getDirection())) {
erpContractDO.setSupplierNumber(contractMainDO.getPurchaseCompanyNumber());
erpContractDO.setSupplierName(contractMainDO.getPurchaseCompanyName());
}
// 代理方:AGT
erpContractDO.setAgent(contractMainDO.getAgent());
// 合同实施主体编号:CTRT_IMPL_NUM 根据合同主表的收支方向判断如果为“支出”值为“ERP甲方公司编码”反之为“ERP乙方公司编码”
// erpContractDO.setContractImplementNumber();
// 合同签订主体编号:CTRT_SGN_NUM 根据合同主表的收支方向判断如果为“支出”值为“ERP甲方公司名称”反之为“ERP乙方公司名称”
// erpContractDO.setContractSignNumber();
if (DictEnum.ERP_RCV_DLVY_EXPENSES.getCode().equals(contractMainDO.getDirection())) {
erpContractDO.setContractImplementNumber(contractMainDO.getPurchaseCompanyNumber());
erpContractDO.setContractSignNumber(contractMainDO.getPurchaseCompanyName());
} else if (DictEnum.ERP_RCV_DLVY_INCOME.getCode().equals(contractMainDO.getDirection())) {
erpContractDO.setContractImplementNumber(contractMainDO.getSalesCompanyNumber());
erpContractDO.setContractSignNumber(contractMainDO.getSalesCompanyName());
}
// 合同签订日期:SGN_DT
if (contractMainDO.getSignDate() != null) {
erpContractDO.setSignDate(contractMainDO.getSignDate().toLocalDate());
@@ -855,9 +929,9 @@ public class ContractServiceImpl implements ContractService {
// 变更后合同总金额(本位币-含税):CHG_BSC_AMT
erpContractDO.setChangeBasicAmount(contractMainDO.getChangeBasicAmount());
// 合同状态编号:STS_NUM 参照060接口
// erpContractDO.setStatusNumber();
erpContractDO.setStatusNumber(DictEnum.SUBMIT_ERP_CTRT_STS_EF.getCode());
// 合同状态名称:STS_NAME 参照060接口
// erpContractDO.setStatusName();
erpContractDO.setStatusName(DictEnum.SUBMIT_ERP_CTRT_STS_EF.getLabel());
// 是否有预付款:IS_PPYM
erpContractDO.setIsPrepayment(contractMainDO.getHasPrepayment());
// 预付款比例:PPYM_RTIO