访问积木报表提示token无权限,原因TokenUtils.getLoginUser方法报错

pull/6344/head
JEECG 2024-06-22 22:59:34 +08:00
parent 6ade7e22f8
commit e9d05b0e75
1 changed files with 5 additions and 4 deletions

View File

@ -112,8 +112,8 @@ public class TokenUtils {
} }
// 查询用户信息 // 查询用户信息
LoginUser user = TokenUtils.getLoginUser(username, commonApi, redisUtil); //LoginUser user = TokenUtils.getLoginUser(username, commonApi, redisUtil);
//LoginUser user = commonApi.getUserByName(username); LoginUser user = commonApi.getUserByName(username);
if (user == null) { if (user == null) {
throw new JeecgBoot401Exception("用户不存在!"); throw new JeecgBoot401Exception("用户不存在!");
} }
@ -173,10 +173,11 @@ public class TokenUtils {
//【重要】此处通过redis原生获取缓存用户是为了解决微服务下system服务挂了其他服务互调不通问题--- //【重要】此处通过redis原生获取缓存用户是为了解决微服务下system服务挂了其他服务互调不通问题---
if (redisUtil.hasKey(loginUserKey)) { if (redisUtil.hasKey(loginUserKey)) {
try { try {
loginUser = (LoginUser) redisUtil.get(loginUserKey); Object obj = redisUtil.get(loginUserKey);
loginUser = (LoginUser) obj;
//解密用户 //解密用户
SensitiveInfoUtil.handlerObject(loginUser, false); SensitiveInfoUtil.handlerObject(loginUser, false);
} catch (IllegalAccessException e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} else { } else {