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 | 41 | /** |
| 42 | 42 | * 定时查询待删除的录像文件 |
| 43 | 43 | */ |
| 44 | -// @Scheduled(fixedRate = 5000) //每五秒执行一次,方便测试 | |
| 44 | +// @Scheduled(fixedRate = 10000) //每五秒执行一次,方便测试 | |
| 45 | 45 | @Scheduled(cron = "0 0 0 * * ?") //每天的0点执行 |
| 46 | 46 | public void execute(){ |
| 47 | 47 | logger.info("[录像文件定时清理] 开始清理过期录像文件"); |
| 48 | 48 | // 获取配置了assist的流媒体节点 |
| 49 | - List<MediaServerItem> mediaServerItemList = mediaServerService.getAllWithAssistPort(); | |
| 49 | + List<MediaServerItem> mediaServerItemList = mediaServerService.getAllOnline(); | |
| 50 | 50 | if (mediaServerItemList.isEmpty()) { |
| 51 | 51 | return; |
| 52 | 52 | } |
| ... | ... | @@ -70,8 +70,7 @@ public class CloudRecordTimer { |
| 70 | 70 | String date = new File(cloudRecordItem.getFilePath()).getParentFile().getName(); |
| 71 | 71 | JSONObject jsonObject = zlmresTfulUtils.deleteRecordDirectory(mediaServerItem, cloudRecordItem.getApp(), |
| 72 | 72 | cloudRecordItem.getStream(), date, cloudRecordItem.getFileName()); |
| 73 | - if (jsonObject.getInteger("code") == 0) { | |
| 74 | - }else { | |
| 73 | + if (jsonObject.getInteger("code") != 0) { | |
| 75 | 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 | 81 | @Value("${media.record-assist-port:0}") |
| 82 | 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 | 87 | @Value("${media.record-path}") |
| 88 | 88 | private String recordPath; | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/CloudRecordServiceMapper.java
| ... | ... | @@ -101,7 +101,7 @@ public interface CloudRecordServiceMapper { |
| 101 | 101 | int changeCollectById(@Param("collect") boolean collect, @Param("recordId") Integer recordId); |
| 102 | 102 | |
| 103 | 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 | 105 | " <foreach collection='cloudRecordItemIdList' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" + |
| 106 | 106 | " </script>") |
| 107 | 107 | int deleteList(List<CloudRecordItem> cloudRecordItemIdList); | ... | ... |
src/main/resources/all-application.yml