|
@@ -1,8 +1,10 @@
|
|
package com.fdkankan.jp.xspace.service.impl;
|
|
package com.fdkankan.jp.xspace.service.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.fdkankan.common.constant.CommonStatus;
|
|
import com.fdkankan.common.constant.CommonStatus;
|
|
@@ -67,6 +69,29 @@ public class UnityServiceImpl implements IUnityService {
|
|
fYunFileService.downloadFile(v, localMeshPath + v.replace(meshKey, ""));
|
|
fYunFileService.downloadFile(v, localMeshPath + v.replace(meshKey, ""));
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ //如果有三维模型,需要下载三维模型原始文件
|
|
|
|
+ String sceneJsonKey = String.format(OSSPathConstant.SCENE_VIEW_DATA_DATA, bean.getNum()) + "scene.json";
|
|
|
|
+ String sceneJsonStr = fYunFileService.getFileContent(sceneJsonKey);
|
|
|
|
+ JSONObject sceneJsonObj = JSON.parseObject(sceneJsonStr);
|
|
|
|
+ String boxModelsStr = sceneJsonObj.getString("boxModels");
|
|
|
|
+ if(StrUtil.isNotEmpty(boxModelsStr)){
|
|
|
|
+ List<JSONObject> jsonObjects = JSON.parseArray(boxModelsStr, JSONObject.class);
|
|
|
|
+ if(CollUtil.isNotEmpty(jsonObjects)){
|
|
|
|
+ String userViewPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_USER, bean.getNum());
|
|
|
|
+ jsonObjects.stream().forEach(item->{
|
|
|
|
+ String sid = item.getString("sid");
|
|
|
|
+ String origObjPath = userViewPath + "boxModels/" + sid + "/";
|
|
|
|
+ List<String> objFileList = fYunFileService.listRemoteFiles(origObjPath);
|
|
|
|
+ if(CollUtil.isNotEmpty(objFileList)){
|
|
|
|
+ objFileList.stream().forEach(objKey->{
|
|
|
|
+ fYunFileService.downloadFile(objKey, workPath + objKey.replace(OSSPathConstant.SCENE_VIEW_DATA + bean.getNum() + "/", ""));
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
return workPath;
|
|
return workPath;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -117,42 +142,48 @@ public class UnityServiceImpl implements IUnityService {
|
|
|
|
|
|
String xspaceSceneOssPath = String.format(OSSPathConstant.XSPACE_SCENE_FORMAT,bean.getNum(), bean.getSerial());
|
|
String xspaceSceneOssPath = String.format(OSSPathConstant.XSPACE_SCENE_FORMAT,bean.getNum(), bean.getSerial());
|
|
|
|
|
|
- //上传mesh
|
|
|
|
- List<File> fileList = FileUtil.loopFiles(workPath);
|
|
|
|
- fileList.parallelStream().forEach(v->{
|
|
|
|
- fYunFileService.uploadFile(v.getAbsolutePath(), v.getAbsolutePath().replace(workPath, xspaceSceneOssPath));
|
|
|
|
- });
|
|
|
|
|
|
+ //复制user
|
|
|
|
+ String sourceUserPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_USER, bean.getNum());
|
|
|
|
+ String targetUserPath = xspaceSceneOssPath + "user/";
|
|
|
|
+ fYunFileService.copyFileInBucket(sourceUserPath, targetUserPath);
|
|
|
|
|
|
- //上传文件映射json
|
|
|
|
-// fYunFileService.uploadFile(workPath + "xxx.json", xspaceSceneOssPath + "xxx.json");
|
|
|
|
|
|
+ //复制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");
|
|
|
|
|
|
- //复制skybox图
|
|
|
|
- String sourceImagesPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_IMAGES, bean.getNum()) + "tiles/4k/";
|
|
|
|
|
|
+ //复制images
|
|
|
|
+ String sourceImagesPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_IMAGES, bean.getNum());
|
|
String targetImagesPath = xspaceSceneOssPath + "images/";
|
|
String targetImagesPath = xspaceSceneOssPath + "images/";
|
|
fYunFileService.copyFileInBucket(sourceImagesPath, targetImagesPath);
|
|
fYunFileService.copyFileInBucket(sourceImagesPath, targetImagesPath);
|
|
|
|
|
|
- //复制user
|
|
|
|
- String sourceUserPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_USER, bean.getNum());
|
|
|
|
- String targetUserPath = xspaceSceneOssPath + "user/";
|
|
|
|
- fYunFileService.copyFileInBucket(sourceUserPath, targetUserPath);
|
|
|
|
|
|
+ //复制video
|
|
|
|
+ String sourceVideoPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_VIDEO, bean.getNum());
|
|
|
|
+ String targetVideoPath = xspaceSceneOssPath + "video/";
|
|
|
|
+ fYunFileService.copyFileInBucket(sourceVideoPath, targetVideoPath);
|
|
|
|
|
|
- //上传getInfo.json
|
|
|
|
- String getInfoKey = xspaceSceneOssPath + "getInfo.json";
|
|
|
|
- SceneInfoVO getInfoJson = this.getSceneInfo4View(bean.getNum());
|
|
|
|
- fYunFileService.uploadFile(JSON.toJSONString(getInfoJson).toString().getBytes(StandardCharsets.UTF_8), getInfoKey);
|
|
|
|
|
|
+ //复制vioce
|
|
|
|
+ String sourceVoicePath = String.format(OSSPathConstant.SCENE_VIEW_DATA_VOICE, bean.getNum());
|
|
|
|
+ String targetVoicePath = xspaceSceneOssPath + "vioce/";
|
|
|
|
+ fYunFileService.copyFileInBucket(sourceVoicePath, targetVoicePath);
|
|
|
|
|
|
- //上传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);
|
|
|
|
|
|
+ //上传mesh
|
|
|
|
+ List<File> fileList = FileUtil.loopFiles(workPath);
|
|
|
|
+ fileList.parallelStream().forEach(v->{
|
|
|
|
+ fYunFileService.uploadFile(v.getAbsolutePath(), v.getAbsolutePath().replace(workPath, targetDataPath));
|
|
|
|
+ });
|
|
|
|
|
|
- //复制vision.modeldata
|
|
|
|
- String sourceVisionPath = String.format(OSSPathConstant.SCENE_VIEW_DATA_IMAGES, bean.getNum()) + "vision.modeldata";
|
|
|
|
- String tagetVisionPath = xspaceSceneOssPath + "vision.modeldata";
|
|
|
|
- fYunFileService.copyFileInBucket(sourceVisionPath, tagetVisionPath);
|
|
|
|
|
|
+ //三维模型
|
|
|
|
+ String ossBoxModelPath = targetUserPath + "boxModels/";
|
|
|
|
+ String boxModelPath = workPath + "user/boxModels/";
|
|
|
|
+ List<File> files = FileUtil.loopFiles(boxModelPath);
|
|
|
|
+ if(CollUtil.isNotEmpty(files)){
|
|
|
|
+ files.stream().forEach(file->{
|
|
|
|
+ fYunFileService.uploadFile(file.getAbsolutePath(), file.getAbsolutePath().replace(boxModelPath, ossBoxModelPath));
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|