Browse Source

Merge branch 'feature-3dtiles-20221202' into feature-slimming-nas-20220130-dsx

# Conflicts:
#	src/main/java/com/fdkankan/contro/controller/TestController.java
#	src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java
dsx 2 years ago
parent
commit
afaa30b7ee

+ 8 - 1
src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java

@@ -2,11 +2,13 @@ package com.fdkankan.contro.mq.service.impl;
 
 import cn.hutool.core.exceptions.ExceptionUtil;
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.common.constant.CommonOperStatus;
 import com.fdkankan.common.constant.CommonStatus;
 import com.fdkankan.common.constant.ModelKind;
+import com.fdkankan.common.constant.SceneSource;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.contro.entity.ScenePlus;
 import com.fdkankan.contro.entity.ScenePro;
@@ -58,6 +60,9 @@ public class BuildObjServiceImpl implements IBuildSceneService {
     @Value("${model.modelKind:3dtiles}")
     private String modelKind;
 
+    @Value("#{'${model.3dtiles.sceneSource:}'.split(',')}")
+    private List<Integer> sdTilesSceneSourceList;
+
     @Autowired
     private RabbitMqProducer mqProducer;
 
@@ -205,7 +210,9 @@ public class BuildObjServiceImpl implements IBuildSceneService {
                 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())
+                    && CollUtil.isNotEmpty(sdTilesSceneSourceList)
+                    && sdTilesSceneSourceList.contains(SceneSource.JG.code())){){
                 String threedtilesPath = resultsPath + ModelKind.THREE_D_TILE.code();
                 String oss3dtilesPath = ossImagePath + ModelKind.THREE_D_TILE.code();
                 List<String> list = FileUtils.list(new File(threedtilesPath));

+ 45 - 36
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java

@@ -87,6 +87,9 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     @Value("${model.modelKind:3dtiles}")
     private String modelKind;
 
+    @Value("#{'${model.3dtiles.sceneSource:}'.split(',')}")
+    private List<Integer> sdTilesSceneSourceList;
+
     @Autowired
     private RabbitMqProducer mqProducer;
 
@@ -276,23 +279,19 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
             Map<String,String> damFileHeaders = new HashMap<>();
             damFileHeaders.put("Content-Encoding","gzip");
-            if (!ObjectUtils.isEmpty(cameraType) && !cameraType.equals(14)) {
-                if (!fYunFileService.getFyunType().equals(FYunTypeEnum.LOCAL.code())) {
-                    // dam 文件设置请求头
-                    uploadFiles.entrySet().stream().filter(entry -> FileNameUtil.extName(entry.getKey()).equals("dam"))
-                        .forEach(entry -> {
-                            if (!new File(entry.getKey()).exists()) {
-                                log.error("文件不存在,不予gzip压缩,文件路径:{}", entry.getKey());
-                                return;
-                            }
-                            // 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);
-                        });
-                }
-            }
+            // dam 文件设置请求头
+            uploadFiles.entrySet().stream().filter(entry -> FileNameUtil.extName(entry.getKey()).equals("dam"))
+                .forEach(entry -> {
+                    if (!new File(entry.getKey()).exists()) {
+                        log.error("文件不存在,不予gzip压缩,文件路径:{}", entry.getKey());
+                        return;
+                    }
+                    // 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);
+                });
 
             //拷贝部分文件到编辑目录,用于用户编辑
             this.copyToEditDir(sceneCode);
@@ -467,26 +466,36 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         }
 
         //exportMeshObj这个是字段由app写入的
-        if (!ObjectUtils.isEmpty(cameraType) && cameraType != 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(this.modelKind.equals(ModelKind.THREE_D_TILE.code())
-                && (!ObjectUtils.isEmpty(cameraType) && cameraType == 14 )//是激光场景
-                && (fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1)//选择生成obj
-        ){
-            List<String> list = FileUtils.list(new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
-            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目录异常");
+        boolean genModel = true;//是否生成模型 默认生成,深时场景要根据 exportMeshObj判断是否生成
+        if(!ObjectUtils.isEmpty(cameraType)
+                && cameraType == 14
+                && (!fdageData.containsKey("exportMeshObj") || fdageData.getIntValue("exportMeshObj") != 1)){
+            genModel = false;
+        }
+        boolean gen3dTiles = true;//是否生成3dtiles模型 默认生成
+        if(!ModelKind.THREE_D_TILE.code().equals(modelKind)
+                || CollUtil.isEmpty(sdTilesSceneSourceList)
+                || !sdTilesSceneSourceList.contains(scenePlus.getSceneSource())){
+            gen3dTiles = false;
+        }
+
+        if(genModel){
+            if (!gen3dTiles) {
+                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");
+            }else{
+                List<String> list = FileUtils.list(new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
+                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目录异常");
+                }
+                list.stream().forEach(str->{
+                    map.put(str, str.replace(path + File.separator + "results" + File.separator, imagesPath));
+                });
             }
-            list.stream().forEach(str->{
-                map.put(str, str.replace(path + File.separator + "results" + File.separator, imagesPath));
-            });
         }
 
         CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision.txt", resultsPath + "vision.modeldata");

+ 12 - 19
src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java

@@ -242,24 +242,17 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
             Map<String,String> damFileHeaders = new HashMap<>();
             damFileHeaders.put("Content-Encoding","gzip");
 
-            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
-                                .rename(new File(entry.getKey() + ".gzip"), entry.getKey(), true);
-                            fYunFileService
-                                .uploadFile(entry.getKey(), entry.getValue(), damFileHeaders);
-                        });
-                }
-            }
+            // 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.rename(new File(entry.getKey() + ".gzip"), entry.getKey(), true);
+                    fYunFileService.uploadFile(entry.getKey(), entry.getValue(), damFileHeaders);
+                });
 
             //生成houseTypejson并上传
             uploadFiles.entrySet().stream().filter(entry-> FileNameUtil.getName(entry.getKey()).equals("floorplan_cad.json"))
@@ -364,7 +357,7 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
 
 
         if ((fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1)
-                || (!ObjectUtils.isEmpty(cameraType) && (!cameraType.equals(14)))) {
+                || (!ObjectUtils.isEmpty(cameraType) && cameraType != 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");

+ 12 - 2
src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java

@@ -89,6 +89,9 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
     @Value("${model.modelKind:3dtiles}")
     private String modelKind;
 
+    @Value("#{'${model.3dtiles.sceneSource:}'.split(',')}")
+    private List<Integer> sdTilesSceneSourceList;
+
     @Value("${build.notSupport.beforeTime:202203}")
     private String jgNotSupportBuildTime;
 
@@ -789,6 +792,11 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         if(cameraType.longValue() == 14 ){
             scenePlus.setSceneSource(4);
             scenePlusExt.setSceneScheme(10);
+        }
+
+        if(ModelKind.THREE_D_TILE.code().equals(modelKind)
+                && CollUtil.isNotEmpty(sdTilesSceneSourceList)
+                && sdTilesSceneSourceList.contains(scenePlus.getSceneSource())){
             scenePlusExt.setModelKind(modelKind);
         }
 
@@ -1174,8 +1182,10 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             .set(ScenePlus::getSceneStatus, SceneStatus.wait.code())
             .eq(ScenePlus::getNum, num));
 
-        if(cameraType == 14){
-            scenePlusExt.setModelKind(this.modelKind);
+        if(ModelKind.THREE_D_TILE.code().equals(modelKind)
+                && CollUtil.isNotEmpty(sdTilesSceneSourceList)
+                && sdTilesSceneSourceList.contains(scenePlus.getSceneSource())){
+            scenePlusExt.setModelKind(modelKind);
         }
         scenePlusExtService.updateById(scenePlusExt);