mirror of
https://github.com/1Panel-dev/CordysCRM.git
synced 2026-05-14 03:02:10 +08:00
refactor: contract payment amount check
--bug=1068744@tapd-34675357 --user=陈建星 去掉回款金额不能大于合同金额的限制 https://www.tapd.cn/34675357/s/1909532
This commit is contained in:
@@ -460,16 +460,10 @@ public class ContractPaymentRecordService {
|
||||
if (StringUtils.isNotEmpty(excludeRecordId)) {
|
||||
recordLambdaQueryWrapper.nq(ContractPaymentRecord::getId, excludeRecordId);
|
||||
}
|
||||
List<ContractPaymentRecord> contractPaymentRecords = contractPaymentRecordMapper.selectListByLambda(recordLambdaQueryWrapper);
|
||||
BigDecimal alreadyPay = contractPaymentRecords.stream().map(ContractPaymentRecord::getRecordAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
Contract contract = contractMapper.selectByPrimaryKey(contractId);
|
||||
if (contract == null) {
|
||||
throw new GenericException(Translator.get("contract.not.exist"));
|
||||
}
|
||||
BigDecimal contractAmount = Optional.ofNullable(contract.getAmount()).orElse(BigDecimal.ZERO);
|
||||
if ((alreadyPay.add(payAmount)).compareTo(contractAmount) > 0) {
|
||||
throw new GenericException(Translator.getWithArgs("record.amount.exceed", contractAmount.subtract(alreadyPay)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -778,7 +778,6 @@ business_title.not.exist=Business title not exist
|
||||
business_title.exist=Business title exist
|
||||
business_title_import_tpl.name=Business_title_import_template
|
||||
# contract payment record
|
||||
record.amount.exceed=The amount exceeded! The remaining contract payment amount is {0}.
|
||||
record.not.exist=Payment record does not exist
|
||||
record.amount.illegal=Payment amount must be greater than 0
|
||||
payment.record.import_tpl.name=Payment_record_import_template
|
||||
|
||||
@@ -778,7 +778,6 @@ business_title.not.exist=工商抬头不存在
|
||||
business_title.exist=工商抬头已存在
|
||||
business_title_import_tpl.name=工商抬头导入模板
|
||||
# contract payment record
|
||||
record.amount.exceed=金额超出! 剩余合同回款额为 {0}。
|
||||
record.amount.illegal=回款金额需大于0
|
||||
record.not.exist=回款记录不存在
|
||||
payment.record.import_tpl.name=回款记录导入模板
|
||||
|
||||
Reference in New Issue
Block a user