Browse Source

Merge branch 'feature-floorplan-20230209-dsx' into test

# Conflicts:
#	src/main/java/com/fdkankan/contro/mq/service/ICommonService.java
#	src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java
#	src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java
#	src/main/java/com/fdkankan/contro/mq/service/impl/CommonServiceImpl.java
dsx 2 năm trước cách đây
mục cha
commit
c034f239df

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

@@ -9,4 +9,6 @@ public interface ICommonService {
      * @param version
      */
     public void uploadBuildResultData(String num, String dataSource, String version);
+
+    public void uploadFloorplanJson(String num, String dataSource) throws Exception;
 }

+ 6 - 0
src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java

@@ -14,6 +14,7 @@ import com.fdkankan.contro.entity.ScenePlus;
 import com.fdkankan.contro.entity.ScenePro;
 import com.fdkankan.contro.entity.SceneProEdit;
 import com.fdkankan.contro.mq.service.IBuildSceneService;
+import com.fdkankan.contro.mq.service.ICommonService;
 import com.fdkankan.contro.service.*;
 import com.fdkankan.contro.service.impl.FdkkV4Service;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
@@ -89,6 +90,9 @@ public class BuildObjServiceImpl implements IBuildSceneService {
     @Autowired
     private ISceneBuildProcessLogService sceneBuildProcessLogService;
 
+    @Autowired
+    private ICommonService commonService;
+
     @Override
     public void buildScenePre(BuildSceneCallMessage message) throws Exception{
         boolean success = false;
@@ -237,6 +241,8 @@ public class BuildObjServiceImpl implements IBuildSceneService {
 
             fdkkLaserService.pushBuildStatusToLaserSystem(projectNum, laserObjFilePath + "/laserData/mesh");
 
+        //生成floorplan.json
+        commonService.uploadFloorplanJson(projectNum, laserObjFilePath);
 
             if(!ObjectUtils.isEmpty(scenePro)){
                 LambdaUpdateWrapper<ScenePro> updateWrapper = new LambdaUpdateWrapper<ScenePro>()

+ 6 - 1
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java

@@ -33,6 +33,7 @@ import com.fdkankan.model.constants.UploadFilePath;
 import com.fdkankan.model.enums.ModelTypeEnums;
 import com.fdkankan.model.utils.CreateHouseJsonUtil;
 import com.fdkankan.model.utils.CreateObjUtil;
+import com.fdkankan.model.utils.FloorPlanUserUtil;
 import com.fdkankan.model.utils.SceneUtil;
 import com.fdkankan.push.config.PushMessageConfig;
 import com.fdkankan.push.utils.PushMsgUtil;
@@ -127,6 +128,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     @Autowired
     private ICommonService commonService;
 
+
     @Override
     public void buildScenePre(BuildSceneCallMessage message) throws Exception{
         boolean success = false;
@@ -298,6 +300,9 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             boolean existHouseType = this.uploadHouseTypeJson(sceneCode, scenePlusExt.getDataSource());
             scenePlus.setHouseType(existHouseType ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code().intValue());
 
+            //生成floorpan.json
+            commonService.uploadFloorplanJson(sceneCode, scenePlusExt.getDataSource());
+
             //重置异步操作记录
             this.removeSceneAsynOperLog(sceneCode);
 
@@ -495,7 +500,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         if(!new File("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum).exists()){
             FileUtil.mkdir("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum);
         }
-        map.put(resultsPath + "floorplan.json", dataViewPath + "floor.json");
+//        map.put(resultsPath + "floorplan.json", dataViewPath + "floor.json");
         map.put(resultsPath + "floorplan_cad.json", dataViewPath + "floorplan_cad.json");
         map.put(path + File.separator + "capture/stitch_params.txt", dataViewPath + "stitch_params.txt");
         map.put(path + File.separator + "capture/Up.xml", dataViewPath + "Up.xml");

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

@@ -374,7 +374,7 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
         log.info("数据转换完成:" + projectNum);
 
         FileUtil.touch("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum);
-        map.put(resultsPath + "floorplan.json", dataViewPath + "floor.json");
+//        map.put(resultsPath + "floorplan.json", dataViewPath + "floor.json");
         map.put(resultsPath + "floorplan_cad.json", dataViewPath + "floorplan_cad.json");
         map.put(path + File.separator + "capture/stitch_params.txt", dataViewPath + "stitch_params.txt");
         map.put(path + File.separator + "capture/Up.xml", dataViewPath + "Up.xml");

+ 19 - 0
src/main/java/com/fdkankan/contro/mq/service/impl/CommonServiceImpl.java

@@ -2,11 +2,13 @@ package com.fdkankan.contro.mq.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.io.FileUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.contro.mq.service.ICommonService;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.model.constants.ConstantFilePath;
 import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.model.utils.FloorPlanUserUtil;
 import com.fdkankan.model.utils.SceneUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,6 +18,7 @@ import java.io.File;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 @Slf4j
 @Service
@@ -88,4 +91,20 @@ public class CommonServiceImpl implements ICommonService {
         //开始上传
         fYunFileServiceInterface.uploadMulFiles(uploadMap);
     }
+
+    @Override
+    public void uploadFloorplanJson(String num, String dataSource) throws Exception{
+        String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
+        if (!new File(floorPlanCardFilePath).exists()) {
+            log.error("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
+            throw new Exception("floorplan_cad.json 文件不存在,文件路径:" + floorPlanCardFilePath);
+        }
+        JSONObject json = FloorPlanUserUtil.createFloorPlanUserJson(floorPlanCardFilePath);
+        if(Objects.isNull(json)){
+            log.error("生成floorplan.json失败,cadPath:", floorPlanCardFilePath);
+            throw new Exception("生成floorplan.json失败,cadPath:" + floorPlanCardFilePath);
+        }
+        String hourseTypeJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "floorplan.json";
+        fYunFileServiceInterface.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
+    }
 }