Jelajahi Sumber

http://192.168.0.21/index.php?m=bug&f=view&bugID=32265
修改生成obj逻辑

tianboguang 2 tahun lalu
induk
melakukan
683796f1ec

+ 53 - 0
src/main/java/com/fdkankan/ucenter/service/impl/SceneProServiceImpl.java

@@ -943,6 +943,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         ScenePro sceneProEntity = this.getOne(wrapper);
 
         if(ObjectUtils.isEmpty(sceneProEntity)){
+            generatePlusObjFile(num);
             throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
         }
 
@@ -990,4 +991,56 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         mqMsg.setPath(sceneProEntity.getDataSource());
         mqProducer.sendByWorkQueue(queueObjModelingPre,mqMsg);
     }
+
+    public void generatePlusObjFile(String num) {
+        ScenePlus scenePlus = scenePlusService.getByNum(num);
+
+        if(ObjectUtils.isEmpty(scenePlus)){
+            throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
+        }
+
+        if(scenePlus.getSceneSource() != 4){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3003, "只能操作激光场景");
+        }
+
+        ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
+
+        // 拷贝文件
+        String path = scenePlusExt.getDataSource();
+        if (!new File(path + "/caches/reconstruction/final.bin").exists()
+                || !new File(path + "/caches/reconstruction/chunk.json").exists()
+                || !new File(path + "/caches/images").exists()
+                || !new File(path + "/caches/depthmap").exists()
+                || !new File(path + "/caches/depthmap_csc").exists()
+                || !new File(path + "/caches/panorama.json").exists()
+                || !new File(path + "/results/laserData/laser.ply").exists()) {
+            log.error("生成obj缺少必要文件,生成失败!");
+            throw new BusinessException(SceneConstant.FAILURE_CODE_5038, SceneConstant.FAILURE_MSG_5038);
+        }
+
+        // 获取最新的场景名称
+        JSONObject sceneInfo = fdkkLaserService.getSceneByNum(num);
+        LambdaUpdateWrapper<ScenePlus> updateWrapper = new LambdaUpdateWrapper<>();
+        updateWrapper
+                .set(ScenePlus::getSceneStatus, 0)
+                .set(ScenePlus::getTitle, sceneInfo.getString("title"))
+                .eq(ScenePlus::getNum, num);
+        scenePlusService.update(updateWrapper);
+
+        LambdaUpdateWrapper<ScenePlusExt> plusExtUpdateWrapper = new LambdaUpdateWrapper<>();
+        plusExtUpdateWrapper
+                .set(ScenePlusExt::getIsObj, 1)
+                .eq(ScenePlusExt::getPlusId, scenePlus.getId());
+        scenePlusExtService.update(plusExtUpdateWrapper);
+
+        log.info("开始发送激光场景生成obj mq消息");
+
+        // 发送MQ
+        BuildSceneCallMessage mqMsg = new BuildSceneCallMessage();
+        mqMsg.setSceneNum(num);
+        mqMsg.setAlgorithm(scenePlusExt.getAlgorithm());
+        mqMsg.setBuildType(scenePlusExt.getBuildType());
+        mqMsg.setPath(scenePlusExt.getDataSource());
+        mqProducer.sendByWorkQueue(queueObjModelingPre,mqMsg);
+    }
 }