|
@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -67,14 +68,18 @@ public class RepairVideosHandler {
|
|
|
JSONObject videosObj = JSONObject.parseObject(videos);
|
|
|
String upPath = videosObj.getString("upPath");
|
|
|
|
|
|
- String upName = upPath.substring(upPath.lastIndexOf("/"));
|
|
|
+ String upName = upPath.substring(upPath.lastIndexOf("/") + 1);
|
|
|
XxlJobHelper.log("文件名:{}", upName);
|
|
|
String targetUpPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, pro.getNum()).concat(upName);
|
|
|
+ String targetUpPath1 = String.format(ConstantFilePath.DATA_PATH_FORMAT, pro.getNum()).concat("Up.xml");
|
|
|
+ String targetUpPath2 = String.format(ConstantFilePath.DATA_PATH_FORMAT, pro.getNum()).concat("Up2.xml");
|
|
|
|
|
|
boolean found = false;
|
|
|
|
|
|
//判断home是否被删除,如果home没被删除。直接从home中获取
|
|
|
upPath = upPath.replace(fYunFileConfig.getHost(), "");
|
|
|
+ String upPath1 = upPath.replace(upName, "").concat("Up.xml");
|
|
|
+ String upPath2 = upPath.replace(upName, "").concat("Up2.xml");
|
|
|
boolean exist = fYunFileService.fileExist(upPath);
|
|
|
XxlJobHelper.log("原始资源是否存在:{}", exist);
|
|
|
if(exist){
|
|
@@ -82,7 +87,9 @@ public class RepairVideosHandler {
|
|
|
found = true;
|
|
|
log.info("upPath=" + upPath);
|
|
|
log.info("targetUpPath=" + targetUpPath);
|
|
|
- fYunFileService.copyFileBetweenBucket(fYunFileConfig.getBucket(), upPath, fYunFileConfig.getBucket(), targetUpPath);
|
|
|
+// fYunFileService.copyFileBetweenBucket(fYunFileConfig.getBucket(), upPath, fYunFileConfig.getBucket(), targetUpPath);
|
|
|
+ fYunFileService.uploadFile(fYunFileService.getFileContent(upPath1).getBytes(StandardCharsets.UTF_8), targetUpPath1);
|
|
|
+ fYunFileService.uploadFile(fYunFileService.getFileContent(upPath2).getBytes(StandardCharsets.UTF_8), targetUpPath2);
|
|
|
}else{
|
|
|
//如果home已被删除,则找相同相机下的场景,有则取回
|
|
|
if(Objects.isNull(pro.getCameraId())){
|
|
@@ -105,7 +112,8 @@ public class RepairVideosHandler {
|
|
|
found = true;
|
|
|
log.info("upPath=" + upPath);
|
|
|
log.info("targetUpPath=" + targetUpPath);
|
|
|
- fYunFileService.copyFileBetweenBucket(fYunFileConfig.getBucket(), upPath, fYunFileConfig.getBucket(), targetUpPath);
|
|
|
+ fYunFileService.uploadFile(fYunFileService.getFileContent(upPath1).getBytes(StandardCharsets.UTF_8), targetUpPath1);
|
|
|
+ fYunFileService.uploadFile(fYunFileService.getFileContent(upPath2).getBytes(StandardCharsets.UTF_8), targetUpPath2);
|
|
|
log.info("场景:{}在场景{}中找到,路径为:{}", pro.getNum(), scenePro.getNum(), upPath);
|
|
|
break;
|
|
|
}
|