【BUG】修改会员管理不能发送电子券的功能

This commit is contained in:
痴货 2024-09-14 19:49:58 +08:00
parent 8a1798607c
commit a81169ab8d
2 changed files with 3 additions and 2 deletions

View File

@ -70,7 +70,7 @@ public interface CouponTemplateMapper extends BaseMapperX<CouponTemplateDO> {
.in(CouponTemplateDO::getTakeType, canTakeTypes) // 2. 领取方式一致 .in(CouponTemplateDO::getTakeType, canTakeTypes) // 2. 领取方式一致
.and(ww -> ww.gt(CouponTemplateDO::getValidEndTime, LocalDateTime.now()) // 3.1 未过期 .and(ww -> ww.gt(CouponTemplateDO::getValidEndTime, LocalDateTime.now()) // 3.1 未过期
.or().eq(CouponTemplateDO::getValidityType, CouponTemplateValidityTypeEnum.TERM.getType())) // 3.2 领取之后 .or().eq(CouponTemplateDO::getValidityType, CouponTemplateValidityTypeEnum.TERM.getType())) // 3.2 领取之后
.apply(" (take_count < total_count OR total_count = -1 )"); // 4. 剩余数量大于 0或者无限领取 .apply(" (take_count < total_count OR total_count = -1 or total_count is null)"); // 4. 剩余数量大于 0或者无限领取,或者是指定发放的券
} }
return canTakeConsumer; return canTakeConsumer;
} }

View File

@ -288,6 +288,7 @@ public class CouponServiceImpl implements CouponService {
} }
// 校验剩余数量仅在 CouponTakeTypeEnum.USER 用户领取时 // 校验剩余数量仅在 CouponTakeTypeEnum.USER 用户领取时
if (CouponTakeTypeEnum.isUser(couponTemplate.getTakeCount()) if (CouponTakeTypeEnum.isUser(couponTemplate.getTakeCount())
&& couponTemplate.getTotalCount() != null
&& couponTemplate.getTakeCount() + userIds.size() > couponTemplate.getTotalCount()) { && couponTemplate.getTakeCount() + userIds.size() > couponTemplate.getTotalCount()) {
throw exception(COUPON_TEMPLATE_NOT_ENOUGH); throw exception(COUPON_TEMPLATE_NOT_ENOUGH);
} }
@ -310,7 +311,7 @@ public class CouponServiceImpl implements CouponService {
* @param couponTemplate 优惠劵模版 * @param couponTemplate 优惠劵模版
*/ */
private void removeTakeLimitUser(Set<Long> userIds, CouponTemplateDO couponTemplate) { private void removeTakeLimitUser(Set<Long> userIds, CouponTemplateDO couponTemplate) {
if (couponTemplate.getTakeLimitCount() <= 0) { if (couponTemplate.getTakeLimitCount() == null || couponTemplate.getTakeLimitCount() <= 0) {
return; return;
} }
// 查询已领过券的用户 // 查询已领过券的用户