Parcourir la source

待办查询为空(实际存在待办)

zhulu il y a 9 mois
Parent
commit
5cfd9cab02

+ 12 - 4
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/panel/service/impl/PanelServiceImpl.java

@@ -113,12 +113,20 @@ public class PanelServiceImpl implements PanelService {
                 ErrorMsgConstants.QUERY_USER_ROLE_ERROR);*/
         List<Long> roleIds = null;
         if (ObjectUtil.equal(SecurityUtils.getUserId(), userId)) {
-            String cacheKey= CacheConstants.USER_CACHE_ROLE_OBJECT_KEY+userId.toString();
+            String cacheKey= CacheConstants.USER_CACHE_ROLE_ID_KEY+userId.toString();
             if(RedisUtils.hasKey(cacheKey))
             {
-                List<SysRole> roles =  RedisUtils.getCacheObject(cacheKey);
-                //roles 获取id集合
-                roleIds = roles.stream().map(SysRole::getId).collect(Collectors.toList());
+                roleIds= RedisUtils.getCacheObject(cacheKey);
+//                List<SysRole> roles =  RedisUtils.getCacheObject(cacheKey);
+//                //roles 获取id集合
+//                roleIds = roles.stream().map(SysRole::getId).collect(Collectors.toList());
+            }
+            // 缓存有被清空的肯能
+            else
+            {
+                roleIds = RemoteCallHandlerExecutor.executeRemoteCall(
+                        () -> roleService.getUserRoleId(userId, SecurityConstants.FROM_SOURCE),
+                        ErrorMsgConstants.QUERY_USER_ROLE_ERROR);
             }
         } else {
             roleIds = RemoteCallHandlerExecutor.executeRemoteCall(