Showing
1 changed file
with
14 additions
and
3 deletions
@@ -223,7 +223,13 @@ public class CouponServiceImpl implements ICouponService { | @@ -223,7 +223,13 @@ public class CouponServiceImpl implements ICouponService { | ||
223 | // 批量获取coupon | 223 | // 批量获取coupon |
224 | List<String> couponIdList = list.stream().map(UserCoupon::getCouponToken).collect(Collectors.toList()); | 224 | List<String> couponIdList = list.stream().map(UserCoupon::getCouponToken).collect(Collectors.toList()); |
225 | List<Coupon> couponList = couponCacheService.getCouponsWithCache(couponIdList); | 225 | List<Coupon> couponList = couponCacheService.getCouponsWithCache(couponIdList); |
226 | - Map<Integer, Coupon> couponMap = couponList.stream().collect(Collectors.toMap(Coupon::getId, Function.identity())); | 226 | + Map<Integer, Coupon> couponMap = couponList.stream().filter(coupon -> { |
227 | + if (coupon.getStatus()!=null && coupon.getStatus().intValue() == CouponsStatusEnum.VALID.getCode()){ | ||
228 | + return true; | ||
229 | + }else{ | ||
230 | + return false; | ||
231 | + } | ||
232 | + }).collect(Collectors.toMap(Coupon::getId, Function.identity())); | ||
227 | 233 | ||
228 | // 优惠券商品限制 key=couponId, value=ProductId集合 | 234 | // 优惠券商品限制 key=couponId, value=ProductId集合 |
229 | Map<Integer, List<Integer>> couponProductIdMap = getProductIdListMap(couponList); | 235 | Map<Integer, List<Integer>> couponProductIdMap = getProductIdListMap(couponList); |
@@ -277,8 +283,13 @@ public class CouponServiceImpl implements ICouponService { | @@ -277,8 +283,13 @@ public class CouponServiceImpl implements ICouponService { | ||
277 | // 批量获取coupon | 283 | // 批量获取coupon |
278 | List<String> couponIdList = list.stream().map(UserCoupon::getCouponToken).collect(Collectors.toList()); | 284 | List<String> couponIdList = list.stream().map(UserCoupon::getCouponToken).collect(Collectors.toList()); |
279 | List<Coupon> couponList = couponCacheService.getCouponsWithCache(couponIdList); | 285 | List<Coupon> couponList = couponCacheService.getCouponsWithCache(couponIdList); |
280 | - Map<Integer, Coupon> couponMap = couponList.stream().collect(Collectors.toMap(Coupon::getId, Function.identity())); | ||
281 | - | 286 | + Map<Integer, Coupon> couponMap = couponList.stream().filter(coupon -> { |
287 | + if (coupon.getStatus()!=null && coupon.getStatus().intValue() == CouponsStatusEnum.VALID.getCode()){ | ||
288 | + return true; | ||
289 | + }else{ | ||
290 | + return false; | ||
291 | + } | ||
292 | + }).collect(Collectors.toMap(Coupon::getId, Function.identity())); | ||
282 | 293 | ||
283 | List<CouponInfo> couponInfoList = list.stream().map(userCoupon -> { | 294 | List<CouponInfo> couponInfoList = list.stream().map(userCoupon -> { |
284 | 295 |
-
Please register or login to post a comment