Commit 97e10e91 authored by 韩桐桐's avatar 韩桐桐

fix(jg):多角色登录信息失效后重新刷入当时选择的单角色类型

parent af2c955a
...@@ -188,6 +188,9 @@ public class ControllerAop { ...@@ -188,6 +188,9 @@ public class ControllerAop {
mapDepartments = user.getCompanyDepartments(); mapDepartments = user.getCompanyDepartments();
departmentM = companyM != null ? mapDepartments.get(companyM.getSequenceNbr()).get(0) : null; departmentM = companyM != null ? mapDepartments.get(companyM.getSequenceNbr()).get(0) : null;
} }
if (!ValidationUtil.isEmpty(company.getCompanyType()) && redisUtils.hasKey(RedisKey.buildReginRoleKey(RequestContext.getExeUserId()))){
company.setCompanyType(String.valueOf(redisUtils.get(RedisKey.buildReginRoleKey(RequestContext.getExeUserId()))));
}
Bean.copyExistPropertis(departmentM, department); Bean.copyExistPropertis(departmentM, department);
Map<Long, List<RoleModel>> roles = user.getOrgRoles(); Map<Long, List<RoleModel>> roles = user.getOrgRoles();
Long sequenceNbr; Long sequenceNbr;
......
...@@ -56,6 +56,10 @@ public class RedisKey { ...@@ -56,6 +56,10 @@ public class RedisKey {
*/ */
public static final String REGION_REDIS_PREFIX = "biz_"; public static final String REGION_REDIS_PREFIX = "biz_";
/** /**
* 多角色用户选择的单一角色
*/
public static final String REGION_ROLE_KEY = REGION_REDIS_PREFIX + "role_";
/**
* 创建区域key * 创建区域key
* @param token 权限 * @param token 权限
* @return String * @return String
...@@ -72,6 +76,14 @@ public class RedisKey { ...@@ -72,6 +76,14 @@ public class RedisKey {
public static String buildPatternKey(String token) { public static String buildPatternKey(String token) {
return REGION_REDIS_PREFIX + "*" + "_" + token; return REGION_REDIS_PREFIX + "*" + "_" + token;
} }
/**
* 创建多角色用户选择的某一角色key
* @param userId 用户id
* @return String
*/
public static String buildReginRoleKey(String userId) {
return REGION_ROLE_KEY + userId;
}
/** /**
* 判断str1中包含str2的个数 * 判断str1中包含str2的个数
......
...@@ -1984,6 +1984,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1984,6 +1984,7 @@ public class CommonServiceImpl implements ICommonService {
@Override @Override
public void updateUnitTypeCache(ReginParams reginParams, String unitType, String selectedRoleSeqs) { public void updateUnitTypeCache(ReginParams reginParams, String unitType, String selectedRoleSeqs) {
reginParams.getCompany().setCompanyType(unitType); reginParams.getCompany().setCompanyType(unitType);
redisUtils.set(RedisKey.buildReginRoleKey(RequestContext.getExeUserId()), unitType);
redisUtils.set(getSelectedRoleRedisKey(), selectedRoleSeqs, redisRegionTimeSecond); redisUtils.set(getSelectedRoleRedisKey(), selectedRoleSeqs, redisRegionTimeSecond);
redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParams), redisRegionTimeSecond); redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParams), redisRegionTimeSecond);
} }
......
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