From b1a7de3bb1428b372c2ba725942a763933f70af8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Tue, 23 Dec 2025 15:31:06 +0800 Subject: [PATCH 1/6] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=20HandlerMethodValidationException=20=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=A0=A1=E9=AA=8C=E5=BC=82=E5=B8=B8=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/web/handler/GlobalExceptionHandler.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/handler/GlobalExceptionHandler.java b/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/handler/GlobalExceptionHandler.java index d519b9d55..7a5d82c3e 100644 --- a/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/handler/GlobalExceptionHandler.java +++ b/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/handler/GlobalExceptionHandler.java @@ -14,6 +14,7 @@ import org.dromara.common.core.exception.SseException; import org.dromara.common.core.exception.base.BaseException; import org.dromara.common.core.utils.StreamUtils; import org.dromara.common.json.utils.JsonUtils; +import org.springframework.context.MessageSourceResolvable; import org.springframework.context.support.DefaultMessageSourceResolvable; import org.springframework.expression.ExpressionException; import org.springframework.http.converter.HttpMessageNotReadableException; @@ -25,6 +26,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.context.request.async.AsyncRequestTimeoutException; +import org.springframework.web.method.annotation.HandlerMethodValidationException; import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; import org.springframework.web.servlet.NoHandlerFoundException; @@ -191,6 +193,16 @@ public class GlobalExceptionHandler { return R.fail(message); } + /** + * 方法参数校验异常 用于处理 @Validated 注解 + */ + @ExceptionHandler(HandlerMethodValidationException.class) + public R handlerMethodValidationException(HandlerMethodValidationException e) { + log.error(e.getMessage()); + String message = StreamUtils.join(e.getAllErrors(), MessageSourceResolvable::getDefaultMessage, ", "); + return R.fail(message); + } + /** * JSON 解析异常(Jackson 在处理 JSON 格式出错时抛出) * 可能是请求体格式非法,也可能是服务端反序列化失败 From 8923333d3fb60e65007cd916898c735cba528f7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Tue, 23 Dec 2025 15:56:20 +0800 Subject: [PATCH 2/6] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20websocket=20?= =?UTF-8?q?=E5=A4=9A=E7=BA=BF=E7=A8=8B=E4=B8=8BIO=E9=98=BB=E5=A1=9E?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dromara/common/websocket/handler/PlusWebSocketHandler.java | 3 ++- .../org/dromara/common/websocket/utils/WebSocketUtils.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ruoyi-common/ruoyi-common-websocket/src/main/java/org/dromara/common/websocket/handler/PlusWebSocketHandler.java b/ruoyi-common/ruoyi-common-websocket/src/main/java/org/dromara/common/websocket/handler/PlusWebSocketHandler.java index 557ed8eb4..5a1b9c5d3 100644 --- a/ruoyi-common/ruoyi-common-websocket/src/main/java/org/dromara/common/websocket/handler/PlusWebSocketHandler.java +++ b/ruoyi-common/ruoyi-common-websocket/src/main/java/org/dromara/common/websocket/handler/PlusWebSocketHandler.java @@ -8,6 +8,7 @@ import org.dromara.common.websocket.utils.WebSocketUtils; import org.dromara.system.api.model.LoginUser; import org.springframework.web.socket.*; import org.springframework.web.socket.handler.AbstractWebSocketHandler; +import org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator; import java.io.IOException; import java.util.List; @@ -33,7 +34,7 @@ public class PlusWebSocketHandler extends AbstractWebSocketHandler { log.info("[connect] invalid token received. sessionId: {}", session.getId()); return; } - WebSocketSessionHolder.addSession(loginUser.getUserId(), session); + WebSocketSessionHolder.addSession(loginUser.getUserId(), new ConcurrentWebSocketSessionDecorator(session, 10 * 1000, 64000)); log.info("[connect] sessionId: {},userId:{},userType:{}", session.getId(), loginUser.getUserId(), loginUser.getUserType()); } diff --git a/ruoyi-common/ruoyi-common-websocket/src/main/java/org/dromara/common/websocket/utils/WebSocketUtils.java b/ruoyi-common/ruoyi-common-websocket/src/main/java/org/dromara/common/websocket/utils/WebSocketUtils.java index 35320c6e7..696ac3c50 100644 --- a/ruoyi-common/ruoyi-common-websocket/src/main/java/org/dromara/common/websocket/utils/WebSocketUtils.java +++ b/ruoyi-common/ruoyi-common-websocket/src/main/java/org/dromara/common/websocket/utils/WebSocketUtils.java @@ -113,7 +113,7 @@ public class WebSocketUtils { * @param session WebSocket会话 * @param message 要发送的WebSocket消息对象 */ - private synchronized static void sendMessage(WebSocketSession session, WebSocketMessage message) { + private static void sendMessage(WebSocketSession session, WebSocketMessage message) { if (session == null || !session.isOpen()) { log.warn("[send] session会话已经关闭"); } else { From d145e3e43289b16f10e7e6bc918cbf7a2a8b0a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Tue, 23 Dec 2025 16:21:14 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20elasticsearch-cl?= =?UTF-8?q?ient=20=E8=A2=ABspring=E7=9A=84=E4=BE=9D=E8=B5=96=E8=A6=86?= =?UTF-8?q?=E7=9B=96=E5=AF=BC=E8=87=B4=E5=87=BA=E7=8E=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pom.xml b/pom.xml index b2e869e63..dd56d3872 100644 --- a/pom.xml +++ b/pom.xml @@ -37,6 +37,7 @@ 1.18.40 7.4 3.0.0 + 7.17.28 9.3.0 1.80 1.5.0 @@ -279,6 +280,18 @@ ${easy-es.version} + + co.elastic.clients + elasticsearch-java + ${elasticsearch-client.version} + + + + org.elasticsearch.client + elasticsearch-rest-client + ${elasticsearch-client.version} + + org.apache.skywalking From df130b04552c30fadc83dbd304141a910d40960b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Tue, 23 Dec 2025 16:29:40 +0800 Subject: [PATCH 4/6] update easy-es 3.0.0 => 3.0.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index dd56d3872..a2a38a724 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ 1.44.0 1.18.40 7.4 - 3.0.0 + 3.0.1 7.17.28 9.3.0 1.80 From 577bb456a48c5d51e482697243666b042e2685f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Wed, 24 Dec 2025 13:07:31 +0800 Subject: [PATCH 5/6] =?UTF-8?q?remove=20=E5=88=A0=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E9=85=8D=E7=BD=AE=E7=B1=BB(=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E4=B9=8B=E5=90=8E=E9=97=AE=E9=A2=98=E8=A7=A3=E5=86=B3=E4=B8=8D?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E9=87=8D=E5=86=99=E4=BA=86)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spring/config/EasyEsConfiguration.java | 102 ------------------ .../config/GeneratorConfiguration.java | 27 ----- 2 files changed, 129 deletions(-) delete mode 100644 ruoyi-common/ruoyi-common-elasticsearch/src/main/java/org/dromara/easyes/spring/config/EasyEsConfiguration.java delete mode 100644 ruoyi-common/ruoyi-common-elasticsearch/src/main/java/org/dromara/easyes/starter/config/GeneratorConfiguration.java diff --git a/ruoyi-common/ruoyi-common-elasticsearch/src/main/java/org/dromara/easyes/spring/config/EasyEsConfiguration.java b/ruoyi-common/ruoyi-common-elasticsearch/src/main/java/org/dromara/easyes/spring/config/EasyEsConfiguration.java deleted file mode 100644 index 4a2f89aca..000000000 --- a/ruoyi-common/ruoyi-common-elasticsearch/src/main/java/org/dromara/easyes/spring/config/EasyEsConfiguration.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.dromara.easyes.spring.config; - -import lombok.NonNull; -import lombok.Setter; -import org.dromara.easyes.common.constants.BaseEsConstants; -import org.dromara.easyes.common.property.EasyEsDynamicProperties; -import org.dromara.easyes.common.property.EasyEsProperties; -import org.dromara.easyes.common.strategy.AutoProcessIndexStrategy; -import org.dromara.easyes.common.utils.EsClientUtils; -import org.dromara.easyes.core.index.AutoProcessIndexNotSmoothlyStrategy; -import org.dromara.easyes.core.index.AutoProcessIndexSmoothlyStrategy; -import org.dromara.easyes.spring.factory.IndexStrategyFactory; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.EnvironmentAware; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.Environment; -import org.springframework.util.Assert; - -import java.util.Map; - -/** - * Easy-Es Spring配置类 - * @author MoJie - * @since 2.0 - */ -@ConditionalOnProperty(value = "easy-es.enable", havingValue = "true") -@Configuration -public class EasyEsConfiguration implements InitializingBean, EnvironmentAware { - - private Environment environment; - - @Setter - @Autowired(required = false) - private EasyEsProperties easyEsProperties; - - @Setter - @Autowired(required = false) - private EasyEsDynamicProperties easyEsDynamicProperties; - - @Override - public void setEnvironment(@NonNull Environment environment) { - this.environment = environment; - } - - /** - * 当当前配置类注册为bean完成后触发,校验easy-es配置是否存在, - * 如果easy-es.enable: false, 那么不进行校验和抛出异常 - * 默认情况下引入了easy-es是需要配置的,即easy-es.enable:true - * 如果不需要easy-es,那么自行配置为false - * @author MoJie - */ - @Override - public void afterPropertiesSet() { - Boolean enable = environment.getProperty(BaseEsConstants.ENABLE_PREFIX, Boolean.class, Boolean.TRUE); - if (enable) { - Assert.notNull(this.easyEsProperties, "easyEsProperties must is A bean. easy-es配置类必须给配置一个bean"); - } - } - - @Bean - public IndexStrategyFactory indexStrategyFactory() { - return new IndexStrategyFactory(); - } - - @Bean - public EsClientUtils esClientUtils() { - EsClientUtils esClientUtils = new EsClientUtils(); - if (this.easyEsDynamicProperties == null) { - this.easyEsDynamicProperties = new EasyEsDynamicProperties(); - } - Map datasourceMap = this.easyEsDynamicProperties.getDatasource(); - if (datasourceMap.isEmpty()) { - // 设置默认数据源,兼容不使用多数据源配置场景的老用户使用习惯 - datasourceMap.put(EsClientUtils.DEFAULT_DS, this.easyEsProperties); - } - for (String key : datasourceMap.keySet()) { - EasyEsProperties easyEsConfigProperties = datasourceMap.get(key); - EsClientUtils.registerClient(key, () -> EsClientUtils.buildClient(easyEsConfigProperties)); - } - return esClientUtils; - } - - /** - * 索引策略注册 - * - * @return {@link AutoProcessIndexStrategy} - * @author MoJie - */ - @Bean - public AutoProcessIndexStrategy autoProcessIndexSmoothlyStrategy() { - return new AutoProcessIndexSmoothlyStrategy(); - } - - @Bean - public AutoProcessIndexStrategy autoProcessIndexNotSmoothlyStrategy() { - return new AutoProcessIndexNotSmoothlyStrategy(); - } - -} diff --git a/ruoyi-common/ruoyi-common-elasticsearch/src/main/java/org/dromara/easyes/starter/config/GeneratorConfiguration.java b/ruoyi-common/ruoyi-common-elasticsearch/src/main/java/org/dromara/easyes/starter/config/GeneratorConfiguration.java deleted file mode 100644 index 3ab45eabb..000000000 --- a/ruoyi-common/ruoyi-common-elasticsearch/src/main/java/org/dromara/easyes/starter/config/GeneratorConfiguration.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.dromara.easyes.starter.config; - -import co.elastic.clients.elasticsearch.ElasticsearchClient; -import org.dromara.easyes.core.config.GeneratorConfig; -import org.dromara.easyes.core.toolkit.Generator; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.stereotype.Component; - -/** - * 代码生成注册 - * @author MoJie - * @since 2.0 - */ -@ConditionalOnProperty(value = "easy-es.enable", havingValue = "true") -@Component -public class GeneratorConfiguration extends Generator { - - @Autowired - private ElasticsearchClient client; - - @Override - public Boolean generate(GeneratorConfig config) { - super.generateEntity(config, this.client); - return Boolean.TRUE; - } -} From b4e1bf259205b1e78c504974fcd32c329700cb1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Wed, 24 Dec 2025 13:11:11 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=9D=A1=E4=BB=B6=E5=86=99=E5=8F=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/dromara/workflow/listener/WorkflowGlobalListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/listener/WorkflowGlobalListener.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/listener/WorkflowGlobalListener.java index fe7bbbcca..fd8e760aa 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/listener/WorkflowGlobalListener.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/listener/WorkflowGlobalListener.java @@ -77,7 +77,7 @@ public class WorkflowGlobalListener implements GlobalListener { String ext = listenerVariable.getNode().getExt(); if (StringUtils.isNotBlank(ext)) { Map variable = listenerVariable.getVariable(); - if (CollUtil.isNotEmpty(variable)) { + if (CollUtil.isEmpty(variable)) { variable = new HashMap<>(); } NodeExtVo nodeExt = nodeExtService.parseNodeExt(ext, variable);