From 0fc796b90d3f44b81ef30285edb897223df439f7 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期五, 13 一月 2023 23:04:09 +0800 Subject: [PATCH] update 适配 javax.servlet 替换为 jakarta.servlet 更新所有代码 update 适配 ServletUtils 更换继承 JakartaServletUtil --- ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatSubmitAspect.java | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatSubmitAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatSubmitAspect.java index b77acb4..2972a9f 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatSubmitAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatSubmitAspect.java @@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.crypto.SecureUtil; import com.ruoyi.common.annotation.RepeatSubmit; -import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.JsonUtils; @@ -23,8 +23,8 @@ import org.springframework.validation.BindingResult; import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.time.Duration; import java.util.Collection; import java.util.Map; @@ -63,7 +63,7 @@ submitKey = SecureUtil.md5(submitKey + ":" + nowParams); // 鍞竴鏍囪瘑锛堟寚瀹歬ey + url + 娑堟伅澶达級 - String cacheRepeatKey = Constants.REPEAT_SUBMIT_KEY + url + submitKey; + String cacheRepeatKey = CacheConstants.REPEAT_SUBMIT_KEY + url + submitKey; String key = RedisUtils.getCacheObject(cacheRepeatKey); if (key == null) { RedisUtils.setCacheObject(cacheRepeatKey, "", Duration.ofMillis(interval)); @@ -85,12 +85,16 @@ @AfterReturning(pointcut = "@annotation(repeatSubmit)", returning = "jsonResult") public void doAfterReturning(JoinPoint joinPoint, RepeatSubmit repeatSubmit, Object jsonResult) { if (jsonResult instanceof R) { - R<?> r = (R<?>) jsonResult; - if (r.getCode() == R.SUCCESS) { - return; + try { + R<?> r = (R<?>) jsonResult; + // 鎴愬姛鍒欎笉鍒犻櫎redis鏁版嵁 淇濊瘉鍦ㄦ湁鏁堟椂闂村唴鏃犳硶閲嶅鎻愪氦 + if (r.getCode() == R.SUCCESS) { + return; + } + RedisUtils.deleteObject(KEY_CACHE.get()); + } finally { + KEY_CACHE.remove(); } - RedisUtils.deleteObject(KEY_CACHE.get()); - KEY_CACHE.remove(); } } -- Gitblit v1.9.3