From be2fb209f247b5d3365950b2383ae026c7244608 Mon Sep 17 00:00:00 2001 From: wangxiaopeng <807933401@qq.com> Date: Tue, 9 Apr 2024 19:41:02 +0800 Subject: [PATCH] getUserByRoleEnumAndAreaId --- .../cool/store/service/impl/UserAuthMappingServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/UserAuthMappingServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/UserAuthMappingServiceImpl.java index 9552326cd..b87785b7c 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/UserAuthMappingServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/UserAuthMappingServiceImpl.java @@ -106,6 +106,9 @@ public class UserAuthMappingServiceImpl implements UserAuthMappingService { } if(UserRoleEnum.INVESTMENT_MANAGER.equals(userRoleEnum)){ // 按工号排序后放入redis + authWarRegionUserIdList = authWarRegionUserIdList.stream() + .sorted((a, b) -> a.compareTo(b)) + .collect(Collectors.toList()); redisUtilPool.listPushTail(investmentManagerKey, authWarRegionUserIdList.toArray(new String[authWarRegionUserIdList.size()])); suitableUserId = redisUtilPool.rpopStr(investmentManagerKey); }else { @@ -139,7 +142,7 @@ public class UserAuthMappingServiceImpl implements UserAuthMappingService { } List roleIdList = roleIds.stream().map(a -> Long.valueOf(a)).collect(Collectors.toList()); List 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> enterpriseUserRoleMap = ListUtils.emptyIfNull(enterpriseUserRoleList).stream().collect(Collectors.groupingBy(EnterpriseUserRole::getRoleId, Collectors.mapping(k->k.getUserId(), Collectors.toList()))); return enterpriseUserRoleMap; }