|
@@ -9,7 +9,10 @@ import com.huaxu.entity.UserRoleEntity;
|
|
|
import com.huaxu.entity.UserTagEntity;
|
|
|
import com.huaxu.model.LoginUser;
|
|
|
import com.huaxu.model.ProgramItem;
|
|
|
+import com.huaxu.util.ByteArrayUtils;
|
|
|
+import com.huaxu.util.RedisUtil;
|
|
|
import com.huaxu.util.UserUtil;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -35,6 +38,8 @@ public class UserService extends ServiceImpl<UserMapper,UserEntity> {
|
|
|
private UserTagService userTagService;
|
|
|
@Resource
|
|
|
private UserRoleService userRoleService;
|
|
|
+ @Autowired
|
|
|
+ private RedisUtil redisUtil;
|
|
|
|
|
|
/**
|
|
|
* 自定义分页查询,含关联实体对像
|
|
@@ -137,6 +142,19 @@ public class UserService extends ServiceImpl<UserMapper,UserEntity> {
|
|
|
*/
|
|
|
public boolean updateUserById(UserEntity user) {
|
|
|
if (this.updateById(user)) {
|
|
|
+ UserEntity userEntity = findUserById(user.getId());
|
|
|
+ if (userEntity != null) {
|
|
|
+ //將禁用的角色放入redis,作为登出判断
|
|
|
+ if (userEntity.getEnableState().equals("0")) {
|
|
|
+ String roleKey = "disableUser:" + user.getId();
|
|
|
+ redisUtil.setExpire(roleKey.getBytes(), ByteArrayUtils.objectToBytes("1").get(), 60 * 60 * 24);//15分钟过期
|
|
|
+
|
|
|
+ }
|
|
|
+ if (userEntity.getEnableState().equals("1")) {
|
|
|
+ String roleKey = "disableUser:" + user.getId();
|
|
|
+ redisUtil.del(roleKey.getBytes());
|
|
|
+ }
|
|
|
+ }
|
|
|
//更新关联附件信息
|
|
|
Long pkId = user.getId();
|
|
|
//添加用户标签
|