whycxzp
2025-06-10 73bb5617e6aeb4ee8f7dfd4ad54b61d477969d86
src/main/java/com/whyc/schedule/VideoScheduleService.java
@@ -72,21 +72,22 @@
    }
    /**
     * 录像保持2天
     * 录像保持7天
     */
    @Scheduled(cron= "0 0 2 * * ?")
    @Scheduled(cron= "0 0 7 * * ?")
    public void recordRecycle(){
        log.info("-----------执行录像循环----------:"+ DateUtil.YYYY_MM_DD_HH_MM_SS.format(new Date()));
        //文件夹路径 /battery_system/video_system/Debug/www/record/rtp/{streamId}/{day}}
        List<String> videoStreamIds = YamlProperties.videoStreamIds;
        videoStreamIds.forEach(streamId ->{
            String dirPath = "/battery_system/video_system/Debug/www/record/rtp/"+streamId;
            String dirPath = "/battery_system/video_system/ZLMediaKit/www/record/rtp/"+streamId;
            //String dirPath = "/batterySystem/videoSystem/ZLMediaKit/www/record/rtp/"+streamId;
            File dirFile = new File(dirPath);
            String[] dirList = dirFile.list();
            List<String> dirList2 = Arrays.asList(dirList);
            for (int i = 0; i < dirList2.size()-3; i++) {
                //按顺序删除,保留最后3个day的视频录像文件夹
                //按顺序删除,保留最后7个day的视频录像文件夹
                String dirPath2Remove = dirPath + File.separator + dirList2.get(i);
                File dir2Remove = new File(dirPath2Remove);
                FileUtil.deleteFile(dir2Remove);