删除合同保存时erp公司校验
This commit is contained in:
@@ -26,11 +26,13 @@ import com.zt.plat.module.contractorder.api.dto.contract.*;
|
|||||||
import com.zt.plat.module.contractorder.api.vo.contract.*;
|
import com.zt.plat.module.contractorder.api.vo.contract.*;
|
||||||
import com.zt.plat.module.contractorder.dal.dataobject.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.dal.mysql.contract.*;
|
||||||
import com.zt.plat.module.contractorder.enums.*;
|
import com.zt.plat.module.contractorder.enums.DateConstants;
|
||||||
|
import com.zt.plat.module.contractorder.enums.DictTypeConstants;
|
||||||
|
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.contractorder.enums.contract.DictEnum;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractPageReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractPageReqVO;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractSaveReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractSaveReqVO;
|
||||||
import com.zt.plat.module.erp.dal.dataobject.erp.ErpCompanyDO;
|
|
||||||
import com.zt.plat.module.erp.dal.dataobject.erp.ErpContractDO;
|
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.ErpCompanyService;
|
||||||
import com.zt.plat.module.erp.service.erp.ErpContractService;
|
import com.zt.plat.module.erp.service.erp.ErpContractService;
|
||||||
@@ -145,30 +147,14 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
// 合同主信息
|
// 合同主信息
|
||||||
ContractMainDO contractMainDO = BeanUtils.toBean(reqVO, ContractMainDO.class);
|
ContractMainDO contractMainDO = BeanUtils.toBean(reqVO, ContractMainDO.class);
|
||||||
|
|
||||||
// 校验ERP的公司
|
// ERP甲方公司编号
|
||||||
if (StringUtils.isNotEmpty(reqVO.getPurchaseCompanyNumber())
|
contractMainDO.setErpPurchaseCompanyNumber(reqVO.getPurchaseCompanyNumber());
|
||||||
|| StringUtils.isNotEmpty(reqVO.getSalesCompanyNumber())) {
|
// ERP甲方公司名称
|
||||||
if (StringUtils.isNotEmpty(reqVO.getPurchaseCompanyNumber())) {
|
contractMainDO.setErpPurchaseCompanyName(reqVO.getPurchaseCompanyName());
|
||||||
ErpCompanyDO erpCompany = erpCompanyService.getErpCompanyByNumber(reqVO.getPurchaseCompanyNumber());
|
// ERP乙方公司编码
|
||||||
if (erpCompany == null) {
|
contractMainDO.setErpSalesCompanyNumber(reqVO.getSalesCompanyNumber());
|
||||||
throw exception(CONTRACT_ERP_COMPANY_PLEASE_BIND, ApiConstants.PURCHASE);
|
// ERP乙方公司名称
|
||||||
} else {
|
contractMainDO.setErpSalesCompanyName(reqVO.getSalesCompanyName());
|
||||||
contractMainDO.setErpPurchaseCompanyNumber(erpCompany.getNumber());
|
|
||||||
contractMainDO.setErpPurchaseCompanyName(erpCompany.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotEmpty(reqVO.getSalesCompanyNumber())) {
|
|
||||||
ErpCompanyDO erpCompany = erpCompanyService.getErpCompanyByNumber(reqVO.getSalesCompanyNumber());
|
|
||||||
if (erpCompany == null) {
|
|
||||||
throw exception(CONTRACT_ERP_COMPANY_PLEASE_BIND, ApiConstants.SALES);
|
|
||||||
} else {
|
|
||||||
contractMainDO.setErpSalesCompanyNumber(erpCompany.getNumber());
|
|
||||||
contractMainDO.setErpSalesCompanyName(erpCompany.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 合同状态保存为草稿
|
// 合同状态保存为草稿
|
||||||
contractMainDO.setStatus(DictEnum.BSE_CTRT_STS_DRAFT.getCode());
|
contractMainDO.setStatus(DictEnum.BSE_CTRT_STS_DRAFT.getCode());
|
||||||
// 生成系统合同编号
|
// 生成系统合同编号
|
||||||
@@ -731,28 +717,14 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
// 请求更新的合同信息
|
// 请求更新的合同信息
|
||||||
ContractMainDO newContractMainDO = BeanUtils.toBean(reqVO, ContractMainDO.class);
|
ContractMainDO newContractMainDO = BeanUtils.toBean(reqVO, ContractMainDO.class);
|
||||||
|
|
||||||
// 校验ERP的公司
|
// ERP甲方公司编号
|
||||||
if (StringUtils.isNotEmpty(reqVO.getPurchaseCompanyNumber())
|
newContractMainDO.setErpPurchaseCompanyNumber(reqVO.getPurchaseCompanyNumber());
|
||||||
|| StringUtils.isNotEmpty(reqVO.getSalesCompanyNumber())) {
|
// ERP甲方公司名称
|
||||||
if (StringUtils.isNotEmpty(reqVO.getPurchaseCompanyNumber())) {
|
newContractMainDO.setErpPurchaseCompanyName(reqVO.getPurchaseCompanyName());
|
||||||
ErpCompanyDO erpCompany = erpCompanyService.getErpCompanyByNumber(reqVO.getPurchaseCompanyNumber());
|
// ERP乙方公司编码
|
||||||
if (erpCompany == null) {
|
newContractMainDO.setErpSalesCompanyNumber(reqVO.getSalesCompanyNumber());
|
||||||
throw exception(CONTRACT_ERP_COMPANY_PLEASE_BIND, ApiConstants.PURCHASE);
|
// ERP乙方公司名称
|
||||||
} else {
|
newContractMainDO.setErpSalesCompanyName(reqVO.getSalesCompanyName());
|
||||||
newContractMainDO.setErpPurchaseCompanyNumber(erpCompany.getNumber());
|
|
||||||
newContractMainDO.setErpPurchaseCompanyName(erpCompany.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotEmpty(reqVO.getSalesCompanyNumber())) {
|
|
||||||
ErpCompanyDO erpCompany = erpCompanyService.getErpCompanyByNumber(reqVO.getSalesCompanyNumber());
|
|
||||||
if (erpCompany == null) {
|
|
||||||
throw exception(CONTRACT_ERP_COMPANY_PLEASE_BIND, ApiConstants.SALES);
|
|
||||||
} else {
|
|
||||||
newContractMainDO.setErpSalesCompanyNumber(erpCompany.getNumber());
|
|
||||||
newContractMainDO.setErpSalesCompanyName(erpCompany.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除关联信息
|
// 删除关联信息
|
||||||
// 查询合同明细
|
// 查询合同明细
|
||||||
|
|||||||
Reference in New Issue
Block a user