dengsixing il y a 10 mois
Parent
commit
6f3cb1862b

+ 4 - 0
src/main/java/com/fdkankan/jp/xspace/common/constant/OSSPathConstant.java

@@ -6,6 +6,10 @@ public class OSSPathConstant {
 
     public final static String SCENE_VIEW_DATA_IMAGES = SCENE_VIEW_DATA + "%s/images/";
 
+    public final static String SCENE_VIEW_DATA_VIDEO = SCENE_VIEW_DATA + "%s/video/";
+
+    public final static String SCENE_VIEW_DATA_VOICE = SCENE_VIEW_DATA + "%s/voice/";
+
     public final static String SCENE_VIEW_DATA_DATA = SCENE_VIEW_DATA + "%s/data/";
 
     public final static String SCENE_VIEW_DATA_USER = SCENE_VIEW_DATA + "%s/user/";

+ 4 - 4
src/main/java/com/fdkankan/jp/xspace/listener/RabbitMqListener.java

@@ -122,10 +122,10 @@ public class RabbitMqListener {
                 String errorLogKey = String.format(OSSPathConstant.XSPACE_SCENE_FORMAT, bean.getNum(), bean.getSerial()) + "log/error.log";
                 String logUrl = fYunFileConfig.getHost() + errorLogKey;
                 String extContent = null;
-                if(FileUtil.exist(errorLogPath)){
-                    fYunFileService.uploadFile(errorLogPath, errorLogKey);
-                    extContent = "**error-log**: " + logUrl + "\n\n";
-                }
+//                if(FileUtil.exist(errorLogPath)){
+//                    fYunFileService.uploadFile(errorLogPath, errorLogKey);
+//                    extContent = "**error-log**: " + logUrl + "\n\n";
+//                }
                 String content = String.format(DINGTALK_MSG_PATTERN, profile, errorReason, bean.getNum(), user.getUserName(), workPath);
                 if(StrUtil.isNotEmpty(extContent)){
                     content = content + extContent;

+ 55 - 27
src/main/java/com/fdkankan/jp/xspace/service/impl/UnityServiceImpl.java

@@ -117,42 +117,70 @@ public class UnityServiceImpl implements IUnityService {
 
         String xspaceSceneOssPath = String.format(OSSPathConstant.XSPACE_SCENE_FORMAT,bean.getNum(), bean.getSerial());
 
+        //复制user
+        String sourceUserPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_USER, bean.getNum());
+        String targetUserPath = xspaceSceneOssPath + "user/";
+        fYunFileService.copyFileInBucket(sourceUserPath, targetUserPath);
+
+        //复制data
+        String sourceDataPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_DATA, bean.getNum());
+        String targetDataPath = xspaceSceneOssPath + "data/";
+        fYunFileService.copyFileInBucket(sourceDataPath, targetDataPath);
+        //删除mesh
+        fYunFileService.deleteFolder(targetDataPath + "mesh");
+
+        //复制images
+        String sourceImagesPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_IMAGES, bean.getNum());
+        String targetImagesPath = xspaceSceneOssPath + "images/";
+        fYunFileService.copyFileInBucket(sourceImagesPath, targetImagesPath);
+
+        //复制video
+        String sourceVideoPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_VIDEO, bean.getNum());
+        String targetVideoPath = xspaceSceneOssPath + "video/";
+        fYunFileService.copyFileInBucket(sourceVideoPath, targetVideoPath);
+
+        //复制vioce
+        String sourceVoicePath = String.format(OSSPathConstant.SCENE_VIEW_DATA_VOICE, bean.getNum());
+        String targetVoicePath = xspaceSceneOssPath + "vioce/";
+        fYunFileService.copyFileInBucket(sourceVoicePath, targetVoicePath);
+
         //上传mesh
         List<File> fileList = FileUtil.loopFiles(workPath);
         fileList.parallelStream().forEach(v->{
-            fYunFileService.uploadFile(v.getAbsolutePath(), v.getAbsolutePath().replace(workPath, xspaceSceneOssPath));
+            fYunFileService.uploadFile(v.getAbsolutePath(), v.getAbsolutePath().replace(workPath, targetDataPath));
         });
 
         //上传文件映射json
 //        fYunFileService.uploadFile(workPath + "xxx.json", xspaceSceneOssPath + "xxx.json");
 
-        //复制skybox图
-        String sourceImagesPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_IMAGES, bean.getNum()) + "tiles/4k/";
-        String targetImagesPath = xspaceSceneOssPath + "images/";
-        fYunFileService.copyFileInBucket(sourceImagesPath, targetImagesPath);
-
-        //复制user
-        String sourceUserPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_USER, bean.getNum());
-        String targetUserPath = xspaceSceneOssPath + "user/";
-        fYunFileService.copyFileInBucket(sourceUserPath, targetUserPath);
-
-        //上传getInfo.json
-        String getInfoKey = xspaceSceneOssPath + "getInfo.json";
-        SceneInfoVO getInfoJson = this.getSceneInfo4View(bean.getNum());
-        fYunFileService.uploadFile(JSON.toJSONString(getInfoJson).toString().getBytes(StandardCharsets.UTF_8), getInfoKey);
-
-        //上传floorplan.json
-        String floorplanPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_DATA, bean.getNum()) + "floorplan.json";
-        if(getInfoJson.getFloorPlanUser() == 1){
-            floorplanPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_USER, bean.getNum()) + "floorplan.json";
-        }
-        String xspaceFloorplanPath = xspaceSceneOssPath + "floorplan.json";
-        fYunFileService.copyFileInBucket(floorplanPath, xspaceFloorplanPath);
+//        //复制skybox图
+//        String sourceImagesPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_IMAGES, bean.getNum()) + "tiles/4k/";
+//        String targetImagesPath = xspaceSceneOssPath + "images/";
+//        fYunFileService.copyFileInBucket(sourceImagesPath, targetImagesPath);
+//
+//        //复制user
+//        String sourceUserPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_USER, bean.getNum());
+//        String targetUserPath = xspaceSceneOssPath + "user/";
+//        fYunFileService.copyFileInBucket(sourceUserPath, targetUserPath);
+//
+//        //上传getInfo.json
+//        String getInfoKey = xspaceSceneOssPath + "getInfo.json";
+//        SceneInfoVO getInfoJson = this.getSceneInfo4View(bean.getNum());
+//        fYunFileService.uploadFile(JSON.toJSONString(getInfoJson).toString().getBytes(StandardCharsets.UTF_8), getInfoKey);
+//
+//        //上传floorplan.json
+//        String floorplanPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_DATA, bean.getNum()) + "floorplan.json";
+//        if(getInfoJson.getFloorPlanUser() == 1){
+//            floorplanPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_USER, bean.getNum()) + "floorplan.json";
+//        }
+//        String xspaceFloorplanPath = xspaceSceneOssPath + "floorplan.json";
+//        fYunFileService.copyFileInBucket(floorplanPath, xspaceFloorplanPath);
+//
+//        //复制vision.modeldata
+//        String sourceVisionPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_IMAGES, bean.getNum()) + "vision.modeldata";
+//        String tagetVisionPath = xspaceSceneOssPath + "vision.modeldata";
+//        fYunFileService.copyFileInBucket(sourceVisionPath, tagetVisionPath);
 
-        //复制vision.modeldata
-        String sourceVisionPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_IMAGES, bean.getNum()) + "vision.modeldata";
-        String tagetVisionPath = xspaceSceneOssPath + "vision.modeldata";
-        fYunFileService.copyFileInBucket(sourceVisionPath, tagetVisionPath);
 
     }