mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	update 移除 重复提交 配置文件全局配置 使用注解默认值替代
This commit is contained in:
		@@ -149,11 +149,6 @@ security:
 | 
				
			|||||||
    - /actuator
 | 
					    - /actuator
 | 
				
			||||||
    - /actuator/**
 | 
					    - /actuator/**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 重复提交
 | 
					 | 
				
			||||||
repeat-submit:
 | 
					 | 
				
			||||||
  # 全局间隔时间(毫秒)
 | 
					 | 
				
			||||||
  interval: 5000
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# MyBatisPlus配置
 | 
					# MyBatisPlus配置
 | 
				
			||||||
# https://baomidou.com/config/
 | 
					# https://baomidou.com/config/
 | 
				
			||||||
mybatis-plus:
 | 
					mybatis-plus:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,6 @@ import com.ruoyi.common.utils.MessageUtils;
 | 
				
			|||||||
import com.ruoyi.common.utils.ServletUtils;
 | 
					import com.ruoyi.common.utils.ServletUtils;
 | 
				
			||||||
import com.ruoyi.common.utils.StringUtils;
 | 
					import com.ruoyi.common.utils.StringUtils;
 | 
				
			||||||
import com.ruoyi.common.utils.redis.RedisUtils;
 | 
					import com.ruoyi.common.utils.redis.RedisUtils;
 | 
				
			||||||
import com.ruoyi.framework.config.properties.RepeatSubmitProperties;
 | 
					 | 
				
			||||||
import lombok.RequiredArgsConstructor;
 | 
					import lombok.RequiredArgsConstructor;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
import org.aspectj.lang.JoinPoint;
 | 
					import org.aspectj.lang.JoinPoint;
 | 
				
			||||||
@@ -43,12 +42,10 @@ public class RepeatSubmitAspect {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private static final ThreadLocal<String> KEY_CACHE = new ThreadLocal<>();
 | 
					    private static final ThreadLocal<String> KEY_CACHE = new ThreadLocal<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final RepeatSubmitProperties repeatSubmitProperties;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Before("@annotation(repeatSubmit)")
 | 
					    @Before("@annotation(repeatSubmit)")
 | 
				
			||||||
    public void doBefore(JoinPoint point, RepeatSubmit repeatSubmit) throws Throwable {
 | 
					    public void doBefore(JoinPoint point, RepeatSubmit repeatSubmit) throws Throwable {
 | 
				
			||||||
        // 如果注解不为0 则使用注解数值
 | 
					        // 如果注解不为0 则使用注解数值
 | 
				
			||||||
        long interval = repeatSubmitProperties.getInterval();
 | 
					        long interval = 0;
 | 
				
			||||||
        if (repeatSubmit.interval() > 0) {
 | 
					        if (repeatSubmit.interval() > 0) {
 | 
				
			||||||
            interval = repeatSubmit.timeUnit().toMillis(repeatSubmit.interval());
 | 
					            interval = repeatSubmit.timeUnit().toMillis(repeatSubmit.interval());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,22 +0,0 @@
 | 
				
			|||||||
package com.ruoyi.framework.config.properties;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import lombok.Data;
 | 
					 | 
				
			||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
 | 
					 | 
				
			||||||
import org.springframework.stereotype.Component;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 重复提交 配置属性
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @author Lion Li
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
@Data
 | 
					 | 
				
			||||||
@Component
 | 
					 | 
				
			||||||
@ConfigurationProperties(prefix = "repeat-submit")
 | 
					 | 
				
			||||||
public class RepeatSubmitProperties {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 间隔时间(毫秒)
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private int interval;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user