|
@ -1,8 +1,8 @@ |
|
|
/** |
|
|
/** |
|
|
* Copyright (c) 2018 人人开源 All rights reserved. |
|
|
* Copyright (c) 2018 人人开源 All rights reserved. |
|
|
* |
|
|
* <p> |
|
|
* https://www.renren.io
|
|
|
* https://www.renren.io
|
|
|
* |
|
|
* <p> |
|
|
* 版权所有,侵权必究! |
|
|
* 版权所有,侵权必究! |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
@ -30,9 +30,9 @@ public class UserDetailRedis { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private RedisUtils redisUtils; |
|
|
private RedisUtils redisUtils; |
|
|
|
|
|
|
|
|
public void set(UserDetail user, long expire){ |
|
|
public void set(UserDetail user, long expire) { |
|
|
if(user == null){ |
|
|
if (user == null) { |
|
|
return ; |
|
|
return; |
|
|
} |
|
|
} |
|
|
String key = RedisKeys.getSecurityUserKey(user.getId()); |
|
|
String key = RedisKeys.getSecurityUserKey(user.getId()); |
|
|
//bean to map
|
|
|
//bean to map
|
|
@ -45,11 +45,11 @@ public class UserDetailRedis { |
|
|
redisUtils.delete(RedisKeys.getUserPermissionsKey(user.getId())); |
|
|
redisUtils.delete(RedisKeys.getUserPermissionsKey(user.getId())); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public UserDetail get(Long id){ |
|
|
public UserDetail get(Long id) { |
|
|
String key = RedisKeys.getSecurityUserKey(id); |
|
|
String key = RedisKeys.getSecurityUserKey(id); |
|
|
|
|
|
|
|
|
Map<String, Object> map = redisUtils.hGetAll(key); |
|
|
Map<String, Object> map = redisUtils.hGetAll(key); |
|
|
if(MapUtil.isEmpty(map)){ |
|
|
if (MapUtil.isEmpty(map)) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -63,7 +63,7 @@ public class UserDetailRedis { |
|
|
* 用户退出 |
|
|
* 用户退出 |
|
|
* @param id 用户ID |
|
|
* @param id 用户ID |
|
|
*/ |
|
|
*/ |
|
|
public void logout(Long id){ |
|
|
public void logout(Long id) { |
|
|
String key = RedisKeys.getSecurityUserKey(id); |
|
|
String key = RedisKeys.getSecurityUserKey(id); |
|
|
redisUtils.hSet(key, "kill", UserKillEnum.YES.value()); |
|
|
redisUtils.hSet(key, "kill", UserKillEnum.YES.value()); |
|
|
|
|
|
|
|
@ -71,5 +71,6 @@ public class UserDetailRedis { |
|
|
redisUtils.deleteByPattern(RedisKeys.getUserMenuNavKey(id)); |
|
|
redisUtils.deleteByPattern(RedisKeys.getUserMenuNavKey(id)); |
|
|
redisUtils.delete(RedisKeys.getUserPermissionsKey(id)); |
|
|
redisUtils.delete(RedisKeys.getUserPermissionsKey(id)); |
|
|
redisUtils.delete(RedisKeys.getAdminUserDeptOptionKey(id)); |
|
|
redisUtils.delete(RedisKeys.getAdminUserDeptOptionKey(id)); |
|
|
|
|
|
redisUtils.delete(RedisKeys.getAllAdminUserDeptOptionKey(id)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|