TRX пре 1 година
родитељ
комит
61be95e0a8

+ 7 - 0
OneCardIotServer/pom.xml

@@ -50,6 +50,13 @@
             <version>${project.version}</version>
         </dependency>
 
+        <!--OpenApi网关客户端-->
+        <dependency>
+            <groupId>com.github.microservice.opengateway</groupId>
+            <artifactId>OpenApiClient</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
         <dependency>
             <groupId>com.github.microservice.components</groupId>
             <artifactId>RedisData</artifactId>

+ 1 - 0
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/artemis/OperationMessageService.java

@@ -460,6 +460,7 @@ public class OperationMessageService {
      */
     public void executeOperationMessage(OperationMessage entity, JSONObject data, IotMain iotMain) {
         CompletableFuture.runAsync(() -> {
+            //todo
             OperationMessageResult messageResult = new OperationMessageResult();
             messageResult.setOperationMessage(entity);
             messageResult.setIotMain(iotMain);

+ 32 - 0
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/timers/CheckDeviceStateWork.java

@@ -0,0 +1,32 @@
+package com.zhongshu.iot.server.core.timers;
+
+import com.zhongshu.iot.server.core.service.mqtt.DevicePingInfoService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+/**
+ * 定时检查设备在线状态
+ *
+ * @author TRX
+ * @date 2024/7/3
+ */
+@Slf4j
+@EnableScheduling
+@Component
+public class CheckDeviceStateWork {
+
+    @Autowired
+    private DevicePingInfoService devicePingInfoService;
+
+    @Scheduled(fixedRate = 1000 * 15)
+    public void checkDeviceState() {
+        // 检测设备在线状态
+        devicePingInfoService.checkDeviceState();
+
+        // 检测网关在线状态
+        devicePingInfoService.checkGateWayState();
+    }
+}