From 68c1113ed1dad674de647a1c99a68e18f45da16e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 2 Sep 2023 00:32:16 +0800 Subject: [PATCH] =?UTF-8?q?code=20review=EF=BC=9A=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=8A=B5=E5=8F=91=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../promotion/service/coupon/CouponServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 66aa9e7d8..115818548 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 @@ -138,9 +138,9 @@ public class CouponServiceImpl implements CouponService { public void takeCoupon(Long templateId, Set userIds, CouponTakeTypeEnum takeType) { CouponTemplateDO template = couponTemplateService.getCouponTemplate(templateId); // 1. 过滤掉达到领取限制的用户 - removeTakeLimitUserId(userIds, template); + removeTakeLimitUser(userIds, template); // 2. 校验优惠劵是否可以领取 - validateCanTake(template, userIds, takeType); + validateCouponTemplateCanTake(template, userIds, takeType); // 3. 批量保存优惠劵 couponMapper.insertBatch(convertList(userIds, userId -> CouponConvert.INSTANCE.convert(template, userId))); @@ -156,7 +156,7 @@ public class CouponServiceImpl implements CouponService { * @param userIds 领取人列表 * @param takeType 领取方式 */ - private void validateCanTake(CouponTemplateDO couponTemplate, Set userIds, CouponTakeTypeEnum takeType) { + private void validateCouponTemplateCanTake(CouponTemplateDO couponTemplate, Set userIds, CouponTakeTypeEnum takeType) { // 如果所有用户都领取过,则抛出异常 if (CollUtil.isEmpty(userIds)) { throw exception(COUPON_TEMPLATE_USER_ALREADY_TAKE); @@ -188,7 +188,7 @@ public class CouponServiceImpl implements CouponService { * @param userIds 用户编号数组 * @param couponTemplate 优惠劵模版 */ - private void removeTakeLimitUserId(Set userIds, CouponTemplateDO couponTemplate) { + private void removeTakeLimitUser(Set userIds, CouponTemplateDO couponTemplate) { if (couponTemplate.getTakeLimitCount() <= 0) { return; }