Commit ffc8a530f30ba5d200dc885aef7404c5cbab282e
1 parent
29ef6803
修复定时录像删除
Showing
4 changed files
with
7 additions
and
8 deletions
src/main/java/com/genersoft/iot/vmp/conf/CloudRecordTimer.java
| @@ -41,12 +41,12 @@ public class CloudRecordTimer { | @@ -41,12 +41,12 @@ public class CloudRecordTimer { | ||
| 41 | /** | 41 | /** |
| 42 | * 定时查询待删除的录像文件 | 42 | * 定时查询待删除的录像文件 |
| 43 | */ | 43 | */ |
| 44 | -// @Scheduled(fixedRate = 5000) //每五秒执行一次,方便测试 | 44 | +// @Scheduled(fixedRate = 10000) //每五秒执行一次,方便测试 |
| 45 | @Scheduled(cron = "0 0 0 * * ?") //每天的0点执行 | 45 | @Scheduled(cron = "0 0 0 * * ?") //每天的0点执行 |
| 46 | public void execute(){ | 46 | public void execute(){ |
| 47 | logger.info("[录像文件定时清理] 开始清理过期录像文件"); | 47 | logger.info("[录像文件定时清理] 开始清理过期录像文件"); |
| 48 | // 获取配置了assist的流媒体节点 | 48 | // 获取配置了assist的流媒体节点 |
| 49 | - List<MediaServerItem> mediaServerItemList = mediaServerService.getAllWithAssistPort(); | 49 | + List<MediaServerItem> mediaServerItemList = mediaServerService.getAllOnline(); |
| 50 | if (mediaServerItemList.isEmpty()) { | 50 | if (mediaServerItemList.isEmpty()) { |
| 51 | return; | 51 | return; |
| 52 | } | 52 | } |
| @@ -70,8 +70,7 @@ public class CloudRecordTimer { | @@ -70,8 +70,7 @@ public class CloudRecordTimer { | ||
| 70 | String date = new File(cloudRecordItem.getFilePath()).getParentFile().getName(); | 70 | String date = new File(cloudRecordItem.getFilePath()).getParentFile().getName(); |
| 71 | JSONObject jsonObject = zlmresTfulUtils.deleteRecordDirectory(mediaServerItem, cloudRecordItem.getApp(), | 71 | JSONObject jsonObject = zlmresTfulUtils.deleteRecordDirectory(mediaServerItem, cloudRecordItem.getApp(), |
| 72 | cloudRecordItem.getStream(), date, cloudRecordItem.getFileName()); | 72 | cloudRecordItem.getStream(), date, cloudRecordItem.getFileName()); |
| 73 | - if (jsonObject.getInteger("code") == 0) { | ||
| 74 | - }else { | 73 | + if (jsonObject.getInteger("code") != 0) { |
| 75 | logger.warn("[录像文件定时清理] 删除磁盘文件错误: {}:{}", cloudRecordItem.getFilePath(), jsonObject); | 74 | logger.warn("[录像文件定时清理] 删除磁盘文件错误: {}:{}", cloudRecordItem.getFilePath(), jsonObject); |
| 76 | } | 75 | } |
| 77 | } | 76 | } |
src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java
| @@ -81,8 +81,8 @@ public class MediaConfig{ | @@ -81,8 +81,8 @@ public class MediaConfig{ | ||
| 81 | @Value("${media.record-assist-port:0}") | 81 | @Value("${media.record-assist-port:0}") |
| 82 | private Integer recordAssistPort = 0; | 82 | private Integer recordAssistPort = 0; |
| 83 | 83 | ||
| 84 | - @Value("${media.record-date:7}") | ||
| 85 | - private Integer recordDay = 7; | 84 | + @Value("${media.record-day:7}") |
| 85 | + private Integer recordDay; | ||
| 86 | 86 | ||
| 87 | @Value("${media.record-path}") | 87 | @Value("${media.record-path}") |
| 88 | private String recordPath; | 88 | private String recordPath; |
src/main/java/com/genersoft/iot/vmp/storager/dao/CloudRecordServiceMapper.java
| @@ -101,7 +101,7 @@ public interface CloudRecordServiceMapper { | @@ -101,7 +101,7 @@ public interface CloudRecordServiceMapper { | ||
| 101 | int changeCollectById(@Param("collect") boolean collect, @Param("recordId") Integer recordId); | 101 | int changeCollectById(@Param("collect") boolean collect, @Param("recordId") Integer recordId); |
| 102 | 102 | ||
| 103 | @Delete(" <script>" + | 103 | @Delete(" <script>" + |
| 104 | - "delete from wvp_cloud_record where media_server_id=#{mediaServerId} and id in " + | 104 | + "delete from wvp_cloud_record where id in " + |
| 105 | " <foreach collection='cloudRecordItemIdList' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" + | 105 | " <foreach collection='cloudRecordItemIdList' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" + |
| 106 | " </script>") | 106 | " </script>") |
| 107 | int deleteList(List<CloudRecordItem> cloudRecordItemIdList); | 107 | int deleteList(List<CloudRecordItem> cloudRecordItemIdList); |
src/main/resources/all-application.yml
| @@ -155,7 +155,7 @@ media: | @@ -155,7 +155,7 @@ media: | ||
| 155 | # 录像路径 | 155 | # 录像路径 |
| 156 | record-path: ./www/record | 156 | record-path: ./www/record |
| 157 | # 录像保存时长 | 157 | # 录像保存时长 |
| 158 | - record-date: 7 | 158 | + record-day: 7 |
| 159 | # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试 | 159 | # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试 |
| 160 | rtp: | 160 | rtp: |
| 161 | # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输 | 161 | # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输 |