Commit 5dfe16ed84ead605e1a2b95b42d2c1e46662234e

Authored by 谭毅彬
1 parent 8f5534ee

移除多环境登录踢出在线账号功能

Signed-off-by: TanYibin <5491541@qq.com>
huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/LoginController.java
@@ -429,27 +429,28 @@ public class LoginController { @@ -429,27 +429,28 @@ public class LoginController {
429 } 429 }
430 } 430 }
431 431
  432 + // 暂时移除唯一登录功能
432 // 删除相同用户名称对应的key 433 // 删除相同用户名称对应的key
433 - Collection<String> keys = redisTemplate.keys(CommonConstant.PREFIX_USER_TOKEN + "*");  
434 - for (String key : keys) {  
435 - String token = (String)redisUtil.get(key);  
436 - LoginUser loginUser = sysBaseAPI.getUserByName(JwtUtil.getUsername(token));  
437 - if (loginUser != null) {  
438 - if (oConvertUtils.isNotEmpty(username) && loginUser.getUsername().contains(username)) {  
439 - log.info("强制 " + sysUser.getRealname() + " 退出成功! ");  
440 - // 清空用户登录Token缓存  
441 - redisUtil.del(token);  
442 - // 清空用户登录Token缓存  
443 - redisUtil.del(CommonConstant.PREFIX_USER_TOKEN + token);  
444 - // 清空用户登录Shiro权限缓存  
445 - redisUtil.del(CommonConstant.PREFIX_USER_SHIRO_CACHE + sysUser.getId());  
446 - // 清空用户的缓存信息(包括部门信息),例如sys:cache:user::<username>  
447 - redisUtil.del(String.format("%s::%s", CacheConstant.SYS_USERS_CACHE, sysUser.getUsername()));  
448 - // 调用shiro的logout  
449 - SecurityUtils.getSubject().logout();  
450 - }  
451 - }  
452 - } 434 +// Collection<String> keys = redisTemplate.keys(CommonConstant.PREFIX_USER_TOKEN + "*");
  435 +// for (String key : keys) {
  436 +// String token = (String)redisUtil.get(key);
  437 +// LoginUser loginUser = sysBaseAPI.getUserByName(JwtUtil.getUsername(token));
  438 +// if (loginUser != null) {
  439 +// if (oConvertUtils.isNotEmpty(username) && loginUser.getUsername().contains(username)) {
  440 +// log.info("强制 " + sysUser.getRealname() + " 退出成功! ");
  441 +// // 清空用户登录Token缓存
  442 +// redisUtil.del(token);
  443 +// // 清空用户登录Token缓存
  444 +// redisUtil.del(CommonConstant.PREFIX_USER_TOKEN + token);
  445 +// // 清空用户登录Shiro权限缓存
  446 +// redisUtil.del(CommonConstant.PREFIX_USER_SHIRO_CACHE + sysUser.getId());
  447 +// // 清空用户的缓存信息(包括部门信息),例如sys:cache:user::<username>
  448 +// redisUtil.del(String.format("%s::%s", CacheConstant.SYS_USERS_CACHE, sysUser.getUsername()));
  449 +// // 调用shiro的logout
  450 +// SecurityUtils.getSubject().logout();
  451 +// }
  452 +// }
  453 +// }
453 // update-end--Author:sunjianlei Date:20210802 for:获取用户租户信息 454 // update-end--Author:sunjianlei Date:20210802 for:获取用户租户信息
454 // 生成token 455 // 生成token
455 String token = HuahengJwtUtil.sign(username, syspassword, warehouseCode); 456 String token = HuahengJwtUtil.sign(username, syspassword, warehouseCode);