From 694b9483c7a551626244cbc222c602ea9ff74094 Mon Sep 17 00:00:00 2001
From: sean.zhou <sean.zhou@dji.com>
Date: Tue, 25 Apr 2023 21:44:00 +0800
Subject: [PATCH] What's new? 1. Wayline management: added `pause wayline task` and `recover wayline task`. 2. Added command flight function. 3. Fixed some issues.
---
src/main/java/com/dji/sample/component/GlobalScheduleService.java | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/dji/sample/component/GlobalScheduleService.java b/src/main/java/com/dji/sample/component/GlobalScheduleService.java
index e092ad4..7e77a34 100644
--- a/src/main/java/com/dji/sample/component/GlobalScheduleService.java
+++ b/src/main/java/com/dji/sample/component/GlobalScheduleService.java
@@ -7,6 +7,7 @@
import com.dji.sample.manage.model.enums.DeviceDomainEnum;
import com.dji.sample.manage.service.IDeviceService;
import com.dji.sample.wayline.service.IWaylineJobService;
+import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
@@ -32,11 +33,12 @@
@Autowired
private IWaylineJobService waylineJobService;
-
+ @Autowired
+ private ObjectMapper mapper;
/**
* Check the status of the devices every 30 seconds. It is recommended to use cache.
*/
- @Scheduled(initialDelay = 30, fixedRate = 30, timeUnit = TimeUnit.SECONDS)
+ @Scheduled(initialDelay = 10, fixedRate = 30, timeUnit = TimeUnit.SECONDS)
private void deviceStatusListen() {
int start = RedisConst.DEVICE_ONLINE_PREFIX.length();
@@ -49,8 +51,9 @@
} else {
deviceService.unsubscribeTopicOffline(key.substring(start));
deviceService.pushDeviceOfflineTopo(device.getWorkspaceId(), device.getDeviceSn());
- RedisOpsUtils.hashDel(RedisConst.LIVE_CAPACITY, new String[]{key});
- RedisOpsUtils.del(RedisConst.HMS_PREFIX + key);
+ RedisOpsUtils.hashDel(RedisConst.LIVE_CAPACITY, new String[]{device.getDeviceSn()});
+ RedisOpsUtils.del(RedisConst.HMS_PREFIX + device.getDeviceSn());
+ RedisOpsUtils.del(RedisConst.OSD_PREFIX + device.getDeviceSn());
}
RedisOpsUtils.del(key);
}
--
Gitblit v1.9.3