|
@@ -404,7 +404,7 @@ public class PromotionCalcServiceImpl implements IPromotionCalcService
|
|
|
// ---- 11. 可用优惠券列表 ----
|
|
// ---- 11. 可用优惠券列表 ----
|
|
|
List<Map<String, Object>> availableCouponMaps = buildAvailableCoupons(storeId, userId,
|
|
List<Map<String, Object>> availableCouponMaps = buildAvailableCoupons(storeId, userId,
|
|
|
originalAmount, afterPromotion, promotionReduce, itemsWithPrice,
|
|
originalAmount, afterPromotion, promotionReduce, itemsWithPrice,
|
|
|
- rulesByProduct, activityMap, priceMap, nameMap);
|
|
|
|
|
|
|
+ rulesByProduct, activityMap, priceMap, nameMap, optimalPath);
|
|
|
response.setAvailableCoupons(availableCouponMaps.stream()
|
|
response.setAvailableCoupons(availableCouponMaps.stream()
|
|
|
.map(this::toAvailableCoupon)
|
|
.map(this::toAvailableCoupon)
|
|
|
.collect(Collectors.toList()));
|
|
.collect(Collectors.toList()));
|
|
@@ -850,7 +850,8 @@ public class PromotionCalcServiceImpl implements IPromotionCalcService
|
|
|
Map<Long, List<PromotionActivityRule>> rulesByProduct,
|
|
Map<Long, List<PromotionActivityRule>> rulesByProduct,
|
|
|
Map<Long, PromotionActivity> activityMap,
|
|
Map<Long, PromotionActivity> activityMap,
|
|
|
Map<Long, BigDecimal> priceMap,
|
|
Map<Long, BigDecimal> priceMap,
|
|
|
- Map<Long, String> nameMap)
|
|
|
|
|
|
|
+ Map<Long, String> nameMap,
|
|
|
|
|
+ String optimalPath)
|
|
|
{
|
|
{
|
|
|
List<Map<String, Object>> available = new ArrayList<>();
|
|
List<Map<String, Object>> available = new ArrayList<>();
|
|
|
if (userId == null)
|
|
if (userId == null)
|
|
@@ -923,6 +924,24 @@ public class PromotionCalcServiceImpl implements IPromotionCalcService
|
|
|
{
|
|
{
|
|
|
usable = false;
|
|
usable = false;
|
|
|
}
|
|
}
|
|
|
|
|
+ // 商品券对应的商品如在折扣/第二份半价活动中且 Path A 生效, 则不可用(避免折上折, spec FR-022)
|
|
|
|
|
+ if (usable && "A".equals(optimalPath))
|
|
|
|
|
+ {
|
|
|
|
|
+ List<PromotionActivityRule> productRules = rulesByProduct.get(rule.getProductId());
|
|
|
|
|
+ if (productRules != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ boolean inDiscount = productRules.stream().anyMatch(r ->
|
|
|
|
|
+ {
|
|
|
|
|
+ PromotionActivity act = activityMap.get(r.getActivityId());
|
|
|
|
|
+ return act != null && (act.getType() == 2 || act.getType() == 3);
|
|
|
|
|
+ });
|
|
|
|
|
+ if (inDiscount)
|
|
|
|
|
+ {
|
|
|
|
|
+ usable = false;
|
|
|
|
|
+ couponInfo.put("conflictWithPromotion", true);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
couponInfo.put("usable", usable);
|
|
couponInfo.put("usable", usable);
|