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; }