Authored by tanling

优惠券

... ... @@ -223,7 +223,13 @@ public class CouponServiceImpl implements ICouponService {
// 批量获取coupon
List<String> couponIdList = list.stream().map(UserCoupon::getCouponToken).collect(Collectors.toList());
List<Coupon> couponList = couponCacheService.getCouponsWithCache(couponIdList);
Map<Integer, Coupon> couponMap = couponList.stream().collect(Collectors.toMap(Coupon::getId, Function.identity()));
Map<Integer, Coupon> couponMap = couponList.stream().filter(coupon -> {
if (coupon.getStatus()!=null && coupon.getStatus().intValue() == CouponsStatusEnum.VALID.getCode()){
return true;
}else{
return false;
}
}).collect(Collectors.toMap(Coupon::getId, Function.identity()));
// 优惠券商品限制 key=couponId, value=ProductId集合
Map<Integer, List<Integer>> couponProductIdMap = getProductIdListMap(couponList);
... ... @@ -277,8 +283,13 @@ public class CouponServiceImpl implements ICouponService {
// 批量获取coupon
List<String> couponIdList = list.stream().map(UserCoupon::getCouponToken).collect(Collectors.toList());
List<Coupon> couponList = couponCacheService.getCouponsWithCache(couponIdList);
Map<Integer, Coupon> couponMap = couponList.stream().collect(Collectors.toMap(Coupon::getId, Function.identity()));
Map<Integer, Coupon> couponMap = couponList.stream().filter(coupon -> {
if (coupon.getStatus()!=null && coupon.getStatus().intValue() == CouponsStatusEnum.VALID.getCode()){
return true;
}else{
return false;
}
}).collect(Collectors.toMap(Coupon::getId, Function.identity()));
List<CouponInfo> couponInfoList = list.stream().map(userCoupon -> {
... ...