新增时,判断甲方和乙方的ERP的公司编码和ERP公司名称是否存在,不存在则返回“请先绑定ERP公司信息”

合同主信息表结构修改
This commit is contained in:
guojunyun
2025-10-10 10:41:12 +08:00
parent 9e87d811ef
commit 3ad87d6d29
9 changed files with 78 additions and 8 deletions

View File

@@ -20,4 +20,7 @@ public class ApiConstants {
public static final String VERSION = "1.0.0";
public static final String PURCHASE = "甲方";
public static final String SALES = "乙方";
}

View File

@@ -21,4 +21,5 @@ public interface ErrorCodeConstants {
ErrorCode CONTRACT_DATA_NOT_EXISTS = new ErrorCode(1_027_000_006, "{}不存在");
ErrorCode CONTRACT_STATUS_NOT_SUBMIT_APPROVAL = new ErrorCode(1_027_000_007, "{}状态合同不允许提交审核");
ErrorCode CONTRACT_STATUS_NOT_APPROVAL = new ErrorCode(1_027_000_008, "{}状态合同不允许审核");
ErrorCode CONTRACT_ERP_COMPANY_PLEASE_BIND = new ErrorCode(1_027_000_009, "请先绑定{}ERP公司信息");
}

View File

@@ -136,6 +136,11 @@
<artifactId>zt-module-bpm-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.zt.plat</groupId>
<artifactId>zt-module-erp-server</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
<build>

View File

@@ -208,6 +208,9 @@ public class ContractSaveReqVO {
@Schema(description = "达到收款条件金额;与ERP(DDSKJE)对应拓展信息销售合同且类型为SAP02COSR必填")
private BigDecimal payeeConditionAmount;
@Schema(description = "是否内部企业(字典ERP_CTRT_YN)")
private String isInternal;
// 模板部分
@Schema(description = "模板实例主键", example = "10196")
private Long instanceId;
@@ -221,6 +224,6 @@ public class ContractSaveReqVO {
// 参数降级规则
private List<ContractDemoteSaveReqVO> demotes;
// 品位不计价配置
// 品位不计价规则
private List<ContractNotSaveReqVO> nots;
}

View File

@@ -40,7 +40,7 @@ public class ContractMainDO extends BusinessBaseDO {
@TableField("SYS_CTRT_NUM")
private String systemContractNumber;
/**
* 状态
* 状态(字典: BSE_CTRT_STS)
*/
@TableField("STS")
private String status;
@@ -60,7 +60,7 @@ public class ContractMainDO extends BusinessBaseDO {
@TableField("CTRT_VRTL")
private String contractVirtual;
/**
* 是否先款后货
* 交易方式(字典: HS_PYBL_TP)
*/
@TableField("HS_PYBL")
private String hasPayable;
@@ -270,7 +270,7 @@ public class ContractMainDO extends BusinessBaseDO {
@TableField("STP")
private Integer step;
/**
* ERP请求状态
* ERP请求状态(字典: ERP_REQ_STS)
*/
@TableField("ERP_STS")
private String erpStatus;
@@ -364,4 +364,29 @@ public class ContractMainDO extends BusinessBaseDO {
*/
@TableField("SALE_CTCT_ADR")
private String salesContactAddress;
/**
* ERP甲方公司编号
*/
@TableField("ERP_PRCH_CPN_NUM")
private String erpPurchaseCompanyNumber;
/**
* ERP甲方公司名称
*/
@TableField("ERP_PRCH_CPN_NAME")
private String erpPurchaseCompanyName;
/**
* ERP乙方公司编码
*/
@TableField("ERP_SALE_CPN_NUM")
private String erpSalesCompanyNumber;
/**
* ERP乙方公司名称
*/
@TableField("ERP_SALE_CPN_NAME")
private String erpSalesCompanyName;
/**
* 是否内部企业(字典ERP_CTRT_YN)
*/
@TableField("IS_INTL")
private String isInternal;
}

View File

@@ -19,11 +19,13 @@ import com.zt.plat.module.bpm.api.task.dto.BpmTaskRespDTO;
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.ApiConstants;
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.ContractStatusEnum;
import com.zt.plat.module.contractorder.enums.contract.ErpCtrtYesNoEnum;
import com.zt.plat.module.erp.service.erp.ErpCompanyService;
import com.zt.plat.module.system.api.user.AdminUserApi;
import com.zt.plat.module.system.api.user.dto.AdminUserRespDTO;
import jakarta.annotation.Resource;
@@ -83,6 +85,8 @@ public class ContractServiceImpl implements ContractService {
private BpmTaskApi bpmTaskApi;
@Resource
private ContractDemoteMapper contractDemoteMapper;
@Resource
private ErpCompanyService erpCompanyService;
@Override
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
@@ -109,6 +113,21 @@ public class ContractServiceImpl implements ContractService {
}
}
// 校验ERP的公司
if (StringUtils.isNotEmpty(reqVO.getPurchaseCompanyNumber())
|| StringUtils.isNotEmpty(reqVO.getSalesCompanyNumber())) {
if (StringUtils.isNotEmpty(reqVO.getPurchaseCompanyNumber())) {
if (erpCompanyService.getErpCompanyByNumber(reqVO.getPurchaseCompanyNumber()) == null) {
throw exception(CONTRACT_ERP_COMPANY_PLEASE_BIND, ApiConstants.PURCHASE);
}
}
if (StringUtils.isNotEmpty(reqVO.getSalesCompanyNumber())) {
if (erpCompanyService.getErpCompanyByNumber(reqVO.getSalesCompanyNumber()) == null) {
throw exception(CONTRACT_ERP_COMPANY_PLEASE_BIND, ApiConstants.SALES);
}
}
}
// 合同主信息
ContractMainDO contractMainDO = BeanUtils.toBean(reqVO, ContractMainDO.class);
// 合同状态保存为草稿