From e0e99fad10f6c8dedf4c11c065b10469cd47a1e8 Mon Sep 17 00:00:00 2001
From: liusuyi <1951119284@qq.com>
Date: Tue, 30 Sep 2025 09:00:14 +0800
Subject: [PATCH] 优化流媒体接口实现机场和相机业务
---
ard-device/src/main/java/com/ard/device/camera/service/impl/ArdCameraServiceImpl.java | 31 ++++++++++++++++++++++++++++++-
1 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/ard-device/src/main/java/com/ard/device/camera/service/impl/ArdCameraServiceImpl.java b/ard-device/src/main/java/com/ard/device/camera/service/impl/ArdCameraServiceImpl.java
index 129ceca..70674cb 100644
--- a/ard-device/src/main/java/com/ard/device/camera/service/impl/ArdCameraServiceImpl.java
+++ b/ard-device/src/main/java/com/ard/device/camera/service/impl/ArdCameraServiceImpl.java
@@ -25,6 +25,7 @@
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.validation.Validator;
@@ -54,6 +55,7 @@
@Resource
protected Validator validator;
+
@Override
public void run(ApplicationArguments args) {
@@ -353,5 +355,32 @@
// SDK 登录成功后写入 Redis
redisService.setCacheObject(getCacheKey(camera.getId()), camera);
}
-
+ /**
+ * 同步设备通道与本地通道库信息
+ *
+ * @author 刘苏义
+ * @date 2024/8/22 14:37
+ */
+ @Scheduled(cron = "0/10 * * * * ?")
+ public void syncChannel() {
+ try {
+ log.info("定时执行同步通道任务");
+ List<ArdCamera> ardCameraList = this.selectArdCameraList(new ArdCamera());
+ if (!ardCameraList.isEmpty()) {
+ ardCameraList
+ .forEach(ardCamera -> {
+ //SDK获取实际通道
+ List<ArdChannel> ardChannelListSDK = cameraSDKService.getChannels(ardCamera);
+ //数据库获取通道
+ ArdChannel ardChannel = new ArdChannel();
+ ardChannel.setDeviceId(ardCamera.getId());
+ List<ArdChannel> ardChannelListDb = ardChannelService.selectArdChannelList(ardChannel);
+ //同步通道
+ asyncChannel(ardChannelListDb, ardChannelListSDK);
+ });
+ }
+ } catch (Exception ex) {
+ log.error("定时执行同步通道任务异常:{}", ex.getMessage());
+ }
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3