From 8660db3bb35945a5ffcafca0cbca5ee475c2e8cd Mon Sep 17 00:00:00 2001 From: dhb52 <dhb52@126.com> Date: 星期二, 02 一月 2024 18:13:46 +0800 Subject: [PATCH] fix: powerjob反向代理添加fonts,修复fontawesome显示 --- ruoyi-common/ruoyi-common-idempotent/src/main/java/org/dromara/common/idempotent/aspectj/RepeatSubmitAspect.java | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ruoyi-common/ruoyi-common-idempotent/src/main/java/org/dromara/common/idempotent/aspectj/RepeatSubmitAspect.java b/ruoyi-common/ruoyi-common-idempotent/src/main/java/org/dromara/common/idempotent/aspectj/RepeatSubmitAspect.java index 016fe0f..553d0db 100644 --- a/ruoyi-common/ruoyi-common-idempotent/src/main/java/org/dromara/common/idempotent/aspectj/RepeatSubmitAspect.java +++ b/ruoyi-common/ruoyi-common-idempotent/src/main/java/org/dromara/common/idempotent/aspectj/RepeatSubmitAspect.java @@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.crypto.SecureUtil; import org.dromara.common.core.constant.GlobalConstants; +import org.dromara.common.core.context.ThreadLocalHolder; import org.dromara.common.core.domain.R; import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.utils.MessageUtils; @@ -36,7 +37,7 @@ @Aspect public class RepeatSubmitAspect { - private static final ThreadLocal<String> KEY_CACHE = new ThreadLocal<>(); + private static final String KEY_CACHE = "keyCache"; @Before("@annotation(repeatSubmit)") public void doBefore(JoinPoint point, RepeatSubmit repeatSubmit) throws Throwable { @@ -59,7 +60,7 @@ // 鍞竴鏍囪瘑锛堟寚瀹歬ey + url + 娑堟伅澶达級 String cacheRepeatKey = GlobalConstants.REPEAT_SUBMIT_KEY + url + submitKey; if (RedisUtils.setObjectIfAbsent(cacheRepeatKey, "", Duration.ofMillis(interval))) { - KEY_CACHE.set(cacheRepeatKey); + ThreadLocalHolder.set(KEY_CACHE, cacheRepeatKey); } else { String message = repeatSubmit.message(); if (StringUtils.startsWith(message, "{") && StringUtils.endsWith(message, "}")) { @@ -82,9 +83,10 @@ if (r.getCode() == R.SUCCESS) { return; } - RedisUtils.deleteObject(KEY_CACHE.get()); + String cacheKey = ThreadLocalHolder.get(KEY_CACHE); + RedisUtils.deleteObject(cacheKey); } finally { - KEY_CACHE.remove(); + ThreadLocalHolder.remove(KEY_CACHE); } } } @@ -97,8 +99,9 @@ */ @AfterThrowing(value = "@annotation(repeatSubmit)", throwing = "e") public void doAfterThrowing(JoinPoint joinPoint, RepeatSubmit repeatSubmit, Exception e) { - RedisUtils.deleteObject(KEY_CACHE.get()); - KEY_CACHE.remove(); + String cacheKey = ThreadLocalHolder.get(KEY_CACHE); + RedisUtils.deleteObject(cacheKey); + ThreadLocalHolder.remove(KEY_CACHE); } /** -- Gitblit v1.9.3