Просмотр исходного кода

计算优惠使用商品券返回商品信息

qmj 1 неделя назад
Родитель
Сommit
8181ad9e24

+ 3 - 3
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PromotionCalcServiceImpl.java

@@ -239,8 +239,8 @@ public class PromotionCalcServiceImpl implements IPromotionCalcService
                             BigDecimal baseForCoupon = afterPromotion.subtract(newCustomerReduce);
                             baseForCoupon = baseForCoupon.max(BigDecimal.ZERO);
 
-                            if (couponRule.getThreshold() != null
-                                    && baseForCoupon.compareTo(couponRule.getThreshold()) >= 0)
+                            if (couponRule.getThreshold() == null
+                                    || baseForCoupon.compareTo(couponRule.getThreshold()) >= 0)
                             {
                                 if (batch.getCouponType() != null && batch.getCouponType() == 2
                                         && couponRule.getProductId() != null && "A".equals(optimalPath))
@@ -724,7 +724,7 @@ public class PromotionCalcServiceImpl implements IPromotionCalcService
             BigDecimal subtotal = originalAmount.subtract(bestMatch.getReduceAmount())
                     .max(MIN_AMOUNT).setScale(0, RoundingMode.HALF_UP);
             pathResult.put("subtotal", subtotal);
-            pathResult.put("promotionReduce", bestMatch.getReduceAmount());
+            pathResult.put("promotionReduce", originalAmount.subtract(subtotal));
             Map<String, Object> matchedRuleInfo = new LinkedHashMap<>();
             matchedRuleInfo.put("id", bestMatch.getId());
             matchedRuleInfo.put("activityId", bestMatch.getActivityId());