|
@@ -11,6 +11,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.fdkankan.common.constant.ExpiredStatus;
|
|
|
+import com.fdkankan.common.constant.ModelKind;
|
|
|
import com.fdkankan.common.constant.PayStatus;
|
|
|
import com.fdkankan.common.constant.SceneStatus;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
@@ -66,6 +67,9 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
|
|
|
@Value("${model.type:#{null}}")
|
|
|
private String modelSceneKind;
|
|
|
|
|
|
+ @Value("${model.modelKind:3dtiles}")
|
|
|
+ private String modelKind;
|
|
|
+
|
|
|
@Autowired
|
|
|
private RabbitMqProducer mqProducer;
|
|
|
|
|
@@ -213,17 +217,23 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
|
|
|
Map<String,String> damFileHeaders = new HashMap<>();
|
|
|
damFileHeaders.put("Content-Encoding","gzip");
|
|
|
|
|
|
- if (!fYunFileService.getFyunType().equals(FYunTypeEnum.LOCAL.code())) {
|
|
|
- // dam 文件设置请求头
|
|
|
- uploadFiles.entrySet().stream().filter(entry -> FileNameUtil.extName(entry.getKey()).equals("dam"))
|
|
|
+ if(modelKind.equals(ModelKind.DAM.code())) {
|
|
|
+ if (!fYunFileService.getFyunType().equals(FYunTypeEnum.LOCAL.code())) {
|
|
|
+ // dam 文件设置请求头
|
|
|
+ uploadFiles.entrySet().stream()
|
|
|
+ .filter(entry -> FileNameUtil.extName(entry.getKey()).equals("dam"))
|
|
|
.filter(entry -> new File(entry.getKey()).exists())
|
|
|
.forEach(entry -> {
|
|
|
// gzip压缩
|
|
|
- FileUtil.writeBytes(ZipUtil.gzip(new File(entry.getKey())), entry.getKey() + ".gzip");
|
|
|
+ FileUtil.writeBytes(ZipUtil.gzip(new File(entry.getKey())),
|
|
|
+ entry.getKey() + ".gzip");
|
|
|
// 重命名
|
|
|
- FileUtil.rename(new File(entry.getKey() + ".gzip"), entry.getKey(), true);
|
|
|
- fYunFileService.uploadFile(entry.getKey(), entry.getValue(), damFileHeaders);
|
|
|
+ FileUtil
|
|
|
+ .rename(new File(entry.getKey() + ".gzip"), entry.getKey(), true);
|
|
|
+ fYunFileService
|
|
|
+ .uploadFile(entry.getKey(), entry.getValue(), damFileHeaders);
|
|
|
});
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//生成houseTypejson并上传
|
|
@@ -327,13 +337,39 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- if ((fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1)
|
|
|
- || (!ObjectUtils.isEmpty(cameraType) && (!cameraType.equals(14)))) {
|
|
|
- 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");
|
|
|
- map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", imagesPath + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
- map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", imagesPath + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
+// if ((fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1)
|
|
|
+// || (!ObjectUtils.isEmpty(cameraType) && (!cameraType.equals(14)))) {
|
|
|
+// 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");
|
|
|
+// map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", imagesPath + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
+// map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", imagesPath + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
+// }
|
|
|
+ //这里适配旧算法和新算法,生成obj|上传3dtiles
|
|
|
+ if (fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1
|
|
|
+ || (!ObjectUtils.isEmpty(cameraType) && (!cameraType.equals(14)))){
|
|
|
+ if(this.modelKind.equals(ModelKind.DAM.code())){
|
|
|
+ CreateObjUtil.convertTxtToDam(resultsPath + "tex" + File.separator + "modeldata.txt", resultsPath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
+ CreateObjUtil.convertDamToLzma(resultsPath + File.separator + "results/");
|
|
|
+ CreateObjUtil.convertTxtToDam(resultsPath + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", resultsPath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
+ File file = new File(resultsPath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
+ while (!file.exists()) {
|
|
|
+ Thread.sleep(60000);
|
|
|
+ }
|
|
|
+ fYunFileService.uploadFile(resultsPath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", imagesPath + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
+ fYunFileService.uploadFile(resultsPath + 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);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision.txt", resultsPath + "vision.modeldata");
|
|
@@ -354,6 +390,10 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private void uploadObj(String num, String path) throws Exception {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private JSONObject getFdageData(String dataFdagePath) {
|
|
|
log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
|
|
|
String data = FileUtils.readFile(dataFdagePath);
|