|
@@ -263,14 +263,14 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
|
|
|
startToInfraredTask.setOtherParams(algorithmConfigTrack.getParameterConfig());
|
|
|
|
|
|
- String osName = System.getProperty("os.name");
|
|
|
- if (osName.toLowerCase().contains("windows")) {
|
|
|
- startToInfraredTask.setSource_dir("C:" + toInfrared.getInputPath());
|
|
|
- startToInfraredTask.setResult_dir("C:" + toInfrared.getOutputPath());
|
|
|
- } else {
|
|
|
+// String osName = System.getProperty("os.name");
|
|
|
+// if (osName.toLowerCase().contains("windows")) {
|
|
|
+// startToInfraredTask.setSource_dir("C:" + toInfrared.getInputPath());
|
|
|
+// startToInfraredTask.setResult_dir("C:" + toInfrared.getOutputPath());
|
|
|
+// } else {
|
|
|
startToInfraredTask.setSource_dir(toInfrared.getInputPath());
|
|
|
startToInfraredTask.setResult_dir(toInfrared.getOutputPath());
|
|
|
- }
|
|
|
+// }
|
|
|
|
|
|
// startToInfraredTask.setSource_dir(toInfrared.getInputPath());
|
|
|
// startToInfraredTask.setResult_dir(toInfrared.getOutputPath());
|
|
@@ -296,7 +296,11 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
public CommonResult stop(Long id) {
|
|
|
ToInfrared toInfrared = getById(id);
|
|
|
|
|
|
- HttpResponseEntity responseEntity = sendPostMsg(to_infrared_stop_url, toInfrared);
|
|
|
+ StartToInfraredTask startToInfraredTask = new StartToInfraredTask();
|
|
|
+ startToInfraredTask.setBizType(BizConstant.BizType.TO_INFRARED);
|
|
|
+ startToInfraredTask.setBizId(toInfrared.getId());
|
|
|
+
|
|
|
+ HttpResponseEntity responseEntity = sendPostMsg(to_infrared_stop_url, startToInfraredTask);
|
|
|
if (ObjectUtil.isNotNull(responseEntity) && responseEntity.getStatus() == 200) {
|
|
|
toInfrared.setStatus(BizConstant.VideoStatus.INTERRUPTED);
|
|
|
updateById(toInfrared);
|
|
@@ -356,29 +360,67 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
}
|
|
|
|
|
|
String outputPath = toInfrared.getOutputPath();
|
|
|
- String zipFilePath = outputPath + ".zip";
|
|
|
|
|
|
- String osName = System.getProperty("os.name");
|
|
|
- if (osName.toLowerCase().contains("windows")) {
|
|
|
- zipFilePath = "C://" + zipFilePath;
|
|
|
- }
|
|
|
+// String osName = System.getProperty("os.name");
|
|
|
+// if (osName.toLowerCase().contains("windows")) {
|
|
|
+// outputPath = outputPath;
|
|
|
+// }
|
|
|
|
|
|
- try {
|
|
|
- ZipUtils.zipFolderFiles(outputPath, zipFilePath);
|
|
|
- } catch (IOException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
+ File modelDir= new File(outputPath + File.separator + BizConstant.MODEL_PATH);
|
|
|
|
|
|
- File file = new File(zipFilePath);
|
|
|
+ if (!modelDir.exists() || !modelDir.isDirectory()) {
|
|
|
+ return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
|
|
|
+ }
|
|
|
|
|
|
- if (!file.exists() || !file.isFile()) {
|
|
|
+ File[] modelFiles = modelDir.listFiles();
|
|
|
+ if(modelFiles == null || modelFiles.length == 0) {
|
|
|
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
|
|
|
}
|
|
|
|
|
|
- org.springframework.core.io.Resource resource = new FileSystemResource(file);
|
|
|
+ for(int i=0; i< modelFiles.length; i++) {
|
|
|
+ System.out.println(modelFiles[i].getName());
|
|
|
+ }
|
|
|
+
|
|
|
+ File returnFile = modelFiles[modelFiles.length-1];
|
|
|
+
|
|
|
+ org.springframework.core.io.Resource resource = new FileSystemResource(returnFile);
|
|
|
return ResponseEntity.ok()
|
|
|
- .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + file.getName() + "\"")
|
|
|
+ .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + returnFile.getName() + "\"")
|
|
|
.header(HttpHeaders.CONTENT_TYPE, "application/octet-stream")
|
|
|
.body(resource);
|
|
|
}
|
|
|
+
|
|
|
+// @Override
|
|
|
+// public ResponseEntity<org.springframework.core.io.Resource> zipImages(Long id) {
|
|
|
+// ToInfrared toInfrared = this.getById(id);
|
|
|
+// if (ObjectUtil.isNull(toInfrared)) {
|
|
|
+// return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
|
|
|
+// }
|
|
|
+//
|
|
|
+// String outputPath = toInfrared.getOutputPath();
|
|
|
+// String zipFilePath = outputPath + ".zip";
|
|
|
+//
|
|
|
+// String osName = System.getProperty("os.name");
|
|
|
+// if (osName.toLowerCase().contains("windows")) {
|
|
|
+// zipFilePath = "C:" + zipFilePath;
|
|
|
+// }
|
|
|
+//
|
|
|
+// try {
|
|
|
+// ZipUtils.zipFolderFiles(outputPath, zipFilePath);
|
|
|
+// } catch (IOException e) {
|
|
|
+// throw new RuntimeException(e);
|
|
|
+// }
|
|
|
+//
|
|
|
+// File file = new File(zipFilePath);
|
|
|
+//
|
|
|
+// if (!file.exists() || !file.isFile()) {
|
|
|
+// return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
|
|
|
+// }
|
|
|
+//
|
|
|
+// org.springframework.core.io.Resource resource = new FileSystemResource(file);
|
|
|
+// return ResponseEntity.ok()
|
|
|
+// .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + file.getName() + "\"")
|
|
|
+// .header(HttpHeaders.CONTENT_TYPE, "application/octet-stream")
|
|
|
+// .body(resource);
|
|
|
+// }
|
|
|
}
|