|
@@ -210,14 +210,14 @@ public class DownloadServiceImpl implements IDownloadService {
|
|
|
|
|
|
private void zipOssFiles(String num, String resolution, int imagesVersion, Set<String> cacheKeys, String version) throws Exception{
|
|
|
|
|
|
- fYunFileService.downloadFileByCommand(String.format(sourceLocal, num, this.wwwroot).concat(String.format(UploadFilePath.VIEW_PATH, num)), String.format(UploadFilePath.VIEW_PATH, num));
|
|
|
- FileUtil.del(String.format(sourceLocal, num, this.wwwroot).concat(String.format(UploadFilePath.IMG_VIEW_PATH, num)).concat("tiles"));
|
|
|
-// List<String> strings = fYunFileService.listRemoteFiles(String.format(UploadFilePath.VIEW_PATH, num));
|
|
|
-// strings.stream().forEach(str->{
|
|
|
-// if(!str.contains("/tiles/4k/") && !str.contains("/tiles/2k/")){
|
|
|
-// fYunFileService.downloadFile(str, String.format(sourceLocal, num, this.wwwroot).concat(str));
|
|
|
-// }
|
|
|
-// });
|
|
|
+// fYunFileService.downloadFileByCommand(String.format(sourceLocal, num, this.wwwroot).concat(String.format(UploadFilePath.VIEW_PATH, num)), String.format(UploadFilePath.VIEW_PATH, num));
|
|
|
+// FileUtil.del(String.format(sourceLocal, num, this.wwwroot).concat(String.format(UploadFilePath.IMG_VIEW_PATH, num)).concat("tiles"));
|
|
|
+ List<String> strings = fYunFileService.listRemoteFiles(String.format(UploadFilePath.VIEW_PATH, num));
|
|
|
+ strings.stream().forEach(str->{
|
|
|
+ if(!str.contains("/tiles/4k/") && !str.contains("/tiles/2k/")){
|
|
|
+ fYunFileService.downloadFile(str, String.format(sourceLocal, num, this.wwwroot).concat(str));
|
|
|
+ }
|
|
|
+ });
|
|
|
// fYunFileService.downloadFile(String.format(UploadFilePath.VIEW_PATH, num), String.format(sourceLocal, num, this.wwwroot));
|
|
|
|
|
|
//特殊文件处理
|
|
@@ -417,7 +417,7 @@ public class DownloadServiceImpl implements IDownloadService {
|
|
|
//key.split("/" + resolution + "/")[0] + "/" +
|
|
|
var fky = dir + "/" + imageType.getName() + num + "_" + item.getI() + "_" + item.getJ() + ext;
|
|
|
|
|
|
- this.downloadFile(url, path + fky);
|
|
|
+ this.downloadFile(url, path + fky,1);
|
|
|
// this.downloadFile(url, path);
|
|
|
});
|
|
|
// }
|
|
@@ -425,13 +425,18 @@ public class DownloadServiceImpl implements IDownloadService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- public void downloadFile(String url, String path){
|
|
|
+ public void downloadFile(String url, String path,int index){
|
|
|
File file = new File(path);
|
|
|
if(!file.getParentFile().exists()){
|
|
|
file.getParentFile().mkdirs();
|
|
|
}
|
|
|
try {
|
|
|
- DownloadUtil.downFile(url,path);
|
|
|
+// DownloadUtil.downFile(url,path);
|
|
|
+ HttpUtil.downloadFileFromUrl(url,path);
|
|
|
+ if(FileUtil.size(new File(path)) == 0 && index < 4){
|
|
|
+ index++;
|
|
|
+ this.downloadFile(url,path,index);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
log.info("下载文件报错,url{},path:{}",url, path);
|
|
|
}
|
|
@@ -505,7 +510,9 @@ public class DownloadServiceImpl implements IDownloadService {
|
|
|
}
|
|
|
|
|
|
private void zip(String sourcePath, String zipPath) throws Exception {
|
|
|
- String cmd = "cd " + sourcePath + " && zip -r " + zipPath + " " + "*";
|
|
|
+ zipPath = zipPath.replace("mnt", "data");
|
|
|
+ String target = String.format("/mnt/scenes/%s", DateExtUtil.format(new Date(), DateExtUtil.dateStyle6));
|
|
|
+ String cmd = "cd " + sourcePath + " && zip -r " + zipPath + " * && mv -f " + zipPath + " " + target;
|
|
|
CmdUtils.callLineSh(cmd, 200);
|
|
|
if(!FileUtil.exist(zipPath)){
|
|
|
throw new RuntimeException("打包失败");
|