更新项目配置,新增设备同步模块,优化WebSocket和Swagger配置,增强SCADA系统的免登录接口,支持数据字典项和登录日志的免登录查询与记录。调整Java编译设置,确保更好的开发体验。

This commit is contained in:
geht
2026-04-28 10:23:58 +08:00
parent bbe46dcf2d
commit 142a0bdaba
1013 changed files with 41858 additions and 28 deletions

View File

@@ -48,7 +48,10 @@ public class Swagger3Config implements WebMvcConfigurer {
"/sys/cas/client/validateLogin",
"/test/jeecgDemo/demo3",
"/sys/thirdLogin/**",
"/sys/user/register"
"/sys/user/register",
"/sys/user/scada/queryUser",
"/sys/dict/scada/queryDictItem",
"/sys/log/scada/addLoginLog"
));
// 预处理通配符模式,提高匹配效率
private static final Set<String> wildcardPatterns = new HashSet<>();
@@ -79,7 +82,18 @@ public class Swagger3Config implements WebMvcConfigurer {
@Bean
public GlobalOpenApiMethodFilter globalOpenApiMethodFilter() {
return method -> method.isAnnotationPresent(Operation.class);
return method -> {
if (method.isAnnotationPresent(Operation.class)) {
return true;
}
RequestMapping classMapping = method.getDeclaringClass().getAnnotation(RequestMapping.class);
if (classMapping != null && classMapping.value().length > 0) {
String classPath = classMapping.value()[0];
// 兼容系统用户管理接口,未加 @Operation 的接口也展示在文档中
return classPath.startsWith("/sys/user");
}
return false;
};
}
@Bean
@@ -89,6 +103,8 @@ public class Swagger3Config implements WebMvcConfigurer {
if (!isExcludedPath(path)) {
operation.addSecurityItem(new SecurityRequirement().addList(CommonConstant.X_ACCESS_TOKEN));
}else{
// 对于免登录接口,显式清空 security覆盖 OpenAPI 全局安全要求
operation.setSecurity(new java.util.ArrayList<>());
log.info("忽略加入 X_ACCESS_TOKEN 的 PATH:" + path);
}
return operation;

View File

@@ -31,7 +31,7 @@ public class WebSocketConfig {
FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(websocketFilter());
//TODO 临时注释掉测试下线上socket总断的问题
bean.addUrlPatterns("/taskCountSocket/*", "/websocket/*","/eoaSocket/*","/eoaNewChatSocket/*", "/newsWebsocket/*", "/dragChannelSocket/*", "/vxeSocket/*");
bean.addUrlPatterns("/taskCountSocket/*", "/websocket/*","/eoaSocket/*","/eoaNewChatSocket/*", "/newsWebsocket/*", "/dragChannelSocket/*", "/vxeSocket/*", "/ws/*");
return bean;
}

View File

@@ -35,9 +35,15 @@ public class WebsocketFilter implements Filter {
redisUtil = SpringContextUtils.getBean(RedisUtil.class);
}
HttpServletRequest request = (HttpServletRequest)servletRequest;
String requestUri = request.getRequestURI();
// SCADA桌面端固定通道允许免token接入保障工控机实时推送可用
if (isScadaAnonymousEndpoint(requestUri)) {
filterChain.doFilter(servletRequest, servletResponse);
return;
}
String token = request.getHeader(TOKEN_KEY);
log.debug("Websocket连接 Token安全校验Path = {}token:{}", request.getRequestURI(), token);
log.debug("Websocket连接 Token安全校验Path = {}token:{}", requestUri, token);
try {
TokenUtils.verifyToken(token, commonApi, redisUtil);
@@ -51,4 +57,16 @@ public class WebsocketFilter implements Filter {
filterChain.doFilter(servletRequest, servletResponse);
}
private boolean isScadaAnonymousEndpoint(String requestUri) {
if (oConvertUtils.isEmpty(requestUri)) {
return false;
}
String uri = requestUri.toLowerCase();
// 设备同步 STOMP 原生握手(与 jeecg-module-device-sync 的 /ws/device 一致)
if (uri.contains("/ws/device")) {
return true;
}
return uri.endsWith("/websocket/scada-sync");
}
}

View File

@@ -172,6 +172,8 @@ public class ShiroConfig {
//websocket排除
filterChainDefinitionMap.put("/websocket/**", "anon");//系统通知和公告
// 设备同步模块 STOMP工控机统一通道与桌面端 /ws/device 对接)
filterChainDefinitionMap.put("/ws/**", "anon");
filterChainDefinitionMap.put("/newsWebsocket/**", "anon");//CMS模块
filterChainDefinitionMap.put("/vxeSocket/**", "anon");//JVxeTable无痕刷新示例
//App vue3版本查询版本接口