瀏覽代碼

上传全景图校验是否有可用jpg文件

dengsixing 3 年之前
父節點
當前提交
f284bb7d6a

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

@@ -732,8 +732,8 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
             .getScenePlusExtByPlusId(scenePlus.getId());
 
         //原始计算根目录
-//      String path = "F:\\test";
-        String path = scenePlusExt.getDataSource();
+      String path = "F:\\test";
+//        String path = scenePlusExt.getDataSource();
         //全景图计算根目录
         String target = path + "_images";
         //解压缩文件存放目录
@@ -786,6 +786,21 @@ 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")){
+                    return true;
+                }
+                return false;
+            });
+        }
+        if(!existJpg){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5061);
+        }
+
         //上传
         Map<String, String> map = new HashMap<>();
         uploadFileList.stream().forEach(filePath->{