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(); } }