From 10c2e86f67ef4a992e5cdd4f8d28a5893b066e4d Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期六, 24 十二月 2022 12:38:22 +0800
Subject: [PATCH] 2022-12-24

---
 src/main/java/com/lf/server/config/ScheduleConfig.java |   31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/lf/server/config/ScheduleConfig.java b/src/main/java/com/lf/server/config/ScheduleConfig.java
index 7332c59..3251821 100644
--- a/src/main/java/com/lf/server/config/ScheduleConfig.java
+++ b/src/main/java/com/lf/server/config/ScheduleConfig.java
@@ -39,11 +39,11 @@
 
             WebSocketService.broadCastInfo(json);
         } catch (Exception ex) {
-            log.error(ex.getStackTrace());
+            log.error(ex.getMessage(), ex);
         }
     }
 
-    @Scheduled(fixedRate = 60 * 1000)
+    @Scheduled(fixedRate = 30 * 1000)
     public void checkSystemStatus() {
         try {
             JSONObject jsonObject = new JSONObject();
@@ -55,7 +55,32 @@
 
             WebSocketService.broadCastInfo(json);
         } catch (Exception ex) {
-            log.error(ex.getStackTrace());
+            log.error(ex.getMessage(), ex);
+        }
+    }
+
+    @Scheduled(fixedRate = 30 * 1000)
+    public void countSystemStatus() {
+        // noinspection AlibabaRemoveCommentedCode
+        try {
+            JSONObject jsonObject = new JSONObject();
+
+            // 鏈嶅姟璧勬簮鐘舵�� sys_res
+            jsonObject.put("resUseCount", scheduleService.countResStatus());
+
+            // 鐢ㄦ埛鐧诲綍鐘舵�� sys_login
+             jsonObject.put("userLoginCount", scheduleService.userLoginCount());
+
+            // 璧勬簮鎿嶄綔鐘舵�� sys_operate
+            jsonObject.put("operateCount", scheduleService.operateCount());
+
+            // 璧勬簮璋冪敤鐘舵��
+
+            String json = JSONObject.toJSONStringWithDateFormat(jsonObject, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue);
+
+            WebSocketService.broadCastInfo(json);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
         }
     }
 }

--
Gitblit v1.9.3