促销金额大于商品金额的极端情况显示问题处理
This commit is contained in:
parent
3af0031214
commit
b1e70ebf12
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user