|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
+import com.fdkankan.common.constant.CommonStatus;
|
|
import com.fdkankan.common.constant.ModelKind;
|
|
import com.fdkankan.common.constant.ModelKind;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.contro.entity.ScenePro;
|
|
import com.fdkankan.contro.entity.ScenePro;
|
|
@@ -159,33 +160,34 @@ public class BuildObjServiceImpl implements IBuildSceneService {
|
|
}
|
|
}
|
|
|
|
|
|
String path = message.getPath();
|
|
String path = message.getPath();
|
|
|
|
+ String laserObjFilePath = path;
|
|
String projectNum = message.getBuildContext().get("sceneNum").toString();
|
|
String projectNum = message.getBuildContext().get("sceneNum").toString();
|
|
ScenePro scenePro = sceneProService.getByNum(projectNum);
|
|
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";
|
|
String version = "v4";
|
|
- if(Objects.nonNull(scenePro)){
|
|
|
|
|
|
+ String ossImagePath = String.format(UploadFilePath.IMG_VIEW_PATH, projectNum);
|
|
|
|
+ String ossDataPath = String.format(UploadFilePath.DATA_VIEW_PATH, projectNum);
|
|
|
|
+ //如果是微服务上线之前的存量场景且未生成过obj(未升级过),需要上传到v3的目录,在函数最后调用升级接口进行文件拷贝
|
|
|
|
+ if(Objects.nonNull(scenePro) && scenePro.getIsUpgrade() != CommonStatus.YES.code().intValue()){
|
|
|
|
+ ossImagePath = String.format(ConstantFilePath.IMAGE_PATH_FORMAT, projectNum);
|
|
|
|
+ ossDataPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, projectNum);
|
|
version = "v3";
|
|
version = "v3";
|
|
- imagesPath = String.format(ConstantFilePath.IMAGE_PATH_FORMAT, projectNum);
|
|
|
|
- dataPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, projectNum);
|
|
|
|
}
|
|
}
|
|
- String laserObjFilePath = path;
|
|
|
|
- String resultsPath = laserObjFilePath + File.separator + "results" + File.separator;
|
|
|
|
|
|
+ //上传obj
|
|
|
|
+ String resultsPath = path + File.separator + "results" + File.separator;
|
|
if(this.modelKind.equals(ModelKind.DAM.code())){
|
|
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");
|
|
|
|
|
|
+ CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
|
+ CreateObjUtil.convertDamToLzma(path + File.separator + "results/");
|
|
|
|
+ CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
|
+ File file = new File(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
while (!file.exists()) {
|
|
while (!file.exists()) {
|
|
Thread.sleep(60000);
|
|
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");
|
|
|
|
|
|
+ fYunFileService.uploadFile(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", ossImagePath + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
|
+ fYunFileService.uploadFile(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", ossImagePath + ConstantFileName.modelUUID + "_50k.dam");
|
|
}
|
|
}
|
|
if(this.modelKind.equals(ModelKind.THREE_D_TILE.code())){
|
|
if(this.modelKind.equals(ModelKind.THREE_D_TILE.code())){
|
|
String threedtilesPath = resultsPath + ModelKind.THREE_D_TILE.code();
|
|
String threedtilesPath = resultsPath + ModelKind.THREE_D_TILE.code();
|
|
- String oss3dtilesPath = imagesPath + ModelKind.THREE_D_TILE.code();
|
|
|
|
|
|
+ String oss3dtilesPath = ossImagePath + ModelKind.THREE_D_TILE.code();
|
|
List<String> list = FileUtils.list(new File(threedtilesPath));
|
|
List<String> list = FileUtils.list(new File(threedtilesPath));
|
|
if(CollUtil.isEmpty(list)){
|
|
if(CollUtil.isEmpty(list)){
|
|
log.error("3dtiles目录异常,3dtiles地址:{}", new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
|
|
log.error("3dtiles目录异常,3dtiles地址:{}", new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
|
|
@@ -193,9 +195,6 @@ public class BuildObjServiceImpl implements IBuildSceneService {
|
|
}
|
|
}
|
|
//上传3dtiles文件
|
|
//上传3dtiles文件
|
|
fYunFileService.uploadFileByCommand(threedtilesPath, oss3dtilesPath);
|
|
fYunFileService.uploadFileByCommand(threedtilesPath, oss3dtilesPath);
|
|
- //上传mesh文件
|
|
|
|
- fYunFileService.deleteFolder(dataPath + "mesh");
|
|
|
|
- fYunFileService.uploadFileByCommand(resultsPath + "mesh", dataPath + "mesh");
|
|
|
|
}
|
|
}
|
|
|
|
|
|
String texPath = laserObjFilePath + File.separator + "results" + File.separator + "tex";
|
|
String texPath = laserObjFilePath + File.separator + "results" + File.separator + "tex";
|
|
@@ -205,13 +204,13 @@ public class BuildObjServiceImpl implements IBuildSceneService {
|
|
for (File textureFile : texFile.listFiles()) {
|
|
for (File textureFile : texFile.listFiles()) {
|
|
if(textureFile.getName().endsWith(".jpg")){
|
|
if(textureFile.getName().endsWith(".jpg")){
|
|
fYunFileService.uploadFile(textureFile.getAbsolutePath(),
|
|
fYunFileService.uploadFile(textureFile.getAbsolutePath(),
|
|
- String.format(UploadFilePath.IMG_VIEW_PATH, projectNum) + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/"+textureFile.getName());
|
|
|
|
|
|
+ ossImagePath + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/"+textureFile.getName());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
fYunFileService.uploadFile(laserObjFilePath + File.separator + "results" + File.separator + "tex/texture1.jpg",
|
|
fYunFileService.uploadFile(laserObjFilePath + File.separator + "results" + File.separator + "tex/texture1.jpg",
|
|
- String.format(UploadFilePath.IMG_VIEW_PATH, projectNum) + "/" + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/texture1.jpg");
|
|
|
|
|
|
+ ossImagePath + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/texture1.jpg");
|
|
|
|
|
|
// 拷贝结果
|
|
// 拷贝结果
|
|
log.info("开始拷贝obj文件");
|
|
log.info("开始拷贝obj文件");
|
|
@@ -219,6 +218,7 @@ public class BuildObjServiceImpl implements IBuildSceneService {
|
|
|
|
|
|
File meshFolder = new File(laserObjFilePath + "/results/mesh");
|
|
File meshFolder = new File(laserObjFilePath + "/results/mesh");
|
|
|
|
|
|
|
|
+ //上传mesh文件
|
|
for (File meshFile : meshFolder.listFiles()) {
|
|
for (File meshFile : meshFolder.listFiles()) {
|
|
fYunFileService.uploadFile(meshFile.getAbsolutePath(), String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "mesh/" + meshFile.getName());
|
|
fYunFileService.uploadFile(meshFile.getAbsolutePath(), String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "mesh/" + meshFile.getName());
|
|
}
|
|
}
|
|
@@ -235,7 +235,9 @@ public class BuildObjServiceImpl implements IBuildSceneService {
|
|
}
|
|
}
|
|
|
|
|
|
// 如果未升级V4,则升级V4
|
|
// 如果未升级V4,则升级V4
|
|
- fdkkV4Service.upgradeToV4(projectNum);
|
|
|
|
|
|
+ if("v3".equals(version)){
|
|
|
|
+ fdkkV4Service.upgradeToV4(projectNum);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|