新增:回传文件到本地磁盘

This commit is contained in:
yangyang01000846
2025-12-05 15:33:21 +08:00
parent 73a65215e8
commit 412fe873bc
12 changed files with 68 additions and 12 deletions

View File

@@ -98,5 +98,10 @@ lombok:
file:
rootPath: /data/home/sdm
security:
whitelist:
paths:
- /aa/bb
#logging:
# config: ./config/logback.xml

View File

@@ -104,5 +104,10 @@ lombok:
file:
rootPath: /data/home/sdm
security:
whitelist:
paths:
- /pbs/jobFileCallback
#logging:
# config: ./config/logback.xml

View File

@@ -1,4 +1,4 @@
package com.sdm.data.config;
package com.sdm.common.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

View File

@@ -1,7 +1,7 @@
package com.sdm.data.filter;
import com.sdm.common.common.ThreadLocalContext;
import com.sdm.data.config.WhitelistProperties;
import com.sdm.common.config.WhitelistProperties;
import jakarta.servlet.*;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

View File

@@ -33,4 +33,7 @@ mybatis-plus:
global-config:
db-config:
id-type: auto
security:
whitelist:
paths:
- /pbs/jobFileCallback

View File

@@ -115,4 +115,9 @@ logging:
# 0单机处理1负载均衡轮询
serverType: 0
serverIp: 192.168.65.161
#serverIp: 192.168.65.73
#serverIp: 192.168.65.73
security:
whitelist:
paths:
- aa

View File

@@ -1,24 +1,30 @@
package com.sdm.pbs.filter;
import com.sdm.common.common.ThreadLocalContext;
//import com.sdm.pbs.service.UserService;
import com.sdm.common.config.WhitelistProperties;
import jakarta.servlet.*;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.AntPathMatcher;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;
@Slf4j
public class AuthFilter implements Filter {
// @Resource
// private UserService userService;
@Autowired
private WhitelistProperties whitelistProperties;
private List<String> excludedPaths;
private final AntPathMatcher pathMatcher = new AntPathMatcher();
@Override
public void init(FilterConfig filterConfig) throws ServletException {
Filter.super.init(filterConfig);
// 从初始化参数中读取白名单
excludedPaths = whitelistProperties.getPaths();
log.info("----------- AuthFilter init ----------");
}
@@ -26,6 +32,14 @@ public class AuthFilter implements Filter {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
if (servletRequest instanceof HttpServletRequest) {
HttpServletRequest req = (HttpServletRequest) servletRequest;
String path = req.getRequestURI().substring(req.getContextPath().length());
// 检查当前请求是否在白名单中
for (String excludedPath : excludedPaths) {
if (pathMatcher.match(excludedPath, path)) {
filterChain.doFilter(servletRequest, servletResponse);
return;
}
}
if(!ThreadLocalContext.verifyRequest(req))
{
HttpServletResponse response = (HttpServletResponse) servletResponse;

View File

@@ -131,4 +131,9 @@ pbs:
task:
hpc: hpc
qusb: qusb
impl: hpc
impl: hpc
security:
whitelist:
paths:
- /pbs/jobFileCallback

View File

@@ -98,5 +98,10 @@ lombok:
file:
rootPath: /data/home/sdm
security:
whitelist:
paths:
- aa
#logging:
# config: ./config/logback.xml

View File

@@ -116,5 +116,9 @@ lombok:
file:
rootPath: /data/home/sdm
security:
whitelist:
paths:
- aa
#logging:
# config: ./config/logback.xml

View File

@@ -170,4 +170,9 @@ cid:
msg:
sendMessage: /spdm-msg/sendMessage
log:
saveLog: /spdm-log/saveLog
saveLog: /spdm-log/saveLog
security:
whitelist:
paths:
- aa

View File

@@ -121,4 +121,9 @@ file:
approve:
replyUrl: http:192.168.65.161:7102/simulation/task/taskpool/approveHandleNotice
#logging:
# config: ./config/logback.xml
# config: ./config/logback.xml
security:
whitelist:
paths:
- aa