Commit 2dcc8f46 by 章家宝

feat:如果优惠券已经过期,则不再发通知

1 parent ea4da463
......@@ -203,7 +203,12 @@ public class CouponAccountService {
return null;
}
List<CouponAccount> pendingCoupons = couponAccountRepository.findByCouponIdInAndDeleteFlag(couponIdList, DeleteFlag.NOT_DELETED.getCode());
if (pendingCoupons.isEmpty()) {
// 过滤掉已过期的优惠券,过期券不再有通知
List<CouponAccount> validCoupons = pendingCoupons.stream()
.filter(c -> c.getValidEndTime() != null && c.getValidEndTime().isAfter(now))
.toList();
if (validCoupons.isEmpty()) {
return null;
}
......@@ -212,8 +217,8 @@ public class CouponAccountService {
// 构建弹窗响应
CouponPopupRespVO popupVO = new CouponPopupRespVO();
popupVO.setPopupType(determinePopupType(pendingCoupons));
popupVO.setCouponList(couponConverter.couponAccountsMapPopupCouponVO(pendingCoupons));
popupVO.setPopupType(determinePopupType(validCoupons));
popupVO.setCouponList(couponConverter.couponAccountsMapPopupCouponVO(validCoupons));
return popupVO;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!