From 6b526bf5e04646557267468fd6cf918b42666b96 Mon Sep 17 00:00:00 2001
From: syruan <15555146157@163.com>
Date: Mon, 27 Oct 2025 14:59:11 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/compiler.xml | 19 +++++++++++++++
.idea/encodings.xml | 7 ++++++
.idea/jarRepositories.xml | 20 ++++++++++++++++
.idea/vcs.xml | 6 +++++
.../gzgqj/business/utils/SystemUtils.java | 8 ++++++-
.../jwt/JwtAuthenticationTokenFilter.java | 24 ++++++++++++++-----
src/main/resources/application-local.yml | 1 +
src/main/resources/application-saas.yml | 1 +
src/main/resources/application-test.yml | 7 +++---
src/main/resources/application.yml | 2 +-
10 files changed, 84 insertions(+), 11 deletions(-)
create mode 100644 .idea/compiler.xml
create mode 100644 .idea/encodings.xml
create mode 100644 .idea/jarRepositories.xml
create mode 100644 .idea/vcs.xml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..6549423
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..aa00ffa
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..712ab9d
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/bonus/gzgqj/business/utils/SystemUtils.java b/src/main/java/com/bonus/gzgqj/business/utils/SystemUtils.java
index c94b318..71e46bb 100644
--- a/src/main/java/com/bonus/gzgqj/business/utils/SystemUtils.java
+++ b/src/main/java/com/bonus/gzgqj/business/utils/SystemUtils.java
@@ -12,6 +12,7 @@ public class SystemUtils {
public static String windowsPath;
+ public static String otherPath;
public static String linuxPath;
@@ -25,6 +26,11 @@ public class SystemUtils {
SystemUtils.windowsPath = windowsPath;
}
+ @Value("${file.upload_path.other}")
+ public void setOtherPath(String otherPath) {
+ SystemUtils.otherPath = otherPath;
+ }
+
/**
* 自动注入
*
@@ -65,7 +71,7 @@ public class SystemUtils {
} else if ("linux".equals(os)) {
return linuxPath;
} else {
- return windowsPath;
+ return otherPath;
}
}
diff --git a/src/main/java/com/bonus/gzgqj/manager/security/jwt/JwtAuthenticationTokenFilter.java b/src/main/java/com/bonus/gzgqj/manager/security/jwt/JwtAuthenticationTokenFilter.java
index 02f7553..d544c0a 100644
--- a/src/main/java/com/bonus/gzgqj/manager/security/jwt/JwtAuthenticationTokenFilter.java
+++ b/src/main/java/com/bonus/gzgqj/manager/security/jwt/JwtAuthenticationTokenFilter.java
@@ -9,6 +9,7 @@ import com.bonus.gzgqj.manager.constant.SecurityConstants;
import com.bonus.gzgqj.manager.security.entity.SelfUserEntity;
import io.jsonwebtoken.Claims;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
@@ -27,17 +28,28 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
@Autowired
private JWTTokenService tokenService;
+ @Value("${server.servlet.context-path}")
+ public String path;
+
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException, IOException, ServletException {
//获取token
String jwtToken = SecurityUtils.getToken(request);
String uri=request.getRequestURI();
- System.err.println(uri);
+ System.err.println(uri);
+
+ if (Objects.isNull(path) || StringUtils.isBlank(path)) {
+ if("/login/userLogin".equals(uri)){
+ filterChain.doFilter(request, response);
+ return;
+ }
+ } else {
+ if((path + "/login/userLogin").equals(uri)){
+ filterChain.doFilter(request, response);
+ return;
+ }
+ }
- if("/login/userLogin".equals(uri)){
- filterChain.doFilter(request, response);
- return;
- }
if (uri.contains(".jpg") || uri.contains(".png") || uri.contains(".jpeg") || uri.contains("onlinePreview")) {
filterChain.doFilter(request, response);
return;
@@ -46,7 +58,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
filterChain.doFilter(request, response);
return;
}
- if(StringUtils.isEmpty(jwtToken)){
+ if(StringUtils.isEmpty(jwtToken) || "null".equals(jwtToken)){
ResultUtil.responseJson(response,ResultUtil.resultCode(401,"请先登录"));
return;
}
diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml
index 533ab17..b4147b3 100644
--- a/src/main/resources/application-local.yml
+++ b/src/main/resources/application-local.yml
@@ -49,6 +49,7 @@ file:
upload_path:
windows: D://files/zg_gqj
linux: /home/zg_gqj/files
+ other: /Users/syruan/files
diff --git a/src/main/resources/application-saas.yml b/src/main/resources/application-saas.yml
index c41b2c3..e4d0901 100644
--- a/src/main/resources/application-saas.yml
+++ b/src/main/resources/application-saas.yml
@@ -49,6 +49,7 @@ file:
upload_path:
windows: D://files/zg_gqj
linux: /home/zg_gqj/files
+ other: /Users/syruan/files
diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml
index 6fec92e..2bb7692 100644
--- a/src/main/resources/application-test.yml
+++ b/src/main/resources/application-test.yml
@@ -1,8 +1,8 @@
# 配置端口
server:
- port: 21999
-# servlet:
-# context-path: /gz-gqj
+ port: 21988
+ servlet:
+ context-path: /gz-gqj
max-http-header-size: 10240
spring:
# 配置数据源
@@ -45,6 +45,7 @@ file:
upload_path:
windows: D://files/gz_car
linux: /home/zg_gqj/files
+ other: /Users/syruan/files
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index f4a8757..2fe244f 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1,4 +1,4 @@
# 环境配置
spring:
profiles:
- active: local
\ No newline at end of file
+ active: test
\ No newline at end of file
From 6c8abe18af389d7006ba27fcef6c7cfb14a0dbb3 Mon Sep 17 00:00:00 2001
From: syruan <15555146157@163.com>
Date: Tue, 28 Oct 2025 15:00:43 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../jwt/JwtAuthenticationTokenFilter.java | 28 +++++++++----------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/src/main/java/com/bonus/gzgqj/manager/security/jwt/JwtAuthenticationTokenFilter.java b/src/main/java/com/bonus/gzgqj/manager/security/jwt/JwtAuthenticationTokenFilter.java
index d544c0a..5266475 100644
--- a/src/main/java/com/bonus/gzgqj/manager/security/jwt/JwtAuthenticationTokenFilter.java
+++ b/src/main/java/com/bonus/gzgqj/manager/security/jwt/JwtAuthenticationTokenFilter.java
@@ -38,18 +38,14 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
String uri=request.getRequestURI();
System.err.println(uri);
- if (Objects.isNull(path) || StringUtils.isBlank(path)) {
- if("/login/userLogin".equals(uri)){
- filterChain.doFilter(request, response);
- return;
- }
- } else {
- if((path + "/login/userLogin").equals(uri)){
- filterChain.doFilter(request, response);
- return;
- }
- }
-
+ if((path + "/login/userLogin").equals(uri)){
+ filterChain.doFilter(request, response);
+ return;
+ }
+ if((path +"/login/appUserLogin").equals(uri)){
+ filterChain.doFilter(request, response);
+ return;
+ }
if (uri.contains(".jpg") || uri.contains(".png") || uri.contains(".jpeg") || uri.contains("onlinePreview")) {
filterChain.doFilter(request, response);
return;
@@ -58,8 +54,10 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
filterChain.doFilter(request, response);
return;
}
- if(StringUtils.isEmpty(jwtToken) || "null".equals(jwtToken)){
- ResultUtil.responseJson(response,ResultUtil.resultCode(401,"请先登录"));
+ if(StringUtils.isEmpty(jwtToken)){
+ System.err.println("----------------->");
+ ResultUtil.responseJson(response,ResultUtil.resultCode(401,"登录过期,请先登录"));
+ System.err.println("异常401,token信息:" + jwtToken + ",地址" + uri);
return;
}
//解析token
@@ -71,7 +69,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
} catch (Exception e) {
e.printStackTrace();
- ResultUtil.responseJson(response,ResultUtil.resultCode(401,"请先登录"));
+ ResultUtil.responseJson(response,ResultUtil.resultCode(401,"登录过期,请先登录"));
return;
}
SelfUserEntity loginUser = tokenService.getLoginUser(request);