dsx 2 năm trước cách đây
mục cha
commit
f52cd0c6e6
21 tập tin đã thay đổi với 221 bổ sung417 xóa
  1. 13 9
      src/main/java/com/fdkankan/scene/config/FdkkLaserConfig.java
  2. 1 1
      src/main/java/com/fdkankan/scene/config/InterceptorConfig.java
  3. 2 2
      src/main/java/com/fdkankan/scene/controller/SceneController.java
  4. 0 150
      src/main/java/com/fdkankan/scene/controller/SceneMarkShapeController.java
  5. 47 127
      src/main/java/com/fdkankan/scene/oss/OssUtil.java
  6. 1 1
      src/main/java/com/fdkankan/scene/service/IScenePlusService.java
  7. 1 1
      src/main/java/com/fdkankan/scene/service/ISceneService.java
  8. 2 2
      src/main/java/com/fdkankan/scene/service/impl/BoxModelServiceImpl.java
  9. 1 1
      src/main/java/com/fdkankan/scene/service/impl/DownloadTourVideoServiceImpl.java
  10. 11 1
      src/main/java/com/fdkankan/scene/service/impl/SceneAsynOperLogServiceImpl.java
  11. 14 14
      src/main/java/com/fdkankan/scene/service/impl/SceneDownloadHandlerServiceImpl.java
  12. 7 1
      src/main/java/com/fdkankan/scene/service/impl/SceneDownloadLogServiceImpl.java
  13. 1 1
      src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoExtServiceImpl.java
  14. 48 46
      src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java
  15. 6 3
      src/main/java/com/fdkankan/scene/service/impl/SceneEditServiceImpl.java
  16. 29 9
      src/main/java/com/fdkankan/scene/service/impl/ScenePlusServiceImpl.java
  17. 23 25
      src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java
  18. 7 20
      src/main/java/com/fdkankan/scene/service/impl/SceneServiceImpl.java
  19. 4 3
      src/main/java/com/fdkankan/scene/service/impl/SceneUploadServiceImpl.java
  20. 1 0
      src/main/java/com/fdkankan/scene/vo/InitSceneParamVO.java
  21. 2 0
      src/main/java/com/fdkankan/scene/vo/SceneParamVO.java

+ 13 - 9
src/main/java/com/fdkankan/scene/config/FdkkLaserConfig.java

@@ -1,6 +1,7 @@
 package com.fdkankan.scene.config;
 
 import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.StrUtil;
 import lombok.Data;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.stereotype.Component;
@@ -62,7 +63,10 @@ public class FdkkLaserConfig {
     }
 
 
-    public static String getProfile() {
+    public static String getProfile(String prefix) {
+        if(StrUtil.isNotEmpty(prefix)){
+            return prefix;
+        }
         return FdkkLaserConfig.profile;
     }
 
@@ -101,28 +105,28 @@ public class FdkkLaserConfig {
     /**
      * 获取导入上传路径
      */
-    public static String getImportPath() {
-        return FdkkLaserConfig.getProfile() + "/import";
+    public static String getImportPath(String prefix) {
+        return FdkkLaserConfig.getProfile(prefix) + "/import";
     }
 
     /**
      * 获取头像上传路径
      */
-    public static String getAvatarPath() {
-        return FdkkLaserConfig.getProfile() + "/avatar";
+    public static String getAvatarPath(String prefix) {
+        return FdkkLaserConfig.getProfile(prefix) + "/avatar";
     }
 
     /**
      * 获取下载路径
      */
-    public static String getDownloadPath() {
-        return FdkkLaserConfig.getProfile() + "/download/";
+    public static String getDownloadPath(String prefix) {
+        return FdkkLaserConfig.getProfile(prefix) + "/download/";
     }
 
     /**
      * 获取上传路径
      */
-    public static String getUploadPath() {
-        return FdkkLaserConfig.getProfile() + "/upload";
+    public static String getUploadPath(String prefix) {
+        return FdkkLaserConfig.getProfile(prefix) + "/upload";
     }
 }

+ 1 - 1
src/main/java/com/fdkankan/scene/config/InterceptorConfig.java

@@ -31,7 +31,7 @@ public class InterceptorConfig implements WebMvcConfigurer {
 
 	@Override
 	public void addResourceHandlers(ResourceHandlerRegistry registry) {
-		registry.addResourceHandler( "/profile/**").addResourceLocations("file:" + FdkkLaserConfig.getProfile() + "/");
+		registry.addResourceHandler( "/profile/**").addResourceLocations("file:" + FdkkLaserConfig.getProfile(null) + "/");
 		WebMvcConfigurer.super.addResourceHandlers(registry);
 	}
 

+ 2 - 2
src/main/java/com/fdkankan/scene/controller/SceneController.java

@@ -83,7 +83,7 @@ public class SceneController extends BaseController {
 
     @PostMapping("/initScene")
     public ResultData initScene(@RequestBody InitSceneParamVO param){
-        return scenePlusService.initScene(param.getNum(), param.getTitle(), param.getDes(),
+        return scenePlusService.initScene(param.getBucket(), param.getNum(), param.getTitle(), param.getDes(),
                 param.getSceneSource(), param.getDataSource(), param.getSceneScheme(),
                 param.getSceneResolution(), param.getSceneFrom());
     }
@@ -134,7 +134,7 @@ public class SceneController extends BaseController {
     @PostMapping("/copyScene")
     public ResultData copyScene(@RequestBody SceneParamVO param) throws Exception {
 //        String username = JwtUtil.getUsername(getToken());
-        sceneService.copyScene(param.getNewNum(), param.getSceneNum(),null, param.getDataSource());
+        sceneService.copyScene(param.getNewNum(), param.getSceneNum(),null, param.getDataSource(), param.getBucket());
         return ResultData.ok();
     }
 

+ 0 - 150
src/main/java/com/fdkankan/scene/controller/SceneMarkShapeController.java

@@ -1,150 +0,0 @@
-package com.fdkankan.scene.controller;
-
-import cn.hutool.core.io.FileUtil;
-import cn.hutool.core.util.ObjectUtil;
-import com.fdkankan.model.constants.UploadFilePath;
-import com.fdkankan.scene.entity.SceneMarkShape;
-import com.fdkankan.scene.entity.ScenePlus;
-import com.fdkankan.scene.entity.ScenePlusExt;
-import com.fdkankan.scene.oss.OssUtil;
-import com.fdkankan.scene.service.ISceneMarkShapeService;
-import com.fdkankan.scene.service.IScenePlusExtService;
-import com.fdkankan.scene.service.IScenePlusService;
-import com.fdkankan.scene.vo.SceneMarkShapeDetectParamVO;
-import com.fdkankan.scene.vo.SceneMarkShapeParamVO;
-import com.fdkankan.scene.vo.SceneMarkShapeReDetectParamVO;
-import com.fdkankan.web.controller.BaseController;
-import com.fdkankan.web.response.ResultData;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.annotation.Resource;
-import java.io.IOException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * 初始化接口
- *
- * @author fdkk
- */
-@RestController
-@RequestMapping("/service/scene/sceneMarkShape")
-@Slf4j
-public class SceneMarkShapeController extends BaseController
-{
-//    @Value("${queue.scene.yolov5-detect-queue}")
-//    private String yolov5DetectQueue;
-    @Autowired
-    private ISceneMarkShapeService sceneMarkShapeService;
-    @Resource
-    private OssUtil ossUtil;
-    @Autowired
-    private IScenePlusService scenePlusService;
-    @Autowired
-    private IScenePlusExtService scenePlusExtService;
-    @Value("${fyun.host:xxx}")
-    private String ossUrlPrefix;
-    @Value("${main.url:xxx}")
-    private String mainUrl;
-
-
-    /**
-     * 获取场景全景图路径连接
-     */
-    @PostMapping("/getPanorama")
-    public ResultData getPanorama(@RequestBody @Validated  SceneMarkShapeParamVO param) {
-        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
-        if(ObjectUtil.isNotNull(scenePlus)) {
-            ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
-            if (ObjectUtil.isNotNull(scenePlus)) {
-                String publicUserPath = null;
-                List<String> panoramaList = ossUtil.listFiles(publicUserPath + "caches/images/");
-                List<String> panoramaListUrl = panoramaList.stream().filter(f -> FileUtil.extName(f).equals("jpg")).map(s -> ossUrlPrefix + s).collect(Collectors.toList());
-                return ResultData.ok(panoramaListUrl);
-            }
-        }
-        return ResultData.ok("场景数据不存在");
-    }
-    /**
-     * 根据场景码和图片名称获取数据
-     */
-    @PostMapping("/getInfo")
-    public ResultData getInfo(@RequestBody @Validated  SceneMarkShapeParamVO param) {
-        SceneMarkShape res=  sceneMarkShapeService.findByNumAndImagePath(param.getNum(),param.getImagePath());
-        return ResultData.ok(res);
-    }
-    /**
-     * 将需要推理的场景推入到队列
-     */
-    @PostMapping("/detectScene")
-    public ResultData detect(@RequestBody @Validated SceneMarkShapeDetectParamVO param) {
-        param.setWebSite(mainUrl);
-//        rabbitMqProducer.sendByWorkQueue(yolov5DetectQueue, param);
-        return ResultData.ok();
-    }
-    /**
-     * 将需要训练的场景推入到队列
-     */
-    @PostMapping("/trainScene")
-    public ResultData trainScene(@RequestBody @Validated SceneMarkShapeReDetectParamVO param) {
-        sceneMarkShapeService.trainScene(param);
-        return ResultData.ok();
-    }
-    /**
-     * 将需要重新推理的场景推入到队列
-     */
-    @PostMapping("/editReDetectStatus")
-    public ResultData editReDetectStatus(@RequestBody @Validated SceneMarkShapeParamVO param) {
-        sceneMarkShapeService.editTrainStatus(param);
-        return ResultData.ok();
-    }
-    /**
-     * 保存或者修改
-     */
-    @PostMapping("/saveOrEdit")
-    public ResultData save(@RequestParam(value = "num") String num,@RequestParam("file") MultipartFile file) throws IOException {
-        sceneMarkShapeService.saveFileToDB(file,num);
-        return ResultData.ok();
-    }
-    /**
-     * 保存或者修改JSON
-     */
-    @PostMapping("/saveOrEditJson")
-    public ResultData saveOrEditJson(@RequestBody SceneMarkShape param) {
-        SceneMarkShape shape = sceneMarkShapeService.findByNumAndImagePath(param.getNum(), param.getImagePath());
-        if (ObjectUtil.isNotNull(shape)){
-            param.setId(shape.getId());
-            param.setUpdateTime(new Date());
-            return ResultData.ok(sceneMarkShapeService.updateById(param));
-        }else {
-            param.setCreateTime(new Date());
-            return ResultData.ok(sceneMarkShapeService.save(param));
-        }
-    }
-    /**
-     * 保存或者修改JSON
-     */
-    @PostMapping("/editLabel")
-    public ResultData editLabel(@RequestParam(value = "num") String num,@RequestParam(value = "imgPath") String imgPath,@RequestParam("file") MultipartFile file) throws IOException {
-        log.info("进入editLabel---num{},imgPath{}",num,imgPath);
-        return sceneMarkShapeService.editLabelByFile(num, imgPath, file);
-    }
-    /**
-     * 保存或者修改JSON
-     */
-    @PostMapping("/testquery")
-    public ResultData testquery()   {
-        Map<String, List<SceneMarkShape>> res=new HashMap<>();
-        res.put("findByReTrainStatus",sceneMarkShapeService.findByReTrainStatus(1));
-        res.put("findByToTrainStatus",sceneMarkShapeService.findByToTrainStatus(0));
-        return ResultData.ok(res);
-    }
-}

+ 47 - 127
src/main/java/com/fdkankan/scene/oss/OssUtil.java

@@ -36,7 +36,7 @@ public class OssUtil {
         return fdkkLaserConfig.getDefaultFolder() + "/" + sceneCode + "/temp/" + type + "/" + fileName;
     }
 
-    public void rmFileCmd(String targetDir) {
+    public void rmFileCmd(String prefix, String targetDir) {
         if (FdkkLaserConfig.isBucket()) {
             if (FdkkLaserConfig.isLocalization()) {
                 minioOssTemplate.rmFileCmd(targetDir);
@@ -44,7 +44,7 @@ public class OssUtil {
                 aliyunOssTemplate.rmFileCmd(targetDir);
             }
         } else {
-            FileUtil.del(FdkkLaserConfig.getProfile() + File.separator + targetDir.replaceAll("/", Matcher.quoteReplacement(File.separator)));
+            FileUtil.del(FdkkLaserConfig.getProfile(prefix) + File.separator + targetDir.replaceAll("/", Matcher.quoteReplacement(File.separator)));
         }
 
     }
@@ -62,7 +62,7 @@ public class OssUtil {
     }
 
 
-    public void uploadFileChunkCmd(String defaultFolder, String sceneCode, String uploadDir, String targetDir, String mergeCode, boolean isLink) {
+    public void uploadFileChunkCmd(String prefix, String defaultFolder, String sceneCode, String uploadDir, String targetDir, String mergeCode, boolean isLink) {
         if (FdkkLaserConfig.isBucket()) {
             if (FdkkLaserConfig.isLocalization()) {
                 minioOssTemplate.uploadFileChunkCmd(defaultFolder, sceneCode, uploadDir, targetDir, mergeCode);
@@ -71,7 +71,7 @@ public class OssUtil {
             }
         } else {
             if (isLink) {
-                String path = FdkkLaserConfig.getProfile() + File.separator + defaultFolder + File.separator + sceneCode + File.separator + "data" + File.separator + mergeCode;
+                String path = FdkkLaserConfig.getProfile(prefix) + File.separator + defaultFolder + File.separator + sceneCode + File.separator + "data" + File.separator + mergeCode;
                 String targetPath = path + File.separator + targetDir;
                 if (!FileUtil.exist(path)) {
                     FileUtil.mkdir(path);
@@ -81,7 +81,7 @@ public class OssUtil {
                 }
                 CmdBuildUtil.MkLinkDir(targetPath, FileUtil.file(uploadDir).getAbsolutePath());
             } else {
-                String path = FdkkLaserConfig.getProfile() + File.separator + defaultFolder + File.separator + sceneCode + File.separator + "data" + File.separator + mergeCode;
+                String path = FdkkLaserConfig.getProfile(prefix) + File.separator + defaultFolder + File.separator + sceneCode + File.separator + "data" + File.separator + mergeCode;
                 if (FileUtil.exist(FileUtil.file(uploadDir))) {
                     FileUtil.copy(
                             FileUtil.file(uploadDir),
@@ -94,7 +94,7 @@ public class OssUtil {
     }
 
 
-    public void uploadFileDirCmd(String uploadDir, String target, Boolean isLink) {
+    public void uploadFileDirCmd(String prefix, String uploadDir, String target, Boolean isLink) {
         if (FdkkLaserConfig.isBucket()) {
             if (FdkkLaserConfig.isLocalization()) {
                 minioOssTemplate.uploadFileDirCmd(uploadDir, target);
@@ -103,7 +103,7 @@ public class OssUtil {
             }
         } else {
             if (isLink) {
-                String path = FdkkLaserConfig.getProfile() + File.separator + target;
+                String path = FdkkLaserConfig.getProfile(prefix) + File.separator + target;
                 File folder = FileUtil.file(path);
                 if (!FileUtil.exist(folder.getParent())) {
                     FileUtil.mkdir(folder.getParent());
@@ -114,7 +114,7 @@ public class OssUtil {
                 for (File l : ls) {
                     FileUtil.copy(
                             FileUtil.file(l),
-                            FileUtil.file(FdkkLaserConfig.getProfile() + File.separator + target),
+                            FileUtil.file(FdkkLaserConfig.getProfile(prefix) + File.separator + target),
                             true);
                 }
             }
@@ -124,7 +124,7 @@ public class OssUtil {
     }
 
 
-    public String uploadFile(String pathKey, String filePath, boolean isLink) {
+    public String uploadFile(String prefix, String pathKey, String filePath, boolean isLink) {
         if (FdkkLaserConfig.isBucket()) {
             if (FdkkLaserConfig.isLocalization()) {
                 return minioOssTemplate.uploadFile(pathKey, filePath);
@@ -137,35 +137,20 @@ public class OssUtil {
                 if (!FileUtil.exist(file.getParent())) {
                     FileUtil.mkdir(file.getParent());
                 }
-                File pathKeyFile = FileUtil.file(FdkkLaserConfig.getProfile() + File.separator + pathKey);
+                File pathKeyFile = FileUtil.file(FdkkLaserConfig.getProfile(prefix) + File.separator + pathKey);
                 if (!FileUtil.exist(pathKeyFile.getParent())) {
                     FileUtil.mkdir(pathKeyFile.getParent());
                 }
                 CmdBuildUtil.MkLinkFile(pathKeyFile.getAbsolutePath(), file.getAbsolutePath());
             } else {
                 FileUtil.copy(filePath,
-                        FdkkLaserConfig.getProfile() + File.separator + pathKey,
+                        FdkkLaserConfig.getProfile(prefix) + File.separator + pathKey,
                         true);
             }
             return pathKey;
         }
     }
 
-
-    public String uploadFileText(String pathKey, String text) {
-        if (FdkkLaserConfig.isBucket()) {
-            if (FdkkLaserConfig.isLocalization()) {
-                return minioOssTemplate.uploadFileText(pathKey, text);
-            } else {
-                return aliyunOssTemplate.uploadFileText(pathKey, text);
-            }
-        } else {
-            FileUtil.writeBytes(text.getBytes(StandardCharsets.UTF_8), FdkkLaserConfig.getProfile() + File.separator + pathKey);
-            return pathKey;
-        }
-    }
-
-
     public String uploadFileText(String bucket, String pathKey, String text) {
         if (FdkkLaserConfig.isBucket()) {
             if (FdkkLaserConfig.isLocalization()) {
@@ -174,27 +159,11 @@ public class OssUtil {
                 return aliyunOssTemplate.uploadFileText(bucket, pathKey, text);
             }
         } else {
-            FileUtil.writeBytes(text.getBytes(StandardCharsets.UTF_8), FdkkLaserConfig.getProfile() + File.separator + pathKey);
-            return pathKey;
-        }
-    }
-
-
-    public String uploadFileBase64Image(String pathKey, String base64) {
-        if (FdkkLaserConfig.isBucket()) {
-            if (FdkkLaserConfig.isLocalization()) {
-                return minioOssTemplate.uploadFileBase64Image(pathKey, base64);
-            } else {
-                return aliyunOssTemplate.uploadFileBase64Image(pathKey, base64);
-            }
-        } else {
-            byte[] bytes = Base64Utils.decodeFromString(base64);
-            FileUtil.writeBytes(bytes, FdkkLaserConfig.getProfile() + File.separator + pathKey);
+            FileUtil.writeBytes(text.getBytes(StandardCharsets.UTF_8), FdkkLaserConfig.getProfile(bucket) + File.separator + pathKey);
             return pathKey;
         }
     }
 
-
     public String uploadFileBase64Image(String bucket, String pathKey, String base64) {
         if (FdkkLaserConfig.isBucket()) {
             if (FdkkLaserConfig.isLocalization()) {
@@ -204,26 +173,11 @@ public class OssUtil {
             }
         } else {
             byte[] bytes = Base64Utils.decodeFromString(base64);
-            FileUtil.writeBytes(bytes, FdkkLaserConfig.getProfile() + File.separator + pathKey);
-            return pathKey;
-        }
-    }
-
-
-    public String uploadFileBytes(String pathKey, byte[] bytes) {
-        if (FdkkLaserConfig.isBucket()) {
-            if (FdkkLaserConfig.isLocalization()) {
-                return minioOssTemplate.uploadFileBytes(pathKey, bytes);
-            } else {
-                return aliyunOssTemplate.uploadFileBytes(pathKey, bytes);
-            }
-        } else {
-            FileUtil.writeBytes(bytes, FdkkLaserConfig.getProfile() + File.separator + pathKey);
+            FileUtil.writeBytes(bytes, FdkkLaserConfig.getProfile(bucket) + File.separator + pathKey);
             return pathKey;
         }
     }
 
-
     public String uploadFileBytes(String bucket, String pathKey, byte[] bytes) {
         if (FdkkLaserConfig.isBucket()) {
             if (FdkkLaserConfig.isLocalization()) {
@@ -232,26 +186,11 @@ public class OssUtil {
                 return aliyunOssTemplate.uploadFileBytes(bucket, pathKey, bytes);
             }
         } else {
-            FileUtil.writeBytes(bytes, FdkkLaserConfig.getProfile() + File.separator + pathKey);
+            FileUtil.writeBytes(bytes, FdkkLaserConfig.getProfile(bucket) + File.separator + pathKey);
             return pathKey;
         }
     }
 
-
-    public String uploadFileStream(String pathKey, InputStream stream) {
-        if (FdkkLaserConfig.isBucket()) {
-            if (FdkkLaserConfig.isLocalization()) {
-                return minioOssTemplate.uploadFileStream(pathKey, stream);
-            } else {
-                return aliyunOssTemplate.uploadFileStream(pathKey, stream);
-            }
-        } else {
-            FileUtil.writeFromStream(stream, FdkkLaserConfig.getProfile() + File.separator + pathKey);
-            return pathKey;
-        }
-    }
-
-
     public String uploadFileStream(String bucket, String pathKey, InputStream stream) {
         if (FdkkLaserConfig.isBucket()) {
             if (FdkkLaserConfig.isLocalization()) {
@@ -260,13 +199,13 @@ public class OssUtil {
                 return aliyunOssTemplate.uploadFileStream(bucket, pathKey, stream);
             }
         } else {
-            FileUtil.writeFromStream(stream, FdkkLaserConfig.getProfile() + File.separator + pathKey);
+            FileUtil.writeFromStream(stream, FdkkLaserConfig.getProfile(bucket) + File.separator + pathKey);
             return pathKey;
         }
     }
 
 
-    public String uploadFileImage(String pathKey, String filePath, boolean isLink) {
+    public String uploadFileImage(String prefix, String pathKey, String filePath, boolean isLink) {
         if (FdkkLaserConfig.isBucket()) {
             if (FdkkLaserConfig.isLocalization()) {
                 return minioOssTemplate.uploadFileImage(pathKey, filePath);
@@ -279,14 +218,14 @@ public class OssUtil {
                 if (!FileUtil.exist(file.getParent())) {
                     FileUtil.mkdir(file.getParent());
                 }
-                File pathKeyFile = FileUtil.file(FdkkLaserConfig.getProfile() + File.separator + pathKey);
+                File pathKeyFile = FileUtil.file(FdkkLaserConfig.getProfile(prefix) + File.separator + pathKey);
                 if (!FileUtil.exist(pathKeyFile.getParent())) {
                     FileUtil.mkdir(pathKeyFile.getParent());
                 }
                 CmdBuildUtil.MkLinkFile(pathKeyFile.getAbsolutePath(), file.getAbsolutePath());
             } else {
                 FileUtil.copy(filePath,
-                        FdkkLaserConfig.getProfile() + File.separator + pathKey,
+                        FdkkLaserConfig.getProfile(prefix) + File.separator + pathKey,
                         true);
             }
 
@@ -313,7 +252,7 @@ public class OssUtil {
     }
 
 
-    public Object downloadFile(String pathKey, String file) {
+    public Object downloadFile(String prefix, String pathKey, String file) {
         if (FdkkLaserConfig.isBucket()) {
             if (FdkkLaserConfig.isLocalization()) {
                 return minioOssTemplate.downloadFile(pathKey, file);
@@ -322,10 +261,10 @@ public class OssUtil {
             }
         }else{
             String copyPath="";
-            if (pathKey.contains(FdkkLaserConfig.getProfile())){
+            if (pathKey.contains(FdkkLaserConfig.getProfile(prefix))){
                 copyPath=pathKey;
             }else {
-                copyPath=FdkkLaserConfig.getProfile() + File.separator + pathKey;
+                copyPath=FdkkLaserConfig.getProfile(prefix) + File.separator + pathKey;
             }
             File copy = FileUtil.copy(new File(copyPath),
                     new File(file), true);
@@ -334,16 +273,7 @@ public class OssUtil {
     }
 
 
-    public Object downloadFile(String bucket, String pathKey, String file) {
-        if (FdkkLaserConfig.isLocalization()) {
-            return minioOssTemplate.downloadFile(bucket, pathKey, file);
-        } else {
-            return aliyunOssTemplate.downloadFile(bucket, pathKey, file);
-        }
-    }
-
-
-    public Boolean copyObject(String oldPath, String newPath) {
+    public Boolean copyObject(String prefix, String oldPath, String newPath) {
         if (FdkkLaserConfig.isBucket()) {
             if (FdkkLaserConfig.isLocalization()) {
                 return minioOssTemplate.copyObject(oldPath, newPath);
@@ -351,23 +281,29 @@ public class OssUtil {
                 return aliyunOssTemplate.copyObject(oldPath, newPath);
             }
         }else{
-            File copy = FileUtil.copy(FdkkLaserConfig.getProfile() + File.separator + oldPath,
-                FdkkLaserConfig.getProfile() + File.separator + newPath, true);
+            File copy = FileUtil.copy(FdkkLaserConfig.getProfile(prefix) + File.separator + oldPath,
+                FdkkLaserConfig.getProfile(prefix) + File.separator + newPath, true);
             return copy.exists();
         }
     }
 
 
     public Boolean copyObject(String bucket, String oldPath, String toBucket, String newPath) {
-        if (FdkkLaserConfig.isLocalization()) {
-            return minioOssTemplate.copyObject(bucket, oldPath, toBucket, newPath);
-        } else {
-            return aliyunOssTemplate.copyObject(bucket, oldPath, toBucket, newPath);
+        if (FdkkLaserConfig.isBucket()) {
+            if (FdkkLaserConfig.isLocalization()) {
+                return minioOssTemplate.copyObject(bucket, oldPath, toBucket, newPath);
+            } else {
+                return aliyunOssTemplate.copyObject(bucket, oldPath, toBucket, newPath);
+            }
+        }else{
+            File copy = FileUtil.copy(FdkkLaserConfig.getProfile(bucket) + File.separator + oldPath,
+                    FdkkLaserConfig.getProfile(toBucket) + File.separator + newPath, true);
+            return copy.exists();
         }
     }
 
 
-    public void deleteObject(String keyName) throws FileSystemException {
+    public void deleteObject(String prefix, String keyName) throws FileSystemException {
         if (FdkkLaserConfig.isBucket()) {
             if (FdkkLaserConfig.isLocalization()) {
                 minioOssTemplate.deleteObject(keyName);
@@ -376,17 +312,11 @@ public class OssUtil {
             }
         } else {
             FileUtil.del(
-                    FdkkLaserConfig.getProfile() + File.separator + keyName
+                    FdkkLaserConfig.getProfile(prefix) + File.separator + keyName
             );
         }
     }
 
-
-    public void deleteObject(String bucket, String keyName) {
-
-    }
-
-
     public List<String> getFileFolder(String keyName) {
         return null;
     }
@@ -396,17 +326,7 @@ public class OssUtil {
         return null;
     }
 
-
-    public boolean doesObjectExist(String bucket, String keyName) {
-        if (FdkkLaserConfig.isLocalization()) {
-            return minioOssTemplate.doesObjectExist(bucket, keyName);
-        } else {
-            return aliyunOssTemplate.doesObjectExist(bucket, keyName);
-        }
-    }
-
-
-    public boolean doesObjectExist(String keyName) {
+    public boolean doesObjectExist(String prefix, String keyName) {
         if (FdkkLaserConfig.isBucket()) {
             if (FdkkLaserConfig.isLocalization()) {
                 return minioOssTemplate.doesObjectExist(keyName);
@@ -414,7 +334,7 @@ public class OssUtil {
                 return aliyunOssTemplate.doesObjectExist(keyName);
             }
         } else {
-            return FileUtil.exist(FdkkLaserConfig.getProfile() + File.separator + keyName);
+            return FileUtil.exist(FdkkLaserConfig.getProfile(prefix) + File.separator + keyName);
         }
     }
 
@@ -428,7 +348,7 @@ public class OssUtil {
         return null;
     }
 
-    public String calculateUrl(String keyName) {
+    public String calculateUrl(String prefix, String keyName) {
         if (FdkkLaserConfig.isBucket()) {
             if (FdkkLaserConfig.isLocalization()) {
                 return keyName;
@@ -436,24 +356,24 @@ public class OssUtil {
                 return keyName;
             }
         } else {
-            return FdkkLaserConfig.getProfile() + File.separator + keyName;
+            return FdkkLaserConfig.getProfile(prefix) + File.separator + keyName;
         }
     }
 
-    public String getFileContent(String pathKey) {
-        return FileUtil.readUtf8String(FdkkLaserConfig.getProfile() + File.separator + pathKey);
+    public String getFileContent(String prefix, String pathKey) {
+        return FileUtil.readUtf8String(FdkkLaserConfig.getProfile(prefix) + File.separator + pathKey);
     }
     public String getFileContentloc(String pathKey) {
         return FileUtil.readUtf8String(File.separator + pathKey);
     }
-    public List<String> listFiles(String pathKey) {
+    public List<String> listFiles(String prefix, String pathKey) {
         return FileUtil.loopFiles(
-                FdkkLaserConfig.getProfile() + File.separator + pathKey).stream().map(file->{
-            return file.getAbsolutePath().replace(FdkkLaserConfig.getProfile() + File.separator, "");
+                FdkkLaserConfig.getProfile(prefix) + File.separator + pathKey).stream().map(file->{
+            return file.getAbsolutePath().replace(FdkkLaserConfig.getProfile(prefix) + File.separator, "");
         }).collect(Collectors.toList());
     }
 
-    public void uploadMulFiles(Map<String, String> files){
-        files.keySet().stream().forEach(key -> this.uploadFile(files.get(key), key, false));
+    public void uploadMulFiles(String prefix, Map<String, String> files){
+        files.keySet().stream().forEach(key -> this.uploadFile(prefix, files.get(key), key, false));
     }
 }

+ 1 - 1
src/main/java/com/fdkankan/scene/service/IScenePlusService.java

@@ -38,7 +38,7 @@ public interface IScenePlusService extends IService<ScenePlus> {
 
     ResultData updateViewCount(String num) throws Exception;
 
-    ResultData initScene(String num, String title, String des, Integer sceneSource,
+    ResultData initScene(String bucket, String num, String title, String des, Integer sceneSource,
         String dataSource, Integer sceneScheme, String sceneResolution, String sceneFrom);
 
     ResultData editScene(LaserSceneBean param);

+ 1 - 1
src/main/java/com/fdkankan/scene/service/ISceneService.java

@@ -17,7 +17,7 @@ public interface ISceneService extends IService<Scene> {
 
     void delete(String sceneNum,Long userId) throws FileSystemException;
 
-    void copyScene(String newNum, String sceneNum, String userName, String dataSource) throws Exception;
+    void copyScene(String newNum, String sceneNum, String userName, String dataSource, String bucket) throws Exception;
 
     Scene getBySceneCode(String sceneCode);
 

+ 2 - 2
src/main/java/com/fdkankan/scene/service/impl/BoxModelServiceImpl.java

@@ -107,7 +107,7 @@ public class BoxModelServiceImpl implements IBoxModelService {
         }
 
         //上传glb
-        ossUtil.uploadFile(String.format(UploadFilePath.USER_EDIT_PATH, num) + "boxModels/" + sid + ".glb", glbPath, false);
+        ossUtil.uploadFile(bucket,String.format(UploadFilePath.USER_EDIT_PATH, num) + "boxModels/" + sid + ".glb", glbPath, false);
 
         return ResultData.ok(sid + ".glb");
     }
@@ -196,7 +196,7 @@ public class BoxModelServiceImpl implements IBoxModelService {
             if(CollUtil.isNotEmpty(deleteFile))
                 deleteFile.stream().forEach(key -> {
                     try{
-                        ossUtil.deleteObject(key);
+                        ossUtil.deleteObject(bucket, key);
                     }catch (FileSystemException e){
 
                     }

+ 1 - 1
src/main/java/com/fdkankan/scene/service/impl/DownloadTourVideoServiceImpl.java

@@ -128,7 +128,7 @@ public class DownloadTourVideoServiceImpl extends ServiceImpl<IDownloadTourVideo
             String ossPath = String.format(UploadFilePath.DOWNLOADS_TOUR_VIDEO, downloadTourVideo.getNum()) + downloadTourVideo.getFileName();
             Map<String, String> headers = new HashMap<>();
             headers.put(HttpHeaders.CONTENT_TYPE, "application/octet-stream");
-            ossUtil.uploadFile(ossPath, destPath, false);
+//            ossUtil.uploadFile(ossPath, destPath, false);
             downloadTourVideo.setDownloadPath(ossPath);
             downloadTourVideo.setState(1);
             this.updateById(downloadTourVideo);

+ 11 - 1
src/main/java/com/fdkankan/scene/service/impl/SceneAsynOperLogServiceImpl.java

@@ -12,10 +12,14 @@ import com.fdkankan.common.constant.SceneAsynFuncType;
 import com.fdkankan.common.constant.SceneAsynModuleType;
 import com.fdkankan.common.constant.SceneAsynOperType;
 import com.fdkankan.scene.entity.SceneAsynOperLog;
+import com.fdkankan.scene.entity.ScenePlus;
+import com.fdkankan.scene.entity.ScenePlusExt;
 import com.fdkankan.scene.mapper.ISceneAsynOperLogMapper;
 import com.fdkankan.scene.oss.OssUtil;
 import com.fdkankan.scene.service.ISceneAsynOperLogService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.scene.service.IScenePlusExtService;
+import com.fdkankan.scene.service.IScenePlusService;
 import com.fdkankan.scene.vo.SceneAsynOperLogParamVO;
 import com.fdkankan.web.response.ResultData;
 import java.io.IOException;
@@ -41,6 +45,10 @@ public class SceneAsynOperLogServiceImpl extends ServiceImpl<ISceneAsynOperLogMa
 
     @Autowired
     private OssUtil ossUtil;
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
 
     @Override
     public ResultData getAsynOperLog(SceneAsynOperLogParamVO param) {
@@ -107,7 +115,9 @@ public class SceneAsynOperLogServiceImpl extends ServiceImpl<ISceneAsynOperLogMa
         deleteList.parallelStream().forEach(item -> {
             if(StrUtil.isNotEmpty(item.getUrl())){
                 try{
-                    ossUtil.deleteObject(item.getUrl());
+                    ScenePlus scenePlus = scenePlusService.getScenePlusByNum(item.getNum());
+                    ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+                    ossUtil.deleteObject(scenePlusExt.getYunFileBucket(), item.getUrl());
                 }catch (FileSystemException e){
 
                 }

+ 14 - 14
src/main/java/com/fdkankan/scene/service/impl/SceneDownloadHandlerServiceImpl.java

@@ -226,7 +226,7 @@ public class SceneDownloadHandlerServiceImpl {
                 zipFile.getParentFile().mkdirs();
             }
 
-            String sceneJsonData = ossUtil.getFileContent(String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json");
+            String sceneJsonData = ossUtil.getFileContent(bucket,String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json");
             JSONObject sceneJson = JSONUtil.parseObj(sceneJsonData);
             String resolution = sceneJson.getStr("sceneResolution");
             //国际版存在已经切好图的情况,下载时不需要再切图,只需要把文件直接下载下来打包就可以了
@@ -245,7 +245,7 @@ public class SceneDownloadHandlerServiceImpl {
             log.info("打包固定文件耗时, num:{}, time:{}", num, timer.intervalRestart());
 
             //oss文件写入
-            this.zipOssFiles(ossFilePaths, num, count, total, resolution, imagesVersion, cacheKeys, "v4");
+            this.zipOssFiles(bucket, ossFilePaths, num, count, total, resolution, imagesVersion, cacheKeys, "v4");
             log.info("打包oss文件耗时, num:{}, time:{}", num, timer.intervalRestart());
 
             //重新写入scene.json(去掉密码访问设置)
@@ -259,7 +259,7 @@ public class SceneDownloadHandlerServiceImpl {
 
             //上传压缩包
             String uploadPath = String.format(this.zipOssFormat, num);
-            ossUtil.uploadFile(uploadPath, zipPath, false);
+            ossUtil.uploadFile(bucket, uploadPath, zipPath, false);
             ServiceConfig serviceConfig = SpringUtil.getBean(ServiceConfig.class);
 
             //更新进度100
@@ -323,7 +323,7 @@ public class SceneDownloadHandlerServiceImpl {
             log.info("打包固定文件耗时, num:{}, time:{}", num, timer.intervalRestart());
 
             //oss文件写入
-            this.zipOssFiles(ossFilePaths, num, count, total, resolution, imagesVersion, cacheKeys, "v3");
+            this.zipOssFiles(null, ossFilePaths, num, count, total, resolution, imagesVersion, cacheKeys, "v3");
             log.info("打包oss文件耗时, num:{}, time:{}", num, timer.intervalRestart());
 
             //重新写入scene.json(去掉密码访问设置)
@@ -337,7 +337,7 @@ public class SceneDownloadHandlerServiceImpl {
 
             //上传压缩包
             String uploadPath = String.format(this.zipOssFormat, num);
-            ossUtil.uploadFile(uploadPath, zipPath, false);
+            ossUtil.uploadFile(bucket, uploadPath, zipPath, false);
             ServiceConfig serviceConfig = SpringUtil.getBean(ServiceConfig.class);
 
             //更新进度100
@@ -373,7 +373,7 @@ public class SceneDownloadHandlerServiceImpl {
         return data;
     }
 
-    private void zipOssFiles(List<String> ossFilePaths, String num, AtomicInteger count,
+    private void zipOssFiles(String bucket, List<String> ossFilePaths, String num, AtomicInteger count,
         int total, String resolution, int imagesVersion, Set<String> cacheKeys, String version) throws Exception{
         if(CollUtil.isEmpty(ossFilePaths)){
             return;
@@ -389,7 +389,7 @@ public class SceneDownloadHandlerServiceImpl {
             Callable<Boolean> call = new Callable() {
                 @Override
                 public Boolean call() throws Exception {
-                    zipOssFilesHandler(num, count, total, resolution,
+                    zipOssFilesHandler(bucket, num, count, total, resolution,
                         imagesVersion, cacheKeys,filePath, finalImageNumPath, version);
                     return true;
                 }
@@ -411,7 +411,7 @@ public class SceneDownloadHandlerServiceImpl {
         }
     }
 
-    private void zipOssFilesHandler(String num,
+    private void zipOssFilesHandler(String bucket, String num,
         AtomicInteger count, int total, String resolution,
         int imagesVersion, Set<String> cacheKeys,
         String filePath, String imageNumPath, String version) throws Exception{
@@ -440,7 +440,7 @@ public class SceneDownloadHandlerServiceImpl {
         }
 
         //其他文件打包
-        this.ProcessFiles(num, filePath, this.wwwroot, cacheKeys);
+        this.ProcessFiles(bucket, num, filePath, this.wwwroot, cacheKeys);
 
         //更新进度
         this.updateProgress(new BigDecimal(count.incrementAndGet()).divide(new BigDecimal(total), 6, BigDecimal.ROUND_HALF_UP),
@@ -485,7 +485,7 @@ public class SceneDownloadHandlerServiceImpl {
         List<String> ossFilePaths = new ArrayList<>();
         for (String prefix : prefixArr) {
             prefix = String.format(prefix, num);
-            List<String> keys = ossUtil.listFiles(prefix);
+            List<String> keys = ossUtil.listFiles(bucket, prefix);
             if(CollUtil.isEmpty(keys)){
                 continue;
             }
@@ -514,7 +514,7 @@ public class SceneDownloadHandlerServiceImpl {
         List<String> ossFilePaths = new ArrayList<>();
         for (String prefix : prefixArr4v3) {
             prefix = String.format(prefix, num);
-            List<String> keys = ossUtil.listFiles(prefix);
+            List<String> keys = ossUtil.listFiles(bucket, prefix);
             if(CollUtil.isEmpty(keys)){
                 continue;
             }
@@ -622,7 +622,7 @@ public class SceneDownloadHandlerServiceImpl {
         HttpUtil.downloadFile(url, path);
     }
 
-    public void ProcessFiles(String num, String key, String prefix, Set<String> cacheKeys) throws Exception{
+    public void ProcessFiles(String bucket, String num, String key, String prefix, Set<String> cacheKeys) throws Exception{
         if(cacheKeys.contains(key)){
             return;
         }
@@ -642,12 +642,12 @@ public class SceneDownloadHandlerServiceImpl {
                 .replace("https://spc.html","spc.html")
                 .replace("https://smobile.html", "smobile.html");
 
-            FileUtil.writeUtf8String(content, String.format(sourceLocal, num, prefix + key.replace(FdkkLaserConfig.getProfile(),"")));
+            FileUtil.writeUtf8String(content, String.format(sourceLocal, num, prefix + key.replace(FdkkLaserConfig.getProfile(bucket),"")));
         }else{
 //            HttpUtil.downloadFile(url, String.format(sourceLocal, num, prefix + key));
             try {
 
-                ossUtil.downloadFile(key,String.format(sourceLocal, num, prefix + key.replace(FdkkLaserConfig.getProfile(),"")));
+                ossUtil.downloadFile(bucket, key,String.format(sourceLocal, num, prefix + key.replace(FdkkLaserConfig.getProfile(bucket),"")));
 //                this.downloadFile(url, String.format(sourceLocal, num, prefix + key));
             }catch (Exception e){
                 log.info("下载文件报错,path:{}", key);

+ 7 - 1
src/main/java/com/fdkankan/scene/service/impl/SceneDownloadLogServiceImpl.java

@@ -20,11 +20,13 @@ import com.fdkankan.scene.config.ServiceConfig;
 import com.fdkankan.scene.entity.SceneDownloadLog;
 import com.fdkankan.scene.entity.SceneEditInfo;
 import com.fdkankan.scene.entity.ScenePlus;
+import com.fdkankan.scene.entity.ScenePlusExt;
 import com.fdkankan.scene.mapper.ISceneDownloadLogMapper;
 import com.fdkankan.scene.oss.OssUtil;
 import com.fdkankan.scene.service.ISceneDownloadLogService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.scene.service.ISceneEditInfoService;
+import com.fdkankan.scene.service.IScenePlusExtService;
 import com.fdkankan.scene.service.IScenePlusService;
 import com.fdkankan.web.bean.DownLoadProgressBean;
 import com.fdkankan.web.response.ResultData;
@@ -64,6 +66,8 @@ public class SceneDownloadLogServiceImpl extends ServiceImpl<ISceneDownloadLogMa
 
     @Autowired
     private ServiceConfig serviceConfig;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
 
 
     @Override
@@ -73,10 +77,12 @@ public class SceneDownloadLogServiceImpl extends ServiceImpl<ISceneDownloadLogMa
         if(Objects.isNull(scenePlus)){
             throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
         }
+        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+        String bucket = scenePlusExt.getYunFileBucket();
 
         Map<String, Object> result = new HashMap<>();
         String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH+"scene.json", num);
-        String sceneJson = ossUtil.getFileContent(sceneJsonPath);
+        String sceneJson = ossUtil.getFileContent(bucket, sceneJsonPath);
         SceneJsonBean sceneJsonBean = JSON.parseObject(sceneJson, SceneJsonBean.class);
         int version = sceneJsonBean.getVersion();
         redisUtil.set(String.format(keyFormat, num), "1");

+ 1 - 1
src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoExtServiceImpl.java

@@ -178,7 +178,7 @@ public class SceneEditInfoExtServiceImpl extends ServiceImpl<ISceneEditInfoExtMa
             if(StrUtil.isEmpty(icon)){
                 continue;
             }
-            ossUtil.deleteObject(userDataPath.concat(icon));
+            ossUtil.deleteObject(bucket, userDataPath.concat(icon));
         }
     }
 

+ 48 - 46
src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java

@@ -29,6 +29,7 @@ import com.fdkankan.redis.constant.RedisLockKey;
 import com.fdkankan.redis.util.RedisLockUtil;
 import com.fdkankan.redis.util.RedisUtil;
 import com.fdkankan.scene.bean.*;
+import com.fdkankan.scene.config.FdkkLaserConfig;
 import com.fdkankan.scene.constant.ConstantFileLocPath;
 import com.fdkankan.scene.entity.*;
 import com.fdkankan.scene.mapper.ISceneEditInfoMapper;
@@ -252,12 +253,12 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         FileUtils.writeFile(localSceneJsonPath, JSON.toJSONString(sceneJson));
         //上传sceneJson文件
         String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH+"scene.json", num);
-        ossUtil.uploadFileBytes(sceneJsonPath, JSON.toJSONString(sceneJson).getBytes(StandardCharsets.UTF_8));
+        ossUtil.uploadFileBytes(bucket, sceneJsonPath, JSON.toJSONString(sceneJson).getBytes(StandardCharsets.UTF_8));
 
         //删除发布数据中的user目录
         String publicUserPath = String.format(UploadFilePath.USER_VIEW_PATH, num);
         try{
-            ossUtil.deleteObject(publicUserPath);
+            ossUtil.deleteObject(bucket, publicUserPath);
         }catch (IORuntimeException e){
             if (e.getMessage().contains("另一个程序正在使用此文件,进程无法访问")){
                 throw new BusinessException(ErrorCode.FAILURE_CODE_5071);
@@ -267,7 +268,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         //复制编辑目录到发布目录
         String editPath = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum());
         String viewPath = String.format(UploadFilePath.USER_VIEW_PATH, param.getNum()).replace("user/","");
-        ossUtil.copyObject(editPath, viewPath);
+        ossUtil.copyObject(bucket, editPath, viewPath);
 
         //sceneJson放入缓存
         String key = String.format(RedisKey.SCENE_JSON, num);
@@ -294,25 +295,25 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
     private void publicSurveillance(String num, Integer surveillances, String bucket) throws IOException {
         String surveillanceJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "surveillance.json";
         if(surveillances == CommonStatus.NO.code().intValue()){
-            ossUtil.deleteObject(surveillanceJsonPath);
+            ossUtil.deleteObject(bucket, surveillanceJsonPath);
             return;
         }
         List<SurveillanceVO> surveillanceList = surveillanceService.listSurveillance(num);
-        ossUtil.uploadFileBytes(surveillanceJsonPath, JSON.toJSONString(surveillanceList).getBytes(StandardCharsets.UTF_8));
+        ossUtil.uploadFileBytes(bucket, surveillanceJsonPath, JSON.toJSONString(surveillanceList).getBytes(StandardCharsets.UTF_8));
     }
 
     private void publicFilterData(String num, int filters, String bucket) throws IOException {
 
         String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
         if(filters == CommonStatus.NO.code()){
-            ossUtil.deleteObject(userEditPath + "filter.json");
+            ossUtil.deleteObject(bucket,userEditPath + "filter.json");
             return;
         }
         String key = String.format(RedisKey.SCENE_filter_DATA, num);
         List<String> list = redisUtil.lGet(key, 0, -1);
         JSONArray jsonArray = new JSONArray();
         list.stream().forEach(str->jsonArray.add(JSON.parseObject(str)));
-        ossUtil.uploadFileBytes(userEditPath + "filter.json", JSON.toJSONBytes(jsonArray));
+        ossUtil.uploadFileBytes(bucket,userEditPath + "filter.json", JSON.toJSONBytes(jsonArray));
     }
 
     public void publicLinkSceneData(String num, String bucket) throws IOException {
@@ -322,8 +323,8 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
 
         //清除发布目录中的场景关联图片
-        if(ossUtil.doesObjectExist(imgViewPath + "panorama")){
-            ossUtil.deleteObject(imgViewPath + "panorama");
+        if(ossUtil.doesObjectExist(bucket,imgViewPath + "panorama")){
+            ossUtil.deleteObject(bucket,imgViewPath + "panorama");
         }
 
         //生成links.json并上传到发布目录
@@ -337,11 +338,11 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
             linkPanArr.add(JSON.parseObject(linkPan));
         });
         String linkScenePath = userEditPath + "links.json";
-        ossUtil.uploadFileBytes(linkScenePath, linkPanArr.toString().getBytes(StandardCharsets.UTF_8));
+        ossUtil.uploadFileBytes(bucket, linkScenePath, linkPanArr.toString().getBytes(StandardCharsets.UTF_8));
 
         //拷贝编辑目录到发布目录
-        ossUtil.deleteObject(imgViewPath + "panorama");
-        ossUtil.copyObject(imgEditPath + "panorama", imgViewPath + "panorama");
+        ossUtil.deleteObject(bucket,imgViewPath + "panorama");
+        ossUtil.copyObject(bucket, imgEditPath + "panorama", imgViewPath + "panorama");
 
     }
 
@@ -367,7 +368,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         }
 
         String hotJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, sceneNum) + "hot.json";
-        ossUtil.uploadFileBytes(hotJsonPath, tags.toString().getBytes(StandardCharsets.UTF_8));
+        ossUtil.uploadFileBytes(bucket, hotJsonPath, tags.toString().getBytes(StandardCharsets.UTF_8));
 //        this.saveTagsToSceneEditInfo(sceneNum, sceneEditInfo);
 
     }
@@ -377,11 +378,11 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, sceneNum) + "billboards.json";
         List<String> list = redisUtil.hgetValues(Key);
         if(CollUtil.isEmpty(list)){
-            ossUtil.deleteObject(userEditPath);
+            ossUtil.deleteObject(bucket,userEditPath);
             return;
         }
         List<JSONObject> collect = list.stream().map(str -> JSON.parseObject(str)).collect(Collectors.toList());
-        ossUtil.uploadFileBytes(userEditPath, JSON.toJSONString(collect).getBytes());
+        ossUtil.uploadFileBytes(bucket, userEditPath, JSON.toJSONString(collect).getBytes());
     }
 
     @Override
@@ -452,9 +453,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
     }
 
     public static void main(String[] args) {
-        String test = "";
-        JSONObject jsonObject = JSON.parseObject(test);
-        System.out.println(jsonObject);
+//        String test = "";
+//        JSONObject jsonObject = JSON.parseObject(test);
+        FileUtil.copyContent(new File("D:\\4DMega\\4DKK_PROGRAM_DATA\\dvt600001_202206291618176080\\caches\\images"), new File("/mnt/4Dkankan/scene/1680825957743071232/caches/"), true);
     }
 
     private void SortBoxVideos(SceneInfoVO sceneInfoVO){
@@ -527,6 +528,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         //校验场景是否为空、封存、计算中
         ScenePlus scenePlus = scenePlusService.checkSceneAvail(num);
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+        String bucket = scenePlusExt.getYunFileBucket();
 
         //访问量+1
         scenePlusService.updateViewCount(num);
@@ -537,7 +539,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         //先查询redis
         if(StrUtil.isEmpty(sceneJson)) {
             String objectName = String.format(ConstantFilePath.SCENE_VIEW_DATA_DATA_SCENEJSON, num);
-            sceneJson = ossUtil.getFileContent(objectName);
+            sceneJson = ossUtil.getFileContent(bucket, objectName);
             redisUtil.set(key, sceneJson);
         }
         sceneInfoVO = JSON.parseObject(sceneJson, SceneInfoVO.class);
@@ -588,7 +590,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         //处理户型图数据
         //上传floorplan_user.json文件
         FileUtils.writeFile(localDataPath + "floorplan_user.json", floorJsonData);
-        ossUtil.uploadFile(editUserPath + "floorplan.json", localDataPath + "floorplan_user.json", false);
+        ossUtil.uploadFile(bucket, editUserPath + "floorplan.json", localDataPath + "floorplan_user.json", false);
 
         //写入数据库
         Byte floorPlanUser = null;
@@ -596,7 +598,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
             JSONObject houseTypeJson = CreateHouseJsonUtil
                 .createHouseTypeJsonByUser(localDataPath + "floorplan_user.json");
             if(Objects.nonNull(houseTypeJson)) {
-                ossUtil.uploadFileBytes(editUserPath + "houseType.json", houseTypeJson.toJSONString().getBytes(StandardCharsets.UTF_8));
+                ossUtil.uploadFileBytes(bucket, editUserPath + "houseType.json", houseTypeJson.toJSONString().getBytes(StandardCharsets.UTF_8));
             }
 
             floorPlanUser = CommonStatus.YES.code();
@@ -686,7 +688,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         String floorplanCadPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "floorplan_cad.json";
         String floorcadStr = null;
         try {
-            floorcadStr = ossUtil.getFileContent(floorplanCadPath);
+            floorcadStr = ossUtil.getFileContent(bucket, floorplanCadPath);
         }catch (Exception e){
             log.warn("场景没有生成floorplan_cad.json, num:{}", num);
             return;
@@ -709,7 +711,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         }
 
         String hourseTypeJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "houseType.json";
-        ossUtil.uploadFileBytes(hourseTypeJsonPath, result.toJSONString().getBytes(StandardCharsets.UTF_8));
+        ossUtil.uploadFileBytes(bucket, hourseTypeJsonPath, result.toJSONString().getBytes(StandardCharsets.UTF_8));
     }
 
     private JSONArray[] createHouseTypeJsonHandler(JSONObject floor){
@@ -800,7 +802,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         String bucket = scenePlusExt.getYunFileBucket();
 
         String key = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + "floorplan.json";
-        String floorplanJson = ossUtil.getFileContent(key);
+        String floorplanJson = ossUtil.getFileContent(bucket, key);
         if(StrUtil.isEmpty(floorplanJson)){
             return ResultData.ok();
         }
@@ -825,7 +827,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
             }
             item.put("name", name);
         }
-        ossUtil.uploadFileBytes(key, jsonObject.toJSONString().getBytes(StandardCharsets.UTF_8));
+        ossUtil.uploadFileBytes(bucket, key, jsonObject.toJSONString().getBytes(StandardCharsets.UTF_8));
         return ResultData.ok();
     }
 
@@ -883,7 +885,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
 
         //更新oss scene.json版本号
         String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json";
-        sceneJson = ossUtil.getFileContent(sceneJsonPath);
+        sceneJson = ossUtil.getFileContent(bucket, sceneJsonPath);
         if(StrUtil.isNotEmpty(sceneJson)){
             SceneJsonBean sceneJsonBean = JSON.parseObject(sceneJson, SceneJsonBean.class);
             if(Objects.nonNull(version)){
@@ -892,7 +894,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
             if(Objects.nonNull(imgVersion)){
                 sceneJsonBean.setImgVersion(imgVersion);
             }
-            ossUtil.uploadFileBytes(sceneJsonPath, JSON.toJSONString(sceneJsonBean).getBytes(StandardCharsets.UTF_8));
+            ossUtil.uploadFileBytes(bucket, sceneJsonPath, JSON.toJSONString(sceneJsonBean).getBytes(StandardCharsets.UTF_8));
         }
 
     }
@@ -989,7 +991,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         //比对图片列表,不存在的要返回名称集合
         String ossVisionPath = String.format(UploadFilePath.IMG_VIEW_PATH, num) + "vision.txt";
         String visionPath = String.format(ConstantFilePath.SCENE_DATA_PATH_V4, num) + "vision.txt";
-        ossUtil.downloadFile(ossVisionPath, visionPath);
+        ossUtil.downloadFile(bucket, ossVisionPath, visionPath);
         List<String> panoramaImageList = SceneUtil.getPanoramaImageList(visionPath);
         List<String> notExistFileList = uploadFileList.stream().filter(filePath -> {
             filePath = filePath.substring(filePath.lastIndexOf(File.separator) + 1);
@@ -1021,13 +1023,13 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         Map<String, String> map = new HashMap<>();
 
         String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
-        ossUtil.downloadFile(imgViewPath + "vision.modeldata", target + File.separator + "extras" + File.separator + "vision.modeldata");
+        ossUtil.downloadFile(bucket, imgViewPath + "vision.modeldata", target + File.separator + "extras" + File.separator + "vision.modeldata");
         CreateObjUtil.convertVisionmodeldataToTxt(target + File.separator + "extras" + File.separator + "vision.modeldata",
             target + File.separator + "extras" + File.separator + "vision.txt");
 
         String  ossResultPath = sceneService.getDataSource(num, scenePlus.getSceneSource(), scenePlusExt.getDataSource());
         FileUtil.copy(ossResultPath + "data.json", target + File.separator+"data.json", true);
-        FileUtil.copy(ossResultPath + "project.json", target + File.separator+"project.json", true);
+        FileUtil.copy(ossResultPath + "project.json",target + File.separator+"project.json", true);
 
         //data.json增加extras为执行重建算法
         String data = FileUtils.readFile(target + File.separator+"data.json");
@@ -1194,7 +1196,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         //用户上传的全景图上传到ossresult目录
         String dataSource = sceneService.getDataSource(num, scenePlus.getSceneSource(), scenePlusExt.getDataSource());
         String ossCachesImagesPath = dataSource + "caches/images/";
-        FileUtil.copy(targetImagesPath, ossCachesImagesPath, true);
+        ossUtil.uploadFileDirCmd(bucket, targetImagesPath, ossCachesImagesPath, false);
 
         //更新数据库版本号
         SceneEditInfo sceneEditInfo = this.getByScenePlusId(scenePlus.getId());
@@ -1236,7 +1238,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         //根据vision.txt获取到有效的全景图名称
         String ossVisionPath = String.format(UploadFilePath.IMG_VIEW_PATH, num) + "vision.txt";
         String visionPath = String.format(ConstantFilePath.SCENE_DATA_PATH_V4, num) + "vision.txt";
-        ossUtil.downloadFile(ossVisionPath, visionPath);
+        ossUtil.downloadFile(bucket, ossVisionPath, visionPath);
         List<String> panoramaImageList = SceneUtil.getPanoramaImageList(visionPath);
         if(CollUtil.isEmpty(panoramaImageList)){
             throw new BusinessException(ErrorCode.FAILURE_CODE_5063);
@@ -1258,7 +1260,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
             }
             String downloadName = fileName;
             String url = String.format(cacheFormat, num) + downloadName;
-            ossUtil.uploadFile(String.format(cacheFormat, num) + downloadName, ossResultPath.concat(downloadName), true);
+            FileUtil.copy(ossResultPath.concat(downloadName), FdkkLaserConfig.getProfile(bucket).concat(String.format(cacheFormat, num).concat(downloadName)), true);
             map.put("asyn", CommonStatus.NO.code());
             map.put("fileUrl", url + "?t=" + System.currentTimeMillis());
             map.put("fileName", downloadName);
@@ -1286,7 +1288,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
 
                     //下载到本地目录
                     FileUtil.del(localImagesPath);
-                    ossUtil.downloadFile(ossResultPath, localImagesPath);
+                    FileUtil.copyContent(new File(ossResultPath), new File(localImagesPath), true);
                     //移除非必须文件
                     List<String> fileNames = FileUtil.listFileNames(localImagesPath);
                     fileNames.stream().forEach(name->{
@@ -1303,7 +1305,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
                     long end1 = Calendar.getInstance().getTimeInMillis();
                     log.info("打包耗时:" + (end1 - start));
                     //上传压缩包
-                    ossUtil.uploadFile(String.format(cacheFormat, num) + downloadName, zipPath, true);
+                    ossUtil.uploadFile(bucket, String.format(cacheFormat, num) + downloadName, zipPath, true);
                     String url = String.format(cacheFormat, num) + downloadName;
                     long end2 = Calendar.getInstance().getTimeInMillis();
                     log.info("上传耗时:" + (end2 - end1));
@@ -1525,12 +1527,12 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
 
         for(String videoName : video.list()){
             log.info("球幕视频名称:{}", videoName);
-            ossUtil.uploadFile(videosViewPath + videoName, target + File.separator + "extras/video/" + videoName, false);
+            ossUtil.uploadFile(bucket,videosViewPath + videoName, target + File.separator + "extras/video/" + videoName, false);
 
             CreateObjUtil.mp4ToFlv(target + File.separator + "extras/video/" + videoName,
                 target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"));
 
-            ossUtil.uploadFile(videosViewPath + videoName.replace("mp4", "flv"), target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"), false);
+            ossUtil.uploadFile(bucket,videosViewPath + videoName.replace("mp4", "flv"), target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"), false);
 
             //覆盖原始视频资源
 //            FileUtils.copyFile(target + File.separator + "extras/video/" + videoName,
@@ -1552,10 +1554,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
     public void upgradeVersionToSceneJson(String num, String bucket) throws Exception{
         String key = String.format(RedisKey.SCENE_JSON, num);
         String objectName = String.format(ConstantFilePath.SCENE_VIEW_DATA_DATA_SCENEJSON, num);
-        String objectContent = ossUtil.getFileContent(objectName);
+        String objectContent = ossUtil.getFileContent(bucket, objectName);
         SceneJsonBean sceneJsonBean = JSON.parseObject(objectContent, SceneJsonBean.class);
         sceneJsonBean.setVersion(sceneJsonBean.getVersion() +1);
-        ossUtil.uploadFileBytes(objectName, JSON.toJSONString(sceneJsonBean).getBytes(StandardCharsets.UTF_8));
+        ossUtil.uploadFileBytes(bucket, objectName, JSON.toJSONString(sceneJsonBean).getBytes(StandardCharsets.UTF_8));
         redisUtil.set(key, JSON.toJSONString(sceneJsonBean));
     }
 
@@ -1737,7 +1739,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         SceneJsonBean sceneJsonBean = null;
         String sceneJson = redisUtil.get(String.format(RedisKey.SCENE_JSON, param.getNum()));
         if(StrUtil.isEmpty(sceneJson)){
-            sceneJson = ossUtil.getFileContent(String.format(UploadFilePath.DATA_VIEW_PATH, param.getNum()) + "scene.json");
+            sceneJson = ossUtil.getFileContent(bucket,String.format(UploadFilePath.DATA_VIEW_PATH, param.getNum()) + "scene.json");
         }
         sceneJsonBean = JSON.parseObject(sceneJson, SceneJsonBean.class);
 
@@ -1899,8 +1901,8 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
 
         //调用算法切全景图
         String ossResultPath = sceneService.getDataSource(num, scenePlus.getSceneSource(), scenePlusExt.getDataSource());
-        FileUtil.copy(ossResultPath + "data.json", target + File.separator+"data.json", true);
-        FileUtil.copy(ossResultPath + "project.json", target + File.separator+"project.json", true);
+        FileUtil.copy(ossResultPath + "data.json",target + File.separator+"data.json", true);
+        FileUtil.copy(ossResultPath + "project.json",target + File.separator+"project.json", true);
         JSONObject visionJson = new JSONObject();
         JSONArray visionArray = new JSONArray();
         visionJson.put("uuid", sid);
@@ -1983,7 +1985,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         //上传全景图
         map.put(filePath, imgEditPath + "panorama/" + sid + "/high/" + fileName);
 
-        ossUtil.uploadMulFiles(map);
+        ossUtil.uploadMulFiles(bucket, map);
 
         Map<String, String> result = new HashMap<>();
         result.put("type", type);
@@ -2094,7 +2096,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         String imgEditPath = String.format(UploadFilePath.IMG_EDIT_PATH, num);
         thumbNameList.stream().forEach(thumbName->{
             try{
-                ossUtil.deleteObject(imgEditPath + "panorama_edit/" + thumbName);
+                ossUtil.deleteObject(bucket, imgEditPath + "panorama_edit/" + thumbName);
             }catch (FileSystemException e){
 
             }
@@ -2623,14 +2625,14 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
 
         //从用户编辑目录中下载视频到本地
         String filePath = userEditPath + fileName;
-        ossUtil.downloadFile(filePath, localImagesPath + fileName);
+        ossUtil.downloadFile(bucket, filePath, localImagesPath + fileName);
 
         //视频格式转换
         MergeVideoUtil.ffmpegFormatFlv(localFilePath, localFilePath.replace("mp4", "flv"));
 
         //上传
         String flvFileName = fileName.replace("mp4", "flv");
-        ossUtil.uploadFile(userEditPath+flvFileName, localFilePath.replace("mp4", "flv"), false);
+        ossUtil.uploadFile(bucket,userEditPath+flvFileName, localFilePath.replace("mp4", "flv"), false);
         FileUtil.del(localFilePath);
     }
 

+ 6 - 3
src/main/java/com/fdkankan/scene/service/impl/SceneEditServiceImpl.java

@@ -82,6 +82,7 @@ public class SceneEditServiceImpl implements ISceneEditService {
             throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
         }
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+        String bucket = scenePlusExt.getYunFileBucket();
 
         SceneAuthVO sceneAuthVO = new SceneAuthVO();
 
@@ -133,8 +134,9 @@ public class SceneEditServiceImpl implements ISceneEditService {
             throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
         }
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+        String bucket = scenePlusExt.getYunFileBucket();
         String key = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + "tour.json";
-        ossUtil.uploadFileBytes(key, param.getData().getBytes(StandardCharsets.UTF_8));
+        ossUtil.uploadFileBytes(bucket, key, param.getData().getBytes(StandardCharsets.UTF_8));
 
         sceneEditInfoExtService.updateToursByNum(
             param.getNum(), Integer.valueOf(CommonStatus.YES.code()));
@@ -149,9 +151,10 @@ public class SceneEditServiceImpl implements ISceneEditService {
             throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
         }
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+        String bucket = scenePlusExt.getYunFileBucket();
         String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum());
         String tourJsonPath = userEditPath + "tour.json";
-        String tourJson = ossUtil.getFileContent(tourJsonPath);
+        String tourJson = ossUtil.getFileContent(bucket, tourJsonPath);
         JSONArray tours = JSON.parseArray(tourJson);
         if(CollUtil.isNotEmpty(tours)){
             List<String> fileNames = new ArrayList<>();
@@ -189,7 +192,7 @@ public class SceneEditServiceImpl implements ISceneEditService {
             }
         }
         //删除tour.json文件
-        ossUtil.deleteObject(tourJsonPath);
+        ossUtil.deleteObject(bucket, tourJsonPath);
 
         sceneEditInfoExtService.updateToursByNum(
             param.getNum(), Integer.valueOf(CommonStatus.NO.code()));

+ 29 - 9
src/main/java/com/fdkankan/scene/service/impl/ScenePlusServiceImpl.java

@@ -9,6 +9,7 @@ import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.qrcode.QrCodeUtil;
 import cn.hutool.extra.qrcode.QrConfig;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -17,6 +18,7 @@ import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.model.constants.ConstantFilePath;
 import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.model.utils.FloorPlanUserUtil;
 import com.fdkankan.scene.bean.SceneBean;
 import com.fdkankan.scene.entity.SceneEditInfoExt;
 import com.fdkankan.scene.entity.ScenePro;
@@ -226,6 +228,8 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
         SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByScenePlusId(scenePlus.getId());
 
+        String bucket = scenePlusExt.getYunFileBucket();
+
         String fileName = file.getOriginalFilename();
         String extName = fileName.substring(fileName.lastIndexOf("."));
         File newFile = File.createTempFile(UUID.randomUUID().toString() ,extName);
@@ -241,11 +245,11 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
         QrCodeUtil.generate(webSize + "&lang=en", QrConfig.create().setImg(logoPath).setWidth(1024).setHeight(1024), FileUtil.file(outPathEn));
         //上传logo图片
         String ossLogoPath = String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + "shareLogo" + extName;
-        ossUtil.uploadFile(ossLogoPath, logoPath, false);
+        ossUtil.uploadFile(bucket, ossLogoPath, logoPath, false);
 
         //上传二维码
-        ossUtil.uploadFile(String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + ".png", outPathZh, false);
-        ossUtil.uploadFile(String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + "_en.png", outPathEn, false);
+        ossUtil.uploadFile(bucket, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + ".png", outPathZh, false);
+        ossUtil.uploadFile(bucket,String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + "_en.png", outPathEn, false);
 
         sceneEditInfoExt.setShareLogoImg(ossLogoPath);
         sceneEditInfoExtService.updateById(sceneEditInfoExt);
@@ -275,7 +279,7 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
      * @return com.fdkankan.web.response.ResultData
      **/
     @Override
-    public ResultData initScene(String num, String title, String des, Integer sceneSource,
+    public ResultData initScene(String bucket, String num, String title, String des, Integer sceneSource,
         String dataSource, Integer sceneScheme, String sceneResolution, String sceneFrom) {
 
         ScenePlus scenePlusByNum = this.getScenePlusByNum(num);
@@ -300,6 +304,8 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
         scenePlusExt.setSceneFrom(sceneFrom);
         scenePlusExt.setModelKind("3dtiles");
         scenePlusExt.setSceneKind(SceneKind.FACE.code());
+        scenePlusExt.setYunFileBucket(bucket);
+        scenePlusExt.setAlgorithmTime(Calendar.getInstance().getTime());
         scenePlusExtService.save(scenePlusExt);
 
         //生成编辑主表
@@ -342,7 +348,18 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
         sceneJson.setModelKind(scenePlusExt.getModelKind());
         //本地写sceneJson文件
         String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH+"scene.json", num);
-        ossUtil.uploadFileBytes(sceneJsonPath, JSON.toJSONString(sceneJson).getBytes(StandardCharsets.UTF_8));
+        ossUtil.uploadFileBytes(bucket, sceneJsonPath, JSON.toJSONString(sceneJson).getBytes(StandardCharsets.UTF_8));
+
+        //生成floorplan.json
+        String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
+        if (new File(floorPlanCardFilePath).exists()) {
+            JSONObject json = FloorPlanUserUtil.createFloorPlanUserJson(floorPlanCardFilePath);
+            if(!Objects.isNull(json)){
+                String hourseTypeJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "floorplan.json";
+                ossUtil.uploadFileBytes(bucket, hourseTypeJsonPath, json.toJSONString().getBytes());
+            }
+        }
+
 
         redisUtil.del(String.format(RedisKey.SCENE_JSON, num));
 
@@ -365,11 +382,12 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
 
         if (StrUtil.isNotBlank(param.getThumb())){
             ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+            String bucket = scenePlusExt.getYunFileBucket();
             scenePlusExt.setThumb(param.getThumb());
             scenePlusExtService.updateById(scenePlusExt);
-            File sourceFile=FileUtil.file(FdkkLaserConfig.getProfile()+param.getThumb());
+            File sourceFile=FileUtil.file(FdkkLaserConfig.getProfile(bucket)+param.getThumb());
             log.info("sourceFile,-{}",sourceFile.getAbsoluteFile());
-            File targetFile=FileUtil.file(FdkkLaserConfig.getProfile()+String.format(UploadFilePath.USER_EDIT_PATH, param.getNum())+ File.separator+"thumb-1k.jpg");
+            File targetFile=FileUtil.file(FdkkLaserConfig.getProfile(bucket)+String.format(UploadFilePath.USER_EDIT_PATH, param.getNum())+ File.separator+"thumb-1k.jpg");
             log.info("targetFile,-{}",targetFile.getAbsoluteFile());
             FileUtils.copyFile(sourceFile,targetFile);
         }
@@ -418,8 +436,10 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
 
         //删除编辑和展示文件
         for (ScenePlus plus : plusList) {
-            ossUtil.deleteObject(String.format(UploadFilePath.VIEW_PATH, plus.getNum()));
-            ossUtil.deleteObject(String.format(UploadFilePath.EDIT_PATH, plus.getNum()));
+            ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(plus.getId());
+            String bucket = scenePlusExt.getYunFileBucket();
+            ossUtil.deleteObject(bucket, String.format(UploadFilePath.VIEW_PATH, plus.getNum()));
+            ossUtil.deleteObject(bucket, String.format(UploadFilePath.EDIT_PATH, plus.getNum()));
         }
 
         //删除原始资源文件

+ 23 - 25
src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java

@@ -219,7 +219,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
 
     private void deleteHotDataFromTourJson(String num, List<String> sidList, String bucket){
         String key = String.format(UploadFilePath.USER_EDIT_PATH, num) + "tour.json";
-        String tourJson = ossUtil.getFileContent(key);
+        String tourJson = ossUtil.getFileContent(bucket, key);
         if(StrUtil.isEmpty(tourJson)){
             return;
         }
@@ -238,7 +238,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
                 }
             });
         });
-        ossUtil.uploadFileBytes(key, jsonArray.toJSONString().getBytes(StandardCharsets.UTF_8));
+        ossUtil.uploadFileBytes(bucket, key, jsonArray.toJSONString().getBytes(StandardCharsets.UTF_8));
 
     }
 
@@ -520,15 +520,15 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
                 String fileType = jsonObject.getString("media");
                 if(fileType.contains("photo"))
                 {
-                    ossUtil.deleteObject(userDataPath + "hot"+sid+".jpg");
+                    ossUtil.deleteObject(bucket, userDataPath + "hot"+sid+".jpg");
                 }
                 if(fileType.contains("audio") || fileType.contains("voice"))
                 {
-                    ossUtil.deleteObject(userDataPath + "hot"+sid+".mp3");
+                    ossUtil.deleteObject(bucket,userDataPath + "hot"+sid+".mp3");
                 }
                 if(fileType.contains("video"))
                 {
-                    ossUtil.deleteObject(userDataPath + "hot"+sid+".mp4");
+                    ossUtil.deleteObject(bucket,userDataPath + "hot"+sid+".mp4");
                 }
             }
         }
@@ -614,7 +614,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         }
         //如果是云存储,将vision.modeldata下载到本地,如果是本地存储,场景计算完就已经将这个文件拷贝到编辑目录了存在这个文件了,不需要再下载
         String viewImagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, param.getNum());
-        ossUtil.downloadFile(viewImagesPath + "vision.modeldata", localDataPath + "vision.modeldata");
+        ossUtil.downloadFile(bucket,viewImagesPath + "vision.modeldata", localDataPath + "vision.modeldata");
 
         //检查vision.modeldata本地是否存在,不存在抛出异常
         File file = new File(localDataPath + "vision.modeldata");
@@ -644,7 +644,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         FileUtils.deleteFile(localDataPath + "vision.modeldata");
         FileUtils.writeFile(localDataPath + "vision.json", json.toString());
         ConvertUtils.convertTxtToVisionModelData(localDataPath + "vision.json", localDataPath + "vision.modeldata");
-        ossUtil.uploadFile(viewImagesPath + "vision.modeldata", localDataPath + "vision.modeldata", false);
+        ossUtil.uploadFile(bucket,viewImagesPath + "vision.modeldata", localDataPath + "vision.modeldata", false);
 
         //更新版本号
         SceneEditInfo editInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
@@ -801,7 +801,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         });
 
         //读取oss上的floors.jsoon用于校验用户上传的模型楼层数是否一一对应
-        String ossFloorsJson = ossUtil.getFileContent(String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh/floors.json");
+        String ossFloorsJson = ossUtil.getFileContent(bucket,String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh/floors.json");
         JSONObject orginFloorsJsonObj = JSON.parseObject(ossFloorsJson);
         JSONArray orginFloorArr = orginFloorsJsonObj.getJSONArray("floors");
         Set<String> orginFloorNameSet = orginFloorArr.stream().map(item -> {
@@ -838,11 +838,11 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
 
         //算法计算完后,生成压缩文件,上传到oss
         //上传3dtiles
-        ossUtil.deleteObject(String.format(UploadFilePath.IMG_VIEW_PATH, num) + "3dtiles");
-        ossUtil.uploadFileDirCmd(tilesPath, String.format(UploadFilePath.IMG_VIEW_PATH, num) + "3dtiles", false);
+        ossUtil.deleteObject(bucket,String.format(UploadFilePath.IMG_VIEW_PATH, num) + "3dtiles");
+        ossUtil.uploadFileDirCmd(bucket, tilesPath, String.format(UploadFilePath.IMG_VIEW_PATH, num) + "3dtiles", false);
         //上传mesh
-        ossUtil.deleteObject(String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh");
-        ossUtil.uploadFileDirCmd(meshPath, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh", false);
+        ossUtil.deleteObject(bucket,String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh");
+        ossUtil.uploadFileDirCmd(bucket,meshPath, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh", false);
 
     }
 
@@ -894,11 +894,11 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
 
         String ossMeshPath = String.format(UploadFilePath.DATA_VIEW_PATH, sceneNum) + "mesh";
         //删除oss中的mesh
-        ossUtil.deleteObject(ossMeshPath);
+        ossUtil.deleteObject(bucket, ossMeshPath);
         //上传obj相关文件
         List<String> fileNames = FileUtil.listFileNames(filePath);
         fileNames.stream().forEach(name->{
-            ossUtil.uploadFile(ossMeshPath + File.separator + name, filePath + name, false);
+            ossUtil.uploadFile(bucket,ossMeshPath + File.separator + name, filePath + name, false);
         });
     }
 
@@ -1039,27 +1039,25 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
 
         //下载mesh到本地
         String meshOssPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh/";
-        String meshLocalPath = String.format(ConstantFilePath.SCENE_DATA_PATH_V4, num) + "mesh";
+        String meshLocalPath = String.format(ConstantFilePath.SCENE_DATA_PATH_V4, num);
         String zipName = num + "_mesh.zip";
         String zipFilePath = String.format(ConstantFilePath.SCENE_DATA_PATH_V4, num) + zipName;
         //下载
-        ossUtil.downloadFile(meshOssPath, meshLocalPath);
+        ossUtil.downloadFile(bucket, meshOssPath, meshLocalPath);
         //打包
-        ZipUtil.zip(meshLocalPath,zipFilePath);
+        ZipUtil.zip(meshLocalPath.concat("mesh") ,zipFilePath);
         //上传压缩包
-        ossUtil.uploadFile("downloads/extras/" + zipName, zipFilePath, false);
+        ossUtil.uploadFile(bucket,"downloads/extras/" + zipName, zipFilePath, false);
         //删除本地文件
-        FileUtil.del(meshLocalPath);
+        FileUtil.del(meshLocalPath.concat("mesh"));
         FileUtil.del(zipFilePath);
         String url = "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
         return ResultData.ok(url);
     }
 
     public static void main(String[] args) {
-
-        Date time = Calendar.getInstance().getTime();
-        time = DateUtil.beginOfDay(DateUtil.offset(time, DateField.MONTH, -12));
-        System.out.println(time);
+        File copy = FileUtil.copy(new File("D:\\4DMega\\4DKK_PROGRAM_STATIC\\scene_view_data/1680825957743071232/data/mesh/"),
+                new File("/mnt/4Dkankan/scene_v4/1680825957743071232/data"), true);
 
     }
 
@@ -1077,7 +1075,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         //V3版本去oss下载2048模型
         String meshPath =  String.format(ConstantFilePath.DATABUFFER_FORMAT, num) + "mesh";
         FileUtils.deleteDirectory(meshPath);
-        ossUtil.downloadFile(dataViewPath + "mesh", meshPath);
+        ossUtil.downloadFile(bucket, dataViewPath + "mesh", meshPath);
         log.info("meshPath="+meshPath);
         if(!new File(meshPath).exists() || new File(meshPath).listFiles().length < 1){
             throw new BusinessException(ErrorCode.FAILURE_CODE_7006);
@@ -1108,7 +1106,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         //打包
         ZipUtil.zip(meshPath, zipPath);
         //上传压缩包
-        ossUtil.uploadFile("downloads/extras/" + zipName, zipPath, false);
+        ossUtil.uploadFile(bucket,"downloads/extras/" + zipName, zipPath, false);
         String url = "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
         FileUtil.del(zipPath);
         return ResultData.ok(url);

+ 7 - 20
src/main/java/com/fdkankan/scene/service/impl/SceneServiceImpl.java

@@ -21,6 +21,7 @@ import com.fdkankan.model.constants.UploadFilePath;
 import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.util.RedisUtil;
 import com.fdkankan.scene.bean.BodySegmentStatusBean;
+import com.fdkankan.scene.config.FdkkLaserConfig;
 import com.fdkankan.scene.entity.*;
 import com.fdkankan.scene.mapper.ISceneMapper;
 import com.fdkankan.scene.oss.OssUtil;
@@ -156,7 +157,7 @@ public class SceneServiceImpl extends ServiceImpl<ISceneMapper, Scene> implement
                 throw new Exception("提取图片失败");
             }
             String targetOssImgPath = "body_segment/segment/" + uuid + ".png";
-            ossUtil.uploadFile(targetOssImgPath, imgPath, false);
+//            ossUtil.uploadFile(targetOssImgPath, imgPath, false);
             bodySegmentStatusBean.setStatus(CommonOperStatus.SUCCESS.code());
 //            bodySegmentStatusBean.setImageUrl(fYunFileConfig.getHost() + targetOssImgPath);
             redisUtil.set(String.format(RedisKey.SCENE_BODY_SEGMENT, uuid), JSON.toJSONString(bodySegmentStatusBean), RedisKey.CAMERA_EXPIRE_7_TIME);
@@ -196,7 +197,7 @@ public class SceneServiceImpl extends ServiceImpl<ISceneMapper, Scene> implement
     }
 
     @Override
-    public void copyScene(String newNum, String sceneNum, String userName, String dataSource) throws Exception {
+    public void copyScene(String newNum, String sceneNum, String userName, String dataSource, String bucket) throws Exception {
         if(StrUtil.isEmpty(newNum) || StrUtil.isEmpty(sceneNum)){
             throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
         }
@@ -207,6 +208,7 @@ public class SceneServiceImpl extends ServiceImpl<ISceneMapper, Scene> implement
         String oldNum = scenePlus.getNum();
         Long plusId = scenePlus.getId();
         ScenePlusExt plusExt = scenePlusExtService.getScenePlusExtByPlusId(plusId);
+        String oldBucket = plusExt.getYunFileBucket();
         String oldDataSource = plusExt.getDataSource();
         if(plusExt == null){
             throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
@@ -228,6 +230,7 @@ public class SceneServiceImpl extends ServiceImpl<ISceneMapper, Scene> implement
         plusExt.setDataSource(dataSource);
         plusExt.setVideos(newVideos);
         plusExt.setViewCount(0);
+        plusExt.setYunFileBucket(bucket);
         scenePlusExtService.save(plusExt);
 
         SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(plusId);
@@ -260,33 +263,17 @@ public class SceneServiceImpl extends ServiceImpl<ISceneMapper, Scene> implement
             });
         }
 
-        if (!ossUtil.doesObjectExist(String.format(cloudPointFyunPath,oldNum,oldNum) +"vision_edit.txt")){
-            return;
-        }
-        log.info("开始同步点云编辑文件");
-        // 上传点云编辑文件,并通知激光系统
-        ossUtil.copyObject(String.format(cloudPointFyunPath,oldNum,oldNum) + "vision_edit.txt",
-                String.format(cloudPointFyunPath,newNum,newNum) + "vision_edit.txt");
-
-        ossUtil.copyObject(String.format(cloudPointFyunPath,oldNum,oldNum) + "uuidcloud",
-                String.format(cloudPointFyunPath,newNum,newNum) + "uuidcloud");
-
-        Map<String, Object> params = new HashMap<>();
-        params.put("sceneNum", newNum);
-        params.put("businessType", 0);
-        // TODO: 2023/7/6 调用文杰接口
-
         try {
 
             // 拷贝场景编辑资源
             String oldEditPath = String.format(UploadFilePath.EDIT_PATH, oldNum);
             String newEditPath = String.format(UploadFilePath.EDIT_PATH, newNum);
-            ossUtil.copyObject(oldEditPath, newEditPath);
+            ossUtil.copyObject(oldBucket, oldEditPath, bucket, newEditPath);
 
             // 拷贝场景展示资源
             String oldViewPath = String.format(UploadFilePath.VIEW_PATH, oldNum);
             String newViewPath = String.format(UploadFilePath.VIEW_PATH, newNum);
-            ossUtil.copyObject(oldViewPath, newViewPath);
+            ossUtil.copyObject(oldBucket, oldViewPath, bucket, newViewPath);
 
             //复制计算目录
             FileUtil.copy(oldDataSource, dataSource, true);

+ 4 - 3
src/main/java/com/fdkankan/scene/service/impl/SceneUploadServiceImpl.java

@@ -91,6 +91,7 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
             throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
         }
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+        String bucket = scenePlusExt.getYunFileBucket();
 
         String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum());
         List<String> filePaths = new ArrayList<>();
@@ -102,7 +103,7 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
             hasDelete.add(fileName);
             String key = userEditPath + fileName;
             filePaths.add(key);
-            ossUtil.deleteObject(key);
+            ossUtil.deleteObject(bucket, key);
         }
 
         this.update(new LambdaUpdateWrapper<SceneUpload>()
@@ -149,7 +150,7 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
 
             String ossPath = StrUtil.isNotBlank(uploadPath) ? uploadPath : (String.format(UploadFilePath.USER_EDIT_PATH ,num) + realFileName);
             try {
-                ossUtil.uploadFile(ossPath, newFile.getPath(), false);
+                ossUtil.uploadFile(bucket, ossPath, newFile.getPath(), false);
             }catch (Exception e){
                 log.error(ossPath+"上传文件失败"+e);
                 throw new BusinessException(ErrorCode.FAILURE_CODE_7013);
@@ -183,7 +184,7 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
         if(list != null && list.size() >0){
             for (SceneUpload sceneUpload : list) {
                 try {
-                    ossUtil.deleteObject(sceneUpload.getFilePath());
+                    ossUtil.deleteObject(bucket, sceneUpload.getFilePath());
                     this.removeEntity(sceneUpload);
                 }catch (Exception e){
                     log.error(sceneUpload.getFilePath()+"删除oss文件失败",e);

+ 1 - 0
src/main/java/com/fdkankan/scene/vo/InitSceneParamVO.java

@@ -21,6 +21,7 @@ public class InitSceneParamVO {
     private Integer sceneScheme;
     private String sceneResolution;
     private String sceneFrom;
+    private String bucket;
 
 
 }

+ 2 - 0
src/main/java/com/fdkankan/scene/vo/SceneParamVO.java

@@ -181,4 +181,6 @@ public class SceneParamVO extends RequestBase implements Serializable {
 
     private String dataSource;
 
+    private String bucket;
+
 }