|
@@ -50,63 +50,38 @@ public class ReverseSceneServiceImpl implements IReverseSceneService {
|
|
|
private ISceneEditInfoExtService sceneEditInfoExtService;
|
|
|
@Autowired
|
|
|
private ISceneEditControlsService sceneEditControlsService;
|
|
|
+ @Resource
|
|
|
+ private FYunFileServiceInterface fYunFileService;
|
|
|
|
|
|
@Override
|
|
|
public void reverseScene(JSONObject jsonObject) throws Exception {
|
|
|
|
|
|
String num = jsonObject.getString("num");
|
|
|
+ String zipPath = jsonObject.getString("path");
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
- SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
|
|
|
- if(Objects.isNull(sceneEditInfo)){
|
|
|
- sceneEditInfo = new SceneEditInfo();
|
|
|
- sceneEditInfo.setScenePlusId(scenePlus.getId());
|
|
|
- }
|
|
|
- sceneEditInfoService.saveOrUpdate(sceneEditInfo);
|
|
|
- SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
|
|
|
- if(Objects.isNull(sceneEditInfoExt)){
|
|
|
- sceneEditInfoExt = new SceneEditInfoExt();
|
|
|
- sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
|
|
|
- sceneEditInfoExt.setScenePlusId(scenePlus.getId());
|
|
|
- }
|
|
|
- sceneEditInfoExtService.saveOrUpdate(sceneEditInfoExt);
|
|
|
-
|
|
|
- SceneEditControls sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
|
|
|
- if(Objects.isNull(sceneEditControls)){
|
|
|
- sceneEditControls = new SceneEditControls();
|
|
|
- sceneEditControls.setEditInfoId(sceneEditInfo.getId());
|
|
|
- }
|
|
|
- sceneEditControlsService.saveOrUpdate(sceneEditControls);
|
|
|
-
|
|
|
|
|
|
- String zipPath = scenePlusExt.getDataSource();
|
|
|
- String zipParentDir = FileUtil.getParent(zipPath, 1);
|
|
|
+ String dataSource = scenePlusExt.getDataSource();
|
|
|
|
|
|
//解压
|
|
|
- ZipUtil.unzip(zipPath, zipParentDir, CharsetUtil.CHARSET_GBK);
|
|
|
+ fYunFileService.downloadFile(zipPath, dataSource);
|
|
|
+ ZipUtil.unzip(zipPath, dataSource, CharsetUtil.CHARSET_GBK);
|
|
|
|
|
|
//生成vision.txt
|
|
|
- int shootCount = this.genVisionTxt(num, zipParentDir);
|
|
|
+ int shootCount = this.genVisionTxt(num, dataSource);
|
|
|
|
|
|
//计算模型
|
|
|
- this.genModel(num, zipParentDir);
|
|
|
+ this.genModel(num, dataSource);
|
|
|
|
|
|
//计算全景图
|
|
|
- this.genPano(num, zipParentDir);
|
|
|
+ this.genPano(num, dataSource);
|
|
|
|
|
|
- scenePlus.setSceneSource(SceneSource.ZT.code());
|
|
|
scenePlus.setPayStatus(PayStatus.PAY.code());
|
|
|
scenePlus.setSceneStatus(SceneStatus.NO_DISPLAY.code());
|
|
|
scenePlus.setUpdateTime(new Date());
|
|
|
scenePlusService.updateById(scenePlus);
|
|
|
|
|
|
- scenePlusExt.setSceneFrom(SceneFrom.MINION.code());
|
|
|
- scenePlusExt.setSceneKind(SceneKind.FACE.code());
|
|
|
- scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
|
|
|
- scenePlusExt.setSceneScheme(SceneScheme.LM.code());
|
|
|
scenePlusExt.setAlgorithmTime(new Date());
|
|
|
- scenePlusExt.setBuildType("V3");
|
|
|
- scenePlusExt.setModelKind(ModelKind.DAM.code());
|
|
|
scenePlusExt.setWebSite(sceneProNewUrl + num);
|
|
|
scenePlusExt.setShootCount(shootCount);
|
|
|
scenePlusExt.setUpdateTime(new Date());
|
|
@@ -146,8 +121,8 @@ public class ReverseSceneServiceImpl implements IReverseSceneService {
|
|
|
fileServiceInterface.uploadFile(JSON.toJSONBytes(sceneJson), sceneJsonPath);
|
|
|
}
|
|
|
|
|
|
- private int genVisionTxt(String num, String zipParentDir) throws Exception {
|
|
|
- String workJsonPath = zipParentDir + "/work.json";
|
|
|
+ private int genVisionTxt(String num, String dataSource) throws Exception {
|
|
|
+ String workJsonPath = dataSource + "/work.json";
|
|
|
JSONObject jsonObject = JSON.parseObject(FileUtil.readUtf8String(workJsonPath));
|
|
|
JSONArray observers = jsonObject.getJSONArray("observers");
|
|
|
JSONObject visionTxtObj = new JSONObject();
|
|
@@ -214,30 +189,30 @@ public class ReverseSceneServiceImpl implements IReverseSceneService {
|
|
|
sweepLocation.put("visibles3", observerObj.get("visible_nodes"));
|
|
|
}
|
|
|
|
|
|
- FileUtil.writeUtf8String(JSON.toJSONString(visionTxtObj), zipParentDir + "/vision.txt");
|
|
|
+ FileUtil.writeUtf8String(JSON.toJSONString(visionTxtObj), dataSource + "/vision.txt");
|
|
|
|
|
|
//转换modedata
|
|
|
- CreateObjUtil.convertTxtToVisionmodeldata(zipParentDir + "/vision.txt", zipParentDir + "/vision.modeldata");
|
|
|
+ CreateObjUtil.convertTxtToVisionmodeldata(dataSource + "/vision.txt", dataSource + "/vision.modeldata");
|
|
|
|
|
|
- fileServiceInterface.uploadFile(zipParentDir + "/vision.txt", String.format(UploadFilePath.IMG_VIEW_PATH, num) + "vision.txt");
|
|
|
- fileServiceInterface.uploadFile(zipParentDir + "/vision.modeldata", String.format(UploadFilePath.IMG_VIEW_PATH, num) + "vision.modeldata");
|
|
|
+ fileServiceInterface.uploadFile(dataSource + "/vision.txt", String.format(UploadFilePath.IMG_VIEW_PATH, num) + "vision.txt");
|
|
|
+ fileServiceInterface.uploadFile(dataSource + "/vision.modeldata", String.format(UploadFilePath.IMG_VIEW_PATH, num) + "vision.modeldata");
|
|
|
|
|
|
return observers.size();
|
|
|
}
|
|
|
|
|
|
- private void genPano(String num, String zipParentDir) throws Exception {
|
|
|
+ private void genPano(String num, String dataSource) throws Exception {
|
|
|
//全景图计算根目录
|
|
|
String target = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + "reverseScene_images";
|
|
|
//解压缩文件存放目录
|
|
|
String targetImagesPath = target + "/extras/images/";
|
|
|
|
|
|
- List<File> files = FileUtil.loopFiles(zipParentDir + "/src_pano/");
|
|
|
+ List<File> files = FileUtil.loopFiles(dataSource + "/src_pano/");
|
|
|
for (File file : files) {
|
|
|
String index = FileUtil.getName(file).split("_")[0];
|
|
|
FileUtil.copyContent(file, new File(targetImagesPath + index + ".jpg"), true);
|
|
|
}
|
|
|
|
|
|
- FileUtil.copy(zipParentDir + "/vision.txt", target + "/extras/" + "vision.txt", true);
|
|
|
+ FileUtil.copy(dataSource + "/vision.txt", target + "/extras/" + "vision.txt", true);
|
|
|
//data.json增加extras为执行重建算法
|
|
|
JSONObject floorplanJson = new JSONObject();
|
|
|
floorplanJson.put("has_source_images", true);
|
|
@@ -328,13 +303,13 @@ public class ReverseSceneServiceImpl implements IReverseSceneService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void genModel(String num, String zipParentDir) throws Exception {
|
|
|
+ private void genModel(String num, String dataSource) throws Exception {
|
|
|
String path = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + "reverseScene_obj2txt";
|
|
|
String filePath = path + "/extras/";
|
|
|
//计算模型
|
|
|
- FileUtil.copyContent(new File(zipParentDir + "/src_model/material/"), new File(filePath), true);
|
|
|
- FileUtil.copyContent(new File(zipParentDir + "/src_model/mtl/"), new File(filePath), true);
|
|
|
- List<File> objFiles = FileUtil.loopFiles(new File(zipParentDir + "/src_model/obj/"));
|
|
|
+ FileUtil.copyContent(new File(dataSource + "/src_model/material/"), new File(filePath), true);
|
|
|
+ FileUtil.copyContent(new File(dataSource + "/src_model/mtl/"), new File(filePath), true);
|
|
|
+ List<File> objFiles = FileUtil.loopFiles(new File(dataSource + "/src_model/obj/"));
|
|
|
for (File objFile : objFiles) {
|
|
|
FileUtil.copyContent(objFile, new File(filePath + "mesh.obj"), true);
|
|
|
}
|