From f386409bcb4c71c078bdfe51137cf84de26f5ce2 Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Wed, 22 Apr 2026 10:49:03 +0800 Subject: [PATCH] refactor: contract payment amount check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1068744@tapd-34675357 --user=陈建星 去掉回款金额不能大于合同金额的限制 https://www.tapd.cn/34675357/s/1909532 --- .../crm/contract/service/ContractPaymentRecordService.java | 6 ------ .../crm/src/main/resources/i18n/cordys-crm_en_US.properties | 1 - .../crm/src/main/resources/i18n/cordys-crm_zh_CN.properties | 1 - 3 files changed, 8 deletions(-) diff --git a/backend/crm/src/main/java/cn/cordys/crm/contract/service/ContractPaymentRecordService.java b/backend/crm/src/main/java/cn/cordys/crm/contract/service/ContractPaymentRecordService.java index 37f3f4b83..2a4288a76 100644 --- a/backend/crm/src/main/java/cn/cordys/crm/contract/service/ContractPaymentRecordService.java +++ b/backend/crm/src/main/java/cn/cordys/crm/contract/service/ContractPaymentRecordService.java @@ -460,16 +460,10 @@ public class ContractPaymentRecordService { if (StringUtils.isNotEmpty(excludeRecordId)) { recordLambdaQueryWrapper.nq(ContractPaymentRecord::getId, excludeRecordId); } - List 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))); - } } /** diff --git a/backend/crm/src/main/resources/i18n/cordys-crm_en_US.properties b/backend/crm/src/main/resources/i18n/cordys-crm_en_US.properties index bd4ec0275..001e1065a 100644 --- a/backend/crm/src/main/resources/i18n/cordys-crm_en_US.properties +++ b/backend/crm/src/main/resources/i18n/cordys-crm_en_US.properties @@ -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 diff --git a/backend/crm/src/main/resources/i18n/cordys-crm_zh_CN.properties b/backend/crm/src/main/resources/i18n/cordys-crm_zh_CN.properties index a6de6c709..a693b4430 100644 --- a/backend/crm/src/main/resources/i18n/cordys-crm_zh_CN.properties +++ b/backend/crm/src/main/resources/i18n/cordys-crm_zh_CN.properties @@ -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=回款记录导入模板