From 3904d80329fb401381f09fcd272000e3a5cd973f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Thu, 9 Apr 2026 10:55:54 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20RepeatSubmitAspec?= =?UTF-8?q?t.KEY=5FCACHE=20=E6=B8=85=E7=90=86=E4=B8=8D=E5=BD=BB=E5=BA=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/idempotent/aspectj/RepeatSubmitAspect.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 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 5a27e9189..6f1f523b9 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 @@ -12,6 +12,7 @@ import org.aspectj.lang.annotation.AfterThrowing; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.dromara.common.core.constant.GlobalConstants; +import org.dromara.common.core.constant.HttpStatus; import org.dromara.common.core.domain.R; import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.utils.MessageUtils; @@ -76,16 +77,16 @@ public class RepeatSubmitAspect { */ @AfterReturning(pointcut = "@annotation(repeatSubmit)", returning = "jsonResult") public void doAfterReturning(JoinPoint joinPoint, RepeatSubmit repeatSubmit, Object jsonResult) { - if (jsonResult instanceof R r) { - try { + try { + if (jsonResult instanceof R r) { // 成功则不删除redis数据 保证在有效时间内无法重复提交 - if (r.getCode() == R.SUCCESS) { + if (r.getCode() == HttpStatus.SUCCESS) { return; } RedisUtils.deleteObject(KEY_CACHE.get()); - } finally { - KEY_CACHE.remove(); } + } finally { + KEY_CACHE.remove(); } }