From fbced0c4dd4950a184f8471ef71995aa93dafd50 Mon Sep 17 00:00:00 2001
From: liusuyi <1951119284@qq.com>
Date: Sat, 27 Dec 2025 10:17:44 +0800
Subject: [PATCH] 优化
---
ard-device/src/main/java/com/ard/device/channel/service/impl/ArdChannelServiceImpl.java | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/ard-device/src/main/java/com/ard/device/channel/service/impl/ArdChannelServiceImpl.java b/ard-device/src/main/java/com/ard/device/channel/service/impl/ArdChannelServiceImpl.java
index 2c9f997..de0230f 100644
--- a/ard-device/src/main/java/com/ard/device/channel/service/impl/ArdChannelServiceImpl.java
+++ b/ard-device/src/main/java/com/ard/device/channel/service/impl/ArdChannelServiceImpl.java
@@ -1,6 +1,8 @@
package com.ard.device.channel.service.impl;
+import com.ard.common.constant.CacheConstants;
import com.ard.common.constant.UserConstants;
+import com.ard.common.core.redis.RedisCache;
import com.ard.common.utils.uuid.IdUtils;
import com.ard.device.camera.domain.ArdCamera;
import com.ard.device.camera.service.IArdCameraService;
@@ -11,6 +13,7 @@
import com.ard.vtdu.domain.ArdVtdu;
import com.ard.vtdu.service.IArdVtduService;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@@ -27,14 +30,16 @@
@Slf4j
@Service
public class ArdChannelServiceImpl implements IArdChannelService {
- @Resource
- private IArdCameraService ardCameraService;
+ // @Resource
+ //private IArdCameraService ardCameraService;
@Resource
private ArdChannelMapper ardChannelMapper;
@Resource
private IArdVtduService ardVtduService;
@Resource
private MediamtxConfig mediamtxConfig;
+ @Resource
+ private RedisCache redisCache;
/**
* 查询通道管理
@@ -141,7 +146,7 @@
}
- @Scheduled(cron = "0/5 * * * * ?")
+ @Scheduled(fixedDelay = 5000)
public void syncVtdu() {
log.debug("定时同步Vtdu任务");
List<ArdChannel> channels = this.selectArdChannelList(new ArdChannel());
@@ -221,7 +226,7 @@
// 根据通道信息获取rtsp源地址
private String getRtspSource(ArdChannel channel) {
String rtspSource = "";
- ArdCamera ardCamera = ardCameraService.selectArdCameraById(channel.getDeviceId());
+ ArdCamera ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + channel.getDeviceId());
if (ardCamera != null) {
switch (ardCamera.getFactory()) {
case "1":
--
Gitblit v1.9.3