Browse Source

修改激光、obj 场景构建逻辑

tianboguang 2 years ago
parent
commit
6274c871a5

+ 1 - 3
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneObjPostServiceImpl.java

@@ -106,9 +106,7 @@ public class BuildSceneObjPostServiceImpl implements IBuildScenePostService {
                 .set(ScenePro::getStatus, -2).eq(ScenePro::getNum, projectNum);
         sceneProService.update(updateWrapper);
 
-        ScenePro scenePro = sceneProService.getByNum(projectNum);
-
         // 如果未升级V4,则升级V4
-        fdkkV4Service.upgradeToV4(scenePro);
+        fdkkV4Service.upgradeToV4(projectNum);
     }
 }

+ 14 - 8
src/main/java/com/fdkankan/contro/mq/service/impl/BuildScenePostServiceImpl.java

@@ -13,10 +13,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.common.constant.*;
 import com.fdkankan.common.util.FileUtils;
-import com.fdkankan.contro.bean.*;
+import com.fdkankan.contro.bean.SceneJsonBean;
 import com.fdkankan.contro.entity.*;
 import com.fdkankan.contro.mq.service.IBuildScenePostService;
 import com.fdkankan.contro.service.*;
+import com.fdkankan.contro.service.impl.FdkkV4Service;
 import com.fdkankan.contro.vo.SceneEditControlsVO;
 import com.fdkankan.fyun.config.FYunFileConfig;
 import com.fdkankan.fyun.constant.FYunTypeEnum;
@@ -63,9 +64,6 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
     @Value("${scene.pro.new.url}")
     private String sceneProNewUrl;
 
-    @Value("${4dkk.laserService.host}")
-    private String laserHost;
-
     @Autowired
     private ISceneFileBuildService sceneFileBuildService;
     @Autowired
@@ -94,6 +92,9 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
     @Autowired
     private IFdkkLaserService fdkkLaserService;
 
+    @Autowired
+    private FdkkV4Service fdkkV4Service;
+
     @Override
     public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
         Integer cameraType = Integer.parseInt(message.getCameraType());
@@ -105,8 +106,8 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
         String path = message.getPath();
 
         Boolean buildSuccess = message.getBuildSuccess();
-        Integer videoVersion = getVideoVersion(path + File.separator + "capture" +File.separator+"data.fdage");
-
+        JSONObject fdageData = getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
+        Integer videoVersion = fdageData.getInteger("videoVersion");
 
 
         Integer pushChannel = message.getPushChannel();
@@ -211,6 +212,11 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
                 //计算成功  激光转台相机 同步 请求
                 fdkkLaserService.syncBuildResult(scenePlus, scenePlusExt);
             }
+
+            if (fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1) {
+                fdkkV4Service.upgradeToV4(sceneCode);
+            }
+
             log.info("场景计算结果处理结束,场景码:{}", message.getSceneCode());
 
         }catch (Exception e){
@@ -329,7 +335,7 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
 
     }
 
-    private Integer getVideoVersion(String dataFdagePath) {
+    private JSONObject getFdageData(String dataFdagePath) {
         log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
         String data = FileUtils.readFile(dataFdagePath);
         //获取data.fdage的内容
@@ -337,7 +343,7 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
         if(data!=null){
             dataJson = JSONObject.parseObject(data);
         }
-        return dataJson.getInteger("videoVersion");
+        return dataJson;
     }
 
     private void uploadFloorCad(String path, String num, Map<String, String> uploadFiles){

+ 12 - 4
src/main/java/com/fdkankan/contro/service/impl/FdkkV4Service.java

@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
 import org.springframework.web.client.RestTemplate;
 
 @Service
@@ -30,12 +31,19 @@ public class FdkkV4Service {
 
     /**
      * 场景升级
-     * @param scenePro  升级的场景信息
+     * @param num  场景码
      * @return
      * @throws Exception
      */
-    public void upgradeToV4(ScenePro scenePro){
-        String url = v4Host + String.format(UPGRADE_TO_V4,scenePro.getNum());
+    public void upgradeToV4(String num){
+        // 如果场景在旧表中存在,则需要升级,否则不需要升级
+        ScenePro scenePro = sceneProService.getByNum(num);
+        if(ObjectUtils.isEmpty(scenePro)){
+            log.error("scene_pro 表中不存在改记录,退出升级!");
+            return;
+        }
+
+        String url = v4Host + String.format(UPGRADE_TO_V4,num);
         log.info("v3场景升级v4,url:{}",url);
         ResponseEntity<Result> responseEntity = restTemplate.getForEntity(url, Result.class);
         log.info("v3场景升级v4,url:{},结果,{}",url, JSONObject.toJSONString(responseEntity.getBody()));
@@ -56,7 +64,7 @@ public class FdkkV4Service {
 
         //修改场景状态为升级中
         LambdaUpdateWrapper<ScenePro> wrapper = new LambdaUpdateWrapper<>();
-        wrapper.set(ScenePro::getStatus,0).set(ScenePro::getIsUpgrade,2).eq(ScenePro::getNum,scenePro.getNum());
+        wrapper.set(ScenePro::getStatus,0).set(ScenePro::getIsUpgrade,2).eq(ScenePro::getNum,num);
         sceneProService.update(wrapper);
     }