From 2bca9ef490d19f6a99492f32915931c59a62f1b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=97=B4=E8=B4=A7?= <252048765@qq.com> Date: Sat, 14 Sep 2024 20:02:29 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90BUG=E3=80=91=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E8=AE=A1=E7=AE=97=E6=97=B6=EF=BC=8C=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E5=A4=AA=E5=A4=A7int=E7=B1=BB=E5=9E=8B=E8=A3=85?= =?UTF-8?q?=E4=B8=8D=E4=B8=8B=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trade/service/price/bo/TradePriceCalculateRespBO.java | 2 +- .../calculator/TradeDiscountActivityPriceCalculator.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/bo/TradePriceCalculateRespBO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/bo/TradePriceCalculateRespBO.java index e1ee66b96..2ad327208 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/bo/TradePriceCalculateRespBO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/bo/TradePriceCalculateRespBO.java @@ -72,7 +72,7 @@ public class TradePriceCalculateRespBO { /** * 是否包邮 */ - private Boolean freeDelivery; + private Boolean freeDelivery = false; /** * 赠送的优惠劵 diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeDiscountActivityPriceCalculator.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeDiscountActivityPriceCalculator.java index eaf07b6a4..37869b6f7 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeDiscountActivityPriceCalculator.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeDiscountActivityPriceCalculator.java @@ -18,6 +18,8 @@ import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import jakarta.annotation.Resource; + +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -171,7 +173,8 @@ public class TradeDiscountActivityPriceCalculator implements TradePriceCalculato if (discountPercent == null) { return 0; } - Integer newPrice = price * discountPercent / 100; + BigDecimal divide = new BigDecimal(price).multiply(new BigDecimal(discountPercent)).divide(new BigDecimal(100)); + Integer newPrice = divide.intValue(); return price - newPrice; }