解决长时间未登录管理体系报错

master
wany 2024-10-12 11:43:08 +08:00
parent afbfd5f33a
commit 2894f9cb94
3 changed files with 9 additions and 2 deletions

View File

@ -4,8 +4,11 @@ import com.gunshi.core.result.R;
import com.gunshi.core.result.exception.ressolver.E500UnknownExceptionResolver;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.bind.annotation.RestControllerAdvice;
/**
* Description:
* Created by XuSan on 2024/7/10.
@ -20,6 +23,9 @@ public class MyE500UnknownExceptionResolver extends E500UnknownExceptionResolver
public R<String> resolve(Exception exception) {
log.error("系统未知异常,错误信息: " + exception.getMessage(), exception);
if (exception instanceof AccessDeniedException) {
return R.error(401, "登录状态失效,请重新登录");
}
return R.error(500, "系统未知异常,错误信息: " + exception.getMessage());
}
}

View File

@ -60,7 +60,8 @@ public class SysUserLogAspect {
// loginUserId = projectCommonService.getLoginUserId();
loginUserId = SecurityUtils.getUserId();
} catch (ServiceException e) {
log.info("获取登录账号id," + e.getMessage(), e);
// log.info("获取登录账号id," + e.getMessage(), e);
log.info("获取登录账号id异常请重新登录");
}
if (loginUserId != null) {

View File

@ -26,7 +26,7 @@ token:
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟
expireTime: 30
expireTime: 1440
# 防止XSS攻击
xss: