Commit 71efa0ed6f7c684f11f74606ddd0268cfe6c2b0e
1 parent
8bbaaf1c
promotion: 订单使用品类券时,根据品类过滤可用商品
Showing
1 changed file
with
3 additions
and
0 deletions
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeCouponPriceCalculator.java
| ... | ... | @@ -103,6 +103,9 @@ public class TradeCouponPriceCalculator implements TradePriceCalculator { |
| 103 | 103 | if (PromotionProductScopeEnum.SPU.getScope().equals(coupon.getProductScope())) { |
| 104 | 104 | matchPredicate = matchPredicate // 额外加如下条件 |
| 105 | 105 | .and(orderItem -> coupon.getProductScopeValues().contains(orderItem.getSpuId())); |
| 106 | + } else if (PromotionProductScopeEnum.CATEGORY.getScope().equals(coupon.getProductScope())) { | |
| 107 | + matchPredicate = matchPredicate // 额外加如下条件 | |
| 108 | + .and(orderItem -> coupon.getProductScopeValues().contains(orderItem.getCategoryId())); | |
| 106 | 109 | } |
| 107 | 110 | return filterList(result.getItems(), matchPredicate); |
| 108 | 111 | } | ... | ... |