解决长时间未登录管理体系报错
parent
afbfd5f33a
commit
2894f9cb94
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ token:
|
|||
# 令牌密钥
|
||||
secret: abcdefghijklmnopqrstuvwxyz
|
||||
# 令牌有效期(默认30分钟)
|
||||
expireTime: 30
|
||||
expireTime: 1440
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
|
|
|
|||
Loading…
Reference in New Issue