Selaa lähdekoodia

添加报警缓存同步功能

shilin 1 viikko sitten
vanhempi
commit
f27d1b9fe1
59 muutettua tiedostoa jossa 18347 lisäystä ja 1537 poistoa
  1. 97 5
      .idea/workspace.xml
  2. 3 1
      alarm-custom/src/main/java/com/gyee/alarm/init/CacheContext.java
  3. 25 25
      alarm-custom/src/main/java/com/gyee/alarm/service/AlarmCtService.java
  4. 3 0
      alarm-custom/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmRuleServiceImpl.java
  5. 3 2
      alarm-custom/src/main/java/com/gyee/alarm/task/thread/ScheduledTasks.java
  6. 7 0
      alarm-scanner/src/main/java/com/gyee/alarm/init/CacheContext.java
  7. 47 41
      alarm-scanner/src/main/java/com/gyee/alarm/service/AlarmScannerService.java
  8. 1 0
      alarm-scanner/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmRuleServiceImpl.java
  9. 46 0
      alarm-scanner/src/main/java/com/gyee/alarm/task/thread/ScheduledTasks.java
  10. 15 3
      alarm-service/pom.xml
  11. 34 9
      alarm-service/src/main/java/com/gyee/alarm/AlarmMain.java
  12. 0 68
      alarm-service/src/main/java/com/gyee/alarm/controller/WebSocketController.java
  13. 125 126
      alarm-service/src/main/java/com/gyee/alarm/init/CacheContext.java
  14. 28 12
      alarm-service/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper.java
  15. 34 6
      alarm-service/src/main/java/com/gyee/alarm/service/AlarmBtService.java
  16. 37 5
      alarm-service/src/main/java/com/gyee/alarm/service/AlarmCtService.java
  17. 36 14
      alarm-service/src/main/java/com/gyee/alarm/service/AlarmInService.java
  18. 202 0
      alarm-service/src/main/java/com/gyee/alarm/service/AlarmInitalService.java
  19. 41 66
      alarm-service/src/main/java/com/gyee/alarm/service/AlarmWtService.java
  20. 26 122
      alarm-service/src/main/java/com/gyee/alarm/service/PushDataSevice.java
  21. 205 0
      alarm-service/src/main/java/com/gyee/alarm/service/PushDataSevicemod.java
  22. 1 2
      alarm-service/src/main/java/com/gyee/alarm/service/ReloadVoSevice.java
  23. 66 0
      alarm-service/src/main/java/com/gyee/alarm/service/auto/impl/AlarmTsServiceImpl.java
  24. 33 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/AdminAuthInterceptor.java
  25. 119 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/ChatController.java
  26. 22 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/ChatMessage.java
  27. 20 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/CorsConfig.java
  28. 54 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/CustomHandshakeInterceptor.java
  29. 27 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/MessageController.java
  30. 98 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/MessagePushService.java
  31. 16 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/Notification.java
  32. 31 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/PushMessage.java
  33. 71 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/PushService.java
  34. 61 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/RateLimitInterceptor.java
  35. 44 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/ScheduledPushService.java
  36. 36 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/SessionConnectEventListener.java
  37. 44 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/UserInterceptor.java
  38. 92 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/WebSocketConfig.java
  39. 95 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/WebSocketEventListener.java
  40. 126 0
      alarm-service/src/main/java/com/gyee/alarm/stomp/WebSocketSessionManager.java
  41. 0 39
      alarm-service/src/main/java/com/gyee/alarm/task/thread/SaticScheduleTask.java
  42. 56 0
      alarm-service/src/main/java/com/gyee/alarm/task/thread/ScheduledTasks.java
  43. 0 30
      alarm-service/src/main/java/com/gyee/alarm/websocket/PushParams.java
  44. 0 288
      alarm-service/src/main/java/com/gyee/alarm/websocket/WebSocket.java
  45. 0 191
      alarm-service/src/main/java/com/gyee/alarm/websocket/WebSocketBt.java
  46. 0 21
      alarm-service/src/main/java/com/gyee/alarm/websocket/WebSocketConfig.java
  47. 0 38
      alarm-service/src/main/java/com/gyee/alarm/websocket/WebSocketCustomEncoding.java
  48. 8 8
      alarm-service/src/main/resources/application-db.yml
  49. 2 0
      alarm-web/src/main/java/com/gyee/alarm/AlarmWeb.java
  50. 173 169
      alarm-web/src/main/java/com/gyee/alarm/init/CacheContext.java
  51. 14 7
      alarm-web/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper.java
  52. 201 0
      alarm-web/src/main/java/com/gyee/alarm/service/AlarmInitalService.java
  53. 33 0
      alarm-web/src/main/java/com/gyee/alarm/service/auto/impl/AlarmTsServiceImpl.java
  54. 46 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/ScheduledTasks.java
  55. 6868 0
      log/2025-06/ota.2025-06-12.0.log
  56. 8865 0
      log/2025-06/ota.2025-06-13.0.log
  57. 10 239
      log/ota.log
  58. BIN
      log/ota.log.2024-11-25.0.gz
  59. BIN
      log/ota.log.2025-06-11.0.gz

+ 97 - 5
.idea/workspace.xml

@@ -7,7 +7,67 @@
     <option name="autoReloadType" value="SELECTIVE" />
   </component>
   <component name="ChangeListManager">
-    <list default="true" id="f8ee1c5b-cf12-4379-be4f-0e9f22a11d65" name="Changes" comment="宁夏分停机事件参数异常处理" />
+    <list default="true" id="f8ee1c5b-cf12-4379-be4f-0e9f22a11d65" name="Changes" comment="宁夏分停机事件参数异常处理">
+      <change afterPath="$PROJECT_DIR$/alarm-scanner/src/main/java/com/gyee/alarm/task/thread/ScheduledTasks.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/AlarmInitalService.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/PushDataSevicemod.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/AdminAuthInterceptor.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/ChatController.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/ChatMessage.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/CorsConfig.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/CustomHandshakeInterceptor.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/MessageController.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/MessagePushService.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/Notification.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/PushMessage.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/PushService.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/RateLimitInterceptor.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/ScheduledPushService.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/SessionConnectEventListener.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/UserInterceptor.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/WebSocketConfig.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/WebSocketEventListener.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/WebSocketSessionManager.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/task/thread/ScheduledTasks.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-web/src/main/java/com/gyee/alarm/service/AlarmInitalService.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/alarm-web/src/main/java/com/gyee/alarm/task/thread/ScheduledTasks.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/log/2025-06/ota.2025-06-12.0.log" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/log/2025-06/ota.2025-06-13.0.log" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/log/ota.log.2024-11-25.0.gz" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/log/ota.log.2025-06-11.0.gz" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-custom/src/main/java/com/gyee/alarm/init/CacheContext.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-custom/src/main/java/com/gyee/alarm/init/CacheContext.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-custom/src/main/java/com/gyee/alarm/service/AlarmCtService.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-custom/src/main/java/com/gyee/alarm/service/AlarmCtService.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-custom/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmRuleServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-custom/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmRuleServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-custom/src/main/java/com/gyee/alarm/task/thread/ScheduledTasks.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-custom/src/main/java/com/gyee/alarm/task/thread/ScheduledTasks.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-scanner/src/main/java/com/gyee/alarm/init/CacheContext.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-scanner/src/main/java/com/gyee/alarm/init/CacheContext.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-scanner/src/main/java/com/gyee/alarm/service/AlarmScannerService.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-scanner/src/main/java/com/gyee/alarm/service/AlarmScannerService.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-scanner/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmRuleServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-scanner/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmRuleServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-service/pom.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/AlarmMain.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/AlarmMain.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/controller/WebSocketController.java" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/init/CacheContext.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/init/CacheContext.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/AlarmBtService.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/AlarmBtService.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/AlarmCtService.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/AlarmCtService.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/AlarmInService.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/AlarmInService.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/AlarmWtService.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/AlarmWtService.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/PushDataSevice.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/PushDataSevice.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/ReloadVoSevice.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/ReloadVoSevice.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/auto/impl/AlarmTsServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/service/auto/impl/AlarmTsServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/task/thread/SaticScheduleTask.java" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/websocket/PushParams.java" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/websocket/WebSocket.java" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/websocket/WebSocketBt.java" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/websocket/WebSocketConfig.java" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/websocket/WebSocketCustomEncoding.java" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-service/src/main/resources/application-db.yml" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-service/src/main/resources/application-db.yml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-web/src/main/java/com/gyee/alarm/AlarmWeb.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-web/src/main/java/com/gyee/alarm/AlarmWeb.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-web/src/main/java/com/gyee/alarm/init/CacheContext.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-web/src/main/java/com/gyee/alarm/init/CacheContext.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-web/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-web/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/alarm-web/src/main/java/com/gyee/alarm/service/auto/impl/AlarmTsServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/alarm-web/src/main/java/com/gyee/alarm/service/auto/impl/AlarmTsServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/log/ota.log" beforeDir="false" afterPath="$PROJECT_DIR$/log/ota.log" afterDir="false" />
+    </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
     <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -63,12 +123,14 @@
   <component name="PropertiesComponent">{
   &quot;keyToString&quot;: {
     &quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
+    &quot;Maven.alarm-service [clean].executor&quot;: &quot;Run&quot;,
     &quot;RequestMappingsPanelOrder0&quot;: &quot;0&quot;,
     &quot;RequestMappingsPanelOrder1&quot;: &quot;1&quot;,
     &quot;RequestMappingsPanelWidth0&quot;: &quot;75&quot;,
     &quot;RequestMappingsPanelWidth1&quot;: &quot;75&quot;,
     &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
     &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
+    &quot;Spring Boot.GenerationMain (1).executor&quot;: &quot;Debug&quot;,
     &quot;ToolWindowBig Data Tools.ShowToolbar&quot;: &quot;false&quot;,
     &quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
     &quot;git-widget-placeholder&quot;: &quot;master&quot;,
@@ -108,13 +170,13 @@
     </key>
     <key name="CopyClassDialog.RECENTS_KEY">
       <recent name="com.gyee.alarm.service" />
+      <recent name="com.gyee.alarm.task.thread" />
       <recent name="com.gyee.alarm.model.vo" />
       <recent name="com.gyee.alarm.controller" />
       <recent name="com.gyee.alarm.service.auto.impl" />
-      <recent name="com.gyee.alarm.service.auto" />
     </key>
   </component>
-  <component name="RunManager" selected="Spring Boot.GenerationMain (2)">
+  <component name="RunManager" selected="Spring Boot.GenerationMain (1)">
     <configuration name="AalarmStatTest" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
       <option name="MAIN_CLASS_NAME" value="com.gyee.AalarmStatTest" />
       <module name="alarm-stat" />
@@ -714,7 +776,16 @@
       <workItem from="1748924330585" duration="274000" />
       <workItem from="1748926076088" duration="2158000" />
       <workItem from="1748934876188" duration="25000" />
-      <workItem from="1749004093553" duration="1691000" />
+      <workItem from="1749004093553" duration="1932000" />
+      <workItem from="1749606762778" duration="1550000" />
+      <workItem from="1749610787624" duration="1503000" />
+      <workItem from="1749612545051" duration="7469000" />
+      <workItem from="1749691598040" duration="2853000" />
+      <workItem from="1749696776837" duration="45086000" />
+      <workItem from="1749761312812" duration="5200000" />
+      <workItem from="1749768309598" duration="27000" />
+      <workItem from="1749769019862" duration="3075000" />
+      <workItem from="1750727810476" duration="4617000" />
     </task>
     <task id="LOCAL-00026" summary="报警统计功能">
       <created>1692260777210</created>
@@ -1059,7 +1130,7 @@
       <option name="project" value="LOCAL" />
       <updated>1743133123746</updated>
     </task>
-    <option name="localTasksCounter" value="75" />
+    <option name="localTasksCounter" value="76" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -1162,12 +1233,28 @@
           <line>163</line>
           <option name="timeStamp" value="177" />
         </line-breakpoint>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>file://$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/MessagePushService.java</url>
+          <line>94</line>
+          <option name="timeStamp" value="202" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>file://$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/MessagePushService.java</url>
+          <line>50</line>
+          <option name="timeStamp" value="203" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>file://$PROJECT_DIR$/alarm-service/src/main/java/com/gyee/alarm/stomp/PushService.java</url>
+          <line>68</line>
+          <option name="timeStamp" value="204" />
+        </line-breakpoint>
       </breakpoints>
     </breakpoint-manager>
     <pin-to-top-manager>
       <pinned-members>
         <PinnedItemInfo parentTag="java.lang.Integer" memberName="value" />
         <PinnedItemInfo parentTag="java.util.HashMap$Node" memberName="value" />
+        <PinnedItemInfo parentTag="org.springframework.messaging.support.GenericMessage" memberName="headers" />
       </pinned-members>
     </pin-to-top-manager>
     <watches-manager>
@@ -1178,6 +1265,11 @@
         <watch expression="reverse.charAt(triggerType)" />
         <watch expression="alarm.getId().toUpperCase()" />
         <watch expression="SXJ_KGDL_DJY_F_WT_0008_EQ_UP_0859" language="JAVA" />
+        <watch expression="wtAlarmMap" />
+        <watch expression="this.destinationPrefix" language="JAVA" />
+        <watch expression="StompCommand.CONNECT" />
+        <watch expression="accessor.getCommand()" />
+        <watch expression="sessionManager.getUserSessionMap()" />
       </configuration>
       <configuration name="Application">
         <watch expression="tbValues.get(tbName) " />

+ 3 - 1
alarm-custom/src/main/java/com/gyee/alarm/init/CacheContext.java

@@ -80,7 +80,8 @@ public class CacheContext implements CommandLineRunner {
     private IProBasicEnergyGroupService proBasicEnergyGroupService;
     @Resource
     private IProEconStateAiService proEconStateAiService;
-
+    @Resource
+    private IProEconAlarmRuleService proEconAlarmRuleService;
     @Resource
     private IProBasicStatusPointService proBasicStatusPointService;
     @Value("${runWindpowerstation}")
@@ -651,6 +652,7 @@ public class CacheContext implements CommandLineRunner {
 //
 //            }
 //        }
+        proEconAlarmRuleService.inital();
 
         logger.info("缓存结束------------------------------------------------------------");
     }

+ 25 - 25
alarm-custom/src/main/java/com/gyee/alarm/service/AlarmCtService.java

@@ -329,31 +329,31 @@ public class AlarmCtService {
         }
     }
 
-    public List<AlarmCustomTag> findTags(String stbaleName) {
-        List<AlarmCustomTag> ls = new ArrayList<>();
-        if (StringUtils.notEmp(stbaleName)) {
-            // List<AlarmVo> vos= alarmTsService.findTags(stbaleName);
-            List<AlarmVo> vos = CacheContext.alarmCtList;
-            if (!vos.isEmpty()) {
-                for (AlarmVo vo : vos) {
-                    AlarmCustomTag po = new AlarmCustomTag();
-                    po.setId(vo.getTbName());
-                    po.setDescription(vo.getDescription());
-                    po.setTagId(vo.getTagid());
-                    po.setDeviceid(vo.getDeviceid());
-                    po.setDevicetype(vo.getDevicetype());
-                    po.setModelId(vo.getModelId());
-                    po.setAlarmtype(vo.getAlarmtype());
-                    po.setStationid(vo.getStationid());
-
-                    po.setVal(null);
-
-                    ls.add(po);
-                }
-            }
-        }
-        return ls;
-    }
+//    public List<AlarmCustomTag> findTags(String stbaleName) {
+//        List<AlarmCustomTag> ls = new ArrayList<>();
+//        if (StringUtils.notEmp(stbaleName)) {
+//          List<AlarmVo> vos= alarmTsService.findTags(stbaleName);
+////            List<AlarmVo> vos = CacheContext.alarmCtList;
+//            if (!vos.isEmpty()) {
+//                for (AlarmVo vo : vos) {
+//                    AlarmCustomTag po = new AlarmCustomTag();
+//                    po.setId(vo.getTbName());
+//                    po.setDescription(vo.getDescription());
+//                    po.setTagId(vo.getTagid());
+//                    po.setDeviceid(vo.getDeviceid());
+//                    po.setDevicetype(vo.getDevicetype());
+//                    po.setModelId(vo.getModelId());
+//                    po.setAlarmtype(vo.getAlarmtype());
+//                    po.setStationid(vo.getStationid());
+//
+//                    po.setVal(null);
+//
+//                    ls.add(po);
+//                }
+//            }
+//        }
+//        return ls;
+//    }
 
 
 

+ 3 - 0
alarm-custom/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmRuleServiceImpl.java

@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -32,6 +33,8 @@ public class ProEconAlarmRuleServiceImpl extends ServiceImpl<ProEconAlarmRuleMap
     public void inital() throws Exception {
 
 
+
+
         List<ProEconAlarmRule> customls =list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
 
         List<ProEconAlarmRule> wtCustomls=new ArrayList<>();

+ 3 - 2
alarm-custom/src/main/java/com/gyee/alarm/task/thread/ScheduledTasks.java

@@ -7,6 +7,7 @@ import com.gyee.alarm.rule.AlarmFunction;
 import com.gyee.alarm.rule.expression.AlarmExpression;
 import com.gyee.alarm.rule.expression.Analyzer;
 import com.gyee.alarm.service.AlarmCtService;
+import com.gyee.alarm.service.AlarmCustomService;
 import com.gyee.alarm.service.auto.IAlarmTsService;
 import com.gyee.alarm.service.auto.IProEconAlarmRuleService;
 import com.gyee.common.model.StringUtils;
@@ -33,7 +34,7 @@ public class ScheduledTasks {
 
     private Logger logger = LoggerFactory.getLogger(this.getClass());
     @Resource
-    private AlarmCtService alarmCtService;
+    private IAlarmService alarmService;
     @Resource
     private IProEconAlarmRuleService proEconAlarmRuleService;
     // 每15分钟执行一次
@@ -41,7 +42,7 @@ public class ScheduledTasks {
     public void reportCurrentTime() throws Exception {
 
         proEconAlarmRuleService.inital();
-        CacheContext.alarmTags = alarmCtService.findTags(AlarmSuperTalbeType.CT.getCode());
+        CacheContext.alarmTags = alarmService.findTagsByCt();
         logger.info("当前时间: " + System.currentTimeMillis() / 1000);
     }
 

+ 7 - 0
alarm-scanner/src/main/java/com/gyee/alarm/init/CacheContext.java

@@ -3,6 +3,7 @@ package com.gyee.alarm.init;
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.TypeReference;
+import com.gyee.alarm.model.vo.AlarmTag;
 import com.gyee.alarm.model.vo.AlarmVo;
 import com.gyee.common.model.StringUtils;
 import com.gyee.alarm.model.auto.*;
@@ -17,6 +18,7 @@ import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
 import java.util.*;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.stream.Collectors;
 
 /**
@@ -154,6 +156,11 @@ public class CacheContext implements CommandLineRunner {
     public static List<ProBasicStatusPoint> pointdis = new ArrayList<>();
 
     public static Map< String,Map<String, ProBasicStatusPoint>> pointdismap = new HashMap<>();
+
+
+    public static  List<AlarmTag>  alarmTags=new CopyOnWriteArrayList<>();
+
+    public static  List<AlarmTag>  alarmInTags=new CopyOnWriteArrayList<>();
     @Override
     public void run(String... args) throws Exception {
         logger.info("缓存开始------------------------------------------------------------");

+ 47 - 41
alarm-scanner/src/main/java/com/gyee/alarm/service/AlarmScannerService.java

@@ -3,6 +3,7 @@ package com.gyee.alarm.service;
 
 import com.gyee.alarm.controller.feigns.IAlarmService;
 
+import com.gyee.alarm.init.CacheContext;
 import com.gyee.alarm.model.vo.AlarmSimpleVo;
 import com.gyee.alarm.model.vo.AlarmSuperTalbeType;
 import com.gyee.alarm.model.vo.AlarmTag;
@@ -45,9 +46,7 @@ public class AlarmScannerService {
     private IAlarmService alarmService;
     @Resource
     private  IAlarmTsService alarmTsService;
-    private List<AlarmTag>  alarmTags=new CopyOnWriteArrayList<>();
 
-    private List<AlarmTag>  alarmInTags=new CopyOnWriteArrayList<>();
     @Resource
     @Qualifier(value = "taskExecutor")
     private Executor executor;
@@ -63,37 +62,44 @@ public class AlarmScannerService {
 //#WT("wt_alarms", "设备报警超级表"),
 //#BT("bt_alarms", "升压站报警超级表"),
 //#IN("in_alarms", "逆变器报警超级表"),
+
+        CacheContext.alarmTags =new ArrayList<>();
+
         switch (alarmType){
             case "wt_alarms":
-                alarmTags =alarmService.findTagsByWt(runWindpowerstation);
-                history(alarmTags);
+                CacheContext.alarmTags =alarmService.findTagsByWt(runWindpowerstation);
+                history(CacheContext.alarmTags);
                 break;
             case "bt_alarms":
-                List<AlarmTag>  templs =alarmService.findTagsByBt();
 
-                if(!templs.isEmpty())
-                {
-                    for(AlarmTag tag:templs)
-                    {
-                        if(StringUtils.notEmp(tag.getTagId()) )
-                        {
-                            if(tag.getTagId().startsWith("GF"))
-                            {
-//                                tag.setVal(-10000.0);
-//                                tag.setOval(-10000.0);
-                                alarmInTags.add(tag);
-                            }else
-                            {
-                                alarmTags.add(tag);
-                            }
-                        }
-                    }
-                }
-                history(templs);
+                CacheContext.alarmTags=alarmService.findTagsByBt();
+//                List<AlarmTag>  templs =alarmService.findTagsByBt();
+//
+//                if(!templs.isEmpty())
+//                {
+//                    for(AlarmTag tag:templs)
+//                    {
+//                        if(StringUtils.notEmp(tag.getTagId()) )
+//                        {
+//                            if(tag.getTagId().startsWith("GF"))
+//                            {
+////                                tag.setVal(-10000.0);
+////                                tag.setOval(-10000.0);
+//                                CacheContext.alarmInTags.add(tag);
+//                            }else
+//                            {
+//                                CacheContext.alarmTags.add(tag);
+//                            }
+//
+//                        }
+//                    }
+//                }
+//                history(templs);
+                history(CacheContext.alarmTags);
                 break;
             case "in_alarms":
-                alarmTags =alarmService.findTagsByIn();
-                history(alarmTags);
+                CacheContext.alarmTags =alarmService.findTagsByIn();
+                history(CacheContext.alarmTags);
                 break;
         }
     }
@@ -129,11 +135,11 @@ public class AlarmScannerService {
 
             String ids = sb.substring(0, sb.length() - 1);
             List<AlarmSimpleVo> templs = new CopyOnWriteArrayList<>();
-            if (alarmTags.get(0).getAlarmType().equals(AlarmTypeValue.BT.getCode())) {
+            if (CacheContext.alarmTags.get(0).getAlarmType().equals(AlarmTypeValue.BT.getCode())) {
                 templs = alarmTsService.selectLastRowByTbname(AlarmSuperTalbeType.BT.getCode(), ids);
-            } else if (alarmTags.get(0).getAlarmType().equals(AlarmTypeValue.WT.getCode())) {
+            } else if (CacheContext.alarmTags.get(0).getAlarmType().equals(AlarmTypeValue.WT.getCode())) {
                 templs = alarmTsService.selectLastRowByTbname(AlarmSuperTalbeType.WT.getCode(), ids);
-            } else if (alarmTags.get(0).getAlarmType().equals(AlarmTypeValue.IN.getCode())) {
+            } else if (CacheContext.alarmTags.get(0).getAlarmType().equals(AlarmTypeValue.IN.getCode())) {
                 templs = alarmTsService.selectLastRowByTbname(AlarmSuperTalbeType.WT.getCode(), ids);
             }
             alarmvols.addAll(templs);
@@ -167,9 +173,9 @@ public class AlarmScannerService {
 
 //                CountDownLatch countDownLatch = new CountDownLatch(2);
 
-//                new Thread(new AlarmThread(executor, edosUtil, alarmService, alarmTags, interval, String.valueOf(1), readRows, alarmType, countDownLatch, alarmTsService, historymap)).start();
+//                new Thread(new AlarmThread(executor, edosUtil, alarmService, CacheContext.alarmTags, interval, String.valueOf(1), readRows, alarmType, countDownLatch, alarmTsService, historymap)).start();
 //                new Thread(new AlarmThread(executor, edosUtil, alarmService, alarmInTags, interval, String.valueOf(2), readRows, alarmType, countDownLatch, alarmTsService, historymap)).start();
-//                executor.execute(new AlarmThread(executor, edosUtil, alarmService, alarmTags, interval, String.valueOf(1), readRows, alarmType, countDownLatch, alarmTsService, historymap));
+//                executor.execute(new AlarmThread(executor, edosUtil, alarmService, CacheContext.alarmTags, interval, String.valueOf(1), readRows, alarmType, countDownLatch, alarmTsService, historymap));
 //                executor.execute(new AlarmThread(executor, edosUtil, alarmService, alarmInTags, interval, String.valueOf(2), readRows, alarmType, countDownLatch, alarmTsService, historymap));
 //
 //                countDownLatch.await(30, TimeUnit.SECONDS);
@@ -179,18 +185,18 @@ public class AlarmScannerService {
 
                 List<AlarmTag> alarmls = new ArrayList<>();
 
-                int listNumber = alarmTags.size() / taskCount;
+                int listNumber = CacheContext.alarmTags.size() / taskCount;
                 int number = 0;
-                if (alarmTags.size() % taskCount != 0) {
+                if (CacheContext.alarmTags.size() % taskCount != 0) {
                     listNumber = listNumber + 1;
                 }
                 CountDownLatch countDownLatch = new CountDownLatch(listNumber);
 
                 StringBuilder str = new StringBuilder();
-                str.append("总数:").append(alarmTags.size()).append(",线程数:").append(listNumber).append(",分块大小:").append(taskCount);
+                str.append("总数:").append(CacheContext.alarmTags.size()).append(",线程数:").append(listNumber).append(",分块大小:").append(taskCount);
                 log.info(String.valueOf(str));
-                for (int i = 0; i < alarmTags.size(); i++) {
-                    alarmls.add(alarmTags.get(i));
+                for (int i = 0; i < CacheContext.alarmTags.size(); i++) {
+                    alarmls.add(CacheContext.alarmTags.get(i));
                     if (i != 0 && alarmls.size() % taskCount == 0) {
 //                        new Thread(new AlarmThread(executor, edosUtil, alarmService, alarmls, interval, String.valueOf(len), readRows, alarmType, countDownLatch, alarmTsService, historymap)).start();
 
@@ -215,18 +221,18 @@ public class AlarmScannerService {
 
                 List<AlarmTag> alarmls = new ArrayList<>();
 
-                int listNumber = alarmTags.size() / taskCount;
+                int listNumber = CacheContext.alarmTags.size() / taskCount;
                 int number = 0;
-                if (alarmTags.size() % taskCount != 0) {
+                if (CacheContext.alarmTags.size() % taskCount != 0) {
                     listNumber = listNumber + 1;
                 }
                 CountDownLatch countDownLatch = new CountDownLatch(listNumber);
 
                 StringBuilder str = new StringBuilder();
-                str.append("总数:").append(alarmTags.size()).append(",线程数:").append(listNumber).append(",分块大小:").append(taskCount);
+                str.append("总数:").append(CacheContext.alarmTags.size()).append(",线程数:").append(listNumber).append(",分块大小:").append(taskCount);
                 log.info(String.valueOf(str));
-                for (int i = 0; i < alarmTags.size(); i++) {
-                    alarmls.add(alarmTags.get(i));
+                for (int i = 0; i < CacheContext.alarmTags.size(); i++) {
+                    alarmls.add(CacheContext.alarmTags.get(i));
                     if (i != 0 && alarmls.size() % taskCount == 0) {
 //                        new Thread(new AlarmThread(executor, edosUtil, alarmService, alarmls, interval, String.valueOf(len), readRows, alarmType, countDownLatch, alarmTsService, historymap)).start();
 

+ 1 - 0
alarm-scanner/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmRuleServiceImpl.java

@@ -17,4 +17,5 @@ import org.springframework.stereotype.Service;
 @Service
 public class ProEconAlarmRuleServiceImpl extends ServiceImpl<ProEconAlarmRuleMapper, ProEconAlarmRule> implements IProEconAlarmRuleService {
 
+
 }

+ 46 - 0
alarm-scanner/src/main/java/com/gyee/alarm/task/thread/ScheduledTasks.java

@@ -0,0 +1,46 @@
+package com.gyee.alarm.task.thread;
+
+
+import com.gyee.alarm.service.AlarmScannerService;
+import com.gyee.alarm.service.auto.IProEconAlarmRuleService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+@Component
+public class ScheduledTasks {
+
+
+    private Logger logger = LoggerFactory.getLogger(this.getClass());
+    @Resource
+    private AlarmScannerService alarmScannerService;
+
+    // 每15分钟执行一次
+    @Scheduled(fixedRate = 1000*60*15)
+    public void reportCurrentTime() throws Exception {
+
+        alarmScannerService.init();
+        logger.info("当前时间: " + System.currentTimeMillis() / 1000);
+    }
+
+//    // 初始延迟1秒,之后每10秒执行一次
+//    @Scheduled(fixedDelay = 10000, initialDelay = 1000)
+//    public void fixedDelayTask() {
+//        System.out.println("固定延迟任务执行: " + System.currentTimeMillis() / 1000);
+//    }
+//
+//    // 初始延迟1秒,之后在上一次执行结束后再等待10秒执行
+//    @Scheduled(fixedDelayString = "10000", initialDelay = 1000)
+//    public void fixedDelayStringTask() {
+//        System.out.println("固定延迟字符串任务执行: " + System.currentTimeMillis() / 1000);
+//    }
+//
+//    // 初始延迟1秒,之后在上一次执行结束后再等待10秒执行,使用cron表达式
+//    @Scheduled(cron = "*/10 * * * * ?")
+//    public void executeTaskWithCron() {
+//        System.out.println("Cron表达式任务执行: " + System.currentTimeMillis() / 1000);
+//    }
+}

+ 15 - 3
alarm-service/pom.xml

@@ -29,7 +29,7 @@
         <mybatis-plus.generator.version>3.3.2</mybatis-plus.generator.version>
         <pgsql.version>42.2.5</pgsql.version>
         <groovy.version>3.0.8</groovy.version>
-        <springframework.boot.version>2.2.2.RELEASE</springframework.boot.version>
+        <springframework.boot.version>2.4.13</springframework.boot.version>
         <tomcat.version>9.0.83</tomcat.version>
     </properties>
 
@@ -110,7 +110,7 @@
         <dependency>
             <groupId>org.springframework.data</groupId>
             <artifactId>spring-data-redis</artifactId>
-            <version>2.3.6.RELEASE</version>
+            <version>2.4.0</version>
         </dependency>
         <dependency>
             <groupId>com.baomidou</groupId>
@@ -184,10 +184,22 @@
             <version>5.1.1</version>
             <scope>test</scope>
         </dependency>
+<!--        <dependency>-->
+<!--            <groupId>com.taosdata.jdbc</groupId>-->
+<!--            <artifactId>taos-jdbcdriver</artifactId>-->
+<!--            <version>2.0.38</version>-->
+<!--        </dependency>-->
+
         <dependency>
             <groupId>com.taosdata.jdbc</groupId>
             <artifactId>taos-jdbcdriver</artifactId>
-            <version>2.0.38</version>
+            <version>3.6.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jetbrains</groupId>
+            <artifactId>annotations</artifactId>
+            <version>13.0</version>
+            <scope>compile</scope>
         </dependency>
 
     </dependencies>

+ 34 - 9
alarm-service/src/main/java/com/gyee/alarm/AlarmMain.java

@@ -1,5 +1,6 @@
 package com.gyee.alarm;
 
+import com.gyee.alarm.init.CacheContext;
 import com.gyee.alarm.service.AlarmBtService;
 import com.gyee.alarm.service.AlarmCtService;
 import com.gyee.alarm.service.AlarmInService;
@@ -8,32 +9,56 @@ import com.gyee.alarm.util.SpringUtils;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.socket.config.annotation.EnableWebSocket;
+import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
+
+import javax.annotation.Resource;
 
 
 @SpringBootApplication
+@EnableScheduling
+
 @MapperScan("com.gyee.alarm.mapper")
 public class AlarmMain {
     public static void main(String[] args) throws Exception {
         SpringApplication.run(AlarmMain.class, args);
 
-//        AlarmBtService alarmBtService= SpringUtils.getBean("alarmBtService");
-        AlarmWtService alarmWtService= SpringUtils.getBean("alarmWtService");
-        AlarmCtService alarmCtService= SpringUtils.getBean("alarmCtService");
+//       AlarmBtService alarmBtService= SpringUtils.getBean("alarmBtService");
+//        AlarmWtService alarmWtService= SpringUtils.getBean("alarmWtService");
+//        AlarmCtService alarmCtService= SpringUtils.getBean("alarmCtService");
+//
+//
+//
+//         CacheContext cacheContext=SpringUtils.getBean("cacheContext");
+
+
+////
+////        alarmCtService.createSuperTable();
+////        alarmCtService.initalCtAlarm();
+////
+////
+////
+////
+////alarmWtService.createSuperTable();
+//        alarmWtService.initalWtAlarm();
 //
-//        alarmCtService.createSuperTable();
-//        alarmCtService.initalCtAlarm();
+//        alarmWtService.updapteWtAlarm();
+////        alarmWtService.updapteWtAlarm();
+////
+//////        alarmBtService.createSuperTable();
+// //       alarmBtService.initalBtAlarm();
 //
 //
 //
 //
-//        alarmWtService.createSuperTable();
-//        alarmWtService.initalWtAlarm();
+////        cacheContext.initialAlarm();
+////        alarmCtService.updateCtAlarm();
 //
-////        alarmBtService.createSuperTable();
 ////        alarmBtService.initalBtAlarm();
-
         System.out.println("完成");
     }
 }

+ 0 - 68
alarm-service/src/main/java/com/gyee/alarm/controller/WebSocketController.java

@@ -1,68 +0,0 @@
-package com.gyee.alarm.controller;
-
-
-import com.gyee.alarm.websocket.PushParams;
-import com.gyee.alarm.websocket.WebSocket;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import javax.websocket.EncodeException;
-import java.io.IOException;
-
-/**
- * 功能描述:
- * 建立WebSocket连接
- * @Author: LXD
- * @Date: 2022-12-01 09:55:00
- * @since: 1.0.0
- */
-@RestController
-@RequestMapping("/webSocketPush")
-public class WebSocketController {
-    @Autowired
-    private WebSocket webSocket;
-
-
-    @RequestMapping("/sentMessage")
-    public void sentMessage(String userId,String message){
-        try {
-            webSocket.sendMessageByUserId(userId,message);
-        } catch (IOException | EncodeException e) {
-            e.printStackTrace();
-        }
-
-    }
-
-    @RequestMapping("/sentObjectMessage")
-    public void sentObjectMessage(String userId){
-        try {
-            webSocket.sendMessageByUserId(userId,"111111");
-        } catch (IOException | EncodeException e) {
-            e.printStackTrace();
-        }
-
-    }
-
-    /***
-     * 功能描述:
-     * 根据用户ID更新ws推送的参数
-     * @Author: LXD
-     * @Date: 2022-12-01 09:21:25
-     * @Param  userId: WS中的用户ID
-     * @Param pushParams: 推送参数
-     * @return: void
-     * @since: 1.0.0
-     */
-    @RequestMapping("/changeWsParams")
-    public void changeWsParams(String userId, PushParams pushParams){
-        try {
-            webSocket.changeParamsByUserId(userId,pushParams);
-        } catch (IOException e) {
-            e.printStackTrace();
-        } catch (EncodeException e) {
-            e.printStackTrace();
-        }
-
-    }
-
-}

+ 125 - 126
alarm-service/src/main/java/com/gyee/alarm/init/CacheContext.java

@@ -8,10 +8,7 @@ import com.gyee.alarm.model.vo.AlarmCustomType;
 import com.gyee.alarm.model.vo.AlarmTag;
 import com.gyee.alarm.model.vo.AlarmTypeValue;
 import com.gyee.alarm.model.vo.AlarmVo;
-import com.gyee.alarm.service.AlarmBtService;
-import com.gyee.alarm.service.AlarmCtService;
-import com.gyee.alarm.service.AlarmInService;
-import com.gyee.alarm.service.AlarmWtService;
+import com.gyee.alarm.service.*;
 import com.gyee.common.model.StringUtils;
 import com.gyee.alarm.model.auto.*;
 import com.gyee.alarm.service.auto.*;
@@ -92,6 +89,8 @@ public class CacheContext implements CommandLineRunner {
 
 
     @Resource
+    private AlarmInitalService alarmInitalService;
+    @Resource
     private AlarmWtService alarmWtService;
     @Resource
     private AlarmInService alarmInService;
@@ -626,131 +625,131 @@ public class CacheContext implements CommandLineRunner {
 //        }
 
 
-
-
-        List<ProEconAlarmConfiguration> templs = proEconAlarmConfigurationService.list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
-        if (!templs.isEmpty()) {
-            for (ProEconAlarmConfiguration alarm : templs) {
-                if (alarm.getAlarmType().equals(AlarmTypeValue.WT.getCode())) {
-                    wtalarmls.add(alarm);
-                    StringBuilder sb=new StringBuilder();
-                    sb.append(alarm.getStationId()).append(alarm.getModelId());
-
-                    if(wtAlarmMap.containsKey(String.valueOf(sb)))
-                    {
-                        List<ProEconAlarmConfiguration> ls=wtAlarmMap.get(String.valueOf(sb));
-                        ls.add(alarm);
-                    }else
-                    {
-                        List<ProEconAlarmConfiguration> ls=new ArrayList<>();
-                        ls.add(alarm);
-                        wtAlarmMap.put(String.valueOf(sb),ls);
-                    }
-                } else if (alarm.getAlarmType().equals(AlarmTypeValue.BT.getCode())) {
-                    btalarmls.add(alarm);
-
-                }
-                else if (alarm.getAlarmType().equals(AlarmTypeValue.IN.getCode())) {
-                    inalarmls.add(alarm);
-                    StringBuilder sb=new StringBuilder();
-                    sb.append(alarm.getStationId()).append(alarm.getModelId());
-
-                    if(inAlarmMap.containsKey(String.valueOf(sb)))
-                    {
-                        List<ProEconAlarmConfiguration> ls=inAlarmMap.get(String.valueOf(sb));
-                        ls.add(alarm);
-                    }else
-                    {
-                        List<ProEconAlarmConfiguration> ls=new ArrayList<>();
-                        ls.add(alarm);
-                        inAlarmMap.put(String.valueOf(sb),ls);
-                    }
-                }
-            }
-        }
-
-        //风机报警初始化标签
-        alarmWtList=alarmWtService.initalAlarmVo();
-        if(!alarmWtList.isEmpty())
-        {
-            for(AlarmVo vo: alarmWtList)
-            {
-                if(alarmWpMap.containsKey(vo.getStationid()))
-                {
-                    List<AlarmVo> ls=alarmWpMap.get(vo.getStationid());
-                    ls.add(vo);
-                }else {
-                    List<AlarmVo> ls=new ArrayList<>();
-                    ls.add(vo);
-                    alarmWpMap.put(vo.getStationid(),ls);
-                }
-                alarmWtMap.put(vo.getTbName().toUpperCase(),vo);
-            }
-        }
-        //逆变器报警初始化标签
-        alarmInList=alarmInService.initalAlarmVo();
-        if(!alarmInList.isEmpty())
-        {
-            for(AlarmVo vo: alarmInList)
-            {
-                alarmInMap.put(vo.getTbName().toUpperCase(),vo);
-            }
-        }
-
-
-        //升压站报警初始化标签
-        alarmBtList=alarmBtService.initalAlarmVo();
-        if(!alarmBtList.isEmpty())
-        {
-            for(AlarmVo vo: alarmBtList)
-            {
-                alarmBtMap.put(vo.getTbName().toUpperCase(),vo);
-            }
-        }
-
-        //从pg数据库获取自定义报警配置信息
-        List<ProEconAlarmRule> customls =proEconAlarmRuleService.list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
-
-        List<ProEconAlarmRule> wtCustomls=new ArrayList<>();
-        List<ProEconAlarmRule> inCustomls=new ArrayList<>();
-        List<ProEconAlarmRule> btCustomls=new ArrayList<>();
-
-        //对自定义报警进行分类
-        if(!customls.isEmpty())
-        {
-            for(ProEconAlarmRule vo: customls)
-            {
-                if(vo.getCategory().equals(AlarmCustomType.WT.getCode()))
-                {
-                    wtCustomls.add(vo);
-                }else  if(vo.getCategory().equals(AlarmCustomType.IN.getCode()))
-                {
-                    inCustomls.add(vo);
-                }else  if(vo.getCategory().equals(AlarmCustomType.Bt.getCode()))
-                {
-                    btCustomls.add(vo);
-                }
-
-            }
-        }
-
-        alarmRulesMap.put(AlarmCustomType.Bt.getCode(),btCustomls);
-        alarmRulesMap.put(AlarmCustomType.WT.getCode(),wtCustomls);
-        alarmRulesMap.put(AlarmCustomType.IN.getCode(),inCustomls);
-        //自定义报警初始化标签
-        alarmCtList=alarmCtService.initalAlarmVo();
-        if(!alarmCtList.isEmpty())
-        {
-            for(AlarmVo vo: alarmCtList)
-            {
-                alarmCtMap.put(vo.getTbName().toUpperCase(),vo);
-            }
-        }
-
-
+        alarmInitalService.initialAlarm();
 
 
 //        inputOrOutPutService.initialInputOrOutputSpeed();
         logger.info("缓存结束------------------------------------------------------------");
     }
+
+//    public void initialAlarm() throws Exception {
+//        List<ProEconAlarmConfiguration> templs = proEconAlarmConfigurationService.list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
+//        if (!templs.isEmpty()) {
+//            for (ProEconAlarmConfiguration alarm : templs) {
+//                if (alarm.getAlarmType().equals(AlarmTypeValue.WT.getCode())) {
+//                    wtalarmls.add(alarm);
+//                    StringBuilder sb=new StringBuilder();
+//                    sb.append(alarm.getStationId()).append(alarm.getModelId());
+//
+//                    if(wtAlarmMap.containsKey(String.valueOf(sb)))
+//                    {
+//                        List<ProEconAlarmConfiguration> ls=wtAlarmMap.get(String.valueOf(sb));
+//                        ls.add(alarm);
+//                    }else
+//                    {
+//                        List<ProEconAlarmConfiguration> ls=new ArrayList<>();
+//                        ls.add(alarm);
+//                        wtAlarmMap.put(String.valueOf(sb),ls);
+//                    }
+//                } else if (alarm.getAlarmType().equals(AlarmTypeValue.BT.getCode())) {
+//                    btalarmls.add(alarm);
+//
+//                }
+//                else if (alarm.getAlarmType().equals(AlarmTypeValue.IN.getCode())) {
+//                    inalarmls.add(alarm);
+//                    StringBuilder sb=new StringBuilder();
+//                    sb.append(alarm.getStationId()).append(alarm.getModelId());
+//
+//                    if(inAlarmMap.containsKey(String.valueOf(sb)))
+//                    {
+//                        List<ProEconAlarmConfiguration> ls=inAlarmMap.get(String.valueOf(sb));
+//                        ls.add(alarm);
+//                    }else
+//                    {
+//                        List<ProEconAlarmConfiguration> ls=new ArrayList<>();
+//                        ls.add(alarm);
+//                        inAlarmMap.put(String.valueOf(sb),ls);
+//                    }
+//                }
+//            }
+//        }
+//
+//        //风机报警初始化标签
+//        alarmWtList=alarmWtService.initalAlarmVo();
+//        if(!alarmWtList.isEmpty())
+//        {
+//            for(AlarmVo vo: alarmWtList)
+//            {
+//                if(alarmWpMap.containsKey(vo.getStationid()))
+//                {
+//                    List<AlarmVo> ls=alarmWpMap.get(vo.getStationid());
+//                    ls.add(vo);
+//                }else {
+//                    List<AlarmVo> ls=new ArrayList<>();
+//                    ls.add(vo);
+//                    alarmWpMap.put(vo.getStationid(),ls);
+//                }
+//                alarmWtMap.put(vo.getTbName().toUpperCase(),vo);
+//            }
+//        }
+//        //逆变器报警初始化标签
+//        alarmInList=alarmInService.initalAlarmVo();
+//        if(!alarmInList.isEmpty())
+//        {
+//            for(AlarmVo vo: alarmInList)
+//            {
+//                alarmInMap.put(vo.getTbName().toUpperCase(),vo);
+//            }
+//        }
+//
+//
+//        //升压站报警初始化标签
+//        alarmBtList=alarmBtService.initalAlarmVo();
+//        if(!alarmBtList.isEmpty())
+//        {
+//            for(AlarmVo vo: alarmBtList)
+//            {
+//                alarmBtMap.put(vo.getTbName().toUpperCase(),vo);
+//            }
+//        }
+//
+//        //从pg数据库获取自定义报警配置信息
+//        List<ProEconAlarmRule> customls =proEconAlarmRuleService.list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
+//
+//        List<ProEconAlarmRule> wtCustomls=new ArrayList<>();
+//        List<ProEconAlarmRule> inCustomls=new ArrayList<>();
+//        List<ProEconAlarmRule> btCustomls=new ArrayList<>();
+//
+//        //对自定义报警进行分类
+//        if(!customls.isEmpty())
+//        {
+//            for(ProEconAlarmRule vo: customls)
+//            {
+//                if(vo.getCategory().equals(AlarmCustomType.WT.getCode()))
+//                {
+//                    wtCustomls.add(vo);
+//                }else  if(vo.getCategory().equals(AlarmCustomType.IN.getCode()))
+//                {
+//                    inCustomls.add(vo);
+//                }else  if(vo.getCategory().equals(AlarmCustomType.Bt.getCode()))
+//                {
+//                    btCustomls.add(vo);
+//                }
+//
+//            }
+//        }
+//
+//        alarmRulesMap.put(AlarmCustomType.Bt.getCode(),btCustomls);
+//        alarmRulesMap.put(AlarmCustomType.WT.getCode(),wtCustomls);
+//        alarmRulesMap.put(AlarmCustomType.IN.getCode(),inCustomls);
+//        //自定义报警初始化标签
+//        alarmCtList=alarmCtService.initalAlarmVo();
+//        if(!alarmCtList.isEmpty())
+//        {
+//            for(AlarmVo vo: alarmCtList)
+//            {
+//                alarmCtMap.put(vo.getTbName().toUpperCase(),vo);
+//            }
+//        }
+//    }
 }

+ 28 - 12
alarm-service/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper.java

@@ -64,12 +64,20 @@ public interface AlarmTsMapper extends BaseMapper<AlarmTs> {
 
 
 
+//    @Update("create table if not exists ${tbName} using ${superTableName} TAGS( " +
+//            "#{alarmid}, #{alarmtype}," +
+//            "#{characteristic}, #{components},#{description}, #{deviceid}, #{devicename}," +
+//            "#{devicetype}, #{enabled}, #{lineid}, #{linename}, #{modelId}, #{projectid}," +
+//            "#{projectname}, #{rank}, #{resettable}, #{stationid}, #{stationname}, #{subcomponents}," +
+//            "#{suffix},  #{tagid}, #{triggertype}, #{uniformcode},#{name}, #{nemCode}, #{faultCause}, #{resolvent},#{faultType},#{aname} " +
+//            " )")
+
     @Update("create table if not exists ${tbName} using ${superTableName} TAGS( " +
-            "#{alarmid}, #{alarmtype}," +
-            "#{characteristic}, #{components},#{description}, #{deviceid}, #{devicename}," +
-            "#{devicetype}, #{enabled}, #{lineid}, #{linename}, #{modelId}, #{projectid}," +
-            "#{projectname}, #{rank}, #{resettable}, #{stationid}, #{stationname}, #{subcomponents}," +
-            "#{suffix},  #{tagid}, #{triggertype}, #{uniformcode},#{name}, #{nemCode}, #{faultCause}, #{resolvent},#{faultType},#{aname} " +
+            "'${alarmid}', '${alarmtype}'," +
+            "'${characteristic}', '${components}','${description}', '${deviceid}', '${devicename}'," +
+            "'${devicetype}', ${enabled}, '${lineid}', '${linename}', '${modelId}', '${projectid}'," +
+            "'${projectname}', ${rank}, ${resettable}, '${stationid}', '${stationname}', '${subcomponents}'," +
+            "'${suffix}',  '${tagid}', ${triggertype}, '${uniformcode}','${name}', '${nemCode}', '${faultCause}', '${resolvent}','${faultType}','${aname}' " +
             " )")
     int createTable(@Param("tbName") String tbName, @Param("alarmid") String alarmid, @Param("alarmtype") String alarmtype,
                     @Param("characteristic") String characteristic, @Param("components") String components,
@@ -87,13 +95,21 @@ public interface AlarmTsMapper extends BaseMapper<AlarmTs> {
 
                     );
 
-    @Update("ALTER  table  ${tbName}  set TAG  " +
-            "alarmid=#{alarmid}, alarmtype=#{alarmtype}," +
-            "characteristic=#{characteristic}, components=#{components},description=#{description}, deviceid=#{deviceid}, devicename=#{devicename}," +
-            "devicetype=#{devicetype}, enabled=#{enabled}, lineid=#{lineid}, linename=#{linename},modelId= #{modelId}, projectid=#{projectid}," +
-            "projectname=#{projectname}, rank=#{rank}, resettable=#{resettable}, stationid=#{stationid}, stationname=#{stationname}, subcomponents=#{subcomponents}," +
-            "suffix=#{suffix}, tagid= #{tagid}, triggertype=#{triggertype}, uniformcode=#{uniformcode},name=#{name}, nemCode=#{nemCode}, faultCause=#{faultCause}, resolvent=#{resolvent},faultType=#{faultType},aname=#{aname} "
-            )
+//    @Update("ALTER  table  ${tbName}  set TAG  " +
+//            "alarmid=#{alarmid}, alarmtype=#{alarmtype}," +
+//            "characteristic=#{characteristic}, components=#{components},description=#{description}, deviceid=#{deviceid}, devicename=#{devicename}," +
+//            "devicetype=#{devicetype}, enabled=#{enabled}, lineid=#{lineid}, linename=#{linename},modelId= #{modelId}, projectid=#{projectid}," +
+//            "projectname=#{projectname}, rank=#{rank}, resettable=#{resettable}, stationid=#{stationid}, stationname=#{stationname}, subcomponents=#{subcomponents}," +
+//            "suffix=#{suffix}, tagid= #{tagid}, triggertype=#{triggertype}, uniformcode=#{uniformcode},name=#{name}, nemCode=#{nemCode}, faultCause=#{faultCause}, resolvent=#{resolvent},faultType=#{faultType},aname=#{aname} "
+//            )
+@Update("ALTER  table  ${tbName}  set TAG  " +
+        "alarmid='${alarmid}', alarmtype='${alarmtype}'," +
+        "characteristic='${characteristic}', components='${components}',description='${description}', deviceid='${deviceid}', devicename='${devicename}'," +
+        "devicetype='${devicetype}', enabled=${enabled}, lineid='${lineid}', linename='${linename}',modelId= '${modelId}', projectid='${projectid}'," +
+        "projectname='${projectname}', rank=${rank}, resettable=${resettable}, stationid='${stationid}', stationname='${stationname}', subcomponents='${subcomponents}'," +
+        "suffix='${suffix}', tagid= '${tagid}', triggertype=${triggertype}, uniformcode='${uniformcode}',name='${name}', nemCode='${nemCode}',"+
+        "faultCause='${faultCause}', resolvent='${resolvent}',faultType='${faultType}',aname='${aname}' "
+)
     int updateTable(@Param("tbName") String tbName, @Param("alarmid") String alarmid, @Param("alarmtype") String alarmtype,
                     @Param("characteristic") String characteristic, @Param("components") String components,
                     @Param("description") String description,

+ 34 - 6
alarm-service/src/main/java/com/gyee/alarm/service/AlarmBtService.java

@@ -8,8 +8,6 @@ import com.gyee.alarm.service.auto.IProEconAlarmInfoService;
 import com.gyee.alarm.util.DateUtils;
 import com.gyee.alarm.util.StringUtils;
 import com.gyee.alarm.util.realtimesource.IEdosUtil;
-import com.gyee.alarm.websocket.PushParams;
-import com.gyee.alarm.websocket.WebSocket;
 
 import com.gyee.common.model.PointData;
 import org.springframework.beans.factory.annotation.Value;
@@ -37,9 +35,6 @@ public class AlarmBtService {
     private Double pushinterval;
 
     @Resource
-    private WebSocket webSocket;
-
-    @Resource
     private PushDataSevice pushDataSevice;
     @Value("${read-rows}")
     private Integer readRows;
@@ -101,6 +96,39 @@ public class AlarmBtService {
     }
 
 
+    public void updateBtAlarm() throws Exception {
+
+
+        List<AlarmTag> alarmTags = new ArrayList<>();
+
+        List<AlarmVo> alarmVoList = CacheContext.alarmBtList;
+
+        if (!alarmVoList.isEmpty()) {
+            for (AlarmVo vo : alarmVoList) {
+                alarmTsService.updateTable(vo.getTbName(), vo.getAlarmid(), vo.getAlarmtype(),
+                        vo.getCharacteristic(), vo.getComponents(),
+                        vo.getDescription(),
+                        vo.getDeviceid(), vo.getDevicename(),
+                        vo.getDevicetype(), vo.getEnabled(),
+                        vo.getLineid(), vo.getLinename(),
+                        vo.getModelId(), vo.getProjectid(),
+                        vo.getProjectname(), vo.getRank(),
+                        vo.getResettable(), vo.getStationid(),
+                        vo.getStationname(), vo.getSubcomponents(),
+                        vo.getSuffix(), vo.getTagid(),
+                        vo.getTriggertype(), vo.getUniformcode(), vo.getSuperTableName(),
+                        vo.getName(),
+                        vo.getNemCode(),vo.getFaultCause(),vo.getResolvent(),vo.getFaultType(),vo.getAname());
+
+            }
+        }
+
+
+//        alarmTsService.insertList(alarmTags);
+    }
+
+
+
     public List<AlarmVo> initalAlarmVo() throws Exception {
 
         List<ProEconAlarmConfiguration> btalarmls = CacheContext.btalarmls;
@@ -352,7 +380,7 @@ public class AlarmBtService {
                         }
                         alarm.setWpId(vo.getStationid());
 
-                        pushDataSevice.pushBtData(alarm);
+                        pushDataSevice.pushWtData(alarm);
                     }
                 }
 

+ 37 - 5
alarm-service/src/main/java/com/gyee/alarm/service/AlarmCtService.java

@@ -8,9 +8,7 @@ import com.gyee.alarm.service.auto.IProEconAlarmInfoService;
 import com.gyee.alarm.service.auto.IProEconAlarmRuleService;
 import com.gyee.alarm.util.DateUtils;
 import com.gyee.alarm.util.StringUtils;
-import com.gyee.alarm.websocket.PushParams;
-import com.gyee.alarm.websocket.WebSocket;
-import org.apache.juli.logging.Log;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
@@ -39,8 +37,7 @@ public class AlarmCtService {
 
     @Value("${pushinterval}")
     private Double pushinterval;
-    @Resource
-    private WebSocket webSocket;
+
     @Resource
     private PushDataSevice pushDataSevice;
     public void dropSuperTable() {
@@ -124,6 +121,41 @@ public class AlarmCtService {
     }
 
 
+    public void updateCtAlarm() throws SQLException {
+
+
+        List<AlarmVo> alarmVoList = CacheContext.alarmCtList;
+//        List<AlarmTag> alarmTags = new ArrayList<>();
+
+
+
+
+        if (!alarmVoList.isEmpty()) {
+            for (AlarmVo vo : alarmVoList) {
+
+
+                alarmTsService.updateTable(vo.getTbName(), vo.getAlarmid(), vo.getAlarmtype(),
+                        vo.getCharacteristic(), vo.getComponents(),
+                        vo.getDescription(),
+                        vo.getDeviceid(), vo.getDevicename(),
+                        vo.getDevicetype(), vo.getEnabled(),
+                        vo.getLineid(), vo.getLinename(),
+                        vo.getModelId(), vo.getProjectid(),
+                        vo.getProjectname(), vo.getRank(),
+                        vo.getResettable(), vo.getStationid(),
+                        vo.getStationname(), vo.getSubcomponents(),
+                        vo.getSuffix(), vo.getTagid(),
+                        vo.getTriggertype(), vo.getUniformcode(), vo.getSuperTableName(),
+                        vo.getName(),
+                        vo.getNemCode(),vo.getFaultCause(),vo.getResolvent(),vo.getFaultType(),vo.getAname());
+            }
+        }
+
+
+//        alarmTsService.insertList(alarmTags);
+    }
+
+
     public List<AlarmVo> initalAlarmVo() {
 
         List<AlarmVo> alarmVoList = new ArrayList<>();

+ 36 - 14
alarm-service/src/main/java/com/gyee/alarm/service/AlarmInService.java

@@ -8,8 +8,7 @@ import com.gyee.alarm.service.auto.IProEconAlarmInfoService;
 import com.gyee.alarm.util.DateUtils;
 import com.gyee.alarm.util.StringUtils;
 import com.gyee.alarm.util.realtimesource.IEdosUtil;
-import com.gyee.alarm.websocket.PushParams;
-import com.gyee.alarm.websocket.WebSocket;
+
 import com.gyee.common.model.PointData;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -36,8 +35,7 @@ public class AlarmInService {
 
     @Value("${pushinterval}")
     private Double pushinterval;
-    @Resource
-    private WebSocket webSocket;
+
     @Resource
     private PushDataSevice pushDataSevice;
 
@@ -58,18 +56,21 @@ public class AlarmInService {
         alarmTsService.createSuperTable(AlarmSuperTalbeType.WT.getCode());
     }
 
+
+
+
+
+
     public void initalInAlarm() throws Exception {
 
 
+        List<AlarmVo> alarmVoList = CacheContext.alarmInList;
+        List<AlarmTag> alarmTags = new ArrayList<>();
 
-        List<AlarmVo> alarmVoList=CacheContext.alarmInList;
-        List<AlarmTag>  alarmTags=new ArrayList<>();
 
 
-        if(!alarmVoList.isEmpty())
-        {
-            for(AlarmVo vo: alarmVoList)
-            {
+        if (!alarmVoList.isEmpty()) {
+            for (AlarmVo vo : alarmVoList) {
 
 
                 alarmTsService.createTable(vo.getTbName(), vo.getAlarmid(), vo.getAlarmtype(),
@@ -83,9 +84,32 @@ public class AlarmInService {
                         vo.getResettable(), vo.getStationid(),
                         vo.getStationname(), vo.getSubcomponents(),
                         vo.getSuffix(), vo.getTagid(),
-                        vo.getTriggertype(), vo.getUniformcode(),vo.getSuperTableName(),
+                        vo.getTriggertype(), vo.getUniformcode(), vo.getSuperTableName(),
                         vo.getName(),
-                        vo.getNemCode(),vo.getFaultCause(),vo.getResolvent(),vo.getFaultType(),vo.getAname());
+                        vo.getNemCode(), vo.getFaultCause(), vo.getResolvent(), vo.getFaultType(), vo.getAname());
+
+
+            }
+        }
+
+
+//        alarmTsService.insertList(alarmTags);
+    }
+
+
+
+    public void updapteInAlarm() throws Exception {
+
+
+        List<AlarmVo> alarmVoList = CacheContext.alarmInList;
+        List<AlarmTag> alarmTags = new ArrayList<>();
+
+
+        if (!alarmVoList.isEmpty()) {
+            for (AlarmVo vo : alarmVoList) {
+
+
+
                 alarmTsService.updateTable(vo.getTbName(), vo.getAlarmid(), vo.getAlarmtype(),
                         vo.getCharacteristic(), vo.getComponents(),
                         vo.getDescription(),
@@ -105,10 +129,8 @@ public class AlarmInService {
         }
 
 
-//        alarmTsService.insertList(alarmTags);
     }
 
-
     public List<AlarmVo> initalAlarmVo() throws Exception {
 
         List<AlarmVo> alarmVoList=new ArrayList<>();

+ 202 - 0
alarm-service/src/main/java/com/gyee/alarm/service/AlarmInitalService.java

@@ -0,0 +1,202 @@
+package com.gyee.alarm.service;
+
+import com.gyee.alarm.init.CacheContext;
+import com.gyee.alarm.model.auto.ProEconAlarmConfiguration;
+import com.gyee.alarm.model.auto.ProEconAlarmRule;
+import com.gyee.alarm.model.vo.AlarmCustomType;
+import com.gyee.alarm.model.vo.AlarmTypeValue;
+import com.gyee.alarm.model.vo.AlarmVo;
+import com.gyee.alarm.service.auto.IProEconAlarmConfigurationService;
+import com.gyee.alarm.service.auto.IProEconAlarmRuleService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Service
+public class AlarmInitalService {
+    @Resource
+    private IProEconAlarmConfigurationService proEconAlarmConfigurationService;
+    @Resource
+    private AlarmWtService alarmWtService;
+    @Resource
+    private AlarmInService alarmInService;
+    @Resource
+    private IProEconAlarmRuleService proEconAlarmRuleService;
+    @Resource
+    private AlarmBtService alarmBtService;
+
+    @Resource
+    private AlarmCtService alarmCtService;
+
+
+    public void initialAlarm() throws Exception {
+
+
+        List<ProEconAlarmConfiguration> inalarmls = new ArrayList<>();
+        List<ProEconAlarmConfiguration> btalarmls = new ArrayList<>();
+        List<ProEconAlarmConfiguration> wtalarmls = new ArrayList<>();
+
+        List<AlarmVo> alarmCtList = new ArrayList<>();
+        List<AlarmVo> alarmWtList = new ArrayList<>();
+        List<AlarmVo> alarmInList=new ArrayList<>();
+
+
+        List<AlarmVo> alarmBtList = new ArrayList<>();
+        Map<String,AlarmVo> alarmInMap=new HashMap<>();
+        Map<String, AlarmVo> alarmBtMap = new HashMap<>();
+        Map<String, AlarmVo> alarmCtMap = new HashMap<>();
+        Map<String, List<ProEconAlarmRule>> alarmRulesMap = new HashMap<>();
+
+        Map<String, List<ProEconAlarmConfiguration>> wtAlarmMap = new HashMap<>();
+        Map<String,List<AlarmVo>> alarmWpMap=new HashMap<>();
+        Map<String, List<ProEconAlarmConfiguration>> inAlarmMap = new HashMap<>();
+        Map<String, AlarmVo> alarmWtMap = new HashMap<>();
+
+
+        List<ProEconAlarmConfiguration> templs = proEconAlarmConfigurationService.list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
+        if (!templs.isEmpty()) {
+            for (ProEconAlarmConfiguration alarm : templs) {
+                if (alarm.getAlarmType().equals(AlarmTypeValue.WT.getCode())) {
+                    wtalarmls.add(alarm);
+                    StringBuilder sb=new StringBuilder();
+                    sb.append(alarm.getStationId()).append(alarm.getModelId());
+
+                    if(wtAlarmMap.containsKey(String.valueOf(sb)))
+                    {
+                        List<ProEconAlarmConfiguration> ls=wtAlarmMap.get(String.valueOf(sb));
+                        ls.add(alarm);
+                    }else
+                    {
+                        List<ProEconAlarmConfiguration> ls=new ArrayList<>();
+                        ls.add(alarm);
+                        wtAlarmMap.put(String.valueOf(sb),ls);
+                    }
+                } else if (alarm.getAlarmType().equals(AlarmTypeValue.BT.getCode())) {
+                    btalarmls.add(alarm);
+
+                }
+                else if (alarm.getAlarmType().equals(AlarmTypeValue.IN.getCode())) {
+                    inalarmls.add(alarm);
+                    StringBuilder sb=new StringBuilder();
+                    sb.append(alarm.getStationId()).append(alarm.getModelId());
+
+                    if(inAlarmMap.containsKey(String.valueOf(sb)))
+                    {
+                        List<ProEconAlarmConfiguration> ls=inAlarmMap.get(String.valueOf(sb));
+                        ls.add(alarm);
+                    }else
+                    {
+                        List<ProEconAlarmConfiguration> ls=new ArrayList<>();
+                        ls.add(alarm);
+                        inAlarmMap.put(String.valueOf(sb),ls);
+                    }
+                }
+            }
+        }
+
+        //风机报警初始化标签
+        alarmWtList=alarmWtService.initalAlarmVo();
+        if(!alarmWtList.isEmpty())
+        {
+            for(AlarmVo vo: alarmWtList)
+            {
+                if(alarmWpMap.containsKey(vo.getStationid()))
+                {
+                    List<AlarmVo> ls=alarmWpMap.get(vo.getStationid());
+                    ls.add(vo);
+                }else {
+                    List<AlarmVo> ls=new ArrayList<>();
+                    ls.add(vo);
+                    alarmWpMap.put(vo.getStationid(),ls);
+                }
+                alarmWtMap.put(vo.getTbName().toUpperCase(),vo);
+            }
+        }
+        //逆变器报警初始化标签
+        alarmInList=alarmInService.initalAlarmVo();
+        if(!alarmInList.isEmpty())
+        {
+            for(AlarmVo vo: alarmInList)
+            {
+                alarmInMap.put(vo.getTbName().toUpperCase(),vo);
+            }
+        }
+
+
+        //升压站报警初始化标签
+        alarmBtList=alarmBtService.initalAlarmVo();
+        if(!alarmBtList.isEmpty())
+        {
+            for(AlarmVo vo: alarmBtList)
+            {
+                alarmBtMap.put(vo.getTbName().toUpperCase(),vo);
+            }
+        }
+
+        //从pg数据库获取自定义报警配置信息
+        List<ProEconAlarmRule> customls =proEconAlarmRuleService.list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
+
+        List<ProEconAlarmRule> wtCustomls=new ArrayList<>();
+        List<ProEconAlarmRule> inCustomls=new ArrayList<>();
+        List<ProEconAlarmRule> btCustomls=new ArrayList<>();
+
+        //对自定义报警进行分类
+        if(!customls.isEmpty())
+        {
+            for(ProEconAlarmRule vo: customls)
+            {
+                if(vo.getCategory().equals(AlarmCustomType.WT.getCode()))
+                {
+                    wtCustomls.add(vo);
+                }else  if(vo.getCategory().equals(AlarmCustomType.IN.getCode()))
+                {
+                    inCustomls.add(vo);
+                }else  if(vo.getCategory().equals(AlarmCustomType.Bt.getCode()))
+                {
+                    btCustomls.add(vo);
+                }
+
+            }
+        }
+
+        alarmRulesMap.put(AlarmCustomType.Bt.getCode(),btCustomls);
+        alarmRulesMap.put(AlarmCustomType.WT.getCode(),wtCustomls);
+        alarmRulesMap.put(AlarmCustomType.IN.getCode(),inCustomls);
+        //自定义报警初始化标签
+        alarmCtList=alarmCtService.initalAlarmVo();
+        if(!alarmCtList.isEmpty())
+        {
+            for(AlarmVo vo: alarmCtList)
+            {
+                alarmCtMap.put(vo.getTbName().toUpperCase(),vo);
+            }
+        }
+
+
+
+        CacheContext.inalarmls =inalarmls;
+        CacheContext.btalarmls =btalarmls;
+        CacheContext.wtalarmls =wtalarmls;
+
+        CacheContext.alarmCtList =alarmCtList;
+        CacheContext.alarmWtList =alarmWtList;
+        CacheContext.alarmInList =alarmInList;
+
+
+        CacheContext.alarmBtList = alarmBtList;
+        CacheContext.alarmInMap=alarmInMap;
+        CacheContext.alarmBtMap = alarmBtMap;
+        CacheContext.alarmCtMap = alarmCtMap;
+        CacheContext.alarmRulesMap = alarmRulesMap;
+
+        CacheContext.wtAlarmMap = wtAlarmMap;
+        CacheContext.alarmWpMap=alarmWpMap;
+        CacheContext.inAlarmMap = inAlarmMap;
+        CacheContext.alarmWtMap = alarmWtMap;
+    }
+}

+ 41 - 66
alarm-service/src/main/java/com/gyee/alarm/service/AlarmWtService.java

@@ -9,10 +9,7 @@ import com.gyee.alarm.service.auto.IProEconAlarmInfoService;
 import com.gyee.alarm.util.DateUtils;
 import com.gyee.alarm.util.StringUtils;
 import com.gyee.alarm.util.realtimesource.IEdosUtil;
-import com.gyee.alarm.websocket.PushParams;
-import com.gyee.alarm.websocket.WebSocket;
-import com.gyee.common.model.PointData;
-import groovy.util.logging.Slf4j;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,11 +36,13 @@ public class AlarmWtService {
 
     @Value("${pushinterval}")
     private Double pushinterval;
-    @Resource
-    private WebSocket webSocket;
+
     @Resource
     private PushDataSevice pushDataSevice;
 
+
+
+
     @Value("${read-rows}")
     private Integer readRows;
 
@@ -68,34 +67,6 @@ public class AlarmWtService {
         List<AlarmTag> alarmTags = new ArrayList<>();
 
 
-//        List<String>  ls=new ArrayList<>();
-//        List<PointData> values=new ArrayList<>();
-//        Map<String,PointData> valuemap=new HashMap<>();
-//
-//        int times=0;
-//        for(AlarmVo vo:alarmVoList)
-//        {
-//
-//            ls.add(vo.getTagid());
-//            times++;
-//            if(times==readRows)
-//            {
-//                List<PointData> templs=edosUtil.getRealData(ls);
-//                values.addAll(templs);
-//                ls=new ArrayList<>();
-//                times=0;
-//            }
-//        }
-//        if(!ls.isEmpty())
-//        {
-//            List<PointData> templs=edosUtil.getRealData(ls);
-//            values.addAll(templs);
-//        }
-//
-//        for(PointData po:values)
-//        {
-//            valuemap.put(po.getEdnaId(),po);
-//        }
 
         if (!alarmVoList.isEmpty()) {
             for (AlarmVo vo : alarmVoList) {
@@ -117,38 +88,6 @@ public class AlarmWtService {
                         vo.getNemCode(), vo.getFaultCause(), vo.getResolvent(), vo.getFaultType(), vo.getAname());
 
 
-//                alarmTsService.updateTable(vo.getTbName(), vo.getAlarmid(), vo.getAlarmtype(),
-//                        vo.getCharacteristic(), vo.getComponents(),
-//                        vo.getDescription(),
-//                        vo.getDeviceid(), vo.getDevicename(),
-//                        vo.getDevicetype(), vo.getEnabled(),
-//                        vo.getLineid(), vo.getLinename(),
-//                        vo.getModelId(), vo.getProjectid(),
-//                        vo.getProjectname(), vo.getRank(),
-//                        vo.getResettable(), vo.getStationid(),
-//                        vo.getStationname(), vo.getSubcomponents(),
-//                        vo.getSuffix(), vo.getTagid(),
-//                        vo.getTriggertype(), vo.getUniformcode(), vo.getSuperTableName(),
-//                        vo.getName(),
-//                        vo.getNemCode(),vo.getFaultCause(),vo.getResolvent(),vo.getFaultType(),vo.getAname());
-//                AlarmTag po=new AlarmTag();
-//                po.setId(vo.getTbName());
-//                if(valuemap.containsKey(vo.getTagid()))
-//                {
-//
-//                    PointData pointData=valuemap.get(vo.getTagid());
-//                    po.setVal(pointData.getPointValueInDouble());
-//                    po.setOval(pointData.getPointValueInDouble());
-//                }
-//
-//
-//                po.setTriggerType(vo.getTriggertype());
-//                po.setTagId(vo.getTagid());
-//
-//                po.setRank(vo.getRank());
-//                po.setTimeLong(0.0);
-//                po.setTs(new Date().getTime());
-//                alarmTags.add(po);
             }
         }
 
@@ -157,6 +96,42 @@ public class AlarmWtService {
     }
 
 
+
+    public void updapteWtAlarm() throws Exception {
+
+
+        List<AlarmVo> alarmVoList = CacheContext.alarmWtList;
+        List<AlarmTag> alarmTags = new ArrayList<>();
+
+
+        if (!alarmVoList.isEmpty()) {
+            for (AlarmVo vo : alarmVoList) {
+
+
+
+                alarmTsService.updateTable(vo.getTbName(), vo.getAlarmid(), vo.getAlarmtype(),
+                        vo.getCharacteristic(), vo.getComponents(),
+                        vo.getDescription(),
+                        vo.getDeviceid(), vo.getDevicename(),
+                        vo.getDevicetype(), vo.getEnabled(),
+                        vo.getLineid(), vo.getLinename(),
+                        vo.getModelId(), vo.getProjectid(),
+                        vo.getProjectname(), vo.getRank(),
+                        vo.getResettable(), vo.getStationid(),
+                        vo.getStationname(), vo.getSubcomponents(),
+                        vo.getSuffix(), vo.getTagid(),
+                        vo.getTriggertype(), vo.getUniformcode(), vo.getSuperTableName(),
+                        vo.getName(),
+                        vo.getNemCode(),vo.getFaultCause(),vo.getResolvent(),vo.getFaultType(),vo.getAname());
+
+            }
+        }
+
+
+    }
+
+
+
     public List<AlarmVo> initalAlarmVo() throws Exception {
 
         List<AlarmVo> alarmVoList = new ArrayList<>();

+ 26 - 122
alarm-service/src/main/java/com/gyee/alarm/service/PushDataSevice.java

@@ -6,9 +6,7 @@ import com.gyee.alarm.model.auto.ProBasicPowerstation;
 import com.gyee.alarm.model.auto.ProBasicSubStation;
 import com.gyee.alarm.model.vo.AlarmTag;
 import com.gyee.alarm.service.auto.ISysUserService;
-import com.gyee.alarm.util.DateUtils;
-import com.gyee.alarm.websocket.PushParams;
-import com.gyee.alarm.websocket.WebSocket;
+
 
 import com.gyee.common.model.StringUtils;
 import org.springframework.beans.factory.annotation.Value;
@@ -28,146 +26,52 @@ public class PushDataSevice {
     private ISysUserService sysUserService;
     @Value("${pushinterval}")
     private Double pushinterval;
-    @Resource
-    private WebSocket webSocket;
+//    @Resource
+//    private WebSocket webSocket;
 
 
     public synchronized void pushWtData(AlarmTag po) throws EncodeException, IOException, InterruptedException {
-        ConcurrentHashMap<String, WebSocket> webSocketPushMap = WebSocket.webSocketMap;
-        ConcurrentHashMap<String, PushParams> webSocketPushParamsMap = WebSocket.webSocketParamsMap;
-
-        if (!webSocketPushMap.isEmpty()) {
-            for (String key : webSocketPushMap.keySet()) {
-                // 根据ws连接用户ID获取推送参数
-
-
-                if (checkWtId(key, po.getDeviceId())) {
-
-                    if(webSocketPushMap.containsKey(key))
-                    {
-                        webSocket.sendMessageByUserId(key, po);
-
-//                        Thread.sleep(300);
-                    }
-                }
-
-            }
-        }
-
-    }
-
-//    public synchronized void pushBtData(AlarmTag po) throws EncodeException, IOException {
 //        ConcurrentHashMap<String, WebSocket> webSocketPushMap = WebSocket.webSocketMap;
-//        ConcurrentHashMap<String, WebSocketBt> webSocketPushBtMap = WebSocketBt.webSocketBtMap;
 //        ConcurrentHashMap<String, PushParams> webSocketPushParamsMap = WebSocket.webSocketParamsMap;
 //
-//        ConcurrentHashMap<String, List<String>> btParamsMap = WebSocketBt.btParamsMap;
-//
 //        if (!webSocketPushMap.isEmpty()) {
 //            for (String key : webSocketPushMap.keySet()) {
 //                // 根据ws连接用户ID获取推送参数
-////                PushParams pushParams = webSocketPushParamsMap.get(key);
-//                synchronized (po.getId()) {
-//                    if (checkBtId(key, po.getWpId())) {
-//                        webSocket.sendMessageByUserId(key, po);
-//
-//                    }
-//                }
-//            }
-//        }
-//
-//        if (!webSocketPushBtMap.isEmpty()) {
-//
-//
-//
-//
-//                if (po.getRank() > 3) {
-//
-//                    if (btParamsMap.containsKey(po.getWpId())) {
-//
-//                        List<String> btls = btParamsMap.get(po.getWpId());
-//
-//                        if (btls.contains(po.getAlarmId())) {
-//                            btls.remove(po.getAlarmId());
-//                        } else {
-//                            btls.add(po.getAlarmId());
-//                        }
-//                        if (btls.isEmpty()) {
-//                            for (String key : webSocketPushBtMap.keySet()) {
-//
-//                                if (checkBtId(key, po.getWpId())) {
-//                                    Map<String, Boolean> map = new HashMap<>();
-//                                    map.put(po.getWpId(), false);
-//                                    webSocketBt.sendMessageByUserId(key, map);
-//                                }
-//                            }
 //
-//                        } else {
 //
-//                            for (String key : webSocketPushBtMap.keySet()) {
+//                if (checkWtId(key, po.getDeviceId())) {
 //
-//                                if (checkBtId(key, po.getWpId())) {
-//                                    Map<String, Boolean> map = new HashMap<>();
-//                                    map.put(po.getWpId(), true);
-//                                    webSocketBt.sendMessageByUserId(key, map);
-//                                }
-//                            }
-//                        }
-//                    } else {
-//                        List<String> btls = new ArrayList<>();
-//
-//                        btls.add(po.getAlarmId());
-//
-//                        btParamsMap.put(po.getWpId(), btls);
-//
-//                        if (StringUtils.empty(po.getIsClose())) {
-//                            for (String key : webSocketPushBtMap.keySet()) {
-//
-//
-//                                if (checkBtId(key, po.getWpId())) {
-//                                    Map<String, Boolean> map = new HashMap<>();
-//                                    map.put(po.getWpId(), false);
-//                                    webSocketBt.sendMessageByUserId(key, map);
-//                                }
-//                            }
-//
-//                        } else {
-//                            for (String key : webSocketPushBtMap.keySet()) {
-//
-//
-//                                if (checkBtId(key, po.getWpId())) {
-//                                    Map<String, Boolean> map = new HashMap<>();
-//                                    map.put(po.getWpId(), true);
-//                                    webSocketBt.sendMessageByUserId(key, map);
-//                                }
-//                            }
-//
-//                        }
+//                    if(webSocketPushMap.containsKey(key))
+//                    {
+//                        webSocket.sendMessageByUserId(key, po);
 //
+////                        Thread.sleep(300);
 //                    }
 //                }
 //
 //            }
-//
-//
-//    }
+//        }
 
-    public synchronized void pushBtData(AlarmTag po) throws EncodeException, IOException, InterruptedException {
-        ConcurrentHashMap<String, WebSocket> webSocketPushMap = WebSocket.webSocketMap;
-        ConcurrentHashMap<String, PushParams> webSocketPushParamsMap = WebSocket.webSocketParamsMap;
+    }
 
 
 
-        if (!webSocketPushMap.isEmpty()) {
-            for (String key : webSocketPushMap.keySet()) {
-                // 根据ws连接用户ID获取推送参数
-//                PushParams pushParams = webSocketPushParamsMap.get(key);
-                if (checkBtId(key, po.getWpId())) {
-                    webSocket.sendMessageByUserId(key, po);
-//                        Thread.sleep(300);
-                }
-            }
-        }
+    public synchronized void pushBtData(AlarmTag po) throws EncodeException, IOException, InterruptedException {
+//        ConcurrentHashMap<String, WebSocket> webSocketPushMap = WebSocket.webSocketMap;
+//        ConcurrentHashMap<String, PushParams> webSocketPushParamsMap = WebSocket.webSocketParamsMap;
+//
+//
+//
+//        if (!webSocketPushMap.isEmpty()) {
+//            for (String key : webSocketPushMap.keySet()) {
+//                // 根据ws连接用户ID获取推送参数
+////                PushParams pushParams = webSocketPushParamsMap.get(key);
+//                if (checkBtId(key, po.getWpId())) {
+//                    webSocket.sendMessageByUserId(key, po);
+////                        Thread.sleep(300);
+//                }
+//            }
+//        }
 
     }
 

+ 205 - 0
alarm-service/src/main/java/com/gyee/alarm/service/PushDataSevicemod.java

@@ -0,0 +1,205 @@
+//package com.gyee.alarm.service;
+//
+//import com.gyee.alarm.init.CacheContext;
+//import com.gyee.alarm.model.auto.ProBasicEquipment;
+//import com.gyee.alarm.model.auto.ProBasicPowerstation;
+//import com.gyee.alarm.model.auto.ProBasicSubStation;
+//import com.gyee.alarm.model.vo.AlarmTag;
+//import com.gyee.alarm.service.auto.ISysUserService;
+//import com.gyee.alarm.stomp.ChatController;
+//import com.gyee.alarm.stomp.MessagePushService;
+//import com.gyee.alarm.stomp.WebSocketSessionManager;
+//
+//
+//import com.gyee.common.model.StringUtils;
+//import org.springframework.beans.factory.annotation.Value;
+//import org.springframework.stereotype.Service;
+//
+//import javax.annotation.Resource;
+//import javax.servlet.http.HttpServletRequest;
+//import javax.websocket.EncodeException;
+//import java.io.IOException;
+//import java.util.*;
+//import java.util.concurrent.ConcurrentHashMap;
+//
+//
+//@Service
+//public class PushDataSevicemod {
+//    @Resource
+//    private ISysUserService sysUserService;
+//    @Value("${pushinterval}")
+//    private Double pushinterval;
+//    @Resource
+//    private ChatController chatController;
+//    @Resource
+//    private WebSocketSessionManager webSocketSessionManager;
+//    @Resource
+//    private MessagePushService messagePushService;
+//
+//
+//    public synchronized void pushWtData(AlarmTag po) throws EncodeException, IOException, InterruptedException {
+//        Map<String, String> webSocketPushMap = webSocketSessionManager.getUserSessionMap();
+//
+//
+//        if (!webSocketPushMap.isEmpty()) {
+//            for (String key : webSocketPushMap.keySet()) {
+//                // 根据ws连接用户ID获取推送参数
+//
+//
+//                if (checkWtId(key, po.getDeviceId())) {
+//
+//                    if(webSocketPushMap.containsKey(key))
+//                    {
+//                        messagePushService.pushToUser(key,po);
+//                    }
+//                }
+//
+//            }
+//        }
+//
+//    }
+//
+//    public synchronized void pushBtData(AlarmTag po) throws EncodeException, IOException, InterruptedException {
+//        Map<String, String> webSocketPushMap = webSocketSessionManager.getUserSessionMap();
+//
+//
+//
+//        if (!webSocketPushMap.isEmpty()) {
+//            for (String key : webSocketPushMap.keySet()) {
+//                // 根据ws连接用户ID获取推送参数
+//                if (checkBtId(key, po.getWpId())) {
+//                    messagePushService.pushToUser(key,po);
+//                }
+//            }
+//        }
+//
+//    }
+//
+//
+//    private boolean checkWtId(String userId, String wtId) {
+//
+//
+//        boolean result = false;
+//
+//        if (StringUtils.notEmp(userId)) {
+//            String[] str = userId.split("_");
+//            if (str.length == 2) {
+//                List<String> depls = sysUserService.getUserByuserId(Long.valueOf(str[0]));
+//                if (!depls.isEmpty()) {
+//                    String depId = depls.get(0);
+//
+//                    if (CacheContext.wpwtmap.containsKey(depId)) {
+//
+//                        List<ProBasicEquipment> wtls = CacheContext.wpwtmap.get(depId);
+//                        for (ProBasicEquipment wt : wtls) {
+//                            if (wt.getId().equals(wtId)) {
+//                                result = true;
+//                                break;
+//                            }
+//
+//                        }
+//
+//                    } else if (CacheContext.cmwtlsmap.containsKey(depId)) {
+//
+//                        List<ProBasicEquipment> wtls = CacheContext.cmwtlsmap.get(depId);
+//                        for (ProBasicEquipment wt : wtls) {
+//                            if (wt.getId().equals(wtId)) {
+//                                result = true;
+//                                break;
+//                            }
+//
+//                        }
+//
+//                    } else if (CacheContext.rgwtlsmap.containsKey(depId)) {
+//
+//                        List<ProBasicEquipment> wtls = CacheContext.rgwtlsmap.get(depId);
+//                        for (ProBasicEquipment wt : wtls) {
+//                            if (wt.getId().equals(wtId)) {
+//                                result = true;
+//                                break;
+//                            }
+//
+//                        }
+//
+//                    } else if (depId.equals("0")) {
+//                        for (ProBasicEquipment wt : CacheContext.wtls) {
+//                            if (wt.getId().equals(wtId)) {
+//                                result = true;
+//                                break;
+//                            }
+//
+//                        }
+//
+//                    }
+//                }
+//
+//            }
+//        }
+//
+//        return result;
+//    }
+//
+//
+//    private boolean checkBtId(String userId, String btId) {
+//
+//
+//        boolean result = false;
+//
+//        if (StringUtils.notEmp(userId)) {
+//            String[] str = userId.split("_");
+//            if (str.length == 2) {
+//                List<String> depls = sysUserService.getUserByuserId(Long.valueOf(str[0]));
+//                if (!depls.isEmpty()) {
+//                    String depId = depls.get(0);
+//
+//                    if (CacheContext.wpmap.containsKey(depId)) {
+//
+//                        ProBasicPowerstation wp = CacheContext.wpmap.get(depId);
+//
+//                        if (CacheContext.subwpmap.containsKey(btId)) {
+//                            ProBasicSubStation sub = CacheContext.subwpmap.get(btId);
+//                            if (sub.getWindpowerstationId().equals(wp.getId())) {
+//                                result = true;
+//                            }
+//                        }
+//
+//                    } else if (CacheContext.cpwpmap.containsKey(depId)) {
+//
+//                        List<ProBasicPowerstation> wpls = CacheContext.cpwpmap.get(depId);
+//                        for (ProBasicPowerstation wp : wpls) {
+//                            if (CacheContext.subwpmap.containsKey(btId)) {
+//                                ProBasicSubStation sub = CacheContext.subwpmap.get(btId);
+//                                if (sub.getWindpowerstationId().equals(wp.getId())) {
+//                                    result = true;
+//                                    break;
+//                                }
+//                            }
+//
+//                        }
+//
+//                    } else if (CacheContext.rgwpmap.containsKey(depId)) {
+//
+//                        List<ProBasicPowerstation> wpls = CacheContext.rgwpmap.get(depId);
+//                        for (ProBasicPowerstation wp : wpls) {
+//                            if (CacheContext.subwpmap.containsKey(btId)) {
+//                                ProBasicSubStation sub = CacheContext.subwpmap.get(btId);
+//                                if (sub.getWindpowerstationId().equals(wp.getId())) {
+//                                    result = true;
+//                                    break;
+//                                }
+//                            }
+//
+//                        }
+//
+//                    } else if (depId.equals("0")) {
+//                        result = true;
+//
+//                    }
+//                }
+//            }
+//        }
+//
+//
+//        return result;
+//    }
+//}

+ 1 - 2
alarm-service/src/main/java/com/gyee/alarm/service/ReloadVoSevice.java

@@ -12,8 +12,7 @@ import com.gyee.alarm.service.auto.IProEconAlarmConfigurationService;
 import com.gyee.alarm.service.auto.IProEconAlarmRuleService;
 import com.gyee.alarm.service.auto.ISysUserService;
 import com.gyee.alarm.util.DateUtils;
-import com.gyee.alarm.websocket.PushParams;
-import com.gyee.alarm.websocket.WebSocket;
+
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 

+ 66 - 0
alarm-service/src/main/java/com/gyee/alarm/service/auto/impl/AlarmTsServiceImpl.java

@@ -51,6 +51,38 @@ public class AlarmTsServiceImpl extends ServiceImpl<AlarmTsMapper, AlarmTs> impl
 
 
     ) {
+
+        tbName = tbName != null ? tbName : "";
+        alarmid = alarmid != null ? alarmid : "";
+        alarmtype = alarmtype != null ? alarmtype : "";
+        characteristic = characteristic != null ? characteristic : "";
+        components = components != null ? components : "";
+        description = description != null ? description : "";
+        deviceid = deviceid != null ? deviceid : "";
+        devicename = devicename != null ? devicename : "";
+        devicetype = devicetype != null ? devicetype : "";
+        enabled = enabled;
+        lineid = lineid != null ? lineid : "";
+        linename = linename != null ? linename : "";
+        modelId = modelId != null ? modelId : "";
+        projectid = projectid != null ? projectid : "";
+        projectname = projectname != null ? projectname : "";
+        rank = rank;
+        resettable = resettable;
+        stationid = stationid != null ? stationid : "";
+        stationname = stationname != null ? stationname : "";
+        subcomponents = subcomponents != null ? subcomponents : "";
+        suffix = suffix != null ? suffix : "";
+        tagid = tagid != null ? tagid : "";
+        triggertype = triggertype;
+        uniformcode = uniformcode != null ? uniformcode : "";
+        superTableName = superTableName != null ? superTableName : "";
+        name = name != null ? name : "";
+        nemCode = nemCode != null ? nemCode : "";
+        faultCause = faultCause != null ? faultCause : "";
+        resolvent = resolvent != null ? resolvent : "";
+        faultType = faultType != null ? faultType : "";
+        aname = aname != null ? aname : "";
         return alarmTsMapper.createTable(tbName, alarmid, alarmtype,
                 characteristic, components,
                 description,
@@ -82,6 +114,40 @@ public class AlarmTsServiceImpl extends ServiceImpl<AlarmTsMapper, AlarmTs> impl
 
 
     ) {
+
+        tbName = tbName != null ? tbName : "";
+        alarmid = alarmid != null ? alarmid : "";
+        alarmtype = alarmtype != null ? alarmtype : "";
+        characteristic = characteristic != null ? characteristic : "";
+        components = components != null ? components : "";
+        description = description != null ? description : "";
+        deviceid = deviceid != null ? deviceid : "";
+        devicename = devicename != null ? devicename : "";
+        devicetype = devicetype != null ? devicetype : "";
+        enabled = enabled;
+        lineid = lineid != null ? lineid : "";
+        linename = linename != null ? linename : "";
+        modelId = modelId != null ? modelId : "";
+        projectid = projectid != null ? projectid : "";
+        projectname = projectname != null ? projectname : "";
+        rank = rank;
+        resettable = resettable;
+        stationid = stationid != null ? stationid : "";
+        stationname = stationname != null ? stationname : "";
+        subcomponents = subcomponents != null ? subcomponents : "";
+        suffix = suffix != null ? suffix : "";
+        tagid = tagid != null ? tagid : "";
+        triggertype = triggertype;
+        uniformcode = uniformcode != null ? uniformcode : "";
+        superTableName = superTableName != null ? superTableName : "";
+        name = name != null ? name : "";
+        nemCode = nemCode != null ? nemCode : "";
+        faultCause = faultCause != null ? faultCause : "";
+        resolvent = resolvent != null ? resolvent : "";
+        faultType = faultType != null ? faultType : "";
+        aname = aname != null ? aname : "";
+
+
         return alarmTsMapper.updateTable(tbName, alarmid, alarmtype,
                 characteristic, components,
                 description,

+ 33 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/AdminAuthInterceptor.java

@@ -0,0 +1,33 @@
+package com.gyee.alarm.stomp;
+
+import org.springframework.messaging.Message;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.simp.stomp.StompHeaderAccessor;
+import org.springframework.messaging.support.ChannelInterceptor;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 管理员认证拦截器
+ * 验证管理员操作权限
+ */
+@Component
+public class AdminAuthInterceptor implements ChannelInterceptor {
+
+//    @Override
+//    public Message<?> preSend(Message<?> message, MessageChannel channel) {
+//        StompHeaderAccessor accessor = StompHeaderAccessor.wrap(message);
+//
+//        // 只处理管理员操作相关的消息
+//        if (accessor.getDestination() != null &&
+//                accessor.getDestination().startsWith("/app/admin")) {
+//
+//            String token = accessor.getFirstNativeHeader("admin-token");
+//            if (token == null || !token.equals("admin-secret-token")) {
+//                throw new SecurityException("管理员操作未授权");
+//            }
+//        }
+//        return message;
+//    }
+}

+ 119 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/ChatController.java

@@ -0,0 +1,119 @@
+//package com.gyee.alarm.stomp;
+//
+//
+//import org.springframework.messaging.handler.annotation.DestinationVariable;
+//import org.springframework.messaging.handler.annotation.MessageMapping;
+//import org.springframework.messaging.handler.annotation.Payload;
+//import org.springframework.messaging.handler.annotation.SendTo;
+//import org.springframework.messaging.simp.SimpMessagingTemplate;
+//import org.springframework.messaging.simp.annotation.SendToUser;
+//import org.springframework.stereotype.Controller;
+//import org.springframework.web.bind.annotation.GetMapping;
+//
+//import javax.annotation.Resource;
+//import java.security.Principal;
+//import java.time.LocalDateTime;
+//import java.util.Map;
+//
+///**
+// * WebSocket 消息控制器
+// * 处理各种类型的消息路由
+// */
+//@Controller
+//public class ChatController {
+//
+//    private final SimpMessagingTemplate messagingTemplate;
+//
+//    public ChatController(SimpMessagingTemplate messagingTemplate) {
+//        this.messagingTemplate = messagingTemplate;
+//    }
+//
+//
+//    @Resource
+//    private WebSocketSessionManager sessionManager;
+//
+//    /**
+//     * 获取在线人数
+//     */
+//    @MessageMapping("/online.count")
+//    @SendTo("/topic/onlineCount")
+//    public int getOnlineCount() {
+//        return sessionManager.getConnectionCount();
+//    }
+//
+//    /**
+//     * 获取在线用户列表
+//     */
+//    @MessageMapping("/online.users")
+//    @SendToUser("/queue/onlineUsers")
+//    public Map<String, String> getOnlineUsers(Principal principal) {
+//        return sessionManager.getActiveUsers();
+//    }
+//    /**
+//     * 公共聊天消息
+//     * @param message 聊天消息
+//     * @return 广播消息
+//     */
+//    @MessageMapping("/chat.public")
+//    @SendTo("/topic/public")
+//    public ChatMessage handlePublicMessage(@Payload ChatMessage message) {
+//        message.setTimestamp(LocalDateTime.now());
+//        return message;
+//    }
+//
+//    /**
+//     * 私聊消息(点对点)
+//     * @param message 聊天消息
+//     * @param principal 当前用户
+//     */
+//    @MessageMapping("/chat.private")
+//    public void handlePrivateMessage(@Payload ChatMessage message, Principal principal) {
+//        message.setTimestamp(LocalDateTime.now());
+//        message.setSender(principal.getName());
+//
+//        // 发送给指定用户
+//        messagingTemplate.convertAndSendToUser(
+//                message.getRecipient(),
+//                "/queue/private",
+//                message
+//        );
+//    }
+//
+//    /**
+//     * 群组消息
+//     * @param groupId 群组ID
+//     * @param message 聊天消息
+//     * @param principal 当前用户
+//     */
+//    @MessageMapping("/chat.group/{groupId}")
+//    public void handleGroupMessage(
+//            @DestinationVariable String groupId,
+//            @Payload ChatMessage message,
+//            Principal principal) {
+//        message.setTimestamp(LocalDateTime.now());
+//        message.setSender(principal.getName());
+//
+//        // 发送到指定群组
+//        messagingTemplate.convertAndSend("/topic/group." + groupId, message);
+//    }
+//
+//    /**
+//     * 系统通知
+//     * @return 发送给当前用户的通知
+//     */
+//    @MessageMapping("/notify")
+//    @SendToUser("/queue/notifications")
+//    public Notification handleNotificationRequest() {
+//        return new Notification("系统通知", "您有新的消息", sessionManager.getConnectionCount());
+//    }
+//
+//    /**
+//     * HTTP 接口测试页面
+//     */
+//    @GetMapping("/chat")
+//    public String chatPage() {
+//        return "chat";
+//    }
+//
+//
+//}

+ 22 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/ChatMessage.java

@@ -0,0 +1,22 @@
+package com.gyee.alarm.stomp;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import java.time.LocalDateTime;
+
+/**
+ * 聊天消息实体类
+ */
+@Data
+@AllArgsConstructor
+public class ChatMessage {
+    private MessageType type;   // 消息类型
+    private String content;     // 消息内容
+    private String sender;      // 发送者
+    private String recipient;   // 接收者(私聊用)
+    private LocalDateTime timestamp; // 时间戳
+
+    public enum MessageType {
+        CHAT, JOIN, LEAVE, NOTICE
+    }
+}

+ 20 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/CorsConfig.java

@@ -0,0 +1,20 @@
+package com.gyee.alarm.stomp;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@Configuration
+public class CorsConfig implements WebMvcConfigurer {
+
+    @Override
+    public void addCorsMappings(CorsRegistry registry) {
+
+
+        registry.addMapping("/ws/**")
+                .allowedOrigins("*")
+                .allowedMethods("*")
+                .allowedHeaders("*")
+                .exposedHeaders("Access-Control-Allow-Origin");
+    }
+}

+ 54 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/CustomHandshakeInterceptor.java

@@ -0,0 +1,54 @@
+package com.gyee.alarm.stomp;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.server.ServerHttpRequest;
+import org.springframework.http.server.ServerHttpResponse;
+import org.springframework.stereotype.Component;
+import org.springframework.web.socket.WebSocketHandler;
+import org.springframework.web.socket.server.HandshakeInterceptor;
+
+import javax.annotation.Resource;
+import java.util.Map;
+import java.util.UUID;
+
+@Component
+public class CustomHandshakeInterceptor implements HandshakeInterceptor {
+
+    private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    @Resource
+    private WebSocketSessionManager sessionManager;
+
+    @Override
+    public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response,
+                                   WebSocketHandler wsHandler, Map<String, Object> attributes) {
+        // 获取请求头
+        String token = request.getHeaders().getFirst("token");
+        String username = request.getHeaders().getFirst("username");
+
+        // 生成会话ID
+        String sessionId = UUID.randomUUID().toString();
+//        attributes.put(SimpMessageHeaderAccessor.SESSION_ID_ATTRIBUTE, sessionId);
+
+        if (username == null) {
+            username = "guest_" + System.currentTimeMillis();
+        }
+
+        // 保存用户名到会话属性
+        attributes.put("username", username);
+
+        logger.info("握手开始: {} (ID: {})", username, sessionId);
+        return true;
+    }
+
+    @Override
+    public void afterHandshake(ServerHttpRequest request, ServerHttpResponse response,
+                               WebSocketHandler wsHandler, Exception exception) {
+        if (exception != null) {
+            logger.error("握手失败", exception);
+        } else {
+            logger.info("握手完成");
+        }
+    }
+}

+ 27 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/MessageController.java

@@ -0,0 +1,27 @@
+package com.gyee.alarm.stomp;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class MessageController {
+
+    @Autowired
+    private PushService pushService;
+
+    @GetMapping("/broadcast")
+    public PushMessage sendBroadcast(@RequestParam String message) {
+        pushService.sendBroadcast(message);
+        return new PushMessage("广播消息已发送: " + message, "INFO", "SERVER");
+    }
+
+    @GetMapping("/private")
+    public PushMessage sendPrivate(
+            @RequestParam String userId,
+            @RequestParam String message) {
+        pushService.sendPrivateMessage(userId, message);
+        return new PushMessage("私信已发送给 " + userId + ": " + message, "INFO", "SERVER");
+    }
+}

+ 98 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/MessagePushService.java

@@ -0,0 +1,98 @@
+package com.gyee.alarm.stomp;
+
+
+import com.gyee.alarm.model.vo.AlarmTag;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
+import org.springframework.messaging.simp.SimpMessageType;
+import org.springframework.messaging.simp.SimpMessagingTemplate;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 消息推送服务
+ * 负责服务端主动推送消息给指定用户
+ */
+@Service
+public class MessagePushService {
+
+    @Resource
+    private SimpMessagingTemplate messagingTemplate;
+
+    @Resource
+    private WebSocketSessionManager sessionManager;
+
+    /**
+     * 推送消息给单个用户
+     * @param username 目标用户名
+     * @param message 消息内容
+     */
+    public void pushToUser(String username, ChatMessage message) {
+
+        if (sessionManager.isUserOnline(username)) {
+
+
+            if(sessionManager.getUserSessionMap().containsKey(username))
+            {
+                String sessionId = sessionManager.getUserSessionMap().get(username);
+                SimpMessageHeaderAccessor headerAccessor = SimpMessageHeaderAccessor.create(SimpMessageType.MESSAGE);
+                headerAccessor.setSessionId(sessionId);
+//                headerAccessor.setLeaveMutable(true);
+                messagingTemplate.convertAndSendToUser(
+                        sessionId,
+                        "/queue/private",
+                        message, headerAccessor.getMessageHeaders()
+                );
+            }
+
+//            messagingTemplate.convertAndSendToUser(
+//                    username,
+//                    "/queue/private",
+//                    message
+//            );
+
+
+        }
+
+
+
+
+    }
+
+
+
+    /**
+     * 推送消息给多个用户
+     * @param usernames 目标用户名列表
+     * @param message 消息内容
+     */
+    public void pushToUsers(List<String> usernames, AlarmTag message) {
+
+
+        for (String username : usernames) {
+            if (sessionManager.isUserOnline(username)) {
+                messagingTemplate.convertAndSendToUser(
+                        username,
+                        "/queue/push-messages",
+                        message
+                );
+            }
+        }
+    }
+
+    /**
+     * 广播系统消息给所有在线用户
+     * @param message 消息内容
+     */
+    public void broadcastToAll(ChatMessage message) {
+
+
+        messagingTemplate.convertAndSend(
+                "/topic/system-broadcast",
+                message
+        );
+    }
+}

+ 16 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/Notification.java

@@ -0,0 +1,16 @@
+package com.gyee.alarm.stomp;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import java.time.LocalDateTime;
+
+/**
+ * 系统通知实体类
+ */
+@Data
+@AllArgsConstructor
+public class Notification {
+    private String title;
+    private String content;
+    private int connectionCount;
+}

+ 31 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/PushMessage.java

@@ -0,0 +1,31 @@
+package com.gyee.alarm.stomp;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PushMessage {
+    private String content;
+    private String type;
+    private String sender;
+    private String receiver;
+    private String timestamp;
+
+    public PushMessage(String content, String type, String sender) {
+        this.content = content;
+        this.type = type;
+        this.sender = sender;
+        this.timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss"));
+    }
+
+    public PushMessage(String content, String type, String sender, String receiver) {
+        this(content, type, sender);
+        this.receiver = receiver;
+    }
+}

+ 71 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/PushService.java

@@ -0,0 +1,71 @@
+package com.gyee.alarm.stomp;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
+import org.springframework.messaging.simp.SimpMessageType;
+import org.springframework.messaging.simp.SimpMessagingTemplate;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicInteger;
+
+@Service
+public class PushService {
+
+    private final AtomicInteger broadcastCounter = new AtomicInteger(0);
+    private final AtomicInteger privateCounter = new AtomicInteger(0);
+
+
+    @Resource
+    private SimpMessagingTemplate messagingTemplate;
+    @Resource
+    private WebSocketSessionManager sessionManager;
+    // 每3秒群发一次消息
+    @Scheduled(fixedRate = 3000)
+    public void broadcastData() {
+        String content = "系统广播 #" + broadcastCounter.incrementAndGet() +
+                " | 时间: " + LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_TIME);
+        PushMessage msg = new PushMessage(content, "BROADCAST", "SERVER");
+        messagingTemplate.convertAndSend("/topic/public", msg);
+    }
+
+    // 每5秒随机选择一个用户发送私信
+    @Scheduled(fixedRate = 5000)
+    public void sendRandomPrivateMessage() {
+        String randomUser = "user1";
+        String content = "系统私信 #" + privateCounter.incrementAndGet() +
+                " | 仅您可见";
+        PushMessage msg = new PushMessage(content, "PRIVATE", "SERVER", randomUser);
+
+
+          if(sessionManager.getUserSessionMap().containsKey(randomUser))
+            {
+                String sessionId = sessionManager.getUserSessionMap().get(randomUser);
+                SimpMessageHeaderAccessor headerAccessor = SimpMessageHeaderAccessor.create(SimpMessageType.MESSAGE);
+                headerAccessor.setSessionId(sessionId);
+//                headerAccessor.setLeaveMutable(true);
+                messagingTemplate.convertAndSendToUser(
+                        sessionId,
+                        "/queue/private",
+                        msg, headerAccessor.getMessageHeaders()
+                );
+           }
+
+    }
+
+    // 群发消息方法
+    public void sendBroadcast(String content) {
+        PushMessage msg = new PushMessage(content, "BROADCAST", "ADMIN");
+        messagingTemplate.convertAndSend("/topic/public", msg);
+    }
+
+    // 单独发送消息方法
+    public void sendPrivateMessage(String userId, String content) {
+        PushMessage msg = new PushMessage(content, "PRIVATE", "ADMIN", userId);
+        messagingTemplate.convertAndSendToUser(userId, "/queue/private", msg);
+    }
+}

+ 61 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/RateLimitInterceptor.java

@@ -0,0 +1,61 @@
+package com.gyee.alarm.stomp;
+
+import org.springframework.messaging.Message;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.simp.stomp.StompCommand;
+import org.springframework.messaging.simp.stomp.StompHeaderAccessor;
+import org.springframework.messaging.support.ChannelInterceptor;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * 流量控制拦截器
+ * 实现基于用户的消息速率限制
+ */
+@Component
+public class RateLimitInterceptor implements ChannelInterceptor {
+
+    // 用户消息速率限制(消息/秒)
+    private static final int RATE_LIMIT_PER_USER = 5;
+    // 存储用户消息计数
+    private final Map<String, RateCounter> userRateMap = new ConcurrentHashMap<>();
+
+    @Override
+    public Message<?> preSend(Message<?> message, MessageChannel channel) {
+        StompHeaderAccessor accessor = StompHeaderAccessor.wrap(message);
+
+        // 只处理SEND命令(用户发送的消息)
+        if (accessor.getCommand() == StompCommand.SEND) {
+            String username = accessor.getUser() != null ?
+                    accessor.getUser().getName() : "anonymous";
+
+            RateCounter counter = userRateMap.computeIfAbsent(
+                    username, k -> new RateCounter());
+
+            // 检查速率限制
+            if (counter.incrementAndCheck() > RATE_LIMIT_PER_USER) {
+                throw new RuntimeException("消息发送过于频繁,请稍后再试");
+            }
+        }
+        return message;
+    }
+
+    // 速率计数器
+    private static class RateCounter {
+        private final AtomicInteger count = new AtomicInteger(0);
+        private long lastResetTime = System.currentTimeMillis();
+
+        public synchronized int incrementAndCheck() {
+            // 每秒重置计数器
+            long currentTime = System.currentTimeMillis();
+            if (currentTime - lastResetTime > 1000) {
+                count.set(0);
+                lastResetTime = currentTime;
+            }
+            return count.incrementAndGet();
+        }
+    }
+}

+ 44 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/ScheduledPushService.java

@@ -0,0 +1,44 @@
+package com.gyee.alarm.stomp;
+
+import com.gyee.alarm.model.vo.AlarmTag;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+/**
+ * 定时推送服务
+ */
+@Service
+public class ScheduledPushService {
+
+    @Autowired
+    private MessagePushService pushService;
+
+    /**
+     * 每分钟发送一次系统时间广播
+     */
+    @Scheduled(fixedRate = 1000)
+    public void pushSystemTime() {
+        String time = LocalDateTime.now().format(
+                DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
+        );
+        ChatMessage message= new ChatMessage(ChatMessage.MessageType.LEAVE,
+                "test1" + " 测试", "test2",null, LocalDateTime.now());
+        pushService.pushToUser("test1",message);
+    }
+
+    /**
+     * 每小时发送一次活跃用户统计
+     */
+//   @Scheduled(cron = "0 0 * * * *")
+    @Scheduled(fixedRate = 1000)
+    public void pushUserStats() {
+        ChatMessage message= new ChatMessage(ChatMessage.MessageType.LEAVE,
+                "test2" + " 离开了聊天室", "test2",null, LocalDateTime.now());
+
+        pushService.broadcastToAll(message);
+    }
+}

+ 36 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/SessionConnectEventListener.java

@@ -0,0 +1,36 @@
+package com.gyee.alarm.stomp;
+
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.ApplicationListener;
+import org.springframework.messaging.simp.stomp.StompHeaderAccessor;
+import org.springframework.stereotype.Component;
+import org.springframework.web.socket.messaging.SessionConnectEvent;
+
+@Component
+public class SessionConnectEventListener implements ApplicationListener<SessionConnectEvent> {
+
+    @Override
+    public void onApplicationEvent(SessionConnectEvent event) {
+        // 处理事件逻辑
+        handleEvent(event);
+    }
+
+    private void handleEvent(SessionConnectEvent event) {
+        // 获取连接信息
+        StompHeaderAccessor accessor = StompHeaderAccessor.wrap(event.getMessage());
+        String sessionId = accessor.getSessionId();
+
+        // 获取自定义头信息
+        String token = accessor.getFirstNativeHeader("token");
+        String username = accessor.getFirstNativeHeader("username");
+
+        if (username == null) {
+            username = "guest_" + System.currentTimeMillis();
+        }
+
+        // 打印连接信息
+        System.out.println("新的 WebSocket 连接: sessionId = " + sessionId + ", username = " + username);
+
+        // 可以在这里添加其他逻辑,比如将连接信息添加到会话管理器中
+    }
+}

+ 44 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/UserInterceptor.java

@@ -0,0 +1,44 @@
+package com.gyee.alarm.stomp;
+
+import org.springframework.messaging.Message;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.simp.stomp.StompHeaderAccessor;
+import org.springframework.messaging.support.ChannelInterceptor;
+import org.springframework.messaging.support.MessageHeaderAccessor;
+
+import org.springframework.stereotype.Component;
+import java.security.Principal;
+import org.springframework.messaging.Message;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.simp.stomp.StompCommand;
+import org.springframework.messaging.simp.stomp.StompHeaderAccessor;
+import java.util.Collections;
+/**
+ * WebSocket 认证拦截器
+ * 从消息头中提取用户信息并设置认证
+ */
+@Component
+public class UserInterceptor implements ChannelInterceptor {
+
+
+
+
+    @Override
+    public Message<?> preSend(Message<?> message, MessageChannel channel) {
+        StompHeaderAccessor accessor = StompHeaderAccessor.wrap(message);
+        if (StompCommand.CONNECT.equals(accessor.getCommand())) {
+            String user = accessor.getFirstNativeHeader("user");
+            if (user != null) {
+                accessor.setUser(new Principal() {
+                    @Override
+                    public String getName() {
+                        return user;
+                    }
+                });
+
+                System.out.println("User authenticated: " + user);
+            }
+        }
+        return message;
+    }
+}

+ 92 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/WebSocketConfig.java

@@ -0,0 +1,92 @@
+package com.gyee.alarm.stomp;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.messaging.converter.MappingJackson2MessageConverter;
+import org.springframework.messaging.converter.MessageConverter;
+import org.springframework.messaging.simp.config.ChannelRegistration;
+import org.springframework.messaging.simp.config.MessageBrokerRegistry;
+import org.springframework.web.socket.WebSocketHandler;
+import org.springframework.web.socket.WebSocketSession;
+import org.springframework.web.socket.config.annotation.*;
+import org.springframework.web.socket.handler.WebSocketHandlerDecorator;
+import org.springframework.web.socket.handler.WebSocketHandlerDecoratorFactory;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * WebSocket 配置类
+ * 启用 STOMP 协议支持,配置消息代理和端点
+ */
+@Configuration
+@EnableWebSocketMessageBroker
+
+public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
+
+    @Resource
+    private RateLimitInterceptor rateLimitInterceptor;
+
+    @Resource
+    private UserInterceptor userInterceptor;
+
+    @Resource
+    private AdminAuthInterceptor adminAuthInterceptor;
+
+
+    /**
+     * 配置客户端入站通道拦截器
+     * @param registration 通道注册器
+     */
+    @Override
+    public void configureClientInboundChannel(ChannelRegistration registration) {
+        // 添加用户认证拦截器
+        registration.interceptors(userInterceptor);
+//        // 添加流量控制拦截器
+//        registration.interceptors(rateLimitInterceptor);
+//        // 添加管理员认证拦截器
+//        registration.interceptors(adminAuthInterceptor);
+
+
+        // 配置线程池和缓冲区大小
+        registration.taskExecutor()
+                .corePoolSize(10)
+                .maxPoolSize(20)
+                .queueCapacity(1000);
+    }
+
+    @Override
+    public void configureClientOutboundChannel(ChannelRegistration registration) {
+        // 配置输出通道
+        registration.taskExecutor().corePoolSize(10);
+    }
+    /**
+     * 注册 STOMP 端点
+     * @param registry STOMP 端点注册器
+     */
+    @Override
+    public void registerStompEndpoints(StompEndpointRegistry registry) {
+        registry.addEndpoint("/ws")
+                .setAllowedOriginPatterns("*")
+                .withSockJS(); // 添加自定义拦截器
+    }
+
+
+
+    /**
+     * 配置消息代理
+     * @param registry 消息代理注册器
+     */
+    @Override
+    public void configureMessageBroker(MessageBrokerRegistry registry) {
+        // 启用内存消息代理,目标前缀为 /topic 和 /queue
+        registry.enableSimpleBroker("/topic", "/queue");
+
+        // 设置应用前缀,客户端发送消息到 /app 开头的地址
+        registry.setApplicationDestinationPrefixes("/app");
+
+        // 设置用户目标前缀,用于点对点消息
+        registry.setUserDestinationPrefix("/user");
+    }
+
+
+}

+ 95 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/WebSocketEventListener.java

@@ -0,0 +1,95 @@
+package com.gyee.alarm.stomp;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.event.EventListener;
+import org.springframework.messaging.simp.SimpMessagingTemplate;
+import org.springframework.messaging.simp.stomp.StompHeaderAccessor;
+import org.springframework.stereotype.Component;
+import org.springframework.web.socket.messaging.SessionConnectEvent;
+import org.springframework.web.socket.messaging.SessionConnectedEvent;
+import org.springframework.web.socket.messaging.SessionDisconnectEvent;
+import org.springframework.web.socket.messaging.SessionSubscribeEvent;
+
+import javax.annotation.Resource;
+
+@Component
+public class WebSocketEventListener {
+    private static final Logger logger = LoggerFactory.getLogger(WebSocketEventListener.class);
+
+    @Resource
+    private WebSocketSessionManager sessionManager;
+
+    @Resource
+    private SimpMessagingTemplate messagingTemplate;
+
+    @EventListener
+    public void handleWebSocketConnectListener(SessionConnectEvent event) {
+        StompHeaderAccessor accessor = StompHeaderAccessor.wrap(event.getMessage());
+        String sessionId = accessor.getSessionId();
+        String token = accessor.getFirstNativeHeader("token");
+        String username = accessor.getFirstNativeHeader("user");
+
+        if (username == null) {
+            username = "guest_" + System.currentTimeMillis();
+        }
+
+        if (!sessionManager.addSession(sessionId, username)) {
+            logger.warn("连接已满,拒绝新连接: {}", username);
+            messagingTemplate.convertAndSendToUser(sessionId, "/queue/errors",
+                    "系统消息: 当前连接数已达上限(" + sessionManager.getMaxConnections() +
+                            "),请稍后再试");
+            return; // 返回而不抛出异常,避免中断连接
+        }
+
+        logger.info("新连接建立: {} (ID: {})", username, sessionId);
+    }
+
+    @EventListener
+    public void handleWebSocketConnectedListener(SessionConnectedEvent event) {
+        StompHeaderAccessor accessor = StompHeaderAccessor.wrap(event.getMessage());
+        String sessionId = accessor.getSessionId();
+        String username = sessionManager.getActiveUsers().get(sessionId);
+
+        if (username != null) {
+            logger.info("用户 {} 连接成功 (ID: {})", username, sessionId);
+            messagingTemplate.convertAndSendToUser(username, "/queue/notifications",
+                    new Notification("系统通知", "欢迎加入聊天室!当前在线人数: ", sessionManager.getConnectionCount()));
+            broadcastOnlineCount();
+        }
+    }
+
+    @EventListener
+    public void handleWebSocketDisconnectListener(SessionDisconnectEvent event) {
+        StompHeaderAccessor accessor = StompHeaderAccessor.wrap(event.getMessage());
+        String sessionId = accessor.getSessionId();
+        String username = sessionManager.getActiveUsers().get(sessionId);
+
+        if (username != null) {
+            sessionManager.removeSession(sessionId);
+            logger.info("用户 {} 断开连接 (ID: {})", username, sessionId);
+            broadcastOnlineCount();
+            messagingTemplate.convertAndSend("/topic/public",
+                    new ChatMessage(ChatMessage.MessageType.LEAVE, username, "离开了聊天室", username,null));
+        }
+    }
+
+    @EventListener
+    public void handleSessionSubscribeEvent(SessionSubscribeEvent event) {
+        StompHeaderAccessor accessor = StompHeaderAccessor.wrap(event.getMessage());
+        String destination = accessor.getDestination();
+        String sessionId = accessor.getSessionId();
+
+        if (destination != null && destination.startsWith("/user")) {
+            String username = sessionManager.getActiveUsers().get(sessionId);
+            if (username != null) {
+                logger.info("用户 {} 订阅了私有频道: {}", username, destination);
+            }
+        }
+    }
+
+    private void broadcastOnlineCount() {
+        int onlineCount = sessionManager.getConnectionCount();
+        messagingTemplate.convertAndSend("/topic/onlineCount", onlineCount);
+    }
+}

+ 126 - 0
alarm-service/src/main/java/com/gyee/alarm/stomp/WebSocketSessionManager.java

@@ -0,0 +1,126 @@
+package com.gyee.alarm.stomp;
+
+import org.springframework.stereotype.Component;
+import org.springframework.web.socket.WebSocketSession;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * WebSocket 会话管理器
+ * 负责监控、统计和控制连接
+ */
+@Component
+public class WebSocketSessionManager {
+    // 当前连接数(原子操作保证线程安全)
+    private final AtomicInteger connectionCount = new AtomicInteger(0);
+    // 最大连接数限制
+    private static final int MAX_CONNECTIONS = 100;
+    // 存储活跃会话 (sessionId -> 用户名)
+    private final Map<String, String> activeSessions = new ConcurrentHashMap<>();
+    // 存储用户与会话的映射 (username -> sessionId)
+    private final Map<String, String> userSessionMap = new ConcurrentHashMap<>();
+
+
+    /**
+     * 检查用户是否在线
+     * @param username 用户名
+     * @return 是否在线
+     */
+    public boolean isUserOnline(String username) {
+        return userSessionMap.containsKey(username);
+    }
+
+    /**
+     * 获取所有在线用户名
+     * @return 在线用户名列表
+     */
+    public List<String> getOnlineUsernames() {
+        return new ArrayList<>(userSessionMap.keySet());
+    }
+
+    /**
+     * 获取用户数统计
+     * @return 用户数统计
+     */
+    public Map<String, Object> getUserStats() {
+
+        Map map=new HashMap();
+
+        map.put("onlineCount", connectionCount.get());
+        map.put("maxConnections", MAX_CONNECTIONS);
+        map.put("onlineUsers", getOnlineUsernames());
+
+        return map;
+    }
+    /**
+     * 添加新会话
+     * @param sessionId 会话ID
+     * @param username 用户名
+     * @return true: 添加成功, false: 已达最大连接数
+     */
+    public synchronized boolean addSession(String sessionId, String username) {
+        if (connectionCount.get() >= MAX_CONNECTIONS) {
+            return false;
+        }
+
+        // 检查用户是否已连接(防止重复登录)
+        if (userSessionMap.containsKey(username)) {
+            removeSession(userSessionMap.get(username));
+        }
+
+        activeSessions.put(sessionId, username);
+        userSessionMap.put(username, sessionId);
+        connectionCount.incrementAndGet();
+        return true;
+    }
+
+    /**
+     * 移除会话
+     * @param sessionId 会话ID
+     */
+    public synchronized void removeSession(String sessionId) {
+        String username = activeSessions.get(sessionId);
+        if (username != null) {
+            activeSessions.remove(sessionId);
+            userSessionMap.remove(username);
+            connectionCount.decrementAndGet();
+        }
+    }
+
+    /**
+     * 获取当前连接数
+     */
+    public int getConnectionCount() {
+        return connectionCount.get();
+    }
+
+    /**
+     * 获取最大连接数限制
+     */
+    public int getMaxConnections() {
+        return MAX_CONNECTIONS;
+    }
+
+    /**
+     * 获取所有活跃用户
+     */
+    public Map<String, String> getActiveUsers() {
+        return new ConcurrentHashMap<>(activeSessions);
+    }
+
+    public Map<String, String> getUserSessionMap() {
+        return new ConcurrentHashMap<>(userSessionMap);
+    }
+
+    /**
+     * 检查会话是否存在
+     */
+    public boolean containsSession(String sessionId) {
+        return activeSessions.containsKey(sessionId);
+    }
+}

+ 0 - 39
alarm-service/src/main/java/com/gyee/alarm/task/thread/SaticScheduleTask.java

@@ -1,39 +0,0 @@
-package com.gyee.alarm.task.thread;
-
-
-import com.gyee.alarm.service.ReloadVoSevice;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.scheduling.annotation.Scheduled;
-
-import javax.annotation.Resource;
-
-/**
- * @ClassName : SaticScheduleTask
- * @Author : xieshengjie
- * @Date: 2021/1/21 19:43
- * @Description : 调度
- */
-@Configuration      //1.主要用于标记配置类,兼备Component的效果。
-@EnableScheduling   // 2.开启定时任务
-public class SaticScheduleTask {
-
-//    @Resource
-//    private ReloadVoSevice reloadVoSevice;
-//
-//    /**
-//     * 重新读取配置信息
-//     */
-//    @Scheduled(cron = "0 0/9 * * * ?")
-//    private void reloadData() {
-//
-//        try {
-//            reloadVoSevice.reload();
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
-//    }
-
-
-}

+ 56 - 0
alarm-service/src/main/java/com/gyee/alarm/task/thread/ScheduledTasks.java

@@ -0,0 +1,56 @@
+package com.gyee.alarm.task.thread;
+
+import com.gyee.alarm.init.CacheContext;
+import com.gyee.alarm.model.vo.AlarmSuperTalbeType;
+import com.gyee.alarm.service.AlarmBtService;
+import com.gyee.alarm.service.AlarmCtService;
+import com.gyee.alarm.service.AlarmInitalService;
+import com.gyee.alarm.service.AlarmWtService;
+import com.gyee.alarm.service.auto.IProEconAlarmRuleService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+@Component
+public class ScheduledTasks {
+
+
+    private Logger logger = LoggerFactory.getLogger(this.getClass());
+    @Resource
+    private AlarmCtService alarmCtService;
+    @Resource
+    private AlarmBtService alarmBtService;
+    @Resource
+    private AlarmWtService alarmWtService;
+    @Resource
+    private AlarmInitalService alarmInitalService;
+    @Resource
+    private IProEconAlarmRuleService proEconAlarmRuleService;
+    // 每15分钟执行一次
+    @Scheduled(fixedRate = 1000*60*15)
+    public void reportCurrentTime() throws Exception {
+
+
+        alarmInitalService.initialAlarm();
+
+//        alarmCtService.createSuperTable();
+//        alarmCtService.initalCtAlarm();
+//        alarmCtService.updateCtAlarm();
+//
+//        alarmWtService.createSuperTable();
+//        alarmWtService.initalWtAlarm();
+//        alarmWtService.updapteWtAlarm();
+//
+//
+//        alarmBtService.createSuperTable();
+//        alarmBtService.initalBtAlarm();
+//        alarmBtService.updateBtAlarm();
+
+
+        logger.info("当前时间: " + System.currentTimeMillis() / 1000);
+    }
+
+}

+ 0 - 30
alarm-service/src/main/java/com/gyee/alarm/websocket/PushParams.java

@@ -1,30 +0,0 @@
-package com.gyee.alarm.websocket;
-
-import lombok.Data;
-
-import java.util.Date;
-
-/**
- * 功能描述:
- *
- * @description: ws推送的参数结构
- * @Date: 2022/12/1
- */
-@Data
-public class PushParams {
-
-    /**
-     * 报警编号:
-     * 类型
-     */
-    private String alarmId;
-
-    /**
-     * 功能描述:
-     * 开始时间
-     */
-    private Date startTime;
-
-
-}
-

+ 0 - 288
alarm-service/src/main/java/com/gyee/alarm/websocket/WebSocket.java

@@ -1,288 +0,0 @@
-package com.gyee.alarm.websocket;
-
-import com.gyee.alarm.util.StringUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.springframework.stereotype.Component;
-import javax.websocket.*;
-import javax.websocket.server.PathParam;
-import javax.websocket.server.ServerEndpoint;
-
-import java.io.IOException;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * 功能描述:
- * WebSocketServer服务端
- * @Date: 2022-12-01 09:41:32
- * @since: 1.0.0
- */
-// @ServerEndpoint 注解是一个类层次的注解,它的功能主要是将目前的类定义成一个websocket服务器端。注解的值将被用于监听用户连接的终端访问URL地址
-// encoders = WebSocketCustomEncoding.class 是为了使用ws自己的推送Object消息对象(sendObject())时进行解码,通过Encoder 自定义规则(转换为JSON字符串)
-@ServerEndpoint(value = "/websocket/{userId}",encoders = WebSocketCustomEncoding.class)
-@Component
-public class WebSocket {
-    private final static Logger logger = LogManager.getLogger(WebSocket.class);
-
-    /**
-     * 静态变量,用来记录当前在线连接数。应该把它设计成线程安全的
-     */
-
-    private static int onlineCount = 0;
-
-    /**
-     * concurrent包的线程安全Map,用来存放每个客户端对应的MyWebSocket对象
-     */
-    public static ConcurrentHashMap<String, WebSocket> webSocketMap = new ConcurrentHashMap<>();
-
-    /***
-     * 功能描述:
-     * concurrent包的线程安全Map,用来存放每个客户端对应的MyWebSocket对象的参数体
-     */
-    public static ConcurrentHashMap<String, PushParams> webSocketParamsMap = new ConcurrentHashMap<>();
-
-    /**
-     * 与某个客户端的连接会话,需要通过它来给客户端发送数据
-     */
-
-    private Session session;
-    private String userId;
-
-
-    /**
-     * 连接建立成功调用的方法
-     * onOpen 和 onClose 方法分别被@OnOpen和@OnClose 所注解。他们定义了当一个新用户连接和断开的时候所调用的方法。
-     */
-    @OnOpen
-    public void onOpen(Session session, @PathParam("userId") String userId) {
-        this.session = session;
-        this.userId = userId;
-        //加入map
-        webSocketMap.put(userId, this);
-        addOnlineCount();           //在线数加1
-        logger.info("用户{}连接成功,当前在线人数为{}", userId, getOnlineCount());
-        try {
-            sendMessage(String.valueOf(this.session.getQueryString()));
-        } catch (IOException | EncodeException e) {
-            logger.error("IO异常");
-        }
-    }
-
-
-    /**
-     * 连接关闭调用的方法
-     */
-    @OnClose
-    public void onClose() {
-        //从map中删除
-        webSocketMap.remove(userId);
-        subOnlineCount();           //在线数减1
-        logger.info("用户{}关闭连接!当前在线人数为{}", userId, getOnlineCount());
-    }
-
-    /**
-     * 收到客户端消息后调用的方法
-     * onMessage 方法被@OnMessage所注解。这个注解定义了当服务器接收到客户端发送的消息时所调用的方法。
-     * @param message 客户端发送过来的消息
-     */
-    @OnMessage
-    public synchronized  void onMessage(String message, Session session) throws IOException, EncodeException {
-        logger.info("来自客户端用户:{} 消息:{}",userId, message);
-
-
-        if(StringUtils.notEmp(session))
-        {
-
-            synchronized (session){
-                if(session.isOpen() && message.equals("HeartBeat"))
-                {
-                    session.getBasicRemote().sendText("ok");
-                }
-            }
-
-        }
-        //群发消息
-        /*for (String item : webSocketMap.keySet()) {
-            try {
-                webSocketMap.get(item).sendMessage(message);
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }*/
-    }
-
-    /**
-     * 发生错误时调用
-     *
-     * @OnError
-     */
-    @OnError
-    public void onError(Session session, Throwable error)   {
-
-        error.printStackTrace();
-
-
-
-    }
-
-    /**
-     * 向客户端发送消息
-     */
-    public void sendMessage(String message) throws IOException, EncodeException {
-//        this.session.getBasicRemote().sendText(message);
-
-        if(StringUtils.notEmp(session))
-        {
-
-            synchronized (session){
-                if(session.isOpen())
-                {
-                    session.getBasicRemote().sendText(message);
-                }
-            }
-
-        }
-        //this.session.getAsyncRemote().sendText(message);
-    }
-
-    /**
-     * 向客户端发送消息
-     */
-    public  void sendMessage(Object message) throws IOException, EncodeException {
-
-        try {
-            if(StringUtils.notEmp(session) && session.isOpen())
-            {
-
-                synchronized (session){
-
-                    session.getBasicRemote().sendObject(message);
-                }
-
-            }
-        }catch (Exception e)
-        {
-            logger.error("原因:" +getStackMsg(e));
-//            try {
-//                if(StringUtils.notEmp(session) )
-//                {
-//                    if( session.isOpen())
-//                    {
-//                        session.close();
-//                        logger.info( "关闭session:" );
-//                    }else
-//                    {
-//                        logger.info( "session:已经关闭" );
-//                    }
-//                }else
-//                {
-//                    logger.info( "session:null" );
-//                }
-//            }catch (IOException io)
-//            {
-//                logger.error("原因:" +getStackMsg(io));
-//            }
-//            logger.error("原因:" + getStackMsg(e));
-//
-//            if(StringUtils.notEmp(userId) && webSocketMap.containsKey(userId))
-//            {
-//                webSocketMap.remove(userId);
-//                subOnlineCount();           //在线数减1
-//                logger.info("用户{}关闭连接!当前在线人数为{}", userId, getOnlineCount());
-//            }
-
-
-        }
-
-
-        //this.session.getAsyncRemote().sendText(message);
-    }
-
-    private static String getStackMsg(Exception e) {
-
-        StringBuffer sb = new StringBuffer();
-        StackTraceElement[] stackArray = e.getStackTrace();
-        for (int i = 0; i < stackArray.length; i++) {
-            StackTraceElement element = stackArray[i];
-            sb.append(element.toString() + "\n");
-        }
-        return sb.toString();
-    }
-
-    private static String getStackMsg(Throwable e) {
-
-        StringBuffer sb = new StringBuffer();
-        StackTraceElement[] stackArray = e.getStackTrace();
-        for (int i = 0; i < stackArray.length; i++) {
-            StackTraceElement element = stackArray[i];
-            sb.append(element.toString() + "\n");
-        }
-        return sb.toString();
-    }
-
-    /**
-     * 通过userId向客户端发送消息
-     */
-    public void sendMessageByUserId(String userId, String message) throws IOException, EncodeException {
-        logger.info("服务端发送消息到{},消息:{}",userId,message);
-
-        if(StringUtils.isNotBlank(userId)&&webSocketMap.containsKey(userId)){
-
-            synchronized ( webSocketMap.get(userId)) {
-                webSocketMap.get(userId).sendMessage(message);
-
-            }
-
-        }else{
-            logger.error("用户{}不在线",userId);
-        }
-
-    }
-
-    /**
-     * 通过userId向客户端发送消息
-     */
-    public synchronized  void sendMessageByUserId(String userId, Object message) throws IOException, EncodeException {
-        logger.info("服务端发送消息到{},消息:{}",userId,message);
-        if(StringUtils.isNotBlank(userId)&&webSocketMap.containsKey(userId)){
-            webSocketMap.get(userId).sendMessage(message);
-        }else{
-            logger.error("用户{}不在线",userId);
-        }
-    }
-
-    /**
-     * 通过userId更新缓存的参数
-     */
-    public void changeParamsByUserId(String userId, PushParams pushParams) throws IOException, EncodeException {
-        logger.info("ws用户{}请求参数更新,参数:{}",userId,pushParams.toString());
-        webSocketParamsMap.put(userId,pushParams);
-    }
-
-    /**
-     * 群发自定义消息
-     */
-    public static void sendInfo(String message) throws IOException {
-        for (String item : webSocketMap.keySet()) {
-            try {
-                webSocketMap.get(item).sendMessage(message);
-            } catch (IOException | EncodeException e) {
-                continue;
-            }
-        }
-    }
-
-    public static synchronized int getOnlineCount() {
-        return onlineCount;
-    }
-
-    public static synchronized void addOnlineCount() {
-        WebSocket.onlineCount++;
-    }
-
-    public static synchronized void subOnlineCount() {
-        WebSocket.onlineCount--;
-    }
-
-
-}

+ 0 - 191
alarm-service/src/main/java/com/gyee/alarm/websocket/WebSocketBt.java

@@ -1,191 +0,0 @@
-//package com.gyee.alarm.websocket;
-//
-//import org.apache.commons.lang.StringUtils;
-//import org.apache.logging.log4j.LogManager;
-//import org.apache.logging.log4j.Logger;
-//import org.springframework.stereotype.Component;
-//
-//import javax.websocket.*;
-//import javax.websocket.server.PathParam;
-//import javax.websocket.server.ServerEndpoint;
-//import java.io.IOException;
-//import java.util.List;
-//import java.util.concurrent.ConcurrentHashMap;
-//
-///**
-// * 功能描述:
-// * WebSocketServer服务端
-// * @Date: 2022-12-01 09:41:32
-// * @since: 1.0.0
-// */
-//// @ServerEndpoint 注解是一个类层次的注解,它的功能主要是将目前的类定义成一个websocket服务器端。注解的值将被用于监听用户连接的终端访问URL地址
-//// encoders = WebSocketCustomEncoding.class 是为了使用ws自己的推送Object消息对象(sendObject())时进行解码,通过Encoder 自定义规则(转换为JSON字符串)
-//@ServerEndpoint(value = "/websocketBt/{userId}",encoders = WebSocketCustomEncoding.class)
-//@Component
-//public class WebSocketBt {
-//    private final static Logger logger = LogManager.getLogger(WebSocketBt.class);
-//
-//    /**
-//     * 静态变量,用来记录当前在线连接数。应该把它设计成线程安全的
-//     */
-//
-//    private static int onlineCount = 0;
-//
-//    /**
-//     * concurrent包的线程安全Map,用来存放每个客户端对应的MyWebSocket对象
-//     */
-//    public static ConcurrentHashMap<String, WebSocketBt> webSocketBtMap = new ConcurrentHashMap<>();
-//
-//    /***
-//     * 功能描述:
-//     * concurrent包的线程安全Map,用来存放每个客户端对应的MyWebSocket对象的参数体
-//     */
-//    public static ConcurrentHashMap<String, PushParams> webSocketParamsBtMap = new ConcurrentHashMap<>();
-//
-//    public static ConcurrentHashMap<String, List<String>> btParamsMap = new ConcurrentHashMap<>();
-//    /**
-//     * 与某个客户端的连接会话,需要通过它来给客户端发送数据
-//     */
-//
-//    private Session session;
-//    private String userId;
-//
-//
-//    /**
-//     * 连接建立成功调用的方法
-//     * onOpen 和 onClose 方法分别被@OnOpen和@OnClose 所注解。他们定义了当一个新用户连接和断开的时候所调用的方法。
-//     */
-//    @OnOpen
-//    public void onOpen(Session session, @PathParam("userId") String userId) {
-//        this.session = session;
-//        this.userId = userId;
-//        //加入map
-//        webSocketBtMap.put(userId, this);
-//        addOnlineCount();           //在线数加1
-//        logger.info("Bt用户{}连接成功,当前在线人数为{}", userId, getOnlineCount());
-//        try {
-//            sendMessage(String.valueOf(this.session.getQueryString()));
-//        } catch (IOException e) {
-//            logger.error("BtIO异常");
-//        }
-//    }
-//
-//
-//    /**
-//     * 连接关闭调用的方法
-//     */
-//    @OnClose
-//    public void onClose() {
-//        //从map中删除
-//        webSocketBtMap.remove(userId);
-//        subOnlineCount();           //在线数减1
-//        logger.info("Bt用户{}关闭连接!当前在线人数为{}", userId, getOnlineCount());
-//    }
-//
-//    /**
-//     * 收到客户端消息后调用的方法
-//     * onMessage 方法被@OnMessage所注解。这个注解定义了当服务器接收到客户端发送的消息时所调用的方法。
-//     * @param message 客户端发送过来的消息
-//     */
-//    @OnMessage
-//    public void onMessage(String message, Session session) throws IOException {
-//        logger.info("Bt来自客户端用户:{} 消息:{}",userId, message);
-//
-//        sendMessageByUserId(userId,"ok");
-//        //群发消息
-//        /*for (String item : webSocketBtMap.keySet()) {
-//            try {
-//                webSocketBtMap.get(item).sendMessage(message);
-//            } catch (IOException e) {
-//                e.printStackTrace();
-//            }
-//        }*/
-//    }
-//
-//    /**
-//     * 发生错误时调用
-//     *
-//     * @OnError
-//     */
-//    @OnError
-//    public void onError(Session session, Throwable error) {
-//        logger.error("Bt用户错误:" + this.userId + ",原因:" + error.getMessage());
-//        error.printStackTrace();
-//    }
-//
-//    /**
-//     * 向客户端发送消息
-//     */
-//    public void sendMessage(String message) throws IOException {
-//        this.session.getBasicRemote().sendText(message);
-//        //this.session.getAsyncRemote().sendText(message);
-//    }
-//
-//    /**
-//     * 向客户端发送消息
-//     */
-//    public void sendMessage(Object message) throws IOException, EncodeException {
-//        this.session.getBasicRemote().sendObject(message);
-//        //this.session.getAsyncRemote().sendText(message);
-//    }
-//
-//    /**
-//     * 通过userId向客户端发送消息
-//     */
-//    public void sendMessageByUserId(String userId, String message) throws IOException {
-//        logger.info("Bt服务端发送消息到{},消息:{}",userId,message);
-//
-//        if(StringUtils.isNotBlank(userId)&&webSocketBtMap.containsKey(userId)){
-//            webSocketBtMap.get(userId).sendMessage(message);
-//        }else{
-//            logger.error("Bt用户{}不在线",userId);
-//        }
-//
-//    }
-//
-//    /**
-//     * 通过userId向客户端发送消息
-//     */
-//    public synchronized void sendMessageByUserId(String userId, Object message) throws IOException, EncodeException {
-//        logger.info("Bt服务端发送消息到{},消息:{}",userId,message);
-//        if(StringUtils.isNotBlank(userId)&&webSocketBtMap.containsKey(userId)){
-//            webSocketBtMap.get(userId).sendMessage(message);
-//        }else{
-//            logger.error("Bt用户{}不在线",userId);
-//        }
-//    }
-//
-//    /**
-//     * 通过userId更新缓存的参数
-//     */
-//    public void changeParamsByUserId(String userId, PushParams pushParams) throws IOException, EncodeException {
-//        logger.info("wsBt用户{}请求参数更新,参数:{}",userId,pushParams.toString());
-//        webSocketParamsBtMap.put(userId,pushParams);
-//    }
-//
-//    /**
-//     * 群发自定义消息
-//     */
-//    public static void sendInfo(String message) throws IOException {
-//        for (String item : webSocketBtMap.keySet()) {
-//            try {
-//                webSocketBtMap.get(item).sendMessage(message);
-//            } catch (IOException e) {
-//                continue;
-//            }
-//        }
-//    }
-//
-//    public static synchronized int getOnlineCount() {
-//        return onlineCount;
-//    }
-//
-//    public static synchronized void addOnlineCount() {
-//        WebSocketBt.onlineCount++;
-//    }
-//
-//    public static synchronized void subOnlineCount() {
-//        WebSocketBt.onlineCount--;
-//    }
-//
-//}

+ 0 - 21
alarm-service/src/main/java/com/gyee/alarm/websocket/WebSocketConfig.java

@@ -1,21 +0,0 @@
-package com.gyee.alarm.websocket;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.socket.server.standard.ServerEndpointExporter;
-
-/**
- * 功能描述:
- * 开启websocket支持
- * @Date: 2022-12-01 09:40:15
- * @since: 1.0.0
- */
-@Configuration
-public class WebSocketConfig {
-
-    // 使用boot内置tomcat时需要注入此bean
-    @Bean
-    public ServerEndpointExporter serverEndpointExporter() {
-        return new ServerEndpointExporter();
-    }
-}

+ 0 - 38
alarm-service/src/main/java/com/gyee/alarm/websocket/WebSocketCustomEncoding.java

@@ -1,38 +0,0 @@
-package com.gyee.alarm.websocket;
-
-import com.alibaba.fastjson.JSON;
-import javax.websocket.EncodeException;
-import javax.websocket.Encoder;
-import javax.websocket.EndpointConfig;
-
-/**
- * 在 websocket 中直接发送 obj 会有问题 - No encoder specified for object of class
- * 需要对 obj 创建解码类,实现 websocket 中的 Encoder.Text<>
- * */
-public class WebSocketCustomEncoding implements Encoder.Text<Object> {
-    /**
-     * The Encoder interface defines how developers can provide a way to convert their
-     * custom objects into web socket messages. The Encoder interface contains
-     * subinterfaces that allow encoding algorithms to encode custom objects to:
-     * text, binary data, character stream and write to an output stream.
-     *
-     * Encoder 接口定义了如何提供一种方法将定制对象转换为 websocket 消息
-     * 可自定义对象编码为文本、二进制数据、字符流、写入输出流
-     *  Text、TextStream、Binary、BinaryStream
-     * */
-
-    @Override
-    public void init(EndpointConfig endpointConfig) {
-
-    }
-
-    @Override
-    public void destroy() {
-
-    }
-
-    @Override
-    public String encode(Object o) throws EncodeException {
-        return JSON.toJSONString(o);
-    }
-}

+ 8 - 8
alarm-service/src/main/resources/application-db.yml

@@ -10,8 +10,8 @@ spring:
     allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
   #redis集群
   redis:
-    #host: 127.0.0.1
-    host: 172.16.12.103
+    host: 127.0.0.1
+    #host: 172.16.12.103
     port: 6379
     timeout: 100000
     #    集群环境打开下面注释,单机不需要打开
@@ -20,7 +20,7 @@ spring:
     #      nodes: 10.83.68.151:6379,10.83.68.152:6379,10.83.68.153:6379,10.83.68.154:6379,10.83.68.155:6379,10.83.68.156:6379,10.83.68.157:6379,10.83.68.158:6379,10.83.68.159:6379
     #      #默认值是5 一般当此值设置过大时,容易报:Too many Cluster redirections
     #      maxRedirects: 3
-    password: GYee@#56
+    password:
     application:
       name: test
     jedis:
@@ -29,7 +29,7 @@ spring:
         min-idle: 0
         max-idle: 8
         max-wait: -1
-    database: 10
+    database: 0
   autoconfigure:
     exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
   datasource:
@@ -40,13 +40,13 @@ spring:
       strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
       datasource:
         master:
-          url: jdbc:postgresql://172.16.12.102:5432/power_lcm
+          url: jdbc:postgresql://127.0.0.1:5432/IMS_NEM_JN
           username: postgres
-          password: GYee@#56
+          password: 123456
           driver-class-name: org.postgresql.Driver
         slave:
           driver-class-name: com.taosdata.jdbc.TSDBDriver
-          url: jdbc:TAOS://172.16.12.101:6030/jsfw_db?charset=UTF-8&locale=en_US.UTF-8&timezone=UTC-8
+          url: jdbc:TAOS://192.168.31.253:6030/alarm?charset=UTF-8&locale=en_US.UTF-8&timezone=UTC-8
           username: root
           password: taosdata
         #配置初始化连接数大小
@@ -140,7 +140,7 @@ db:
   url2: http://172.16.12.103:8011/ts
 
 #参与计算的场站
-runWindpowerstation: GJNY_SXGS_JSL_FDC_STA,GJNY_SXGS_CSL_FDC_STA,GJNY_SXGS_LJS_FDC_STA,GJNY_SXGS_ZZ_FDC_STA,GJNY_SXGS_XZ_FDC_STA,GJNY_SXGS_FSG_FDC_STA
+runWindpowerstation: SXJ_KGDL_TZ_GDC_STA
 #计算状态用ai或者di
 clauStatus:
   ai: GJY03_GC,YLZ01_GC,PTZ02_GC   #配置期次

+ 2 - 0
alarm-web/src/main/java/com/gyee/alarm/AlarmWeb.java

@@ -6,11 +6,13 @@ import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.core.env.Environment;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
 import java.net.InetAddress;
 
 @Log4j2
 @SpringBootApplication
+@EnableScheduling
 @MapperScan("com.gyee.alarm.mapper")
 public class AlarmWeb {
     public static void main(String[] args) throws Exception {

+ 173 - 169
alarm-web/src/main/java/com/gyee/alarm/init/CacheContext.java

@@ -7,10 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.alarm.model.vo.AlarmCustomType;
 import com.gyee.alarm.model.vo.AlarmTypeValue;
 import com.gyee.alarm.model.vo.AlarmVo;
-import com.gyee.alarm.service.AlarmBtService;
-import com.gyee.alarm.service.AlarmCtService;
-import com.gyee.alarm.service.AlarmInService;
-import com.gyee.alarm.service.AlarmWtService;
+import com.gyee.alarm.service.*;
 import com.gyee.common.model.StringUtils;
 import com.gyee.alarm.model.auto.*;
 import com.gyee.alarm.service.auto.*;
@@ -104,6 +101,10 @@ public class CacheContext implements CommandLineRunner {
     @Resource
     private IProEconAlarmTypeService proEconAlarmTypeService;
 
+
+    @Resource
+    private AlarmInitalService alarmInitalService;
+
     public static List<ProEconAlarmSwitch> asls = new ArrayList<>();
     public static Map<String, Map<String, ProBasicPowerstationPoint>> weatherwppointmap = new HashMap<>();
     public static List<ProBasicWeatherStation> weawpls = new ArrayList<>();
@@ -201,7 +202,7 @@ public class CacheContext implements CommandLineRunner {
 
     public static List<AlarmVo> alarmWtList = new ArrayList<>();
     public static Map<String, AlarmVo> alarmWtMap = new HashMap<>();
-
+    public static Map<String,List<AlarmVo>> alarmWpMap=new HashMap<>();
     public static List<AlarmVo> alarmBtList = new ArrayList<>();
     public static Map<String, AlarmVo> alarmBtMap = new HashMap<>();
 
@@ -666,173 +667,176 @@ public class CacheContext implements CommandLineRunner {
 //
 //            }
 //        }
-
-        List<ProEconAlarmRule> customls = proEconAlarmRuleService.list();
-
-        if (!customls.isEmpty()) {
-            customls = customls.stream().filter(i -> null != i.getEnable() && i.getEnable()).collect(Collectors.toList());
-        }
-        List<ProEconAlarmRule> wtCustomls = new ArrayList<>();
-        List<ProEconAlarmRule> btCustomls = new ArrayList<>();
-//        List<ProEconAlarmRule> btCustomls=new ArrayList<>();
-        if (!customls.isEmpty()) {
-            for (ProEconAlarmRule vo : customls) {
-
-                ctAlarmMap.put(vo.getId(),vo);
-                StringBuilder sb = new StringBuilder();
-                sb.append(vo.getStationId()).append(vo.getModelId());
-                if (StringUtils.notEmp(vo.getCategory())) {
-
-
-                    if (vo.getCategory().equals(AlarmCustomType.WT.getCode())) {
-                        if (ctAlarmlsMap.containsKey(String.valueOf(sb))) {
-                            List<ProEconAlarmRule> ls = ctAlarmlsMap.get(String.valueOf(sb));
-                            ls.add(vo);
-                            ctAlarmlsMap.put(String.valueOf(sb), ls);
-                        } else {
-                            List<ProEconAlarmRule> ls = new ArrayList<>();
-                            ls.add(vo);
-                            ctAlarmlsMap.put(String.valueOf(sb), ls);
-                        }
-                        wtCustomls.add(vo);
-                    }
-                    if (vo.getCategory().equals(AlarmCustomType.IN.getCode())) {
-                        if (ctAlarmlsMap.containsKey(String.valueOf(sb))) {
-                            List<ProEconAlarmRule> ls = ctAlarmlsMap.get(String.valueOf(sb));
-                            ls.add(vo);
-                        } else {
-                            List<ProEconAlarmRule> ls = new ArrayList<>();
-                            ls.add(vo);
-                            ctAlarmlsMap.put(String.valueOf(sb), ls);
-                        }
-                        wtCustomls.add(vo);
-                    } else if (vo.getCategory().equals(AlarmCustomType.BT.getCode())) {
-                        btCustomls.add(vo);
-                    }
-                }
-            }
-        }
-        alarmRulesMap.put(AlarmCustomType.WT.getCode(), wtCustomls);
-        alarmRulesMap.put(AlarmCustomType.BT.getCode(), btCustomls);
-
-
-        List<ProEconAlarmConfiguration> templs = proEconAlarmConfigurationService.list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
-        if (!templs.isEmpty()) {
-            for (ProEconAlarmConfiguration alarm : templs) {
-
-                alarmMap.put(alarm.getId(), alarm);
-                if (alarm.getAlarmType().equals(AlarmTypeValue.WT.getCode())) {
-                    wtalarmls.add(alarm);
-                    alarmMap.put(alarm.getId(), alarm);
-                    StringBuilder sb = new StringBuilder();
-                    sb.append(alarm.getStationId()).append(alarm.getModelId());
-
-                    if (wtAlarmMap.containsKey(String.valueOf(sb))) {
-                        List<ProEconAlarmConfiguration> ls = wtAlarmMap.get(String.valueOf(sb));
-                        ls.add(alarm);
-                    } else {
-                        List<ProEconAlarmConfiguration> ls = new ArrayList<>();
-                        ls.add(alarm);
-                        wtAlarmMap.put(String.valueOf(sb), ls);
-                    }
-                }else if (alarm.getAlarmType().equals(AlarmTypeValue.IN.getCode())) {
-                    inalarmls.add(alarm);
-
-                    StringBuilder sb = new StringBuilder();
-                    sb.append(alarm.getStationId()).append(alarm.getModelId());
-
-                    if (inAlarmMap.containsKey(String.valueOf(sb))) {
-                        List<ProEconAlarmConfiguration> ls = inAlarmMap.get(String.valueOf(sb));
-                        ls.add(alarm);
-                    } else {
-                        List<ProEconAlarmConfiguration> ls = new ArrayList<>();
-                        ls.add(alarm);
-                        inAlarmMap.put(String.valueOf(sb), ls);
-                    }
-                } else if (alarm.getAlarmType().equals(AlarmTypeValue.BT.getCode())) {
-                    btalarmls.add(alarm);
-
-                }
-            }
-        }
-        wtls.forEach(wt -> {
-            if (wpByEmMap.containsKey(wt.getWindpowerstationId())) {
-                Set<ProEconEquipmentmodel> set = wpByEmMap.get(wt.getWindpowerstationId());
-                if (modelMap.containsKey(wt.getModelId())) {
-                    ProEconEquipmentmodel model = modelMap.get(wt.getModelId());
-                    set.add(model);
-                }
-
-            } else {
-                Set<ProEconEquipmentmodel> set = new HashSet<>();
-                if (modelMap.containsKey(wt.getModelId())) {
-                    ProEconEquipmentmodel model = modelMap.get(wt.getModelId());
-                    set.add(model);
-                }
-                wpByEmMap.put(wt.getWindpowerstationId(), set);
-            }
-
-        });
-        weawpls = proBasicWeatherStationService.list().stream().filter(i -> i.getIsAble() == 1).collect(Collectors.toList());
-        weawpls.stream().forEach(weather -> {
-
-            String subString = redisService.get(weather.getId());
-            Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(subString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
-            });
-            weatherwppointmap.put(weather.getId(), stringWindpowerstationpointnewMap);
-
-
-        });
-
-        alarmTypeList = proEconAlarmTypeService.list();
-
-        if (!alarmTypeList.isEmpty()) {
-            for (ProEconAlarmType at : alarmTypeList) {
-                alarmTypeMap.put(at.getNemCode(), at);
-            }
-        }
-
-        //风机报警初始化标签
-        alarmWtList=alarmWtService.initalAlarmVo();
-        if(!alarmWtList.isEmpty())
-        {
-            for(AlarmVo vo: alarmWtList)
-            {
-                alarmWtMap.put(vo.getTbName().toUpperCase(),vo);
-            }
-        }
-        //逆变器报警初始化标签
-        alarmInList=alarmInService.initalAlarmVo();
-        if(!alarmInList.isEmpty())
-        {
-            for(AlarmVo vo: alarmInList)
-            {
-                alarmInMap.put(vo.getTbName().toUpperCase(),vo);
-            }
-        }
-
-
-        //升压站报警初始化标签
-        alarmBtList=alarmBtService.initalAlarmVo();
-        if(!alarmBtList.isEmpty())
-        {
-            for(AlarmVo vo: alarmBtList)
-            {
-                alarmBtMap.put(vo.getTbName().toUpperCase(),vo);
-            }
-        }
-        //自定义报警初始化标签
-        alarmCtList=alarmCtService.initalAlarmVo();
-        if(!alarmCtList.isEmpty())
-        {
-            for(AlarmVo vo: alarmCtList)
-            {
-                alarmCtMap.put(vo.getTbName().toUpperCase(),vo);
-            }
-        }
+//
+//        List<ProEconAlarmRule> customls = proEconAlarmRuleService.list();
+//
+//        if (!customls.isEmpty()) {
+//            customls = customls.stream().filter(i -> null != i.getEnable() && i.getEnable()).collect(Collectors.toList());
+//        }
+//        List<ProEconAlarmRule> wtCustomls = new ArrayList<>();
+//        List<ProEconAlarmRule> btCustomls = new ArrayList<>();
+////        List<ProEconAlarmRule> btCustomls=new ArrayList<>();
+//        if (!customls.isEmpty()) {
+//            for (ProEconAlarmRule vo : customls) {
+//
+//                ctAlarmMap.put(vo.getId(),vo);
+//                StringBuilder sb = new StringBuilder();
+//                sb.append(vo.getStationId()).append(vo.getModelId());
+//                if (StringUtils.notEmp(vo.getCategory())) {
+//
+//
+//                    if (vo.getCategory().equals(AlarmCustomType.WT.getCode())) {
+//                        if (ctAlarmlsMap.containsKey(String.valueOf(sb))) {
+//                            List<ProEconAlarmRule> ls = ctAlarmlsMap.get(String.valueOf(sb));
+//                            ls.add(vo);
+//                            ctAlarmlsMap.put(String.valueOf(sb), ls);
+//                        } else {
+//                            List<ProEconAlarmRule> ls = new ArrayList<>();
+//                            ls.add(vo);
+//                            ctAlarmlsMap.put(String.valueOf(sb), ls);
+//                        }
+//                        wtCustomls.add(vo);
+//                    }
+//                    if (vo.getCategory().equals(AlarmCustomType.IN.getCode())) {
+//                        if (ctAlarmlsMap.containsKey(String.valueOf(sb))) {
+//                            List<ProEconAlarmRule> ls = ctAlarmlsMap.get(String.valueOf(sb));
+//                            ls.add(vo);
+//                        } else {
+//                            List<ProEconAlarmRule> ls = new ArrayList<>();
+//                            ls.add(vo);
+//                            ctAlarmlsMap.put(String.valueOf(sb), ls);
+//                        }
+//                        wtCustomls.add(vo);
+//                    } else if (vo.getCategory().equals(AlarmCustomType.BT.getCode())) {
+//                        btCustomls.add(vo);
+//                    }
+//                }
+//            }
+//        }
+//        alarmRulesMap.put(AlarmCustomType.WT.getCode(), wtCustomls);
+//        alarmRulesMap.put(AlarmCustomType.BT.getCode(), btCustomls);
+//
+//
+//        List<ProEconAlarmConfiguration> templs = proEconAlarmConfigurationService.list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
+//        if (!templs.isEmpty()) {
+//            for (ProEconAlarmConfiguration alarm : templs) {
+//
+//                alarmMap.put(alarm.getId(), alarm);
+//                if (alarm.getAlarmType().equals(AlarmTypeValue.WT.getCode())) {
+//                    wtalarmls.add(alarm);
+//                    alarmMap.put(alarm.getId(), alarm);
+//                    StringBuilder sb = new StringBuilder();
+//                    sb.append(alarm.getStationId()).append(alarm.getModelId());
+//
+//                    if (wtAlarmMap.containsKey(String.valueOf(sb))) {
+//                        List<ProEconAlarmConfiguration> ls = wtAlarmMap.get(String.valueOf(sb));
+//                        ls.add(alarm);
+//                    } else {
+//                        List<ProEconAlarmConfiguration> ls = new ArrayList<>();
+//                        ls.add(alarm);
+//                        wtAlarmMap.put(String.valueOf(sb), ls);
+//                    }
+//                }else if (alarm.getAlarmType().equals(AlarmTypeValue.IN.getCode())) {
+//                    inalarmls.add(alarm);
+//
+//                    StringBuilder sb = new StringBuilder();
+//                    sb.append(alarm.getStationId()).append(alarm.getModelId());
+//
+//                    if (inAlarmMap.containsKey(String.valueOf(sb))) {
+//                        List<ProEconAlarmConfiguration> ls = inAlarmMap.get(String.valueOf(sb));
+//                        ls.add(alarm);
+//                    } else {
+//                        List<ProEconAlarmConfiguration> ls = new ArrayList<>();
+//                        ls.add(alarm);
+//                        inAlarmMap.put(String.valueOf(sb), ls);
+//                    }
+//                } else if (alarm.getAlarmType().equals(AlarmTypeValue.BT.getCode())) {
+//                    btalarmls.add(alarm);
+//
+//                }
+//            }
+//        }
+//        wtls.forEach(wt -> {
+//            if (wpByEmMap.containsKey(wt.getWindpowerstationId())) {
+//                Set<ProEconEquipmentmodel> set = wpByEmMap.get(wt.getWindpowerstationId());
+//                if (modelMap.containsKey(wt.getModelId())) {
+//                    ProEconEquipmentmodel model = modelMap.get(wt.getModelId());
+//                    set.add(model);
+//                }
+//
+//            } else {
+//                Set<ProEconEquipmentmodel> set = new HashSet<>();
+//                if (modelMap.containsKey(wt.getModelId())) {
+//                    ProEconEquipmentmodel model = modelMap.get(wt.getModelId());
+//                    set.add(model);
+//                }
+//                wpByEmMap.put(wt.getWindpowerstationId(), set);
+//            }
+//
+//        });
+//        weawpls = proBasicWeatherStationService.list().stream().filter(i -> i.getIsAble() == 1).collect(Collectors.toList());
+//        weawpls.stream().forEach(weather -> {
+//
+//            String subString = redisService.get(weather.getId());
+//            Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(subString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
+//            });
+//            weatherwppointmap.put(weather.getId(), stringWindpowerstationpointnewMap);
+//
+//
+//        });
+//
+//        alarmTypeList = proEconAlarmTypeService.list();
+//
+//        if (!alarmTypeList.isEmpty()) {
+//            for (ProEconAlarmType at : alarmTypeList) {
+//                alarmTypeMap.put(at.getNemCode(), at);
+//            }
+//        }
+//
+//        //风机报警初始化标签
+//        alarmWtList=alarmWtService.initalAlarmVo();
+//        if(!alarmWtList.isEmpty())
+//        {
+//            for(AlarmVo vo: alarmWtList)
+//            {
+//                alarmWtMap.put(vo.getTbName().toUpperCase(),vo);
+//            }
+//        }
+//        //逆变器报警初始化标签
+//        alarmInList=alarmInService.initalAlarmVo();
+//        if(!alarmInList.isEmpty())
+//        {
+//            for(AlarmVo vo: alarmInList)
+//            {
+//                alarmInMap.put(vo.getTbName().toUpperCase(),vo);
+//            }
+//        }
+//
+//
+//        //升压站报警初始化标签
+//        alarmBtList=alarmBtService.initalAlarmVo();
+//        if(!alarmBtList.isEmpty())
+//        {
+//            for(AlarmVo vo: alarmBtList)
+//            {
+//                alarmBtMap.put(vo.getTbName().toUpperCase(),vo);
+//            }
+//        }
+//        //自定义报警初始化标签
+//        alarmCtList=alarmCtService.initalAlarmVo();
+//        if(!alarmCtList.isEmpty())
+//        {
+//            for(AlarmVo vo: alarmCtList)
+//            {
+//                alarmCtMap.put(vo.getTbName().toUpperCase(),vo);
+//            }
+//        }
 //        inputOrOutPutService.initialInputOrOutputSpeed();
 
+        alarmInitalService.initialAlarm();;
 
         logger.info("缓存结束------------------------------------------------------------");
     }
+
+
 }

+ 14 - 7
alarm-web/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper.java

@@ -30,13 +30,20 @@ public interface AlarmTsMapper extends BaseMapper<AlarmTs> {
 
 
 
-    @Update("create table if not exists ${tbName} using ${superTableName} TAGS( " +
-            "#{alarmid}, #{alarmtype}," +
-            "#{characteristic}, #{components},#{description}, #{deviceid}, #{devicename}," +
-            "#{devicetype}, #{enabled}, #{lineid}, #{linename}, #{modelId}, #{projectid}," +
-            "#{projectname}, #{rank}, #{resettable}, #{stationid}, #{stationname}, #{subcomponents}," +
-            "#{suffix},  #{tagid}, #{triggertype}, #{uniformcode},#{name}, #{nemCode}, #{faultCause}, #{resolvent},#{faultType},#{aname} " +
-            " )")
+//    @Update("create table if not exists ${tbName} using ${superTableName} TAGS( " +
+//            "#{alarmid}, #{alarmtype}," +
+//            "#{characteristic}, #{components},#{description}, #{deviceid}, #{devicename}," +
+//            "#{devicetype}, #{enabled}, #{lineid}, #{linename}, #{modelId}, #{projectid}," +
+//            "#{projectname}, #{rank}, #{resettable}, #{stationid}, #{stationname}, #{subcomponents}," +
+//            "#{suffix},  #{tagid}, #{triggertype}, #{uniformcode},#{name}, #{nemCode}, #{faultCause}, #{resolvent},#{faultType},#{aname} " +
+//            " )")
+@Update("create table if not exists ${tbName} using ${superTableName} TAGS( " +
+        "'${alarmid}', '${alarmtype}'," +
+        "'${characteristic}', '${components}','${description}', '${deviceid}', '${devicename}'," +
+        "'${devicetype}', ${enabled}, '${lineid}', '${linename}', '${modelId}', '${projectid}'," +
+        "'${projectname}', ${rank}, ${resettable}, '${stationid}', '${stationname}', '${subcomponents}'," +
+        "'${suffix}',  '${tagid}', ${triggertype}, '${uniformcode}','${name}', '${nemCode}', '${faultCause}', '${resolvent}','${faultType}','${aname}' " +
+        " )")
     int createTable(@Param("tbName") String tbName, @Param("alarmid") String alarmid, @Param("alarmtype") String alarmtype,
                     @Param("characteristic") String characteristic, @Param("components") String components,
                     @Param("description") String description,

+ 201 - 0
alarm-web/src/main/java/com/gyee/alarm/service/AlarmInitalService.java

@@ -0,0 +1,201 @@
+package com.gyee.alarm.service;
+
+import com.gyee.alarm.init.CacheContext;
+import com.gyee.alarm.model.auto.ProEconAlarmConfiguration;
+import com.gyee.alarm.model.auto.ProEconAlarmRule;
+import com.gyee.alarm.model.vo.AlarmCustomType;
+import com.gyee.alarm.model.vo.AlarmTypeValue;
+import com.gyee.alarm.model.vo.AlarmVo;
+import com.gyee.alarm.service.auto.IProEconAlarmConfigurationService;
+import com.gyee.alarm.service.auto.IProEconAlarmRuleService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+@Service
+public class AlarmInitalService {
+    @Resource
+    private IProEconAlarmConfigurationService proEconAlarmConfigurationService;
+    @Resource
+    private AlarmWtService alarmWtService;
+    @Resource
+    private AlarmInService alarmInService;
+    @Resource
+    private IProEconAlarmRuleService proEconAlarmRuleService;
+    @Resource
+    private AlarmBtService alarmBtService;
+
+    @Resource
+    private AlarmCtService alarmCtService;
+
+
+    public void initialAlarm() throws Exception {
+
+
+        List<ProEconAlarmConfiguration> inalarmls = new ArrayList<>();
+        List<ProEconAlarmConfiguration> btalarmls = new ArrayList<>();
+        List<ProEconAlarmConfiguration> wtalarmls = new ArrayList<>();
+
+        List<AlarmVo> alarmCtList = new ArrayList<>();
+        List<AlarmVo> alarmWtList = new ArrayList<>();
+        List<AlarmVo> alarmInList=new ArrayList<>();
+
+
+        List<AlarmVo> alarmBtList = new ArrayList<>();
+        Map<String,AlarmVo> alarmInMap=new HashMap<>();
+        Map<String, AlarmVo> alarmBtMap = new HashMap<>();
+        Map<String, AlarmVo> alarmCtMap = new HashMap<>();
+        Map<String, List<ProEconAlarmRule>> alarmRulesMap = new HashMap<>();
+
+        Map<String, List<ProEconAlarmConfiguration>> wtAlarmMap = new HashMap<>();
+        Map<String,List<AlarmVo>> alarmWpMap=new HashMap<>();
+        Map<String, List<ProEconAlarmConfiguration>> inAlarmMap = new HashMap<>();
+        Map<String, AlarmVo> alarmWtMap = new HashMap<>();
+
+
+        List<ProEconAlarmConfiguration> templs = proEconAlarmConfigurationService.list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
+        if (!templs.isEmpty()) {
+            for (ProEconAlarmConfiguration alarm : templs) {
+                if (alarm.getAlarmType().equals(AlarmTypeValue.WT.getCode())) {
+                    wtalarmls.add(alarm);
+                    StringBuilder sb=new StringBuilder();
+                    sb.append(alarm.getStationId()).append(alarm.getModelId());
+
+                    if(wtAlarmMap.containsKey(String.valueOf(sb)))
+                    {
+                        List<ProEconAlarmConfiguration> ls=wtAlarmMap.get(String.valueOf(sb));
+                        ls.add(alarm);
+                    }else
+                    {
+                        List<ProEconAlarmConfiguration> ls=new ArrayList<>();
+                        ls.add(alarm);
+                        wtAlarmMap.put(String.valueOf(sb),ls);
+                    }
+                } else if (alarm.getAlarmType().equals(AlarmTypeValue.BT.getCode())) {
+                    btalarmls.add(alarm);
+
+                }
+                else if (alarm.getAlarmType().equals(AlarmTypeValue.IN.getCode())) {
+                    inalarmls.add(alarm);
+                    StringBuilder sb=new StringBuilder();
+                    sb.append(alarm.getStationId()).append(alarm.getModelId());
+
+                    if(inAlarmMap.containsKey(String.valueOf(sb)))
+                    {
+                        List<ProEconAlarmConfiguration> ls=inAlarmMap.get(String.valueOf(sb));
+                        ls.add(alarm);
+                    }else
+                    {
+                        List<ProEconAlarmConfiguration> ls=new ArrayList<>();
+                        ls.add(alarm);
+                        inAlarmMap.put(String.valueOf(sb),ls);
+                    }
+                }
+            }
+        }
+
+        //风机报警初始化标签
+        alarmWtList=alarmWtService.initalAlarmVo();
+        if(!alarmWtList.isEmpty())
+        {
+            for(AlarmVo vo: alarmWtList)
+            {
+                if(alarmWpMap.containsKey(vo.getStationid()))
+                {
+                    List<AlarmVo> ls=alarmWpMap.get(vo.getStationid());
+                    ls.add(vo);
+                }else {
+                    List<AlarmVo> ls=new ArrayList<>();
+                    ls.add(vo);
+                    alarmWpMap.put(vo.getStationid(),ls);
+                }
+                alarmWtMap.put(vo.getTbName().toUpperCase(),vo);
+            }
+        }
+        //逆变器报警初始化标签
+        alarmInList=alarmInService.initalAlarmVo();
+        if(!alarmInList.isEmpty())
+        {
+            for(AlarmVo vo: alarmInList)
+            {
+                alarmInMap.put(vo.getTbName().toUpperCase(),vo);
+            }
+        }
+
+
+        //升压站报警初始化标签
+        alarmBtList=alarmBtService.initalAlarmVo();
+        if(!alarmBtList.isEmpty())
+        {
+            for(AlarmVo vo: alarmBtList)
+            {
+                alarmBtMap.put(vo.getTbName().toUpperCase(),vo);
+            }
+        }
+
+        //从pg数据库获取自定义报警配置信息
+        List<ProEconAlarmRule> customls =proEconAlarmRuleService.list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
+
+        List<ProEconAlarmRule> wtCustomls=new ArrayList<>();
+        List<ProEconAlarmRule> inCustomls=new ArrayList<>();
+        List<ProEconAlarmRule> btCustomls=new ArrayList<>();
+
+        //对自定义报警进行分类
+        if(!customls.isEmpty())
+        {
+            for(ProEconAlarmRule vo: customls)
+            {
+                if(vo.getCategory().equals(AlarmCustomType.WT.getCode()))
+                {
+                    wtCustomls.add(vo);
+                }else  if(vo.getCategory().equals(AlarmCustomType.IN.getCode()))
+                {
+                    inCustomls.add(vo);
+                }else  if(vo.getCategory().equals(AlarmCustomType.BT.getCode()))
+                {
+                    btCustomls.add(vo);
+                }
+
+            }
+        }
+
+        alarmRulesMap.put(AlarmCustomType.BT.getCode(),btCustomls);
+        alarmRulesMap.put(AlarmCustomType.WT.getCode(),wtCustomls);
+        alarmRulesMap.put(AlarmCustomType.IN.getCode(),inCustomls);
+        //自定义报警初始化标签
+        alarmCtList=alarmCtService.initalAlarmVo();
+        if(!alarmCtList.isEmpty())
+        {
+            for(AlarmVo vo: alarmCtList)
+            {
+                alarmCtMap.put(vo.getTbName().toUpperCase(),vo);
+            }
+        }
+
+
+
+        CacheContext.inalarmls =inalarmls;
+        CacheContext.btalarmls =btalarmls;
+        CacheContext.wtalarmls =wtalarmls;
+
+        CacheContext.alarmCtList =alarmCtList;
+        CacheContext.alarmWtList =alarmWtList;
+        CacheContext.alarmInList =alarmInList;
+
+
+        CacheContext.alarmBtList = alarmBtList;
+        CacheContext.alarmInMap=alarmInMap;
+        CacheContext.alarmBtMap = alarmBtMap;
+        CacheContext.alarmCtMap = alarmCtMap;
+        CacheContext.alarmRulesMap = alarmRulesMap;
+
+        CacheContext.wtAlarmMap = wtAlarmMap;
+        CacheContext.alarmWpMap=alarmWpMap;
+        CacheContext.inAlarmMap = inAlarmMap;
+        CacheContext.alarmWtMap = alarmWtMap;
+    }
+}

+ 33 - 0
alarm-web/src/main/java/com/gyee/alarm/service/auto/impl/AlarmTsServiceImpl.java

@@ -50,6 +50,38 @@ public class AlarmTsServiceImpl extends ServiceImpl<AlarmTsMapper, AlarmTs> impl
 
 
     ) {
+
+        tbName = tbName != null ? tbName : "";
+        alarmid = alarmid != null ? alarmid : "";
+        alarmtype = alarmtype != null ? alarmtype : "";
+        characteristic = characteristic != null ? characteristic : "";
+        components = components != null ? components : "";
+        description = description != null ? description : "";
+        deviceid = deviceid != null ? deviceid : "";
+        devicename = devicename != null ? devicename : "";
+        devicetype = devicetype != null ? devicetype : "";
+        enabled = enabled;
+        lineid = lineid != null ? lineid : "";
+        linename = linename != null ? linename : "";
+        modelId = modelId != null ? modelId : "";
+        projectid = projectid != null ? projectid : "";
+        projectname = projectname != null ? projectname : "";
+        rank = rank;
+        resettable = resettable;
+        stationid = stationid != null ? stationid : "";
+        stationname = stationname != null ? stationname : "";
+        subcomponents = subcomponents != null ? subcomponents : "";
+        suffix = suffix != null ? suffix : "";
+        tagid = tagid != null ? tagid : "";
+        triggertype = triggertype;
+        uniformcode = uniformcode != null ? uniformcode : "";
+        superTableName = superTableName != null ? superTableName : "";
+        name = name != null ? name : "";
+        nemCode = nemCode != null ? nemCode : "";
+        faultCause = faultCause != null ? faultCause : "";
+        resolvent = resolvent != null ? resolvent : "";
+        faultType = faultType != null ? faultType : "";
+        aname = aname != null ? aname : "";
         return alarmTsMapper.createTable(tbName, alarmid, alarmtype,
                 characteristic, components,
                 description,
@@ -65,6 +97,7 @@ public class AlarmTsServiceImpl extends ServiceImpl<AlarmTsMapper, AlarmTs> impl
     }
 
 
+
     public int createTable(AlarmVo vo) {
         return alarmTsMapper.createTable(vo);
     }

+ 46 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/ScheduledTasks.java

@@ -0,0 +1,46 @@
+package com.gyee.alarm.task.thread;
+
+
+import com.gyee.alarm.init.CacheContext;
+import com.gyee.alarm.service.AlarmInitalService;
+import com.gyee.alarm.service.auto.IProEconAlarmRuleService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+@Component
+public class ScheduledTasks {
+
+
+    private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    @Resource
+    private AlarmInitalService alarmInitalService;
+    // 每15分钟执行一次
+    @Scheduled(fixedRate = 1000*60*15)
+    public void reportCurrentTime() throws Exception {
+        alarmInitalService.initialAlarm();
+        logger.info("当前时间: " + System.currentTimeMillis() / 1000);
+    }
+
+//    // 初始延迟1秒,之后每10秒执行一次
+//    @Scheduled(fixedDelay = 10000, initialDelay = 1000)
+//    public void fixedDelayTask() {
+//        System.out.println("固定延迟任务执行: " + System.currentTimeMillis() / 1000);
+//    }
+//
+//    // 初始延迟1秒,之后在上一次执行结束后再等待10秒执行
+//    @Scheduled(fixedDelayString = "10000", initialDelay = 1000)
+//    public void fixedDelayStringTask() {
+//        System.out.println("固定延迟字符串任务执行: " + System.currentTimeMillis() / 1000);
+//    }
+//
+//    // 初始延迟1秒,之后在上一次执行结束后再等待10秒执行,使用cron表达式
+//    @Scheduled(cron = "*/10 * * * * ?")
+//    public void executeTaskWithCron() {
+//        System.out.println("Cron表达式任务执行: " + System.currentTimeMillis() / 1000);
+//    }
+}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6868 - 0
log/2025-06/ota.2025-06-12.0.log


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 8865 - 0
log/2025-06/ota.2025-06-13.0.log


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 10 - 239
log/ota.log


BIN
log/ota.log.2024-11-25.0.gz


BIN
log/ota.log.2025-06-11.0.gz