From 5b017324148ea92d96f9f16ade215463d6c712e5 Mon Sep 17 00:00:00 2001 From: liusuyi <1951119284@qq.com> Date: 星期六, 10 八月 2024 14:15:02 +0800 Subject: [PATCH] 优化:海康大华sdk断线重连机制 --- ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java | 30 ++++++++++++++++++++++++++++-- 1 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java index eee48bb..39e9b5c 100644 --- a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java +++ b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java @@ -1,5 +1,7 @@ package com.ruoyi.device.camera.service.impl; +import java.nio.file.Path; +import java.nio.file.Paths; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -38,6 +40,7 @@ import com.ruoyi.utils.gis.Point; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; @@ -70,8 +73,7 @@ @PostConstruct public void loadCameras() { - - //娓呴櫎褰曞儚缂撳瓨 + //娓呯悊鏈湴褰曞儚缂撳瓨鏂囦欢 String tempPath = ARDConfig.getProfile() + Constants.LOCAL_RECORD_TEMP_PREFIX; FileUtils.deleteFolder(tempPath); //娓呯┖鐩告満缂撳瓨 @@ -82,7 +84,26 @@ for (ArdCameras ardCamera : ardCameras) { redisCache.setCacheObject(getCacheKey(ardCamera.getId()), ardCamera); } + //娓呯┖閫氶亾 + ardChannelMapper.clearArdChannel(); + //娓呯┖娴佸獟浣� + vtduService.clearVtdu(); + } + /** + * @Author 鍒樿嫃涔� + * @Description 瀹氭椂娓呯悊鏈湴褰曞儚缂撳瓨鏂囦欢锛堣秴杩�1澶╋級 + * @Date 2024/6/21 8:13 + * @Param + * @return + */ + //@Scheduled(cron = "0 0/10 * * * ?") + public void clearRecordTemp() + { + log.debug("瀹氭椂娓呯悊鏈湴褰曞儚缂撳瓨鏂囦欢锛堣秴杩�1澶╋級"); + String tempPath = ARDConfig.getProfile() + Constants.LOCAL_RECORD_TEMP_PREFIX; + Path folderPath = Paths.get(tempPath); + FileUtils.deleteNonTodayFiles(folderPath); } /** @@ -740,4 +761,9 @@ } } } + + @Override + public int resetCameraLoginId() { + return ardCamerasMapper.resetCameraLoginId(); + } } -- Gitblit v1.9.3