|
|
|
|
@ -30,6 +30,7 @@ import org.dromara.oa.erp.domain.bo.ErpProjectContractsBo;
|
|
|
|
|
import org.dromara.oa.erp.domain.bo.ErpProjectPlanStageBo;
|
|
|
|
|
import org.dromara.oa.erp.domain.vo.ErpContractInfoVo;
|
|
|
|
|
import org.dromara.oa.erp.domain.vo.ErpContractOrderPurchaseMaterialVo;
|
|
|
|
|
import org.dromara.oa.erp.domain.vo.ErpPartyACustomerValidateVo;
|
|
|
|
|
import org.dromara.oa.erp.domain.vo.ErpProjectInfoVo;
|
|
|
|
|
import org.dromara.oa.erp.mapper.ErpContractInfoMapper;
|
|
|
|
|
import org.dromara.oa.erp.mapper.ErpContractMaterialMapper;
|
|
|
|
|
@ -703,24 +704,70 @@ public class ErpContractOrderServiceImpl implements IErpContractOrderService {
|
|
|
|
|
/**
|
|
|
|
|
* 订单激活时校验甲方客户基础信息(附件、税号、开户银行、银行账号不能为空)
|
|
|
|
|
*
|
|
|
|
|
* @param oneCustomerId 甲方客户ID
|
|
|
|
|
* @param contractId 合同ID
|
|
|
|
|
* @return 校验结果
|
|
|
|
|
*/
|
|
|
|
|
private void validPartyACustomerForOrderActivate(Long oneCustomerId) {
|
|
|
|
|
if (oneCustomerId == null) {
|
|
|
|
|
return;
|
|
|
|
|
@Override
|
|
|
|
|
public ErpPartyACustomerValidateVo checkPartyACustomerForOrderActivate(Long contractId) {
|
|
|
|
|
if (contractId == null) {
|
|
|
|
|
ErpPartyACustomerValidateVo result = new ErpPartyACustomerValidateVo();
|
|
|
|
|
result.setValid(true);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
ErpContractInfoVo contractInfoVo = contractInfoMapper.selectVoById(contractId);
|
|
|
|
|
if (contractInfoVo == null) {
|
|
|
|
|
throw new ServiceException("合同信息不存在");
|
|
|
|
|
}
|
|
|
|
|
return buildPartyACustomerValidateResult(contractInfoVo.getOneCustomerId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构建甲方客户校验结果
|
|
|
|
|
*
|
|
|
|
|
* @param oneCustomerId 甲方客户ID
|
|
|
|
|
* @return 校验结果
|
|
|
|
|
*/
|
|
|
|
|
private ErpPartyACustomerValidateVo buildPartyACustomerValidateResult(Long oneCustomerId) {
|
|
|
|
|
ErpPartyACustomerValidateVo result = new ErpPartyACustomerValidateVo();
|
|
|
|
|
result.setValid(true);
|
|
|
|
|
if (oneCustomerId == null) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
result.setOneCustomerId(oneCustomerId);
|
|
|
|
|
CrmCustomerInfoVo customerInfo = crmCustomerInfoService.queryById(oneCustomerId);
|
|
|
|
|
if (customerInfo == null) {
|
|
|
|
|
throw new ServiceException("合同甲方客户信息不存在,请先在客户管理中维护客户信息");
|
|
|
|
|
result.setValid(false);
|
|
|
|
|
result.setMessage("合同甲方客户信息不存在,请先在客户管理中维护客户信息");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isBlank(customerInfo.getOssId())
|
|
|
|
|
|| StringUtils.isBlank(customerInfo.getTaxNumber())
|
|
|
|
|
|| StringUtils.isBlank(customerInfo.getBankAccountOpening())
|
|
|
|
|
|| StringUtils.isBlank(customerInfo.getBankNumber())) {
|
|
|
|
|
result.setCustomerName(customerInfo.getCustomerName());
|
|
|
|
|
boolean ossIdMissing = StringUtils.isBlank(customerInfo.getOssId());
|
|
|
|
|
boolean taxNumberMissing = StringUtils.isBlank(customerInfo.getTaxNumber());
|
|
|
|
|
boolean bankAccountOpeningMissing = StringUtils.isBlank(customerInfo.getBankAccountOpening());
|
|
|
|
|
boolean bankNumberMissing = StringUtils.isBlank(customerInfo.getBankNumber());
|
|
|
|
|
result.setOssIdMissing(ossIdMissing);
|
|
|
|
|
result.setTaxNumberMissing(taxNumberMissing);
|
|
|
|
|
result.setBankAccountOpeningMissing(bankAccountOpeningMissing);
|
|
|
|
|
result.setBankNumberMissing(bankNumberMissing);
|
|
|
|
|
if (ossIdMissing || taxNumberMissing || bankAccountOpeningMissing || bankNumberMissing) {
|
|
|
|
|
result.setValid(false);
|
|
|
|
|
String customerName = StringUtils.isNotBlank(customerInfo.getCustomerName())
|
|
|
|
|
? customerInfo.getCustomerName()
|
|
|
|
|
: String.valueOf(oneCustomerId);
|
|
|
|
|
throw new ServiceException("客户【" + customerName + "】的附件、税号、开户银行、银行账号不能为空,请先在客户管理中完善!");
|
|
|
|
|
result.setMessage("客户【" + customerName + "】的附件、税号、开户银行、银行账号不能为空,请完善客户信息");
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 订单激活保存前校验甲方客户基础信息
|
|
|
|
|
*
|
|
|
|
|
* @param oneCustomerId 甲方客户ID
|
|
|
|
|
*/
|
|
|
|
|
private void validPartyACustomerForOrderActivate(Long oneCustomerId) {
|
|
|
|
|
ErpPartyACustomerValidateVo result = buildPartyACustomerValidateResult(oneCustomerId);
|
|
|
|
|
if (!Boolean.TRUE.equals(result.getValid())) {
|
|
|
|
|
throw new ServiceException(result.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|