Commit 402755e0 authored by nie'hong's avatar nie'hong

修改bug

parent c6e6724f
package cn.wisenergy.common.utils;
import java.util.List;
/**
* @description:
* @author: nh
* @create: 2021-06-02 11:47
**/
public class CustomerCollectionUtil {
/**
* @Author liuhaidong
* @Description containsAll 仅能判断内容,不能判断顺序
* @param
* @Date 11:42 2019/10/7 0007
*/
public static boolean isTrue(List<Integer> list1, List<Integer> list2){
if(list1 == null && list2 == null){
return true;
}
if(list1 != null && list1.containsAll(list2) &&
list2 != null && list2.containsAll(list1)){
return true;
}else {
return false;
}
}
}
......@@ -53,4 +53,6 @@ public class ResultUser implements Serializable {
private List<WorkLevel> workLevels;
private List<Integer> roleList;
}
......@@ -2,6 +2,7 @@ package cn.wisenergy.service.impl;
import cn.hutool.json.JSONObject;
import cn.wisenergy.common.utils.CustomerCollectionUtil;
import cn.wisenergy.common.utils.Md5Util;
import cn.wisenergy.common.utils.WeChatUtil;
import cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM;
......@@ -246,12 +247,15 @@ public class WorkUserServiceImpl implements WorkUserService {
if (null == workUser) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.QUERY_DATA_IS_NULL);
}
// 获取用户当前的角色信息
List<Integer> roleIdList = UserRoleLevelUtils.getRole(userId);
// 修改用户角色信息和账户状态,该用户下线
if (!CustomerCollectionUtil.isTrue(roleIds,roleIdList) || !workUser.getStatus().equals(status)) {
// 踢出该用户前一个登录
kickoutSessionControlFilter.cleanUserLogin( userId);
kickoutSessionControlFilter.cleanUserLogin(userId);
}
// 清空该用在redis中的认证信息
WorkUser user = workUserMapper.getUserById(userId);
redisTemplate.delete("AuthenticationRedisCache" + user.getName());
redisTemplate.delete("AuthenticationRedisCache" + workUser.getName());
WorkDept workDept = workDeptService.getById(workUser.getDeptId());
WorkCentre centre = workCentreService.getCentreById(workDept.getCentreId());
......@@ -455,6 +459,8 @@ public class WorkUserServiceImpl implements WorkUserService {
//将用户对象转换为dto
ResultUser resultUser = getResultUser(user, byId, roles);
resultUser.setRoleList(roles);
return resultUser;
}
......
......@@ -74,7 +74,7 @@ public class ShiroConfig {
map.put("/swagger-resources/**","anon");
map.put("/v2/**","anon");
map.put("/static/**", "anon");
// map.put("/**", "kickout");
map.put("/**", "kickout");
map.put("/wxLogout", "wxLogout");
shiroFilterFactoryBean.setFilterChainDefinitionMap(map);
......
......@@ -123,7 +123,6 @@ public class KickoutSessionControlFilter extends AccessControlFilter {
e.printStackTrace();
}
}
return true;
}
......
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