|
@@ -1,8 +1,10 @@
|
|
|
package com.fdkankan.contro.mq.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.fdkankan.common.constant.ModelKind;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
import com.fdkankan.contro.bean.SceneJsonBean;
|
|
|
import com.fdkankan.contro.entity.*;
|
|
@@ -19,6 +21,8 @@ import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
|
|
|
import com.fdkankan.rabbitmq.util.RabbitMqProducer;
|
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -45,6 +49,9 @@ public class BuildObjServiceImpl implements IBuildSceneService {
|
|
|
@Value("${queue.modeling.obj.modeling-post}")
|
|
|
private String queueObjModelingPost;
|
|
|
|
|
|
+ @Value("${model.modelKind:3dtiles}")
|
|
|
+ private String modelKind;
|
|
|
+
|
|
|
@Autowired
|
|
|
private RabbitMqProducer mqProducer;
|
|
|
|
|
@@ -67,6 +74,9 @@ public class BuildObjServiceImpl implements IBuildSceneService {
|
|
|
private IScenePlusService scenePlusService;
|
|
|
|
|
|
@Autowired
|
|
|
+ private IScenePlusExtService scenePlusextService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private ISceneEditControlsService sceneEditControlsService;
|
|
|
|
|
|
@Autowired
|
|
@@ -162,18 +172,43 @@ public class BuildObjServiceImpl implements IBuildSceneService {
|
|
|
|
|
|
String path = message.getPath();
|
|
|
String projectNum = message.getBuildContext().get("sceneNum").toString();
|
|
|
-
|
|
|
+ ScenePro scenePro = sceneProService.getByNum(projectNum);
|
|
|
+ String imagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, projectNum);
|
|
|
+ String dataPath = String.format(UploadFilePath.DATA_VIEW_PATH, projectNum);
|
|
|
+ //标记激光场景是微服务上线后拍摄或是上线前拍摄(v3-代表上线前拍摄,v4-上线后拍摄),上线前拍摄的场景需要上传到v3目录,通过升级接口进行文件拷贝
|
|
|
+ String version = "v4";
|
|
|
+ if(Objects.nonNull(scenePro)){
|
|
|
+ version = "v3";
|
|
|
+ imagesPath = String.format(ConstantFilePath.IMAGE_PATH_FORMAT, projectNum);
|
|
|
+ dataPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, projectNum);
|
|
|
+ }
|
|
|
String laserObjFilePath = path;
|
|
|
- CreateObjUtil.convertTxtToDam(laserObjFilePath + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
- CreateObjUtil.convertDamToLzma(laserObjFilePath + File.separator + "results/");
|
|
|
- CreateObjUtil.convertTxtToDam(laserObjFilePath + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
- File file = new File(laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
- while (!file.exists()) {
|
|
|
- Thread.sleep(60000);
|
|
|
+ String resultsPath = laserObjFilePath + File.separator + "results" + File.separator;
|
|
|
+ if(this.modelKind.equals(ModelKind.DAM.code())){
|
|
|
+ CreateObjUtil.convertTxtToDam(laserObjFilePath + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
+ CreateObjUtil.convertDamToLzma(laserObjFilePath + File.separator + "results/");
|
|
|
+ CreateObjUtil.convertTxtToDam(laserObjFilePath + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
+ File file = new File(laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
+ while (!file.exists()) {
|
|
|
+ Thread.sleep(60000);
|
|
|
+ }
|
|
|
+ fYunFileService.uploadFile(laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", imagesPath + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
+ fYunFileService.uploadFile(laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", imagesPath + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
+ }
|
|
|
+ if(this.modelKind.equals(ModelKind.THREE_D_TILE.code())){
|
|
|
+ String threedtilesPath = resultsPath + ModelKind.THREE_D_TILE.code();
|
|
|
+ String oss3dtilesPath = imagesPath + ModelKind.THREE_D_TILE.code();
|
|
|
+ List<String> list = FileUtils.list(new File(threedtilesPath));
|
|
|
+ if(CollUtil.isEmpty(list)){
|
|
|
+ log.error("3dtiles目录异常,3dtiles地址:{}", new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
|
|
|
+ throw new Exception("3dtiles目录异常");
|
|
|
+ }
|
|
|
+ //上传3dtiles文件
|
|
|
+ fYunFileService.uploadFileByCommand(threedtilesPath, oss3dtilesPath);
|
|
|
+ //上传mesh文件
|
|
|
+ fYunFileService.deleteFolder(dataPath + "mesh");
|
|
|
+ fYunFileService.uploadFileByCommand(resultsPath + "mesh", dataPath + "mesh");
|
|
|
}
|
|
|
-
|
|
|
- fYunFileService.uploadFile(laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", String.format(UploadFilePath.IMG_VIEW_PATH, projectNum) + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
- fYunFileService.uploadFile(laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", String.format(UploadFilePath.IMG_VIEW_PATH, projectNum) + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
|
|
|
String texPath = laserObjFilePath + File.separator + "results" + File.separator + "tex";
|
|
|
|
|
@@ -203,7 +238,6 @@ public class BuildObjServiceImpl implements IBuildSceneService {
|
|
|
fdkkLaserService.pushBuildStatusToLaserSystem(projectNum, laserObjFilePath + "/laserData/mesh");
|
|
|
|
|
|
|
|
|
- ScenePro scenePro = sceneProService.getByNum(projectNum);
|
|
|
if(!ObjectUtils.isEmpty(scenePro)){
|
|
|
LambdaUpdateWrapper<ScenePro> updateWrapper = new LambdaUpdateWrapper<ScenePro>()
|
|
|
.set(ScenePro::getStatus, -2).eq(ScenePro::getNum, projectNum);
|
|
@@ -222,6 +256,10 @@ public class BuildObjServiceImpl implements IBuildSceneService {
|
|
|
sceneEditControls.setShowMap(0);
|
|
|
sceneEditControlsService.updateById(sceneEditControls);
|
|
|
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusextService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
+ scenePlusExt.setModelKind(modelKind);
|
|
|
+ scenePlusextService.updateById(scenePlusExt);
|
|
|
+
|
|
|
// 更新scene.json
|
|
|
String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, projectNum);
|
|
|
SceneJsonBean jsonObject =JSONObject.parseObject(fYunFileService.getFileContent(dataViewPath + "scene.json"), SceneJsonBean.class);
|