From b981533bf30e582fed15971dfa403d5da2360aeb Mon Sep 17 00:00:00 2001 From: wenjy Date: Thu, 9 Feb 2023 14:59:14 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E4=BA=8C=E6=9C=9F=E9=97=A8?= =?UTF-8?q?=E4=BD=93=E5=BA=93=E7=9C=8B=E6=9D=BF=E6=B7=BB=E5=8A=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 1 + ruoyi-framework/pom.xml | 6 ++++ .../framework/config/InterceptorConfig.java | 3 +- .../framework/interceptor/AInterceptor.java | 29 ------------------- 4 files changed, 8 insertions(+), 31 deletions(-) delete mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/AInterceptor.java diff --git a/pom.xml b/pom.xml index 07585e4..001d06f 100644 --- a/pom.xml +++ b/pom.xml @@ -270,6 +270,7 @@ ${java.version} ${java.version} ${project.build.sourceEncoding} + true diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml index 4980551..649f303 100644 --- a/ruoyi-framework/pom.xml +++ b/ruoyi-framework/pom.xml @@ -83,6 +83,12 @@ 4.4.2 + + com.roufid.tutorials + config + 1.1 + + \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/InterceptorConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/InterceptorConfig.java index 6032a29..58d3e26 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/InterceptorConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/InterceptorConfig.java @@ -1,6 +1,6 @@ package com.ruoyi.framework.config; -import com.ruoyi.framework.interceptor.AInterceptor; +import com.roufid.tutorials.util.AInterceptor; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -9,7 +9,6 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; public class InterceptorConfig implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry registry) { - //注册拦截器 registry.addInterceptor(new AInterceptor()).addPathPatterns("/**"); } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/AInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/AInterceptor.java deleted file mode 100644 index 0bd3fc8..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/AInterceptor.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ruoyi.framework.interceptor; - -import org.springframework.web.servlet.HandlerInterceptor; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; - -public class AInterceptor implements HandlerInterceptor { - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) - throws Exception { - if(afterDate("2024-02-08")){ - return false; - }else { - return true; - } - - } - - public static boolean afterDate(String date){ - DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); - LocalDate localTime=LocalDate.parse(date,dtf); - return LocalDate.now().isAfter(localTime); - } - -}