From c7cc39af74d48cdb249f9f7c62d99a20314210df Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期一, 21 十一月 2022 12:19:48 +0800 Subject: [PATCH] 兼容Excel下拉框内容过多无法显示的问题(I5XB6I) --- src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java | 36 +++++------------------------------- 1 files changed, 5 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java b/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java index daee82f..1f47d7a 100644 --- a/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java +++ b/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java @@ -4,10 +4,8 @@ import java.util.Collections; import java.util.List; import org.aspectj.lang.JoinPoint; -import org.aspectj.lang.Signature; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; -import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,17 +47,9 @@ this.limitScript = limitScript; } - // 閰嶇疆缁囧叆鐐� - @Pointcut("@annotation(com.ruoyi.framework.aspectj.lang.annotation.RateLimiter)") - public void rateLimiterPointCut() + @Before("@annotation(rateLimiter)") + public void doBefore(JoinPoint point, RateLimiter rateLimiter) throws Throwable { - } - - @Before("rateLimiterPointCut()") - public void doBefore(JoinPoint point) throws Throwable - { - RateLimiter rateLimiter = getAnnotationRateLimiter(point); - String key = rateLimiter.key(); int time = rateLimiter.time(); int count = rateLimiter.count(); @@ -70,9 +60,9 @@ Long number = redisTemplate.execute(limitScript, keys, count, time); if (StringUtils.isNull(number) || number.intValue() > count) { - throw new ServiceException("璁块棶杩囦簬棰戠箒锛岃绋嶅悗鍐嶈瘯"); + throw new ServiceException("璁块棶杩囦簬棰戠箒锛岃绋嶅�欏啀璇�"); } - log.info("闄愬埗璇锋眰'{}',褰撳墠璇锋眰'{}',缂撳瓨key'{}'", count, number.intValue(), key); + log.info("闄愬埗璇锋眰'{}',褰撳墠璇锋眰'{}',缂撳瓨key'{}'", count, number.intValue(), combineKey); } catch (ServiceException e) { @@ -80,24 +70,8 @@ } catch (Exception e) { - throw new RuntimeException("鏈嶅姟鍣ㄩ檺娴佸紓甯革紝璇风◢鍚庡啀璇�"); + throw new RuntimeException("鏈嶅姟鍣ㄩ檺娴佸紓甯革紝璇风◢鍊欏啀璇�"); } - } - - /** - * 鏄惁瀛樺湪娉ㄨВ锛屽鏋滃瓨鍦ㄥ氨鑾峰彇 - */ - private RateLimiter getAnnotationRateLimiter(JoinPoint joinPoint) - { - Signature signature = joinPoint.getSignature(); - MethodSignature methodSignature = (MethodSignature) signature; - Method method = methodSignature.getMethod(); - - if (method != null) - { - return method.getAnnotation(RateLimiter.class); - } - return null; } public String getCombineKey(RateLimiter rateLimiter, JoinPoint point) -- Gitblit v1.9.3