gaoluyang
2 天以前 bd5825f42960b67c23c69fc23c8aa5339cc4d084
feat(erp): 付款单保存支持接收手动修改的合计付款

保存时优先使用传入的 totalPrice,未传时仍按付款明细的本次付款汇总;实际付款=合计付款-优惠金额。

Co-Authored-By: Claude Code <noreply@anthropic.com>
已修改2个文件
8 ■■■■■ 文件已修改
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/vo/payment/ErpFinancePaymentSaveReqVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/finance/ErpFinancePaymentServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/vo/payment/ErpFinancePaymentSaveReqVO.java
@@ -37,6 +37,9 @@
    @NotNull(message = "优惠金额不能为空")
    private BigDecimal discountPrice;
    @Schema(description = "合计付款,单位:元。不传时按付款明细汇总", example = "11600")
    private BigDecimal totalPrice;
    @Schema(description = "备注", example = "你猜")
    private String remark;
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/finance/ErpFinancePaymentServiceImpl.java
@@ -160,7 +160,10 @@
    }
    private void calculateTotalPrice(ErpFinancePaymentDO payment, List<ErpFinancePaymentItemDO> paymentItems) {
        payment.setTotalPrice(getSumValue(paymentItems, ErpFinancePaymentItemDO::getPaymentPrice, BigDecimal::add, BigDecimal.ZERO));
        // 合计付款允许用户手动修改,未传时再按付款明细汇总
        if (payment.getTotalPrice() == null) {
            payment.setTotalPrice(getSumValue(paymentItems, ErpFinancePaymentItemDO::getPaymentPrice, BigDecimal::add, BigDecimal.ZERO));
        }
        payment.setPaymentPrice(payment.getTotalPrice().subtract(payment.getDiscountPrice()));
    }