From 28a9582a3e4a573881879947960bae1e848ce97a Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期二, 11 八月 2020 11:20:45 +0800
Subject: [PATCH] 优化防重复提交拦截器,唯一值(没有消息头则使用请求地址)
---
src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java b/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java
index 385a05b..b40078c 100644
--- a/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java
+++ b/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java
@@ -6,7 +6,6 @@
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.constant.Constants;
@@ -70,9 +69,16 @@
// 璇锋眰鍦板潃锛堜綔涓哄瓨鏀綾ache鐨刱ey鍊硷級
String url = request.getRequestURI();
+
+ // 鍞竴鍊硷紙娌℃湁娑堟伅澶村垯浣跨敤璇锋眰鍦板潃锛�
+ String submitKey = request.getHeader(header);
+ if (StringUtils.isEmpty(submitKey))
+ {
+ submitKey = url;
+ }
// 鍞竴鏍囪瘑锛堟寚瀹歬ey + 娑堟伅澶达級
- String cache_repeat_key = Constants.REPEAT_SUBMIT_KEY + request.getHeader(header);
+ String cache_repeat_key = Constants.REPEAT_SUBMIT_KEY + submitKey;
Object sessionObj = redisCache.getCacheObject(cache_repeat_key);
if (sessionObj != null)
--
Gitblit v1.9.3