Commit c98ef23b98573d622f6637bb181bfebc8172b118
1 parent
c1bc45fe
修复定时删除过期录像文件时,收藏文件被删除的问题
Showing
3 changed files
with
7 additions
and
4 deletions
src/main/java/com/genersoft/iot/vmp/conf/CloudRecordTimer.java
| @@ -41,8 +41,8 @@ public class CloudRecordTimer { | @@ -41,8 +41,8 @@ public class CloudRecordTimer { | ||
| 41 | /** | 41 | /** |
| 42 | * 定时查询待删除的录像文件 | 42 | * 定时查询待删除的录像文件 |
| 43 | */ | 43 | */ |
| 44 | -// @Scheduled(fixedRate = 5000) //每五秒执行一次,方便测试 | ||
| 45 | - @Scheduled(cron = "0 0 0 * * ?") //每天的0点执行 | 44 | + @Scheduled(fixedRate = 5000) //每五秒执行一次,方便测试 |
| 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的流媒体节点 |
| @@ -56,7 +56,7 @@ public class CloudRecordTimer { | @@ -56,7 +56,7 @@ public class CloudRecordTimer { | ||
| 56 | Calendar lastCalendar = Calendar.getInstance(); | 56 | Calendar lastCalendar = Calendar.getInstance(); |
| 57 | if (mediaServerItem.getRecordDay() > 0) { | 57 | if (mediaServerItem.getRecordDay() > 0) { |
| 58 | lastCalendar.setTime(new Date()); | 58 | lastCalendar.setTime(new Date()); |
| 59 | - // 获取保存的最后截至日期,因为每个节点都有一个日期,也就是支持每个节点设置不同的保存日期, | 59 | + // 获取保存的最后截至日[期,因为每个节点都有一个日期,也就是支持每个节点设置不同的保存日期, |
| 60 | lastCalendar.add(Calendar.DAY_OF_MONTH, -mediaServerItem.getRecordDay()); | 60 | lastCalendar.add(Calendar.DAY_OF_MONTH, -mediaServerItem.getRecordDay()); |
| 61 | Long lastDate = lastCalendar.getTimeInMillis(); | 61 | Long lastDate = lastCalendar.getTimeInMillis(); |
| 62 | 62 |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
| @@ -133,6 +133,9 @@ public class StreamProxyServiceImpl implements IStreamProxyService { | @@ -133,6 +133,9 @@ public class StreamProxyServiceImpl implements IStreamProxyService { | ||
| 133 | JSONArray dataArray = jsonObject.getJSONArray("data"); | 133 | JSONArray dataArray = jsonObject.getJSONArray("data"); |
| 134 | JSONObject mediaServerConfig = dataArray.getJSONObject(0); | 134 | JSONObject mediaServerConfig = dataArray.getJSONObject(0); |
| 135 | String ffmpegCmd = mediaServerConfig.getString(param.getFfmpegCmdKey()); | 135 | String ffmpegCmd = mediaServerConfig.getString(param.getFfmpegCmdKey()); |
| 136 | + if (ffmpegCmd == null) { | ||
| 137 | + throw new ControllerException(ErrorCode.ERROR100.getCode(), "ffmpeg拉流代理无法获取ffmpeg cmd"); | ||
| 138 | + } | ||
| 136 | String schema = getSchemaFromFFmpegCmd(ffmpegCmd); | 139 | String schema = getSchemaFromFFmpegCmd(ffmpegCmd); |
| 137 | if (schema == null) { | 140 | if (schema == null) { |
| 138 | throw new ControllerException(ErrorCode.ERROR100.getCode(), "ffmpeg拉流代理无法从ffmpeg cmd中获取到输出格式"); | 141 | throw new ControllerException(ErrorCode.ERROR100.getCode(), "ffmpeg拉流代理无法从ffmpeg cmd中获取到输出格式"); |
src/main/java/com/genersoft/iot/vmp/storager/dao/CloudRecordServiceMapper.java
| @@ -91,7 +91,7 @@ public interface CloudRecordServiceMapper { | @@ -91,7 +91,7 @@ public interface CloudRecordServiceMapper { | ||
| 91 | @Select(" <script>" + | 91 | @Select(" <script>" + |
| 92 | "select *" + | 92 | "select *" + |
| 93 | " from wvp_cloud_record " + | 93 | " from wvp_cloud_record " + |
| 94 | - " where end_time <= #{endTimeStamp} and media_server_id = #{mediaServerId} " + | 94 | + " where collect = false and end_time <= #{endTimeStamp} and media_server_id = #{mediaServerId} " + |
| 95 | " </script>") | 95 | " </script>") |
| 96 | List<CloudRecordItem> queryRecordListForDelete(@Param("endTimeStamp")Long endTimeStamp, String mediaServerId); | 96 | List<CloudRecordItem> queryRecordListForDelete(@Param("endTimeStamp")Long endTimeStamp, String mediaServerId); |
| 97 | 97 |