From 6b06bf8a3da6afca15e22755ab8e39116f986b8f Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 1 Mar 2024 13:55:37 +0800 Subject: [PATCH] bugfix MALL:已过期的优惠劵,还显示可以使用 --- yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java index 51f1d22..f281987 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java +++ b/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 { @Override public List getMatchCouponList(Long userId, AppCouponMatchReqVO matchReqVO) { - return couponMapper.selectListByUserIdAndStatusAndUsePriceLeAndProductScope(userId, + List list = couponMapper.selectListByUserIdAndStatusAndUsePriceLeAndProductScope(userId, CouponStatusEnum.UNUSED.getStatus(), matchReqVO.getPrice(), matchReqVO.getSpuIds(), matchReqVO.getCategoryIds()); + // 兜底逻辑:如果 CouponExpireJob 未执行,status 未变成 EXPIRE ,但是 validEndTime 已经过期了,需要进行过滤 + list.removeIf(coupon -> !LocalDateTimeUtils.isBetween(coupon.getValidStartTime(), coupon.getValidEndTime())); + return list; } @Override -- libgit2 0.21.4