Commit a81169ab8d11c159c9ed8685c8cfa9a9eaf8a47c
1 parent
8a179860
【BUG】修改会员管理不能发送电子券的功能
Showing
2 changed files
with
3 additions
and
2 deletions
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/coupon/CouponTemplateMapper.java
| ... | ... | @@ -70,7 +70,7 @@ public interface CouponTemplateMapper extends BaseMapperX<CouponTemplateDO> { |
| 70 | 70 | .in(CouponTemplateDO::getTakeType, canTakeTypes) // 2. 领取方式一致 |
| 71 | 71 | .and(ww -> ww.gt(CouponTemplateDO::getValidEndTime, LocalDateTime.now()) // 3.1 未过期 |
| 72 | 72 | .or().eq(CouponTemplateDO::getValidityType, CouponTemplateValidityTypeEnum.TERM.getType())) // 3.2 领取之后 |
| 73 | - .apply(" (take_count < total_count OR total_count = -1 )"); // 4. 剩余数量大于 0,或者无限领取 | |
| 73 | + .apply(" (take_count < total_count OR total_count = -1 or total_count is null)"); // 4. 剩余数量大于 0,或者无限领取,或者是指定发放的券 | |
| 74 | 74 | } |
| 75 | 75 | return canTakeConsumer; |
| 76 | 76 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java
| ... | ... | @@ -288,6 +288,7 @@ public class CouponServiceImpl implements CouponService { |
| 288 | 288 | } |
| 289 | 289 | // 校验剩余数量(仅在 CouponTakeTypeEnum.USER 用户领取时) |
| 290 | 290 | if (CouponTakeTypeEnum.isUser(couponTemplate.getTakeCount()) |
| 291 | + && couponTemplate.getTotalCount() != null | |
| 291 | 292 | && couponTemplate.getTakeCount() + userIds.size() > couponTemplate.getTotalCount()) { |
| 292 | 293 | throw exception(COUPON_TEMPLATE_NOT_ENOUGH); |
| 293 | 294 | } |
| ... | ... | @@ -310,7 +311,7 @@ public class CouponServiceImpl implements CouponService { |
| 310 | 311 | * @param couponTemplate 优惠劵模版 |
| 311 | 312 | */ |
| 312 | 313 | private void removeTakeLimitUser(Set<Long> userIds, CouponTemplateDO couponTemplate) { |
| 313 | - if (couponTemplate.getTakeLimitCount() <= 0) { | |
| 314 | + if (couponTemplate.getTakeLimitCount() == null || couponTemplate.getTakeLimitCount() <= 0) { | |
| 314 | 315 | return; |
| 315 | 316 | } |
| 316 | 317 | // 查询已领过券的用户 | ... | ... |