From b1e70ebf12503f7cede463d8e8455566d7468f74 Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 24 Dec 2021 15:46:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=83=E9=94=80=E9=87=91=E9=A2=9D=E5=A4=A7?= =?UTF-8?q?=E4=BA=8E=E5=95=86=E5=93=81=E9=87=91=E9=A2=9D=E7=9A=84=E6=9E=81?= =?UTF-8?q?=E7=AB=AF=E6=83=85=E5=86=B5=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/order/entity/dto/PriceDetailDTO.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java b/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java index b03e1a51..15724eb7 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java @@ -349,14 +349,30 @@ public class PriceDetailDTO implements Serializable { public void setDiscountPrice(Double discountPrice) { this.discountPrice = discountPrice; + promotionPriceHandler(); this.recount(); } public void setCouponPrice(Double couponPrice) { this.couponPrice = couponPrice; + promotionPriceHandler(); this.recount(); } + /** + * 如果促销金额+优惠券金额大于商品金额问题处理 + */ + private void promotionPriceHandler() { + if (couponPrice == null || discountPrice == null) { + return; + } + //如果订单优惠总额>商品金额,则处理一下数据,使得两数相加<=商品金额 + if (CurrencyUtil.add(couponPrice, discountPrice) > goodsPrice) { + couponPrice = CurrencyUtil.sub(goodsPrice, discountPrice); + this.setCouponPrice(couponPrice); + } + } + public void setDistributionCommission(Double distributionCommission) { this.distributionCommission = distributionCommission; this.recount();