Commit 6b06bf8a3da6afca15e22755ab8e39116f986b8f
1 parent
da6e01f6
bugfix MALL:已过期的优惠劵,还显示可以使用
Showing
1 changed file
with
4 additions
and
1 deletions
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java
| ... | ... | @@ -194,9 +194,12 @@ public class CouponServiceImpl implements CouponService { |
| 194 | 194 | |
| 195 | 195 | @Override |
| 196 | 196 | public List<CouponDO> getMatchCouponList(Long userId, AppCouponMatchReqVO matchReqVO) { |
| 197 | - return couponMapper.selectListByUserIdAndStatusAndUsePriceLeAndProductScope(userId, | |
| 197 | + List<CouponDO> list = couponMapper.selectListByUserIdAndStatusAndUsePriceLeAndProductScope(userId, | |
| 198 | 198 | CouponStatusEnum.UNUSED.getStatus(), |
| 199 | 199 | matchReqVO.getPrice(), matchReqVO.getSpuIds(), matchReqVO.getCategoryIds()); |
| 200 | + // 兜底逻辑:如果 CouponExpireJob 未执行,status 未变成 EXPIRE ,但是 validEndTime 已经过期了,需要进行过滤 | |
| 201 | + list.removeIf(coupon -> !LocalDateTimeUtils.isBetween(coupon.getValidStartTime(), coupon.getValidEndTime())); | |
| 202 | + return list; | |
| 200 | 203 | } |
| 201 | 204 | |
| 202 | 205 | @Override | ... | ... |