|
@@ -1710,7 +1710,7 @@ public class SceneProServiceImpl extends BaseServiceImpl<SceneProEntity, String>
|
|
|
}
|
|
|
|
|
|
//重算全景图并上传oss或视频上传oss
|
|
|
- if(scenejson.containsKey("buildImages") && scenejson.getIntValue("buildImages") == 1){
|
|
|
+ if(scenejson.containsKey("buildImages") ){
|
|
|
String path = sceneProEntity.getDataSource();
|
|
|
|
|
|
if(path != null && !"".equals(path) && path.startsWith("http")){
|
|
@@ -1721,127 +1721,149 @@ public class SceneProServiceImpl extends BaseServiceImpl<SceneProEntity, String>
|
|
|
File images = new File(target + File.separator + "extras/images");
|
|
|
File video = new File(target + File.separator + "extras/video");
|
|
|
|
|
|
- log.info("下载vision.modeldata文件");
|
|
|
- FileUtils.downLoadFromUrl(prefixAli + "images/images" + sceneProEntity.getNum() + "/vision.modeldata" + "?m="+new Date().getTime(),
|
|
|
- "vision.modeldata", target + File.separator + "extras" + File.separator);
|
|
|
- CreateObjUtil.convertVisionmodeldataToTxt(target + File.separator + "extras" + File.separator + "vision.modeldata",
|
|
|
- target + File.separator + "extras" + File.separator + "vision.txt");
|
|
|
-
|
|
|
- if(images.exists() && images.listFiles() != null && images.listFiles().length > 0){
|
|
|
+ if(scenejson.getIntValue("buildImages") == 1){
|
|
|
+ log.info("下载vision.modeldata文件");
|
|
|
+ FileUtils.downLoadFromUrl(prefixAli + "images/images" + sceneProEntity.getNum() + "/vision.modeldata" + "?m="+new Date().getTime(),
|
|
|
+ "vision.modeldata", target + File.separator + "extras" + File.separator);
|
|
|
+ CreateObjUtil.convertVisionmodeldataToTxt(target + File.separator + "extras" + File.separator + "vision.modeldata",
|
|
|
+ target + File.separator + "extras" + File.separator + "vision.txt");
|
|
|
+
|
|
|
+ if(images.exists() && images.listFiles() != null && images.listFiles().length > 0){
|
|
|
+
|
|
|
+ FileUtils.copyFile(path + File.separator + "data.json", target + File.separator+"data.json", true);
|
|
|
+ FileUtils.copyFile(path + File.separator + "project.json", target + File.separator+"project.json", true);
|
|
|
+
|
|
|
+ //data.json增加extras为执行重建算法
|
|
|
+ String data = FileUtils.readFile(target + File.separator+"data.json");
|
|
|
+ if(data != null){
|
|
|
+ JSONObject floorplanJson = new JSONObject();
|
|
|
+ floorplanJson.put("has_source_images", true);
|
|
|
+ floorplanJson.put("has_vision_txt", true);
|
|
|
+
|
|
|
+ JSONObject dataJson = JSONObject.parseObject(data);
|
|
|
+ dataJson.put("extras", floorplanJson);
|
|
|
+ //V5表示不需要生成high,low文件
|
|
|
+ dataJson.put("skybox_type", "SKYBOX_V6");
|
|
|
+ if(sceneProEntity.getSceneScheme() == 11){
|
|
|
+ dataJson.put("skybox_type", "SKYBOX_V7");
|
|
|
+ }
|
|
|
+ dataJson.put("split_type", "SPLIT_V8");
|
|
|
+ //sceneScheme为3切成瓦片图
|
|
|
+ if(sceneProEntity.getSceneScheme() == 3){
|
|
|
+ dataJson.put("skybox_type", "SKYBOX_V4");
|
|
|
+ }
|
|
|
+ FileUtils.writeFile(target + File.separator+"data.json", new String(dataJson.toString().getBytes(), "UTF-8"));
|
|
|
+ }
|
|
|
|
|
|
- FileUtils.copyFile(path + File.separator + "data.json", target + File.separator+"data.json", true);
|
|
|
- FileUtils.copyFile(path + File.separator + "project.json", target + File.separator+"project.json", true);
|
|
|
+ //创建文件夹软连接并且复制data.json和project.json
|
|
|
+ if(new File(target + File.separator + "capture").exists()){
|
|
|
+ new File(target + File.separator + "capture").delete();
|
|
|
+ }
|
|
|
+ if(new File(target + File.separator + "results").exists()){
|
|
|
+ FileUtils.delAllFile(target + File.separator + "results");
|
|
|
+ }
|
|
|
+ //下载data.fdage
|
|
|
+ CreateObjUtil.ossUtilCp(ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "") + "/data.fdage", target + File.separator + "capture/");
|
|
|
|
|
|
- //data.json增加extras为执行重建算法
|
|
|
- String data = FileUtils.readFile(target + File.separator+"data.json");
|
|
|
- if(data != null){
|
|
|
- JSONObject floorplanJson = new JSONObject();
|
|
|
- floorplanJson.put("has_source_images", true);
|
|
|
- floorplanJson.put("has_vision_txt", true);
|
|
|
+ CreateObjUtil.build3dModel(target , "1");
|
|
|
|
|
|
- JSONObject dataJson = JSONObject.parseObject(data);
|
|
|
- dataJson.put("extras", floorplanJson);
|
|
|
- //V5表示不需要生成high,low文件
|
|
|
- dataJson.put("skybox_type", "SKYBOX_V6");
|
|
|
- if(sceneProEntity.getSceneScheme() == 11){
|
|
|
- dataJson.put("skybox_type", "SKYBOX_V7");
|
|
|
+ //读取upload文件,检验需要上传的文件是否存在
|
|
|
+ String uploadData = FileUtils.readFile(target + File.separator + "results" +File.separator+"upload.json");
|
|
|
+ JSONObject uploadJson = null;
|
|
|
+ JSONArray array = null;
|
|
|
+ if(uploadData!=null) {
|
|
|
+ uploadJson = JSONObject.parseObject(uploadData);
|
|
|
+ array = uploadJson.getJSONArray("upload");
|
|
|
}
|
|
|
- dataJson.put("split_type", "SPLIT_V8");
|
|
|
- //sceneScheme为3切成瓦片图
|
|
|
- if(sceneProEntity.getSceneScheme() == 3){
|
|
|
- dataJson.put("skybox_type", "SKYBOX_V4");
|
|
|
+ if(array == null){
|
|
|
+ throw new Exception("upload.json数据出错");
|
|
|
}
|
|
|
- FileUtils.writeFile(target + File.separator+"data.json", new String(dataJson.toString().getBytes(), "UTF-8"));
|
|
|
- }
|
|
|
+ JSONObject fileJson = null;
|
|
|
+ String fileName = "";
|
|
|
+ for(int i = 0, len = array.size(); i < len; i++){
|
|
|
+ fileJson = array.getJSONObject(i);
|
|
|
+ fileName = fileJson.getString("file");
|
|
|
+ //文件不存在抛出异常
|
|
|
+ if(!new File(target + File.separator + "results" +File.separator + fileName).exists()){
|
|
|
+ throw new Exception(target + File.separator + "results" +File.separator + fileName+"文件不存在");
|
|
|
+ }
|
|
|
|
|
|
- //创建文件夹软连接并且复制data.json和project.json
|
|
|
- if(new File(target + File.separator + "capture").exists()){
|
|
|
- new File(target + File.separator + "capture").delete();
|
|
|
- }
|
|
|
- if(new File(target + File.separator + "results").exists()){
|
|
|
- FileUtils.delAllFile(target + File.separator + "results");
|
|
|
- }
|
|
|
- //下载data.fdage
|
|
|
- CreateObjUtil.ossUtilCp(ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "") + "/data.fdage", target + File.separator + "capture/");
|
|
|
+ //high文件夹
|
|
|
+ if(fileJson.getIntValue("clazz") == 3){
|
|
|
+ map.put(target + File.separator + "results" +File.separator+ fileName,"images/images"+
|
|
|
+ sceneProEntity.getNum()+"/pan/high/"+ fileName.replace("high/", ""));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //low文件夹
|
|
|
+ if(fileJson.getIntValue("clazz") == 4){
|
|
|
+ map.put(target + File.separator + "results" +File.separator+ fileName,"images/images"+
|
|
|
+ sceneProEntity.getNum()+"/pan/low/"+ fileName.replace("low/", ""));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- CreateObjUtil.build3dModel(target , "1");
|
|
|
+ //tiles文件夹,亚马逊没有裁剪图片api,不需要上传4k图
|
|
|
+ if(fileJson.getIntValue("clazz") == 5){
|
|
|
+ map.put(target + File.separator + "results" + File.separator+ fileName,"images/images"+
|
|
|
+ sceneProEntity.getNum()+ File.separator + fileName);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- //读取upload文件,检验需要上传的文件是否存在
|
|
|
- String uploadData = FileUtils.readFile(target + File.separator + "results" +File.separator+"upload.json");
|
|
|
- JSONObject uploadJson = null;
|
|
|
- JSONArray array = null;
|
|
|
- if(uploadData!=null) {
|
|
|
- uploadJson = JSONObject.parseObject(uploadData);
|
|
|
- array = uploadJson.getJSONArray("upload");
|
|
|
- }
|
|
|
- if(array == null){
|
|
|
- throw new Exception("upload.json数据出错");
|
|
|
- }
|
|
|
- JSONObject fileJson = null;
|
|
|
- String fileName = "";
|
|
|
- for(int i = 0, len = array.size(); i < len; i++){
|
|
|
- fileJson = array.getJSONObject(i);
|
|
|
- fileName = fileJson.getString("file");
|
|
|
- //文件不存在抛出异常
|
|
|
- if(!new File(target + File.separator + "results" +File.separator + fileName).exists()){
|
|
|
- throw new Exception(target + File.separator + "results" +File.separator + fileName+"文件不存在");
|
|
|
+ //tiles文件夹,亚马逊瓦片图
|
|
|
+ if(fileJson.getIntValue("clazz") == 7 ){
|
|
|
+ map.put(target + File.separator + "results" + File.separator+ fileName,"images/images"+
|
|
|
+ sceneProEntity.getNum()+ File.separator + fileName);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- //high文件夹
|
|
|
- if(fileJson.getIntValue("clazz") == 3){
|
|
|
- map.put(target + File.separator + "results" +File.separator+ fileName,"images/images"+
|
|
|
- sceneProEntity.getNum()+"/pan/high/"+ fileName.replace("high/", ""));
|
|
|
- continue;
|
|
|
- }
|
|
|
- //low文件夹
|
|
|
- if(fileJson.getIntValue("clazz") == 4){
|
|
|
- map.put(target + File.separator + "results" +File.separator+ fileName,"images/images"+
|
|
|
- sceneProEntity.getNum()+"/pan/low/"+ fileName.replace("low/", ""));
|
|
|
- continue;
|
|
|
+ for(String imagesName : images.list()){
|
|
|
+ //覆盖原始图片资源
|
|
|
+ FileUtils.copyFile(target + File.separator + "extras/images/" + imagesName,
|
|
|
+ path + File.separator + "caches/images/" + imagesName, true);
|
|
|
+ FileUtils.deleteFile(target + File.separator + "extras/images/" + imagesName);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- //tiles文件夹,亚马逊没有裁剪图片api,不需要上传4k图
|
|
|
- if(fileJson.getIntValue("clazz") == 5){
|
|
|
- map.put(target + File.separator + "results" + File.separator+ fileName,"images/images"+
|
|
|
- sceneProEntity.getNum()+ File.separator + fileName);
|
|
|
- continue;
|
|
|
- }
|
|
|
+ if(video.exists() && video.listFiles() != null && video.listFiles().length > 0){
|
|
|
+ for(String videoName : video.list()){
|
|
|
+ uploadToOssUtil.upload(target + File.separator + "extras/video/" + videoName,"video/video"+
|
|
|
+ sceneProEntity.getNum()+ File.separator + videoName);
|
|
|
|
|
|
- //tiles文件夹,亚马逊瓦片图
|
|
|
- if(fileJson.getIntValue("clazz") == 7 ){
|
|
|
- map.put(target + File.separator + "results" + File.separator+ fileName,"images/images"+
|
|
|
- sceneProEntity.getNum()+ File.separator + fileName);
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
+ CreateObjUtil.mp4ToFlv(target + File.separator + "extras/video/" + videoName,
|
|
|
+ target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"));
|
|
|
|
|
|
- for(String imagesName : images.list()){
|
|
|
- //覆盖原始图片资源
|
|
|
- FileUtils.copyFile(target + File.separator + "extras/images/" + imagesName,
|
|
|
- path + File.separator + "caches/images/" + imagesName, true);
|
|
|
- FileUtils.deleteFile(target + File.separator + "extras/images/" + imagesName);
|
|
|
- }
|
|
|
- }
|
|
|
+ uploadToOssUtil.upload(target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"),"video/video"+
|
|
|
+ sceneProEntity.getNum()+ File.separator + videoName.replace("mp4", "flv"));
|
|
|
|
|
|
- if(video.exists() && video.listFiles() != null && video.listFiles().length > 0){
|
|
|
- for(String videoName : video.list()){
|
|
|
- uploadToOssUtil.upload(target + File.separator + "extras/video/" + videoName,"video/video"+
|
|
|
- sceneProEntity.getNum()+ File.separator + videoName);
|
|
|
+ //覆盖原始视频资源
|
|
|
+ FileUtils.copyFile(target + File.separator + "extras/video/" + videoName,
|
|
|
+ path + File.separator + "caches/videos/" + videoName, true);
|
|
|
|
|
|
- CreateObjUtil.mp4ToFlv(target + File.separator + "extras/video/" + videoName,
|
|
|
- target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"));
|
|
|
+ }
|
|
|
+ FileUtils.deleteDirectory(target + File.separator + "extras/video/");
|
|
|
+ }
|
|
|
+ }else if(scenejson.getIntValue("buildImages") == 2){
|
|
|
+ if(video.exists() && video.listFiles() != null && video.listFiles().length > 0){
|
|
|
+ for(String videoName : video.list()){
|
|
|
+ uploadToOssUtil.upload(target + File.separator + "extras/video/" + videoName,"video/video"+
|
|
|
+ sceneProEntity.getNum()+ File.separator + videoName);
|
|
|
|
|
|
- uploadToOssUtil.upload(target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"),"video/video"+
|
|
|
- sceneProEntity.getNum()+ File.separator + videoName.replace("mp4", "flv"));
|
|
|
+ CreateObjUtil.mp4ToFlv(target + File.separator + "extras/video/" + videoName,
|
|
|
+ target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"));
|
|
|
|
|
|
- //覆盖原始视频资源
|
|
|
- FileUtils.copyFile(target + File.separator + "extras/video/" + videoName,
|
|
|
- path + File.separator + "caches/videos/" + videoName, true);
|
|
|
+ uploadToOssUtil.upload(target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"),"video/video"+
|
|
|
+ sceneProEntity.getNum()+ File.separator + videoName.replace("mp4", "flv"));
|
|
|
|
|
|
+ //覆盖原始视频资源
|
|
|
+ FileUtils.copyFile(target + File.separator + "extras/video/" + videoName,
|
|
|
+ path + File.separator + "caches/videos/" + videoName, true);
|
|
|
+
|
|
|
+ }
|
|
|
+ FileUtils.deleteDirectory(target + File.separator + "extras/video/");
|
|
|
}
|
|
|
- FileUtils.deleteDirectory(target + File.separator + "extras/video/");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
scenejson.put("imagesVersion", sceneProEditEntity.getImagesVersion() + 1);
|
|
|
scenejson.put("buildImages", 0);
|
|
|
sceneProEditEntity.setImagesVersion(sceneProEditEntity.getImagesVersion() + 1);
|
|
@@ -3216,8 +3238,13 @@ public class SceneProServiceImpl extends BaseServiceImpl<SceneProEntity, String>
|
|
|
scenejson = JSONObject.parseObject(strsceneInfos);
|
|
|
}
|
|
|
|
|
|
- scenejson.put("buildImages", 1);
|
|
|
- FileUtils.writeFile(dataBuffer.toString() + "scene.json", scenejson.toString());
|
|
|
+ if(type.equals("video")){
|
|
|
+ scenejson.put("buildImages", 2);
|
|
|
+ FileUtils.writeFile(dataBuffer.toString() + "scene.json", scenejson.toString());
|
|
|
+ }else{
|
|
|
+ scenejson.put("buildImages", 1);
|
|
|
+ FileUtils.writeFile(dataBuffer.toString() + "scene.json", scenejson.toString());
|
|
|
+ }
|
|
|
|
|
|
return Result.success();
|
|
|
}
|
|
@@ -3872,4 +3899,9 @@ public class SceneProServiceImpl extends BaseServiceImpl<SceneProEntity, String>
|
|
|
return Result.success();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public int updateTime2(String sceneNum, String videos, long computeTime) {
|
|
|
+ return sceneProMapper.updateTime2(sceneNum, videos, computeTime);
|
|
|
+ }
|
|
|
+
|
|
|
}
|