Commit ad4df6245dcb2628cdb33ac1333af4af317479b5
1 parent
71ec44a5
优化防重复提交拦截器,请求没有消息头则使用地址
Showing
1 changed file
with
8 additions
and
1 deletions
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java
| @@ -70,8 +70,15 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor | @@ -70,8 +70,15 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor | ||
| 70 | // 请求地址(作为存放cache的key值) | 70 | // 请求地址(作为存放cache的key值) |
| 71 | String url = request.getRequestURI(); | 71 | String url = request.getRequestURI(); |
| 72 | 72 | ||
| 73 | + // 唯一值(没有消息头则使用请求地址) | ||
| 74 | + String submitKey = request.getHeader(header); | ||
| 75 | + if (StringUtils.isEmpty(submitKey)) | ||
| 76 | + { | ||
| 77 | + submitKey = url; | ||
| 78 | + } | ||
| 79 | + | ||
| 73 | // 唯一标识(指定key + 消息头) | 80 | // 唯一标识(指定key + 消息头) |
| 74 | - String cache_repeat_key = Constants.REPEAT_SUBMIT_KEY + request.getHeader(header); | 81 | + String cache_repeat_key = Constants.REPEAT_SUBMIT_KEY + submitKey; |
| 75 | 82 | ||
| 76 | Object sessionObj = redisCache.getCacheObject(cache_repeat_key); | 83 | Object sessionObj = redisCache.getCacheObject(cache_repeat_key); |
| 77 | if (sessionObj != null) | 84 | if (sessionObj != null) |