新增:新增系统监控/在线用户功能,并优化部分注释规范

This commit is contained in:
2023-01-21 14:15:00 +08:00
parent 185b79320f
commit 3116fd3eae
24 changed files with 640 additions and 48 deletions

View File

@@ -169,7 +169,20 @@ public class GlobalExceptionHandler {
@ExceptionHandler(NotLoginException.class)
public R handleNotLoginException(NotLoginException e, HttpServletRequest request) {
log.error("请求地址'{}',认证失败,无法访问系统资源", request.getRequestURI(), e);
String errorMsg = "登录状态已过期,请重新登录";
String errorMsg;
switch (e.getType()) {
case NotLoginException.KICK_OUT:
errorMsg = "您已被踢下线";
break;
case NotLoginException.BE_REPLACED_MESSAGE:
errorMsg = "您已被顶下线";
break;
default:
errorMsg = "登录状态已过期,请重新登录";
break;
}
LogContextHolder.setErrorMsg(errorMsg);
return R.fail(HttpStatus.UNAUTHORIZED.value(), errorMsg);
}