Commit fd1f43a9 authored by 赵啸非's avatar 赵啸非

添加删除站点后通知门户服务更新

parent 7923bd7e
...@@ -243,16 +243,9 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity ...@@ -243,16 +243,9 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
this.update(userEntity, context); this.update(userEntity, context);
//更新redis中 所有用户session信息 //更新redis中 所有用户session信息
Set<String> keys = cacheService.scan(Constant.LOGIN_TOKEN_KEY + userEntity.getId()); updateRedisUserSession(userEntity);
keys.forEach(item->{
String token = StrUtil.subAfter(item, Constant.LOGIN_TOKEN_KEY + userEntity.getId() + ":", false);
userEntity.setToken(token);
userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
authTokenService.setUser(userEntity);
});
} }
@Override @Override
protected void saveAfter(UserEntity entity, Context context) throws AppException { protected void saveAfter(UserEntity entity, Context context) throws AppException {
super.saveAfter(entity, context); super.saveAfter(entity, context);
...@@ -286,7 +279,19 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity ...@@ -286,7 +279,19 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
userEntity.setId(item.getId()); userEntity.setId(item.getId());
userEntity.setSiteIds(siteIds); userEntity.setSiteIds(siteIds);
this.dao.update(userEntity); this.dao.update(userEntity);
updateRedisUserSession(userEntity);
} }
}); });
} }
private void updateRedisUserSession(UserEntity userEntity) {
Set<String> keys = cacheService.scan(Constant.LOGIN_TOKEN_KEY + userEntity.getId());
keys.forEach(key -> {
String token = StrUtil.subAfter(key, Constant.LOGIN_TOKEN_KEY + userEntity.getId() + ":", false);
userEntity.setToken(token);
userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
authTokenService.setUser(userEntity);
});
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment