Browse Source

3.2.0-重置密码bug

xiaof 2 years ago
parent
commit
bb0778d8db

+ 8 - 4
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/TeachcloudCommonServiceImpl.java

@@ -363,9 +363,13 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
                 redisUtil.deleteUserSession(sessionId);
             }
         } else {
-            TBSession tbSession = (TBSession) ServletUtil.getRequestSession();
-            tbSessionService.removeById(tbSession.getId());
-            redisUtil.deleteUserSession(tbSession.getId());
+            Set<String> roleNamesSet = authBean.getRoleList().stream().map(s -> s.getName()).collect(Collectors.toSet());
+            List<String> roleNames = new ArrayList<>();
+            roleNames.addAll(roleNamesSet);
+            Collections.sort(roleNames);
+            String sessionId = SessionUtil.digest(userId, Math.abs(roleNames.toString().hashCode()), Platform.WEB.name());
+            tbSessionService.removeById(sessionId);
+            redisUtil.deleteUserSession(sessionId);
         }
         commonCacheService.removeUserCache(userId);
         commonCacheService.removeUserAuthCache(userId);
@@ -689,7 +693,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         if (orgId == null) {
             return null;
         }
-        List<OrgDto> orgDtos = sysOrgService.listOrgTree(null,false);
+        List<OrgDto> orgDtos = sysOrgService.listOrgTree(null, false);
         Set<Long> stringSet = new HashSet<>();
         stringSet.add(orgId);
         stringSet = getOrgIds(stringSet, orgDtos, orgId);