【BUG】解决会员计算时,金额太大int类型装不下的问题

This commit is contained in:
痴货 2024-09-14 20:02:29 +08:00
parent 7ef329f57a
commit 2bca9ef490
2 changed files with 5 additions and 2 deletions

View File

@ -72,7 +72,7 @@ public class TradePriceCalculateRespBO {
/**
* 是否包邮
*/
private Boolean freeDelivery;
private Boolean freeDelivery = false;
/**
* 赠送的优惠劵

View File

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