jindi 1 éve
szülő
commit
6a8dd5efbc

+ 37 - 30
.idea/workspace.xml

@@ -334,7 +334,7 @@
       <workItem from="1694170221068" duration="88000" />
       <workItem from="1694224377178" duration="4330000" />
       <workItem from="1694240006247" duration="12587000" />
-      <workItem from="1694394248081" duration="27545000" />
+      <workItem from="1694394248081" duration="29779000" />
     </task>
     <task id="LOCAL-00001" summary="项目提交">
       <created>1692754671570</created>
@@ -560,7 +560,14 @@
       <option name="project" value="LOCAL" />
       <updated>1694429016359</updated>
     </task>
-    <option name="localTasksCounter" value="33" />
+    <task id="LOCAL-00033" summary="项目提交">
+      <created>1694429823236</created>
+      <option name="number" value="00033" />
+      <option name="presentableId" value="LOCAL-00033" />
+      <option name="project" value="LOCAL" />
+      <updated>1694429823236</updated>
+    </task>
+    <option name="localTasksCounter" value="34" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -600,10 +607,10 @@
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
     <state x="2635" y="222" width="1024" height="595" key="#xdebugger.evaluate/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694402260583" />
-    <state x="2544" y="170" key="CommitChangelistDialog2" timestamp="1694429011193">
+    <state x="2544" y="170" key="CommitChangelistDialog2" timestamp="1694429817699">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
-    <state x="2544" y="170" key="CommitChangelistDialog2/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429011193" />
+    <state x="2544" y="170" key="CommitChangelistDialog2/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429817699" />
     <state width="1444" height="466" key="DebuggerActiveHint" timestamp="1694418699725">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
@@ -616,54 +623,54 @@
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
     <state x="2660" y="275" key="FileChooserDialogImpl/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694249944928" />
-    <state width="1877" height="220" key="GridCell.Tab.0.bottom" timestamp="1694429760369">
+    <state width="1877" height="220" key="GridCell.Tab.0.bottom" timestamp="1694432021150">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="220" key="GridCell.Tab.0.bottom/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429760369" />
-    <state width="1877" height="220" key="GridCell.Tab.0.center" timestamp="1694429760369">
+    <state width="1877" height="220" key="GridCell.Tab.0.bottom/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694432021150" />
+    <state width="1877" height="220" key="GridCell.Tab.0.center" timestamp="1694432021149">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="220" key="GridCell.Tab.0.center/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429760369" />
-    <state width="1877" height="220" key="GridCell.Tab.0.left" timestamp="1694429760368">
+    <state width="1877" height="220" key="GridCell.Tab.0.center/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694432021149" />
+    <state width="1877" height="220" key="GridCell.Tab.0.left" timestamp="1694432021149">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="220" key="GridCell.Tab.0.left/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429760368" />
-    <state width="1877" height="220" key="GridCell.Tab.0.right" timestamp="1694429760369">
+    <state width="1877" height="220" key="GridCell.Tab.0.left/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694432021149" />
+    <state width="1877" height="220" key="GridCell.Tab.0.right" timestamp="1694432021150">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="220" key="GridCell.Tab.0.right/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429760369" />
-    <state width="1877" height="233" key="GridCell.Tab.1.bottom" timestamp="1694429745767">
+    <state width="1877" height="220" key="GridCell.Tab.0.right/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694432021150" />
+    <state width="1877" height="218" key="GridCell.Tab.1.bottom" timestamp="1694432005403">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="233" key="GridCell.Tab.1.bottom/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429745767" />
-    <state width="1877" height="233" key="GridCell.Tab.1.center" timestamp="1694429745766">
+    <state width="1877" height="218" key="GridCell.Tab.1.bottom/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694432005403" />
+    <state width="1877" height="218" key="GridCell.Tab.1.center" timestamp="1694432005402">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="233" key="GridCell.Tab.1.center/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429745766" />
-    <state width="1877" height="233" key="GridCell.Tab.1.left" timestamp="1694429745766">
+    <state width="1877" height="218" key="GridCell.Tab.1.center/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694432005402" />
+    <state width="1877" height="218" key="GridCell.Tab.1.left" timestamp="1694432005402">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="233" key="GridCell.Tab.1.left/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429745766" />
-    <state width="1877" height="233" key="GridCell.Tab.1.right" timestamp="1694429745766">
+    <state width="1877" height="218" key="GridCell.Tab.1.left/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694432005402" />
+    <state width="1877" height="218" key="GridCell.Tab.1.right" timestamp="1694432005403">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="233" key="GridCell.Tab.1.right/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429745766" />
-    <state width="1877" height="233" key="GridCell.Tab.2.bottom" timestamp="1694429745767">
+    <state width="1877" height="218" key="GridCell.Tab.1.right/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694432005403" />
+    <state width="1877" height="218" key="GridCell.Tab.2.bottom" timestamp="1694432005403">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="233" key="GridCell.Tab.2.bottom/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429745767" />
-    <state width="1877" height="233" key="GridCell.Tab.2.center" timestamp="1694429745767">
+    <state width="1877" height="218" key="GridCell.Tab.2.bottom/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694432005403" />
+    <state width="1877" height="218" key="GridCell.Tab.2.center" timestamp="1694432005403">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="233" key="GridCell.Tab.2.center/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429745767" />
-    <state width="1877" height="233" key="GridCell.Tab.2.left" timestamp="1694429745767">
+    <state width="1877" height="218" key="GridCell.Tab.2.center/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694432005403" />
+    <state width="1877" height="218" key="GridCell.Tab.2.left" timestamp="1694432005403">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="233" key="GridCell.Tab.2.left/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429745767" />
-    <state width="1877" height="233" key="GridCell.Tab.2.right" timestamp="1694429745767">
+    <state width="1877" height="218" key="GridCell.Tab.2.left/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694432005403" />
+    <state width="1877" height="218" key="GridCell.Tab.2.right" timestamp="1694432005403">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
-    <state width="1877" height="233" key="GridCell.Tab.2.right/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429745767" />
+    <state width="1877" height="218" key="GridCell.Tab.2.right/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694432005403" />
     <state x="2636" y="231" key="RollbackChangesDialog" timestamp="1694401544807">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
@@ -672,10 +679,10 @@
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
     <state x="2381" y="162" key="SettingsEditor/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694170307639" />
-    <state x="2472" y="253" key="Vcs.Push.Dialog.v2" timestamp="1694429021077">
+    <state x="2472" y="253" key="Vcs.Push.Dialog.v2" timestamp="1694429829164">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>
-    <state x="2472" y="253" key="Vcs.Push.Dialog.v2/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429021077" />
+    <state x="2472" y="253" key="Vcs.Push.Dialog.v2/1920.0.1920.1040/0.0.1920.1040@1920.0.1920.1040" timestamp="1694429829164" />
     <state width="968" height="528" key="XDebugger.FullValuePopup" timestamp="1693907767752">
       <screen x="1920" y="0" width="1920" height="1040" />
     </state>

+ 41 - 2
src/main/java/com/pj/project/sso/SsoServerController.java

@@ -336,9 +336,48 @@ public class SsoServerController {
     // 返回所有在线用户
     @RequestMapping("/sso/getList")
     public AjaxJson getList(@RequestParam(defaultValue = "") String keyword) {
-        if (StringUtil.isNullOrEmpty(keyword)){
+        if (StringUtil.isNullOrEmpty(keyword)) {
             // 返回
-            return AjaxJson.getPageData(0L,null);
+            int[] array = new int[0];
+            return AjaxJson.getPageData(0L, array);
+        }
+
+        SoMap so = SoMap.getRequestSoMap();
+        // 可以搜索到多少条数据
+        long count = StpUserUtil.searchSessionId(keyword, 0, -1, false).size();
+        // 搜出来的所有SessionId
+        List<String> sessionIdList = StpUserUtil.searchSessionId(keyword, so.getStartIndex(), so.getKeyPageSize(), false);
+        // 根据其 Session 获取详细数据
+        List<SoMap> infoList = sessionIdList
+                .stream()
+                .map(sessionId -> StpUserUtil.getSessionBySessionId(sessionId))
+                .map(session -> {
+                    SoMap soMap = SoMap.getSoMap()
+                            .set("sessionId", session.getId())
+                            .set("tokenSignList", session.getTokenSignList())
+                            .set("createTime", session.getCreateTime())
+                            .set("timeout", session.getTimeout());
+                    SysUser user = session.getModel("user", SysUser.class);
+                    if (user != null) {
+                        soMap.set("userId", user.getId())
+                                .set("username", user.getUsername())
+                                .set("avatar", user.getAvatar());
+                    }
+                    return soMap;
+                }).collect(Collectors.toList());
+        // 返回
+        return AjaxJson.getPageData(count, infoList);
+    }
+
+    // 返回所有在线用户-server端
+    @RequestMapping("/sso/getListServer")
+    public AjaxJson getListServer(@RequestBody String keyJson) {
+        JSONObject jsonObject = JSON.parseObject(keyJson);
+        String keyword = (String) jsonObject.get("keyword");
+        if (StringUtil.isNullOrEmpty(keyword)) {
+            // 返回
+            int[] array = new int[0];
+            return AjaxJson.getPageData(0L, array);
         }
 
         SoMap so = SoMap.getRequestSoMap();

BIN
target/classes/com/pj/project/sso/SsoServerController.class


BIN
xmnk-sso-1.0.jar