getUserByRoleEnumAndAreaId

This commit is contained in:
wangxiaopeng
2024-04-09 19:41:02 +08:00
parent 4ebf5c184a
commit be2fb209f2

View File

@@ -106,6 +106,9 @@ public class UserAuthMappingServiceImpl implements UserAuthMappingService {
} }
if(UserRoleEnum.INVESTMENT_MANAGER.equals(userRoleEnum)){ if(UserRoleEnum.INVESTMENT_MANAGER.equals(userRoleEnum)){
// 按工号排序后放入redis // 按工号排序后放入redis
authWarRegionUserIdList = authWarRegionUserIdList.stream()
.sorted((a, b) -> a.compareTo(b))
.collect(Collectors.toList());
redisUtilPool.listPushTail(investmentManagerKey, authWarRegionUserIdList.toArray(new String[authWarRegionUserIdList.size()])); redisUtilPool.listPushTail(investmentManagerKey, authWarRegionUserIdList.toArray(new String[authWarRegionUserIdList.size()]));
suitableUserId = redisUtilPool.rpopStr(investmentManagerKey); suitableUserId = redisUtilPool.rpopStr(investmentManagerKey);
}else { }else {
@@ -139,7 +142,7 @@ public class UserAuthMappingServiceImpl implements UserAuthMappingService {
} }
List<Long> roleIdList = roleIds.stream().map(a -> Long.valueOf(a)).collect(Collectors.toList()); List<Long> roleIdList = roleIds.stream().map(a -> Long.valueOf(a)).collect(Collectors.toList());
List<EnterpriseUserRole> enterpriseUserRoleList = sysRoleMapper.getUserIdListByRoleIdList(roleIdList); List<EnterpriseUserRole> enterpriseUserRoleList = sysRoleMapper.getUserIdListByRoleIdList(roleIdList);
enterpriseUserRoleList = enterpriseUserRoleList.stream().filter(o -> authRegionUserIdList.contains(o.getUserId())).collect(Collectors.toList()); enterpriseUserRoleList = ListUtils.emptyIfNull(enterpriseUserRoleList).stream().filter(o -> authRegionUserIdList.contains(o.getUserId())).collect(Collectors.toList());
Map<String, List<String>> enterpriseUserRoleMap = ListUtils.emptyIfNull(enterpriseUserRoleList).stream().collect(Collectors.groupingBy(EnterpriseUserRole::getRoleId, Collectors.mapping(k->k.getUserId(), Collectors.toList()))); Map<String, List<String>> enterpriseUserRoleMap = ListUtils.emptyIfNull(enterpriseUserRoleList).stream().collect(Collectors.groupingBy(EnterpriseUserRole::getRoleId, Collectors.mapping(k->k.getUserId(), Collectors.toList())));
return enterpriseUserRoleMap; return enterpriseUserRoleMap;
} }