浏览代码

修复bug:
1、全景图上传,下载还是旧的
2、全景图压缩包下载,排除非.jpg文件

dengsixing 3 年之前
父节点
当前提交
342a87e611

+ 7 - 6
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java

@@ -755,9 +755,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         //全景图计算根目录
         String target = path + "_images";
         //解压缩文件存放目录
-        String targetImagesPath = target + "/extras/images";
+        String targetImagesPath = target + "/extras/images/";
         //压缩文件保存目录
-        String zipTargetFilePath = targetImagesPath + File.separator + file.getOriginalFilename();
+        String zipTargetFilePath = targetImagesPath + file.getOriginalFilename();
 
         //压缩包保存到本地
 //        String cachePath =  String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
@@ -795,7 +795,6 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
 
         //判断是否有可用的jpg文件
         boolean existJpg = false;
-        uploadFileList = FileUtil.getFileList(targetImagesPath);
         if(CollUtil.isNotEmpty(uploadFileList)){
             existJpg = uploadFileList.stream().anyMatch(str -> {
                 if(str.endsWith(".jpg")){
@@ -999,9 +998,11 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
             List<String> keyList = uploadToOssUtil.listKeys(imgCachePath);
             if (!StorageType.LOCAL.code().equals(this.type)) {// TODO: 2022/2/15 这里有可能有问题,可能还需要考虑本地部署的情况
                 keyList.parallelStream().forEach(key->{
-                    String file = key.substring(key.lastIndexOf("/") + 1);
-                    String imageUrl = ossUrlPrefix + imgCachePath + file + "?t=" + System.currentTimeMillis();
-                    FileUtils.downLoadFromUrl(imageUrl, file, localImagesPath);
+                    if(key.endsWith(".jpg")){
+                        String file = key.substring(key.lastIndexOf("/") + 1);
+                        String imageUrl = ossUrlPrefix + imgCachePath + file + "?t=" + System.currentTimeMillis();
+                        FileUtils.downLoadFromUrl(imageUrl, file, localImagesPath);
+                    }
                 });
             }
         }