第二件半价券

This commit is contained in:
2025-09-29 15:48:43 +08:00
parent 080be5ac18
commit 76d69a7c5c

View File

@@ -463,7 +463,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
if (param.getOriginAmount().subtract(param.getProductCouponDiscountAmount()).subtract(param.getOtherCouponDiscountAmount()).compareTo(newTotalAmount) != 0) {
log.info("其它优惠券金额不正确:满减金额为:{},折扣金额为:{},买一赠一金额为:{},第二件半价券金额为:{} 传递为:{}",
fullReductionAmount.getPrice(), rateAmount.getPrice(), oneGiftAmount.getPrice(), twoHalfAmount.getPrice(), param.getOtherCouponDiscountAmount());
throw new ValidateException("生成支付订单失败,商品优惠券优惠金额不正确");
throw new ValidateException("生成支付订单失败,其它优惠券金额不正确");
}
//新客立减
if (shopUser != null) {
@@ -677,7 +677,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
private void twoHalfCalculate(List<OrderDetail> orderDetails, boolean isAllFoods, List<Long> couponFoodIds, boolean isAsc, BigDecimalDTO oneGiftAmount) {
orderDetails = getDetailsSort(orderDetails, isAsc);
for (OrderDetail detail : orderDetails) {
if ((isAllFoods || couponFoodIds.contains(detail.getProductId())) && couponFoodIds.contains(detail.getProductId())
if ((isAllFoods || couponFoodIds.contains(detail.getProductId()))
&& detail.getUnitPrice().compareTo(BigDecimal.ZERO) > 0
&& detail.getNum().subtract(detail.getReturnNum()).subtract(detail.getCouponNum()).compareTo(BigDecimal.TWO) >= 0) {
detail.setHalfPriceCouponNum(BigDecimal.ONE);