dengsixing il y a 4 mois
Parent
commit
882f4d33e5

+ 7 - 5
src/main/java/com/fdkankan/contro/mq/service/impl/BuildE57SceneServiceImpl.java

@@ -66,11 +66,7 @@ public class BuildE57SceneServiceImpl implements IBuildSceneService {
     @Autowired
     private IBuildSceneDTService buildSceneDTService;
     @Autowired
-    private ICommonService commonService;
-    @Autowired
-    private ISceneColdStorageService sceneColdStorageService;
-    @Autowired
-    private IntermitSceneService intermitSceneService;
+    private IBuildService buildService;
 
     @Override
     public void buildScenePre(BuildSceneCallMessage message) throws Exception{
@@ -91,6 +87,12 @@ public class BuildE57SceneServiceImpl implements IBuildSceneService {
             message.setResultReceiverMqName(queueModelingPost);
             message.setBizType("e57");
 
+            //写入算法参数文件
+            Map<String, String> dataMap = new HashMap<>();
+            dataMap.put("splitType", "SPLIT_V27");
+            dataMap.put("skyboxType", "SKYBOX_V5");
+            buildService.writeDataJson(message, null, dataMap, null);
+
             log.info("e57计算资源准备结束,场景码:{}", message.getSceneNum());
 
         }catch (Exception e){

+ 6 - 12
src/main/java/com/fdkankan/contro/mq/service/impl/BuildIntermitSceneServiceImpl.java

@@ -76,6 +76,8 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
     private ISceneColdStorageService sceneColdStorageService;
     @Autowired
     private IntermitSceneService intermitSceneService;
+    @Autowired
+    private IBuildService buildService;
 
     @Override
     public void buildScenePre(BuildSceneCallMessage message) throws Exception{
@@ -113,6 +115,9 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
             message.setResultReceiverMqName(queueModelingPost);
             message.setBizType("intermit");
 
+            JSONObject fdageData = commonService.getFdageData(message.getPath() + File.separator + "capture" + File.separator + "data.fdage");
+            buildService.writeDataJson(message, fdageData, null, null);
+
             log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
 
         }catch (Exception e){
@@ -150,7 +155,7 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
             fYunFileService.uploadFile(path + File.separator + "console.log", buildLogPath + "console.log");
             log.info("计算日志上传完成");
 
-            JSONObject fdageData = getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
+            JSONObject fdageData = commonService.getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
 
             if (!message.getBuildSuccess()) {
                 log.error("建模失败,修改状态为失败状态");
@@ -252,17 +257,6 @@ public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
         return map;
     }
 
-    private JSONObject getFdageData(String dataFdagePath) {
-        log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
-        String data = FileUtils.readFile(dataFdagePath);
-        //获取data.fdage的内容
-        JSONObject dataJson = new JSONObject();
-        if(data!=null){
-            dataJson = JSONObject.parseObject(data);
-        }
-        return dataJson;
-    }
-
     private void uploadStatusJson(ScenePlus scenePlus, ScenePlusExt scenePlusExt){
         String num = scenePlus.getNum();
         String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);

+ 5 - 1
src/main/java/com/fdkankan/contro/mq/service/impl/BuildLiguangServiceImpl.java

@@ -129,6 +129,8 @@ public class BuildLiguangServiceImpl implements IBuildSceneService {
     private ISceneBuildProcessLogService sceneBuildProcessLogService;
     @Autowired
     private ISceneColdStorageService sceneColdStorageService;
+    @Autowired
+    private IBuildService buildService;
 
 
     @Override
@@ -160,9 +162,11 @@ public class BuildLiguangServiceImpl implements IBuildSceneService {
 
 
             message.getBuildContext().put("cameraType",message.getCameraType());
-
             message.setBizType("standard");
 
+            JSONObject fdageData = commonService.getFdageData(message.getPath() + File.separator + "capture" + File.separator + "data.fdage");
+            buildService.writeDataJson(message, fdageData, null, null);
+
             log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
 
         }catch (Exception e){

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

@@ -105,6 +105,8 @@ public class BuildObjServiceImpl implements IBuildSceneService {
     private ICameraDetailService cameraDetailService;
     @Autowired
     private ICompanyService companyService;
+    @Autowired
+    private IBuildService buildService;
 
     @Override
     public void buildScenePre(BuildSceneCallMessage message) throws Exception{
@@ -119,7 +121,6 @@ public class BuildObjServiceImpl implements IBuildSceneService {
             FileUtils.delAllFile(laserObjFilePath);
 
             //获取解压后的资源的data.fdage中的数据
-            File folderPath = new File(path);
             fYunFileService.downloadFile(ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage", laserObjFilePath + "/capture/data.fdage");
             JSONObject jsonObject = FileUtils.readJson(laserObjFilePath + File.separator + "capture" + File.separator + "data.fdage");
             if(ObjectUtils.isEmpty(jsonObject)){
@@ -147,6 +148,11 @@ public class BuildObjServiceImpl implements IBuildSceneService {
             message.setResultReceiverMqName(queueObjModelingPost);
             message.setBizType("obj");
 
+            JSONObject fdageData = commonService.getFdageData(laserObjFilePath + File.separator + "capture" + File.separator + "data.fdage");
+            Map<String, Object> dataExtras = new HashMap<>(1);
+            dataExtras.put("big_depthmap", true);
+            buildService.writeDataJson(message, fdageData, null, dataExtras);
+
             success = true;
 
             log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());

+ 35 - 5
src/main/java/com/fdkankan/contro/mq/service/impl/BuildReverseE57SceneServiceImpl.java

@@ -86,6 +86,8 @@ public class BuildReverseE57SceneServiceImpl implements IBuildSceneService {
     private IFdkkLaserService fdkkLaserService;
     @Autowired
     private ISceneEditControlsService sceneEditControlsService;
+    @Autowired
+    private IBuildService buildService;
 
     @Value("${main.url}")
     private String mainUrl;
@@ -93,7 +95,6 @@ public class BuildReverseE57SceneServiceImpl implements IBuildSceneService {
     public void buildScenePre(BuildSceneCallMessage message) throws Exception{
         String num = message.getSceneNum();
         Integer rebuild = (Integer)message.getExt().get("rebuild");
-        Boolean deleteExtras = (Boolean)message.getExt().get("deleteExtras");
         ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
         try {
@@ -101,16 +102,12 @@ public class BuildReverseE57SceneServiceImpl implements IBuildSceneService {
             String homePath = SceneUtil.getHomePath(dataSource);
             message.setPath(dataSource);
             String homeKey = homePath + "input.e57";
-            String key = null;
             if(Objects.isNull(rebuild) || rebuild == CommonStatus.NO.code().intValue()){
                 String path = (String)message.getExt().get("path");
                 //复制原始资源到home目录
                 fYunFileService.copyFileInBucket(path, homeKey);
                 //删除临时文件
                 fYunFileService.deleteFile(path);
-                key = homeKey;
-            }else{
-                key = homeKey;
             }
 
             //删除点位校准数据
@@ -137,6 +134,19 @@ public class BuildReverseE57SceneServiceImpl implements IBuildSceneService {
             message.setResultReceiverMqName(queueModelingPost);
             message.setBizType("reverseE57");
 
+            String splitType = "SPLIT_V29";
+            String skyboxType = "SKYBOX_V11";
+            String otherType = (String)message.getExt().get("otherType");
+            Integer isObj = (Integer) message.getExt().get("isObj");
+            if(StrUtil.isNotEmpty(modelType) && ModelTypeEnums.TILE_CODE.equals(modelType)){
+                skyboxType = "SKYBOX_V15";
+            }
+            if(Objects.nonNull(isObj) && isObj == CommonStatus.YES.code().intValue()){
+                splitType = "SPLIT_V30";
+            }
+
+            this.createProjectAndDataFile(message.getPath(), num, splitType, skyboxType,otherType,null,null);
+
             log.info("上传e57计算资源准备结束,场景码:{}", message.getSceneNum());
 
         }catch (Exception e){
@@ -149,6 +159,26 @@ public class BuildReverseE57SceneServiceImpl implements IBuildSceneService {
         }
     }
 
+    public void createProjectAndDataFile(String path, String sceneNum, String splitType, String skyboxType, String otherType, Map<String, Object> projectExtras, Map<String, Object> dataExtras) {
+        JSONObject projectJson = new JSONObject();
+        if (!org.apache.commons.lang3.ObjectUtils.isEmpty(projectExtras)) {
+            projectJson.putAll(projectExtras);
+        }
+
+        projectJson.put("sceneNum", sceneNum);
+        FileUtils.writeFile(path + File.separator + "project.json", projectJson.toString());
+        JSONObject dataJson = new JSONObject();
+        if (!org.apache.commons.lang3.ObjectUtils.isEmpty(dataExtras)) {
+            dataJson.putAll(dataExtras);
+        }
+
+        dataJson.put("split_type", splitType);
+        dataJson.put("skybox_type", skyboxType);
+        dataJson.put("extras", (Object)null);
+        dataJson.put("other_type", otherType);
+        FileUtils.writeFile(path + File.separator + "data.json", dataJson.toString());
+    }
+
     private String getOssPath(String path) {
         String ossPath = ConstantFilePath.OSS_PREFIX
                 + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")

+ 5 - 0
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java

@@ -138,6 +138,8 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     private IWbService wbService;
     @Autowired
     private IAiService aiService;
+    @Autowired
+    private IBuildService buildService;
 
 
     @Override
@@ -212,6 +214,9 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
             message.setBizType("standard");
 
+            //写入算法参数文件
+            buildService.writeDataJson(message, fdageJson, null, null);
+
             log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
 
         }catch (Exception e){

+ 4 - 2
src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java

@@ -115,6 +115,8 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
 
     @Autowired
     private ICompanyService companyService;
+    @Autowired
+    private IBuildService buildService;
 
     @Override
     public void buildScenePre(BuildSceneCallMessage message) {
@@ -159,11 +161,11 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
             }
 
             message.getBuildContext().put("cameraType",message.getCameraType());
-
             message.setResultReceiverMqName(queueV3ModelingPost);
-
             message.setBizType("standard");
 
+            buildService.writeDataJson(message, fdageJson, null, null);
+
             log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
 
         }catch (Exception e){

+ 14 - 0
src/main/java/com/fdkankan/contro/service/IBuildService.java

@@ -0,0 +1,14 @@
+package com.fdkankan.contro.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
+
+import java.util.Map;
+
+public interface IBuildService {
+
+    Map<String, String> getTypeString(String cameraType, String algorithm, String resolution, JSONObject fdageData);
+
+    void writeDataJson(BuildSceneCallMessage message, JSONObject dataFdage, Map<String, String> dataMap, Map<String, Object> dataExtras);
+
+}

+ 1 - 0
src/main/java/com/fdkankan/contro/service/ICommonService.java

@@ -1,6 +1,7 @@
 package com.fdkankan.contro.service;
 
 import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.contro.entity.*;
 import com.fdkankan.contro.vo.ScenePlusVO;
 import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;

+ 108 - 0
src/main/java/com/fdkankan/contro/service/impl/BuildServiceImpl.java

@@ -0,0 +1,108 @@
+package com.fdkankan.contro.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.contro.service.IBuildService;
+import com.fdkankan.model.enums.ModelTypeEnums;
+import com.fdkankan.model.utils.ComputerUtil;
+import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+@Slf4j
+@Service
+public class BuildServiceImpl implements IBuildService {
+
+    @Override
+    public Map<String, String> getTypeString(String cameraType, String algorithm, String resolution, JSONObject fdageData){
+        Map<String, String> map = new HashMap<>();
+        String splitType = "";
+        String skyboxType = "";
+        if(Integer.parseInt(cameraType) >= 4){
+            if("0".equals(resolution)){
+                skyboxType = "SKYBOX_V7";    //high,low,2k
+            }else {
+                skyboxType = "SKYBOX_V1";
+            }
+            splitType = "SPLIT_V1";
+
+            if(Integer.parseInt(cameraType) == 5){
+                //新双目相机
+                splitType = "SPLIT_V9";
+                skyboxType = "SKYBOX_V1";
+            }
+            if(Integer.parseInt(cameraType) == 6){
+                //小红屋新双目相机
+//                    skyboxType = "SKYBOX_V9";
+                splitType = "SPLIT_V3";
+                skyboxType = "SKYBOX_V7";
+            }
+
+            if(Integer.parseInt(cameraType) == 13){
+                //转台相机
+                skyboxType = "SKYBOX_V6";
+                splitType = "SPLIT_V12";
+            }
+
+            if(Integer.parseInt(cameraType) == 14){
+                Integer location = fdageData.getInteger("location");
+                //转台相机
+                log.info("激光转台相机调用算法");
+                skyboxType = "SKYBOX_V11";
+                splitType = "SPLIT_V14";
+                if(location == 6){//slam
+                    splitType = "SPLIT_V25";
+                }
+                if (!ObjectUtils.isEmpty(fdageData)) {
+                    if ((fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1)) {
+                        splitType = "SPLIT_V22";
+                    }
+                    if(fdageData.containsKey("OnlyExportMeshObj")){
+                        splitType = "SPLIT_V20";
+                    }
+                }
+            }
+
+        }else {
+            if("sfm".equals(algorithm)){
+                splitType = "SPLIT_V2";
+                skyboxType = "SKYBOX_V1";
+            }else {
+                splitType = "SPLIT_V3";
+                skyboxType = "SKYBOX_V1";
+            }
+        }
+        if (!ObjectUtils.isEmpty(fdageData) && !ObjectUtils.isEmpty(fdageData.getString("modelType"))) {
+            switch (fdageData.getString("modelType")){
+                case ModelTypeEnums.TILE_CODE:
+                    if(skyboxType.equals("SKYBOX_V6")){
+                        skyboxType = "SKYBOX_V14";
+                    }else if(skyboxType.equals("SKYBOX_V11")){
+                        skyboxType = "SKYBOX_V15";
+                    } else{
+                        skyboxType = "SKYBOX_V13";
+                    }
+            }
+        }
+        Integer location = fdageData.getInteger("location");
+        if(Objects.nonNull(location) && location == 7){
+            splitType = "SPLIT_V26";
+        }
+        map.put("splitType", splitType);
+        map.put("skyboxType", skyboxType);
+        return map;
+    }
+
+    @Override
+    public void writeDataJson(BuildSceneCallMessage message, JSONObject dataFdage, Map<String, String> dataMap, Map<String, Object> dataExtras) {
+        if(CollUtil.isEmpty(dataMap)){
+            dataMap = this.getTypeString(message.getCameraType(), message.getAlgorithm(), message.getResolution(), dataFdage);
+        }
+        ComputerUtil.createProjectAndDataFile(message.getPath(), message.getSceneNum(), dataMap.get("splitType"), dataMap.get("skyboxType"),null, dataExtras);
+    }
+}

+ 4 - 5
src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java

@@ -981,6 +981,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         scenePlus.setSceneSource(SceneSource.BM.code());
         scenePlusExt.setDataSource(dataSource);
         scenePlusExt.setLocation(location);
+        scenePlusExt.setModelKind(ModelKind.DAM.code());
         if (sceneName != null) {
             scenePlus.setTitle(sceneName);
             scenePlus.setLaserTitle(sceneName);
@@ -1005,8 +1006,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             if(camType == CameraTypeEnum.LASER_SG.getType()){
                 scenePlus.setSceneSource(SceneSource.SG.code());
             }
-            if(camType == CameraTypeEnum.LASER_SG.getType()){
-                scenePlus.setSceneSource(SceneSource.SG.code());
+            if(camType == CameraTypeEnum.LASER_SX.getType()){
+                scenePlus.setSceneSource(SceneSource.SX.code());
             }
         }
 
@@ -1015,9 +1016,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             scenePlus.setSceneSource(SceneSource.QJKK.code());
         }
 
-        if(ModelKind.THREE_D_TILE.code().equals(modelKind)
-                && CollUtil.isNotEmpty(sdTilesSceneSourceList)
-                && sdTilesSceneSourceList.contains(scenePlus.getSceneSource())){
+        if(cameraTypeService.isLaser(camType)){
             scenePlusExt.setModelKind(modelKind);
         }