|
@@ -931,6 +931,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
//压缩文件保存目录
|
|
|
String zipTargetFilePath = targetImagesPath + file.getOriginalFilename();
|
|
|
|
|
|
+ //判断全景图缓存是否存在,如果不存在,从计算目录中拷贝到缓存目录
|
|
|
+ this.cachePanorama(path, num);
|
|
|
+
|
|
|
//先删除本地文件
|
|
|
FileUtils.deleteDirectory(targetImagesPath);
|
|
|
File targetFile = new File(zipTargetFilePath);
|
|
@@ -1162,6 +1165,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
String cacheFormat = "downloads/scene/%s/caches/";
|
|
|
String cacheImageFormat = "downloads/scene/%s/caches/images/";
|
|
|
|
|
|
+ //判断全景图缓存是否存在,如果不存在,从计算目录中拷贝到缓存目录
|
|
|
+ this.cachePanorama(scenePlusExt.getDataSource(), num);
|
|
|
+
|
|
|
String url = null;
|
|
|
String downloadName = null;
|
|
|
//如果入参文件名不为空,则是单个文件下载,不需要打包
|
|
@@ -1205,6 +1211,27 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
return ResultData.ok(map);
|
|
|
}
|
|
|
|
|
|
+ private void cachePanorama(String dataSource, String num){
|
|
|
+ String cachedImagesPath = String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
|
|
|
+ if(FileUtil.exist(cachedImagesPath) && CollUtil.isNotEmpty(FileUtil.listFileNames(cachedImagesPath))){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //将全景图缓存到缓存目录
|
|
|
+ List<String> imagesList = FileUtil.listFileNames(dataSource + "/caches/images");
|
|
|
+ //先清除旧的全景图
|
|
|
+ cn.hutool.core.io.FileUtil.del(cachedImagesPath);
|
|
|
+ String visionPath = dataSource + "/results/vision.txt";
|
|
|
+ List<String> panoramaImageList = SceneUtil.getPanoramaImageList(visionPath);
|
|
|
+ imagesList.stream().forEach(fileName -> {
|
|
|
+ if (panoramaImageList.contains(fileName)) {
|
|
|
+ String srcPath = dataSource + "/caches/images/" + fileName;
|
|
|
+ String targetPath = cachedImagesPath + fileName;
|
|
|
+ log.info("源文件:{}, 目标文件:{}", srcPath, targetPath);
|
|
|
+ cn.hutool.core.io.FileUtil.copy(srcPath, targetPath, true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void saveTagsToSceneEditInfo(String num, SceneEditInfo sceneEditInfo){
|
|
|
//查询缓存是否包含热点数据
|