满减活动 门槛计算
This commit is contained in:
@@ -870,31 +870,6 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 满减券/折扣券 门槛计算
|
|
||||||
*
|
|
||||||
* @param couponFoodIds 门槛商品
|
|
||||||
*/
|
|
||||||
private void thresholdCalculate(List<OrderDetail> orderDetails, boolean isAllFoods, List<Long> couponFoodIds, BigDecimal thresholdAmount) {
|
|
||||||
if (thresholdAmount.compareTo(BigDecimal.ZERO) == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BigDecimal foodsAmount = BigDecimal.ZERO;
|
|
||||||
for (OrderDetail detail : orderDetails) {
|
|
||||||
if ((isAllFoods || couponFoodIds.contains(detail.getProductId()))
|
|
||||||
&& detail.getUnitPrice().compareTo(BigDecimal.ZERO) > 0
|
|
||||||
&& detail.getNum().subtract(detail.getReturnNum()).subtract(detail.getCouponNum()).compareTo(BigDecimal.ONE) >= 0) {
|
|
||||||
foodsAmount = foodsAmount.add(detail.getPayAmount());
|
|
||||||
if (foodsAmount.compareTo(thresholdAmount) >= 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (foodsAmount.compareTo(thresholdAmount) < 0) {
|
|
||||||
throw new CzgException("优惠券未达到门槛金额");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取价格排序后的orderDetail
|
* 获取价格排序后的orderDetail
|
||||||
*
|
*
|
||||||
@@ -924,7 +899,13 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
if (orderDetail.getIsGift() == 1 || orderDetail.getIsTemporary() == 1) {
|
if (orderDetail.getIsGift() == 1 || orderDetail.getIsTemporary() == 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
originalPrice = originalPrice.add(orderDetail.getPayAmount());
|
if (orderDetail.getDiscountSaleAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
BigDecimal num = orderDetail.getNum().subtract(orderDetail.getReturnNum());
|
||||||
|
//单品改价 按原价计算门槛金额
|
||||||
|
originalPrice = originalPrice.add(orderDetail.getPrice().multiply(num).setScale(2, RoundingMode.HALF_UP));
|
||||||
|
} else {
|
||||||
|
originalPrice = originalPrice.add(orderDetail.getPayAmount());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
originalPrice = originalPrice.add(packPrice).add(seatPrice);
|
originalPrice = originalPrice.add(packPrice).add(seatPrice);
|
||||||
for (MkDiscountThreshold threshold : discountAct.getThresholds()) {
|
for (MkDiscountThreshold threshold : discountAct.getThresholds()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user