mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-15 02:31:53 +08:00
promotion: 优惠券模板 productSpuIds 改成 productScopeValues
This commit is contained in:
@@ -102,7 +102,7 @@ public class TradeCouponPriceCalculator implements TradePriceCalculator {
|
||||
Predicate<TradePriceCalculateRespBO.OrderItem> matchPredicate = TradePriceCalculateRespBO.OrderItem::getSelected;
|
||||
if (PromotionProductScopeEnum.SPU.getScope().equals(coupon.getProductScope())) {
|
||||
matchPredicate = matchPredicate // 额外加如下条件
|
||||
.and(orderItem -> coupon.getProductSpuIds().contains(orderItem.getSpuId()));
|
||||
.and(orderItem -> coupon.getProductScopeValues().contains(orderItem.getSpuId()));
|
||||
}
|
||||
return filterList(result.getItems(), matchPredicate);
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ public class TradeCouponPriceCalculatorTest extends BaseMockitoUnitTest {
|
||||
|
||||
// mock 方法(优惠劵 Coupon 信息)
|
||||
CouponRespDTO coupon = randomPojo(CouponRespDTO.class, o -> o.setId(1024L).setName("程序员节")
|
||||
.setProductScope(PromotionProductScopeEnum.SPU.getScope()).setProductSpuIds(asList(1L, 2L))
|
||||
.setProductScope(PromotionProductScopeEnum.SPU.getScope()).setProductScopeValues(asList(1L, 2L))
|
||||
.setUsePrice(350).setDiscountType(PromotionDiscountTypeEnum.PERCENT.getType())
|
||||
.setDiscountPercent(50).setDiscountLimitPrice(70));
|
||||
when(couponApi.validateCoupon(eq(new CouponValidReqDTO().setId(1024L).setUserId(233L)))).thenReturn(coupon);
|
||||
|
Reference in New Issue
Block a user