Commit 6f09111264edc9497713dd15542385fc86c2b3c0

Authored by 648540858
1 parent ddad8cf6

优化录像收藏列表查询

src/main/java/top/panll/assist/dto/SignInfo.java
@@ -3,6 +3,7 @@ package top.panll.assist.dto; @@ -3,6 +3,7 @@ package top.panll.assist.dto;
3 public class SignInfo { 3 public class SignInfo {
4 private String app; 4 private String app;
5 private String stream; 5 private String stream;
  6 + private String type;
6 7
7 public String getApp() { 8 public String getApp() {
8 return app; 9 return app;
@@ -19,4 +20,12 @@ public class SignInfo { @@ -19,4 +20,12 @@ public class SignInfo {
19 public void setStream(String stream) { 20 public void setStream(String stream) {
20 this.stream = stream; 21 this.stream = stream;
21 } 22 }
  23 +
  24 + public String getType() {
  25 + return type;
  26 + }
  27 +
  28 + public void setType(String type) {
  29 + this.type = type;
  30 + }
22 } 31 }
src/main/java/top/panll/assist/service/VideoFileService.java
@@ -574,12 +574,29 @@ public class VideoFileService { @@ -574,12 +574,29 @@ public class VideoFileService {
574 continue; 574 continue;
575 } 575 }
576 } 576 }
577 - File signFile = new File(streamFile.getAbsolutePath() + File.separator + type + ".sign");  
578 - if (signFile.exists()) {  
579 - SignInfo signInfo = new SignInfo();  
580 - signInfo.setApp(appFile.getName());  
581 - signInfo.setStream(streamFile.getName());  
582 - result.add(signInfo); 577 +
  578 + if (type != null) {
  579 + File signFile = new File(streamFile.getAbsolutePath() + File.separator + type + ".sign");
  580 + if (signFile.exists()) {
  581 + SignInfo signInfo = new SignInfo();
  582 + signInfo.setApp(appFile.getName());
  583 + signInfo.setStream(streamFile.getName());
  584 + signInfo.setType(type);
  585 + result.add(signInfo);
  586 + }
  587 + }else {
  588 + streamFile.listFiles((File dir, String name) -> {
  589 + File currentFile = new File(dir.getAbsolutePath() + File.separator + name);
  590 + if (currentFile.isFile() && name.endsWith(".sign")){
  591 + String currentType = name.substring(0, name.length() - ".sign".length());
  592 + SignInfo signInfo = new SignInfo();
  593 + signInfo.setApp(appFile.getName());
  594 + signInfo.setStream(streamFile.getName());
  595 + signInfo.setType(currentType);
  596 + result.add(signInfo);
  597 + }
  598 + return false;
  599 + });
583 } 600 }
584 } 601 }
585 } 602 }