Bladeren bron

获取全景图接口改造

dengsixing 1 jaar geleden
bovenliggende
commit
6d9e27d154
1 gewijzigde bestanden met toevoegingen van 15 en 6 verwijderingen
  1. 15 6
      src/main/java/com/fdkankan/openApi/service/www/impl/ScenePlusServiceImpl.java

+ 15 - 6
src/main/java/com/fdkankan/openApi/service/www/impl/ScenePlusServiceImpl.java

@@ -49,7 +49,7 @@ import java.util.stream.Collectors;
  * 场景主表 服务实现类
  * </p>
  *
- * @author 
+ * @author
  * @since 2023-02-15
  */
 @DS("www")
@@ -533,12 +533,21 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
     @Override
     public List<String> getScenePanoramicImageFiles(String sceneCode) {
         // 根据vision.txt 获取全景图文件
+        String imagePath = String.format(UploadFilePath.scene_result_data_path, sceneCode) + "caches/images/";
         String content = fYunFileService.getFileContent(String.format(UploadFilePath.IMG_VIEW_PATH, sceneCode).concat("vision.txt"));
-        JSONObject jsonObject = JSONObject.parseObject(content);
-        return jsonObject.getJSONArray("sweepLocations").stream()
-                .map(json -> String.format(fYunFileConfig.getHost()
-                        + UploadFilePath.scene_result_data_path, sceneCode).concat("caches/images/")
-                        + ((JSONObject) json).getString("uuid").concat(".jpg")).collect(Collectors.toList());
+        List<String> cacheImageList = fYunFileService.listRemoteFiles(imagePath);
+        if(!StrUtil.isEmpty(content) && CollUtil.isNotEmpty(cacheImageList)){
+            JSONObject jsonObject = JSONObject.parseObject(content);
+            String finalImagePath = imagePath;
+            return jsonObject.getJSONArray("sweepLocations").stream()
+                    .map(json -> fYunFileConfig.getHost() + finalImagePath + ((JSONObject) json).getString("uuid").concat(".jpg")).collect(Collectors.toList());
+        }
+        imagePath = String.format(UploadFilePath.IMG_VIEW_PATH, sceneCode) + "pan/high/";
+        List<String> imageList = fYunFileService.listRemoteFiles(imagePath);
+        if(CollUtil.isNotEmpty(imageList)){
+            return imageList.stream().map(key -> fYunFileConfig.getHost() + key).collect(Collectors.toList());
+        }
+        return null;
     }
 
     @Override