feat(erp): 付款单保存支持接收手动修改的合计付款
保存时优先使用传入的 totalPrice,未传时仍按付款明细的本次付款汇总;实际付款=合计付款-优惠金额。
Co-Authored-By: Claude Code <noreply@anthropic.com>
| | |
| | | @NotNull(message = "优惠金额不能为空") |
| | | private BigDecimal discountPrice; |
| | | |
| | | @Schema(description = "合计付款,单位:元。不传时按付款明细汇总", example = "11600") |
| | | private BigDecimal totalPrice; |
| | | |
| | | @Schema(description = "备注", example = "你猜") |
| | | private String remark; |
| | | |
| | |
| | | } |
| | | |
| | | 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())); |
| | | } |
| | | |