From f375432e7d2fdd126f5b64d4d4d1e96657ba5049 Mon Sep 17 00:00:00 2001 From: paulGao Date: Tue, 13 Sep 2022 11:33:39 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=B8=BA=E9=83=A8=E5=88=86=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=8D=95=E6=8D=89=E6=B7=BB=E5=8A=A0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../limit/interceptor/LimitInterceptor.java | 16 ++++++++-------- .../PreventDuplicateSubmissionsInterceptor.java | 1 + .../service/impl/VerificationServiceImpl.java | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/framework/src/main/java/cn/lili/cache/limit/interceptor/LimitInterceptor.java b/framework/src/main/java/cn/lili/cache/limit/interceptor/LimitInterceptor.java index 402f165df..1be580ceb 100644 --- a/framework/src/main/java/cn/lili/cache/limit/interceptor/LimitInterceptor.java +++ b/framework/src/main/java/cn/lili/cache/limit/interceptor/LimitInterceptor.java @@ -45,21 +45,20 @@ public class LimitInterceptor { @Before("@annotation(limitPointAnnotation)") public void interceptor(LimitPoint limitPointAnnotation) { LimitTypeEnums limitTypeEnums = limitPointAnnotation.limitType(); - String name = limitPointAnnotation.name(); + String key; int limitPeriod = limitPointAnnotation.period(); int limitCount = limitPointAnnotation.limit(); - switch (limitTypeEnums) { - case CUSTOMER: - key = limitPointAnnotation.key(); - break; - default: - key = limitPointAnnotation.key() + IpUtils - .getIpAddress(((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); + if (limitTypeEnums == LimitTypeEnums.CUSTOMER) { + key = limitPointAnnotation.key(); + } else { + key = limitPointAnnotation.key() + IpUtils + .getIpAddress(((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); } ImmutableList keys = ImmutableList.of(StringUtils.join(limitPointAnnotation.prefix(), key)); try { Number count = redisTemplate.execute(limitScript, keys, limitCount, limitPeriod); + assert count != null; log.info("限制请求{}, 当前请求{},缓存key{}", limitCount, count.intValue(), key); //如果缓存里没有值,或者他的值小于限制频率 if (count.intValue() >= limitCount) { @@ -72,6 +71,7 @@ public class LimitInterceptor { } catch (ServiceException e) { throw e; } catch (Exception e) { + log.error("限流异常", e); throw new ServiceException(ResultCode.ERROR); } } diff --git a/framework/src/main/java/cn/lili/common/aop/interceptor/PreventDuplicateSubmissionsInterceptor.java b/framework/src/main/java/cn/lili/common/aop/interceptor/PreventDuplicateSubmissionsInterceptor.java index 8f6decfe2..9a8604442 100644 --- a/framework/src/main/java/cn/lili/common/aop/interceptor/PreventDuplicateSubmissionsInterceptor.java +++ b/framework/src/main/java/cn/lili/common/aop/interceptor/PreventDuplicateSubmissionsInterceptor.java @@ -47,6 +47,7 @@ public class PreventDuplicateSubmissionsInterceptor { } catch (ServiceException e) { throw e; } catch (Exception e) { + log.error("防重复提交拦截器异常", e); throw new ServiceException(ResultCode.ERROR); } } diff --git a/framework/src/main/java/cn/lili/modules/verification/service/impl/VerificationServiceImpl.java b/framework/src/main/java/cn/lili/modules/verification/service/impl/VerificationServiceImpl.java index dd4b5894c..edf3c9f51 100644 --- a/framework/src/main/java/cn/lili/modules/verification/service/impl/VerificationServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/verification/service/impl/VerificationServiceImpl.java @@ -96,6 +96,7 @@ public class VerificationServiceImpl implements VerificationService { } catch (ServiceException e) { throw e; } catch (Exception e) { + log.error("生成验证码失败", e); throw new ServiceException(ResultCode.ERROR); } } From cbdcb6f1ce140b60bbf8dae6c219ab353238817c Mon Sep 17 00:00:00 2001 From: paulGao Date: Wed, 14 Sep 2022 17:11:26 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=BB=A1=E5=87=8F=E6=B4=BB=E5=8A=A8=E5=92=8C=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E6=B4=BB=E5=8A=A8=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/controller/promotion/FullDiscountManagerController.java | 1 - .../java/cn/lili/controller/promotion/CouponStoreController.java | 1 - 2 files changed, 2 deletions(-) diff --git a/manager-api/src/main/java/cn/lili/controller/promotion/FullDiscountManagerController.java b/manager-api/src/main/java/cn/lili/controller/promotion/FullDiscountManagerController.java index 0647cf365..fc640c46b 100644 --- a/manager-api/src/main/java/cn/lili/controller/promotion/FullDiscountManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/promotion/FullDiscountManagerController.java @@ -35,7 +35,6 @@ public class FullDiscountManagerController { @ApiOperation(value = "获取满优惠列表") @GetMapping public ResultMessage> getCouponList(FullDiscountSearchParams searchParams, PageVO page) { - page.setNotConvert(true); return ResultUtil.data(fullDiscountService.pageFindAll(searchParams, page)); } diff --git a/seller-api/src/main/java/cn/lili/controller/promotion/CouponStoreController.java b/seller-api/src/main/java/cn/lili/controller/promotion/CouponStoreController.java index 908442936..7af2c8e26 100644 --- a/seller-api/src/main/java/cn/lili/controller/promotion/CouponStoreController.java +++ b/seller-api/src/main/java/cn/lili/controller/promotion/CouponStoreController.java @@ -41,7 +41,6 @@ public class CouponStoreController { @GetMapping @ApiOperation(value = "获取优惠券列表") public ResultMessage> getCouponList(CouponSearchParams queryParam, PageVO page) { - page.setNotConvert(true); String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId(); queryParam.setStoreId(storeId); IPage coupons = couponService.pageVOFindAll(queryParam, page);