| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | @PostConstruct |
| | | public void loadCameras() { |
| | | |
| | | //清除录像缓存 |
| | | //清理本地录像缓存文件 |
| | | String tempPath = ARDConfig.getProfile() + Constants.LOCAL_RECORD_TEMP_PREFIX; |
| | | FileUtils.deleteFolder(tempPath); |
| | | //清空相机缓存 |
| | |
| | | for (ArdCameras ardCamera : ardCameras) { |
| | | redisCache.setCacheObject(getCacheKey(ardCamera.getId()), ardCamera); |
| | | } |
| | | //清空流媒体 |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public int resetCameraLoginId() { |
| | | return ardCamerasMapper.resetCameraLoginId(); |
| | | } |
| | | } |