|
@@ -24,6 +24,7 @@ import com.fdkankan.common.util.CreateObjUtil;
|
|
|
import com.fdkankan.common.util.FileMd5Util;
|
|
|
import com.fdkankan.common.util.FileUtil;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
+import com.fdkankan.common.util.SceneUtil;
|
|
|
import com.fdkankan.fyun.constant.StorageType;
|
|
|
import com.fdkankan.fyun.oss.UploadToOssUtil;
|
|
|
import com.fdkankan.platform.api.feign.PlatformGoodsClient;
|
|
@@ -65,6 +66,7 @@ import com.fdkankan.scene.vo.*;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.errorprone.annotations.Var;
|
|
|
import java.io.File;
|
|
|
+import java.nio.charset.Charset;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Comparator;
|
|
@@ -814,13 +816,12 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
List<String> keyList = uploadToOssUtil.listKeys(imgCachePath);
|
|
|
|
|
|
//比对图片列表,不存在的要返回名称集合
|
|
|
+ String visionPath = path + "/results/vision.txt";
|
|
|
+ List<String> panoramaImageList = SceneUtil.getPanoramaImageList(visionPath);
|
|
|
List<String> notExistFileList = uploadFileList.stream().filter(filePath -> {
|
|
|
filePath = filePath.substring(filePath.lastIndexOf(File.separator) + 1);
|
|
|
- for (String key : keyList) {
|
|
|
- key = key.substring(key.lastIndexOf("/") + 1);
|
|
|
- if (filePath.equals(key)) {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ if(!panoramaImageList.contains(filePath)){
|
|
|
+ return false;
|
|
|
}
|
|
|
return true;
|
|
|
}).collect(Collectors.toList());
|
|
@@ -972,6 +973,13 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
String num = param.getNum();
|
|
|
String fileName = param.getFileName();
|
|
|
|
|
|
+ ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
+ if(Objects.isNull(scenePlus)){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
+ }
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
+ String path = scenePlusExt.getDataSource();
|
|
|
+
|
|
|
String cachePath = String.format(ConstantFilePath.SCENE_CACHE, num);
|
|
|
String imgCachePath = String.format(UploadFilePath.IMG_CACHES_PATH, num);
|
|
|
String localImagesPath = String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
|
|
@@ -996,12 +1004,17 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
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 这里有可能有问题,可能还需要考虑本地部署的情况
|
|
|
keyList.parallelStream().forEach(key->{
|
|
|
- if(key.endsWith(".jpg")){
|
|
|
- String file = key.substring(key.lastIndexOf("/") + 1);
|
|
|
+ String file = key.substring(key.lastIndexOf("/") + 1);
|
|
|
+ if(imageList.contains(file)){
|
|
|
String imageUrl = ossUrlPrefix + imgCachePath + file + "?t=" + System.currentTimeMillis();
|
|
|
FileUtils.downLoadFromUrl(imageUrl, file, localImagesPath);
|
|
|
}
|