|
@@ -814,7 +814,6 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
|
|
|
//列出caches/images中的文件列表
|
|
|
String imgCachePath = String.format(UploadFilePath.IMG_CACHES_PATH, num);
|
|
|
- List<String> keyList = uploadToOssUtil.listKeys(imgCachePath);
|
|
|
|
|
|
//比对图片列表,不存在的要返回名称集合
|
|
|
String visionPath = path + "/results/vision.txt";
|
|
@@ -847,9 +846,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
|
|
|
//上传
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
- uploadFileList.stream().forEach(filePath->{
|
|
|
- map.put(filePath, filePath.replace(targetImagesPath, imgCachePath));
|
|
|
- });
|
|
|
+// uploadFileList.stream().forEach(filePath->{
|
|
|
+// map.put(filePath, filePath.replace(targetImagesPath, imgCachePath));
|
|
|
+// });
|
|
|
|
|
|
String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
|
|
|
FileUtils.downLoadFromUrl(ossUrlPrefix + imgViewPath + "vision.modeldata" + "?m="+new Date().getTime(),
|
|
@@ -953,6 +952,12 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
uploadToOssUtil.uploadMulFiles(map);
|
|
|
}
|
|
|
|
|
|
+ //拷贝修改后的全景图到缓存目录
|
|
|
+ String cachedImagesPath = String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
|
|
|
+ uploadFileList.stream().forEach(srcPath->{
|
|
|
+ cn.hutool.core.io.FileUtil.copy(srcPath, srcPath.replace(targetImagesPath, cachedImagesPath), true);
|
|
|
+ });
|
|
|
+
|
|
|
//更新版本号
|
|
|
SceneEditInfo sceneEditInfo = this.getByScenePlusId(scenePlus.getId());
|
|
|
this.upgradeVersionById(sceneEditInfo.getId());
|
|
@@ -992,41 +997,33 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
String downloadName = null;
|
|
|
//删除本地文件
|
|
|
FileUtils.deleteDirectory(localImagesPath);
|
|
|
- long start = Calendar.getInstance().getTimeInMillis();
|
|
|
//如果入参文件名不为空,则是单个文件下载,不需要打包
|
|
|
- boolean single = true;
|
|
|
if(StrUtil.isNotEmpty(fileName)){
|
|
|
//如果是单张图片,直接提供oss url
|
|
|
- if (!StorageType.LOCAL.code().equals(this.type)) {
|
|
|
- String filePath = imgCachePath + fileName;
|
|
|
- url = ossUrlPrefix + filePath;
|
|
|
+ String localFilePath = localImagesPath + fileName;
|
|
|
+ String ossFilePath = imgCachePath + fileName;
|
|
|
+ uploadToOssUtil.upload(localFilePath, ossFilePath);
|
|
|
+ url = ossUrlPrefix + ossFilePath;
|
|
|
// FileUtils.downLoadFromUrl(imageUrl, fileName, localImagesPath);
|
|
|
- }
|
|
|
downloadName = fileName;
|
|
|
}else{
|
|
|
- single = false;
|
|
|
-
|
|
|
//从vision.txt中读取有效全景图名称列表
|
|
|
- String visionPath = path + "/results/vision.txt";
|
|
|
- List<String> imageList = SceneUtil.getPanoramaImageList(visionPath);
|
|
|
-
|
|
|
- //先下载到本地
|
|
|
- List<String> keyList = uploadToOssUtil.listKeys(imgCachePath);
|
|
|
- if (!StorageType.LOCAL.code().equals(this.type)) {// TODO: 2022/2/15 这里有可能有问题,可能还需要考虑本地部署的情况
|
|
|
-// System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "8");
|
|
|
- keyList.stream().forEach(key->{
|
|
|
- String file = key.substring(key.lastIndexOf("/") + 1);
|
|
|
- if(imageList.contains(file)){
|
|
|
- String imageUrl = ossUrlPrefix + imgCachePath + file + "?t=" + System.currentTimeMillis();
|
|
|
- FileUtils.downLoadFromUrl(imageUrl, file, localImagesPath);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- long downloadEnd = Calendar.getInstance().getTimeInMillis();
|
|
|
- log.info("全景图下载耗时,num:{}, time:{}", num, downloadEnd - start);
|
|
|
+// String visionPath = path + "/results/vision.txt";
|
|
|
+// List<String> imageList = SceneUtil.getPanoramaImageList(visionPath);
|
|
|
+//
|
|
|
+// //先下载到本地
|
|
|
+// List<String> keyList = cn.hutool.core.io.FileUtil.listFileNames(imgCachePath);
|
|
|
+// if (!StorageType.LOCAL.code().equals(this.type)) {// TODO: 2022/2/15 这里有可能有问题,可能还需要考虑本地部署的情况
|
|
|
+//// System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "8");
|
|
|
+// keyList.stream().forEach(key->{
|
|
|
+// String file = key.substring(key.lastIndexOf("/") + 1);
|
|
|
+// if(imageList.contains(file)){
|
|
|
+// String imageUrl = ossUrlPrefix + imgCachePath + file + "?t=" + System.currentTimeMillis();
|
|
|
+// FileUtils.downLoadFromUrl(imageUrl, file, localImagesPath);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
|
|
|
- if(!single){
|
|
|
downloadName = num + "_images.zip";
|
|
|
//打包
|
|
|
String zipPath = cachePath + downloadName;
|
|
@@ -1036,11 +1033,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
url = ossUrlPrefix + String.format(cacheFormat, num) + downloadName;
|
|
|
//删除本地压缩包
|
|
|
FileUtils.deleteFile(zipPath);
|
|
|
- //删除本地目录
|
|
|
- FileUtils.deleteDirectory(localImagesPath);
|
|
|
+// //删除本地目录
|
|
|
+// FileUtils.deleteDirectory(localImagesPath);
|
|
|
}
|
|
|
- long end = Calendar.getInstance().getTimeInMillis();
|
|
|
- log.info("全景图压缩包上传耗时,num:{}, time:{}", num, end - downloadEnd);
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("fileUrl", url + "?t=" + System.currentTimeMillis());
|