Commit 8a50a02d27d6305d46c7902b0e17d491520f49f6
1 parent
7de9f1e1
优化文件删除逻辑
Showing
2 changed files
with
2 additions
and
1 deletions
src/main/java/top/panll/assist/service/FileManagerTimer.java
| @@ -81,7 +81,7 @@ public class FileManagerTimer { | @@ -81,7 +81,7 @@ public class FileManagerTimer { | ||
| 81 | } | 81 | } |
| 82 | } | 82 | } |
| 83 | } | 83 | } |
| 84 | - if (streamFile.listFiles() == null && streamFile.listFiles().length == 0) { | 84 | + if (streamFile.listFiles() == null || streamFile.listFiles().length == 0) { |
| 85 | boolean result = FileUtils.deleteQuietly(streamFile); | 85 | boolean result = FileUtils.deleteQuietly(streamFile); |
| 86 | if (result) { | 86 | if (result) { |
| 87 | logger.info("[录像巡查]成功移除 {} ", streamFile.getAbsolutePath()); | 87 | logger.info("[录像巡查]成功移除 {} ", streamFile.getAbsolutePath()); |
src/main/java/top/panll/assist/service/VideoFileService.java
| @@ -439,6 +439,7 @@ public class VideoFileService { | @@ -439,6 +439,7 @@ public class VideoFileService { | ||
| 439 | date = simpleDateFormat.parse(name); | 439 | date = simpleDateFormat.parse(name); |
| 440 | } catch (ParseException e) { | 440 | } catch (ParseException e) { |
| 441 | logger.error("格式化时间{}错误", name); | 441 | logger.error("格式化时间{}错误", name); |
| 442 | + return false; | ||
| 442 | } | 443 | } |
| 443 | Calendar c = Calendar.getInstance(); | 444 | Calendar c = Calendar.getInstance(); |
| 444 | c.setTime(date); | 445 | c.setTime(date); |