This commit is contained in:
syruan 2025-10-27 14:59:11 +08:00
parent c82cae618c
commit 6b526bf5e0
10 changed files with 84 additions and 11 deletions

19
.idea/compiler.xml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="gz_gqj" />
</profile>
</annotationProcessing>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="gz_gqj" options="-parameters" />
</option>
</component>
</project>

7
.idea/encodings.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

20
.idea/jarRepositories.xml Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -49,6 +49,7 @@ file:
upload_path:
windows: D://files/zg_gqj
linux: /home/zg_gqj/files
other: /Users/syruan/files

View File

@ -49,6 +49,7 @@ file:
upload_path:
windows: D://files/zg_gqj
linux: /home/zg_gqj/files
other: /Users/syruan/files

View File

@ -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

View File

@ -1,4 +1,4 @@
# 环境配置
spring:
profiles:
active: local
active: test