From cbfeb09a2214ea5aba23f4d4fd9dedb98f6d067c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98=E6=AF=9B=E6=96=87=E6=98=A5=E2=80=99?= <739897791@qq.com> Date: Mon, 13 Mar 2023 17:45:29 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E4=B8=8D=E8=A6=81=E9=9C=80=E8=A6=81=E9=AA=8C=E8=AF=81=E7=9A=84?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=88path=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tiesheng/login/config/token/TsTokenAspect.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/springboot-login/src/main/java/com/tiesheng/login/config/token/TsTokenAspect.java b/springboot-login/src/main/java/com/tiesheng/login/config/token/TsTokenAspect.java index b1b6c1c..b56ccc1 100644 --- a/springboot-login/src/main/java/com/tiesheng/login/config/token/TsTokenAspect.java +++ b/springboot-login/src/main/java/com/tiesheng/login/config/token/TsTokenAspect.java @@ -50,8 +50,15 @@ public class TsTokenAspect { // 过滤不要需要验证的接口(path) String requestURI = ServletKit.getRequest().getRequestURI(); - if (StrUtil.startWithAnyIgnoreCase(requestURI, tsTokenConfig.getIgnorePaths())) { - return; + for (String path : tsTokenConfig.getIgnorePaths()) { + if (path.contains("/**")) { + path = path.replace("/**", ""); + if (StrUtil.startWith(requestURI, path)) { + return; + } + } else if (requestURI.equals(path)) { + return; + } } // 过滤不要需要验证的接口(注解) From 60dea50e438447d6ea6584c67254dc6af80c102f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98=E6=AF=9B=E6=96=87=E6=98=A5=E2=80=99?= <739897791@qq.com> Date: Tue, 14 Mar 2023 14:01:11 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E4=B8=8D=E8=A6=81=E9=9C=80=E8=A6=81=E9=AA=8C=E8=AF=81=E7=9A=84?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=88path=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../login/config/token/TsTokenAspect.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/springboot-login/src/main/java/com/tiesheng/login/config/token/TsTokenAspect.java b/springboot-login/src/main/java/com/tiesheng/login/config/token/TsTokenAspect.java index b56ccc1..9ead849 100644 --- a/springboot-login/src/main/java/com/tiesheng/login/config/token/TsTokenAspect.java +++ b/springboot-login/src/main/java/com/tiesheng/login/config/token/TsTokenAspect.java @@ -1,5 +1,7 @@ package com.tiesheng.login.config.token; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjUtil; import cn.hutool.core.util.StrUtil; import com.tiesheng.annotation.token.TokenIgnore; import com.tiesheng.util.ServletKit; @@ -50,14 +52,17 @@ public class TsTokenAspect { // 过滤不要需要验证的接口(path) String requestURI = ServletKit.getRequest().getRequestURI(); - for (String path : tsTokenConfig.getIgnorePaths()) { - if (path.contains("/**")) { - path = path.replace("/**", ""); - if (StrUtil.startWith(requestURI, path)) { + String[] ignorePaths = tsTokenConfig.getIgnorePaths(); + if (ObjUtil.isNotEmpty(ignorePaths)) { + for (String path : ignorePaths) { + if (path.contains("/**")) { + path = path.replace("/**", ""); + if (StrUtil.startWith(requestURI, path)) { + return; + } + } else if (requestURI.equals(path)) { return; } - } else if (requestURI.equals(path)) { - return; } } From 0c511940aa6f0656951e7bc582498e0e42457edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98=E6=AF=9B=E6=96=87=E6=98=A5=E2=80=99?= <739897791@qq.com> Date: Tue, 14 Mar 2023 14:03:53 +0800 Subject: [PATCH 3/3] =?UTF-8?q?GlobalConfig=E6=96=B0=E5=8A=A0uploadDir?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/tiesheng/util/config/GlobalConfig.java | 10 ++++++++++ .../java/com/tiesheng/util/pojos/FileUploadPath.java | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/springboot-util/src/main/java/com/tiesheng/util/config/GlobalConfig.java b/springboot-util/src/main/java/com/tiesheng/util/config/GlobalConfig.java index e682ab8..36fda2e 100644 --- a/springboot-util/src/main/java/com/tiesheng/util/config/GlobalConfig.java +++ b/springboot-util/src/main/java/com/tiesheng/util/config/GlobalConfig.java @@ -23,6 +23,7 @@ public class GlobalConfig { private String host; private String service; private String version; + private String uploadDir = System.getProperty("user.dir"); /////////////////////////////////////////////////////////////////////////// // 逻辑方法 @@ -80,6 +81,15 @@ public class GlobalConfig { // setter\getter /////////////////////////////////////////////////////////////////////////// + + public String getUploadDir() { + return uploadDir; + } + + public void setUploadDir(String uploadDir) { + this.uploadDir = uploadDir; + } + public String getHost() { return host; } diff --git a/springboot-util/src/main/java/com/tiesheng/util/pojos/FileUploadPath.java b/springboot-util/src/main/java/com/tiesheng/util/pojos/FileUploadPath.java index 18b32cc..1c9d50d 100644 --- a/springboot-util/src/main/java/com/tiesheng/util/pojos/FileUploadPath.java +++ b/springboot-util/src/main/java/com/tiesheng/util/pojos/FileUploadPath.java @@ -5,7 +5,9 @@ import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.CharUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.spring.SpringUtil; import cn.hutool.http.HttpUtil; +import com.tiesheng.util.config.GlobalConfig; public class FileUploadPath { @@ -46,7 +48,7 @@ public class FileUploadPath { } pathBean.setHttpPath(tempPath); - String tempAbs = String.format("%s/static%s", System.getProperty("user.dir"), tempPath); + String tempAbs = String.format("%s/static%s", SpringUtil.getBean(GlobalConfig.class).getUploadDir(), tempPath); tempAbs = FileUtil.normalize(tempAbs); pathBean.setAbsolutePath(tempAbs);