mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-12-26 01:55:59 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88f871002c | ||
|
|
874ad7c9b7 | ||
|
|
89d6f6f247 | ||
|
|
1324a1cb16 |
@@ -14,6 +14,7 @@ import org.dromara.common.core.exception.SseException;
|
|||||||
import org.dromara.common.core.exception.base.BaseException;
|
import org.dromara.common.core.exception.base.BaseException;
|
||||||
import org.dromara.common.core.utils.StreamUtils;
|
import org.dromara.common.core.utils.StreamUtils;
|
||||||
import org.dromara.common.json.utils.JsonUtils;
|
import org.dromara.common.json.utils.JsonUtils;
|
||||||
|
import org.springframework.context.MessageSourceResolvable;
|
||||||
import org.springframework.context.support.DefaultMessageSourceResolvable;
|
import org.springframework.context.support.DefaultMessageSourceResolvable;
|
||||||
import org.springframework.expression.ExpressionException;
|
import org.springframework.expression.ExpressionException;
|
||||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
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.ResponseStatus;
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
import org.springframework.web.context.request.async.AsyncRequestTimeoutException;
|
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.method.annotation.MethodArgumentTypeMismatchException;
|
||||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||||
|
|
||||||
@@ -191,6 +193,16 @@ public class GlobalExceptionHandler {
|
|||||||
return R.fail(message);
|
return R.fail(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方法参数校验异常 用于处理 @Validated 注解
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(HandlerMethodValidationException.class)
|
||||||
|
public R<Void> handlerMethodValidationException(HandlerMethodValidationException e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
String message = StreamUtils.join(e.getAllErrors(), MessageSourceResolvable::getDefaultMessage, ", ");
|
||||||
|
return R.fail(message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSON 解析异常(Jackson 在处理 JSON 格式出错时抛出)
|
* JSON 解析异常(Jackson 在处理 JSON 格式出错时抛出)
|
||||||
* 可能是请求体格式非法,也可能是服务端反序列化失败
|
* 可能是请求体格式非法,也可能是服务端反序列化失败
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import org.dromara.common.websocket.holder.WebSocketSessionHolder;
|
|||||||
import org.dromara.common.websocket.utils.WebSocketUtils;
|
import org.dromara.common.websocket.utils.WebSocketUtils;
|
||||||
import org.springframework.web.socket.*;
|
import org.springframework.web.socket.*;
|
||||||
import org.springframework.web.socket.handler.AbstractWebSocketHandler;
|
import org.springframework.web.socket.handler.AbstractWebSocketHandler;
|
||||||
|
import org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -33,7 +34,7 @@ public class PlusWebSocketHandler extends AbstractWebSocketHandler {
|
|||||||
log.info("[connect] invalid token received. sessionId: {}", session.getId());
|
log.info("[connect] invalid token received. sessionId: {}", session.getId());
|
||||||
return;
|
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());
|
log.info("[connect] sessionId: {},userId:{},userType:{}", session.getId(), loginUser.getUserId(), loginUser.getUserType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public class WebSocketUtils {
|
|||||||
* @param session WebSocket会话
|
* @param session WebSocket会话
|
||||||
* @param message 要发送的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()) {
|
if (session == null || !session.isOpen()) {
|
||||||
log.warn("[send] session会话已经关闭");
|
log.warn("[send] session会话已经关闭");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class WorkflowGlobalListener implements GlobalListener {
|
|||||||
String ext = listenerVariable.getNode().getExt();
|
String ext = listenerVariable.getNode().getExt();
|
||||||
if (StringUtils.isNotBlank(ext)) {
|
if (StringUtils.isNotBlank(ext)) {
|
||||||
Map<String, Object> variable = listenerVariable.getVariable();
|
Map<String, Object> variable = listenerVariable.getVariable();
|
||||||
if (CollUtil.isNotEmpty(variable)) {
|
if (CollUtil.isEmpty(variable)) {
|
||||||
variable = new HashMap<>();
|
variable = new HashMap<>();
|
||||||
}
|
}
|
||||||
NodeExtVo nodeExt = nodeExtService.parseNodeExt(ext, variable);
|
NodeExtVo nodeExt = nodeExtService.parseNodeExt(ext, variable);
|
||||||
|
|||||||
Reference in New Issue
Block a user