Kaynağa Gözat

场景计算完后 写入sceneproext表中的sceneresolution和scenefrom字段

dengsixing 3 yıl önce
ebeveyn
işleme
44d60f1d78

+ 12 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/SceneProExt.java

@@ -92,6 +92,18 @@ public class SceneProExt implements Serializable {
     private Integer sceneSource;
 
     /**
+     * 全景图加载方式,tiles/1k:1k瓦片图,tiles/2:2k瓦片图,tiles/4k:4k瓦片图,pan:全景图 ,local:本地切片,cube:立体图
+     */
+    @TableField("scene_resolution")
+    private String sceneResolution;
+
+    /**
+     * 场景来源,lite:双目lite相机,pro:八目相机,minion:双面转台相机,laser:激光相机,virtual:虚拟场景,sketch:图片建模场景
+     */
+    @TableField("scene_from")
+    private String sceneFrom;
+
+    /**
      * 大场景序号(随心装场景码)
      */
     @TableField("vrnum")

+ 27 - 4
4dkankan-center-scene/src/main/java/com/fdkankan/scene/listener/BuildSceneResultMQListener.java

@@ -4,7 +4,11 @@ import cn.hutool.http.HttpStatus;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.common.constant.BuildStatus;
 import com.fdkankan.common.constant.ExpiredStatus;
+import com.fdkankan.common.constant.SceneFrom;
+import com.fdkankan.common.constant.SceneResolution;
+import com.fdkankan.common.constant.SceneSource;
 import com.fdkankan.common.constant.SceneStatus;
+import com.fdkankan.common.constant.ServerCode;
 import com.fdkankan.common.response.ResultData;
 import com.fdkankan.mq.message.BuildSceneResultMqMessage;
 import com.fdkankan.platform.api.feign.PlatformGoodsClient;
@@ -37,8 +41,6 @@ import java.util.Objects;
  * </p>
  * @author dengsixing
  * @date 2022/2/23
- * @param null
- * @return null
  **/
 @Slf4j
 @Component
@@ -116,14 +118,14 @@ public class BuildSceneResultMQListener implements RocketMQListener<String> {
                 if(Objects.nonNull(scenePro)){
                     SceneProExt sceneProExt = sceneProExtService.findBySceneProId(scenePro.getId());
                     ResultData<CameraDetail> resultData = platformGoodsClient.updateCameraDetailByCameraIdAndSpace(scenePro.getCameraId(), sceneProExt.getSpace());
-                    if(resultData.getCode() != HttpStatus.HTTP_OK){
+                    if(resultData.getCode() != ServerCode.SUCCESS.code()){
                         log.error("调用platform服务updateCameraDetailByCameraIdAndSpace失败,参数{},{}" ,scenePro.getCameraId(), sceneProExt.getSpace());
                         return ;
                     }
                     CameraDetail cameraDetail = JSONObject.parseObject(JSONObject.toJSONString(resultData.getData()), CameraDetail.class);
 
                     ResultData<UserIncrement> resultData1 = platformUserClient.getUserIncrementByCameraId(scenePro.getCameraId());
-                    if(resultData1.getCode() != HttpStatus.HTTP_OK){
+                    if(resultData1.getCode() != ServerCode.SUCCESS.code()){
                         log.error("调用platform服务getUserIncrementByCameraId失败,参数{}" ,scenePro.getCameraId());
                         return;
                     }
@@ -135,6 +137,27 @@ public class BuildSceneResultMQListener implements RocketMQListener<String> {
                             sceneProService.tempScenes(ids);
                         }
                     }
+
+                    SceneSource sceneSource = SceneSource.get(sceneProExt.getSceneSource());
+                    switch (sceneSource){
+                        case BM:
+                            sceneProExt.setSceneResolution(SceneResolution.TILES_2K.code());
+                            sceneProExt.setSceneFrom(SceneFrom.PRO.code());
+                            break;
+                        case SM:
+                            sceneProExt.setSceneResolution(SceneResolution.TILES_1K.code());
+                            sceneProExt.setSceneFrom(SceneFrom.LITE.code());
+                            break;
+                        case ZT:
+                            sceneProExt.setSceneResolution(SceneResolution.TILES_4K.code());
+                            sceneProExt.setSceneFrom(SceneFrom.MINION.code());
+                            break;
+                        case JG:
+                            sceneProExt.setSceneResolution(SceneResolution.TILES_4K.code());
+                            sceneProExt.setSceneFrom(SceneFrom.LASER.code());
+                            break;
+                    }
+                    sceneProExtService.updateById(sceneProExt);
                 }
 
             }

+ 1 - 1
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java

@@ -238,7 +238,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
                 path + File.separator + "caches/videos/" + videoName, true);
 
         }
-//        FileUtils.deleteDirectory(target + File.separator + "extras/video/");
+        FileUtils.deleteDirectory(target + File.separator + "extras/video/");
 
         //重置状态
         sceneEditInfo.setBuildVideoStatus(CommonStatus.NO.code());

+ 88 - 74
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneFileBuildServiceImpl.java

@@ -141,6 +141,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
     ISceneExtService sceneExtService;
     @Autowired
     IFdkkLaserService fdkkLaserService;
+    @Autowired
+    ISceneEditInfoService sceneEditInfoService;
 
     @Override
     public SceneFileBuild findByFileId(String fileId) {
@@ -1722,44 +1724,48 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         log.info("场景记录添加到数据库:"+projectNum);
         //type=0为新生成场景,其余为重新计算场景
 
-        SceneProEdit sceneProEdit = new SceneProEdit();
-        SceneProEditExt sceneProEditExt = new SceneProEditExt();
+        // TODO: 2022/2/23  SceneProEdit 重构版本SceneProEdit 这个表可能不用,这里先暂时注释掉
+//        SceneProEdit sceneProEdit = new SceneProEdit();
+//        SceneProEditExt sceneProEditExt = new SceneProEditExt();
         if(type == 0){
             scenePro.setSceneStatus(SceneStatus.wait.code());
             sceneProService.save(scenePro);
             sceneProExt.setSceneProId(scenePro.getId());
             sceneProExtService.save(sceneProExt);
 
-            sceneProEdit.setNeedKey(0);
-
-            if(sceneKey == null) {
-                sceneKey = "";
-            }
-            sceneProEdit.setSceneKey(sceneKey);
-            if(!sceneKey.equals("")) {
-                sceneProEdit.setNeedKey(1);
-            }else {
-                sceneProEdit.setNeedKey(0);
-            }
-
-            sceneProEdit.setProId(scenePro.getId());
-            sceneProEdit.setFloorLogoSize(100);
-            sceneProEdit.setCreateTime(Calendar.getInstance().getTime());
-            sceneProEditService.save(sceneProEdit);
-
-            sceneProEditExt.setProEditId(sceneProEdit.getId());
-            sceneProEditExt.setProId(scenePro.getId());
-            sceneProEditExt.setMapVisi(1);
-            sceneProEditExt.setTourVisi(1);
-            sceneProEditExt.setVrVisi(1);
-            sceneProEditExt.setRulerVisi(1);
-            sceneProEditExt.setCadImgVisi(1);
-            sceneProEditExt.setPanoVisi(1);
-            sceneProEditExt.setM2dVisi(1);
-            sceneProEditExt.setM3dVisi(1);
-            sceneProEditExt.setMeasureVisi(0);
-            sceneProEditExt.setCreateTime(Calendar.getInstance().getTime());
-            sceneProEditExtService.save(sceneProEditExt);
+            SceneEditInfo sceneEditInfo = new SceneEditInfo();
+            sceneEditInfo.setSceneProId(scenePro.getId());
+            sceneEditInfoService.save(sceneEditInfo);
+
+//            sceneProEdit.setNeedKey(0);
+//            if(sceneKey == null) {
+//                sceneKey = "";
+//            }
+//            sceneProEdit.setSceneKey(sceneKey);
+//            if(!sceneKey.equals("")) {
+//                sceneProEdit.setNeedKey(1);
+//            }else {
+//                sceneProEdit.setNeedKey(0);
+//            }
+//
+//            sceneProEdit.setProId(scenePro.getId());
+//            sceneProEdit.setFloorLogoSize(100);
+//            sceneProEdit.setCreateTime(Calendar.getInstance().getTime());
+//            sceneProEditService.save(sceneProEdit);
+//
+//            sceneProEditExt.setProEditId(sceneProEdit.getId());
+//            sceneProEditExt.setProId(scenePro.getId());
+//            sceneProEditExt.setMapVisi(1);
+//            sceneProEditExt.setTourVisi(1);
+//            sceneProEditExt.setVrVisi(1);
+//            sceneProEditExt.setRulerVisi(1);
+//            sceneProEditExt.setCadImgVisi(1);
+//            sceneProEditExt.setPanoVisi(1);
+//            sceneProEditExt.setM2dVisi(1);
+//            sceneProEditExt.setM3dVisi(1);
+//            sceneProEditExt.setMeasureVisi(0);
+//            sceneProEditExt.setCreateTime(Calendar.getInstance().getTime());
+//            sceneProEditExtService.save(sceneProEditExt);
 
 
             //新增场景时,同时新增场景协作信息
@@ -1804,45 +1810,53 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             sceneProService.updateById(scenePro);
             sceneProExtService.updateById(sceneProExt);
 
-            SceneProEdit oldSceneProEdit = sceneProEditService.findByProId(scenePro.getId());
-            SceneProEditExt oldSceneProEditeExt = sceneProEditExtService.getByProEditId(oldSceneProEdit.getId());
-            sceneProEdit.setNeedKey(0);
-
-            if(sceneKey == null) {
-                sceneKey = "";
-            }
-            sceneProEdit.setSceneKey(sceneKey);
-            if(!sceneKey.equals("")) {
-                sceneProEdit.setNeedKey(1);
-            }else {
-                sceneProEdit.setNeedKey(0);
+            // TODO: 2022/2/23 如果是重算场景 ,这里需要更新一些字段,现在还不知道更写哪些字段,先留空
+            SceneEditInfo sceneEditInfo = sceneEditInfoService.getBySceneProId(oldScene.getId());
+            if(sceneEditInfo == null){
+                throw new BusinessException(ErrorCode.FAILURE_CODE_7008);
             }
+            sceneEditInfoService.updateById(sceneEditInfo);
 
-            sceneProEdit.setId(oldSceneProEdit.getId());
-            sceneProEdit.setProId(scenePro.getId());
-            sceneProEdit.setFloorLogoSize(100);
-            sceneProEdit.setTbStatus(TbStatus.VALID.code());
-            sceneProEdit.setFloorPublishVer(oldSceneProEdit.getFloorEditVer() + 1);
-            sceneProEdit.setFloorEditVer(oldSceneProEdit.getFloorEditVer() + 1);
-            sceneProEdit.setVersion(oldSceneProEdit.getVersion() + 1);
-            sceneProEdit.setUpdateTime(Calendar.getInstance().getTime());
-            sceneProEditService.updateById(sceneProEdit);
-
-            sceneProEditExt.setId(oldSceneProEditeExt.getId());
-            sceneProEditExt.setProId(scenePro.getId());
-            sceneProEditExt.setMapVisi(1);
-            sceneProEditExt.setTourVisi(1);
-            sceneProEditExt.setVrVisi(1);
-            sceneProEditExt.setRulerVisi(1);
-            sceneProEditExt.setCadImgVisi(1);
-            sceneProEditExt.setPanoVisi(1);
-            sceneProEditExt.setM2dVisi(1);
-            sceneProEditExt.setM3dVisi(1);
-            sceneProEditExt.setMeasureVisi(0);
-            sceneProEditExt.setCreateTime(oldSceneProEdit.getCreateTime());
-            sceneProEditExt.setImagesVersion(oldSceneProEditeExt.getImagesVersion() + 1);
-            sceneProEditExt.setUpdateTime(Calendar.getInstance().getTime());
-            sceneProEditExtService.updateById(sceneProEditExt);
+
+//            SceneProEdit oldSceneProEdit = sceneProEditService.findByProId(scenePro.getId());
+//            SceneProEditExt oldSceneProEditeExt = sceneProEditExtService.getByProEditId(oldSceneProEdit.getId());
+//            sceneProEdit.setNeedKey(0);
+//
+//            if(sceneKey == null) {
+//                sceneKey = "";
+//            }
+//            sceneProEdit.setSceneKey(sceneKey);
+//            if(!sceneKey.equals("")) {
+//                sceneProEdit.setNeedKey(1);
+//            }else {
+//                sceneProEdit.setNeedKey(0);
+//            }
+//
+//            sceneProEdit.setId(oldSceneProEdit.getId());
+//            sceneProEdit.setProId(scenePro.getId());
+//            sceneProEdit.setFloorLogoSize(100);
+//            sceneProEdit.setTbStatus(TbStatus.VALID.code());
+//            sceneProEdit.setFloorPublishVer(oldSceneProEdit.getFloorEditVer() + 1);
+//            sceneProEdit.setFloorEditVer(oldSceneProEdit.getFloorEditVer() + 1);
+//            sceneProEdit.setVersion(oldSceneProEdit.getVersion() + 1);
+//            sceneProEdit.setUpdateTime(Calendar.getInstance().getTime());
+//            sceneProEditService.updateById(sceneProEdit);
+//
+//            sceneProEditExt.setId(oldSceneProEditeExt.getId());
+//            sceneProEditExt.setProId(scenePro.getId());
+//            sceneProEditExt.setMapVisi(1);
+//            sceneProEditExt.setTourVisi(1);
+//            sceneProEditExt.setVrVisi(1);
+//            sceneProEditExt.setRulerVisi(1);
+//            sceneProEditExt.setCadImgVisi(1);
+//            sceneProEditExt.setPanoVisi(1);
+//            sceneProEditExt.setM2dVisi(1);
+//            sceneProEditExt.setM3dVisi(1);
+//            sceneProEditExt.setMeasureVisi(0);
+//            sceneProEditExt.setCreateTime(oldSceneProEdit.getCreateTime());
+//            sceneProEditExt.setImagesVersion(oldSceneProEditeExt.getImagesVersion() + 1);
+//            sceneProEditExt.setUpdateTime(Calendar.getInstance().getTime());
+//            sceneProEditExtService.updateById(sceneProEditExt);
 
         }
 
@@ -1874,13 +1888,13 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         }
         scenejson.put("createTime", new DateTime(new Date()).toString("yyyy-MM-dd HH:mm"));
 
-        scenejson.put("floorPublishVer", sceneProEdit.getFloorPublishVer());
-        scenejson.put("floorEditVer", sceneProEdit.getFloorEditVer());
+//        scenejson.put("floorPublishVer", sceneProEdit.getFloorPublishVer());
+//        scenejson.put("floorEditVer", sceneProEdit.getFloorEditVer());
         scenejson.put("entry", null);
 
-        if(!org.springframework.util.StringUtils.isEmpty(sceneProEdit.getHotsIds())){
-            scenejson.put("hots", 1);
-        }
+//        if(!org.springframework.util.StringUtils.isEmpty(sceneProEdit.getHotsIds())){
+//            scenejson.put("hots", 1);
+//        }
 
         File file = new File(ConstantFilePath.SCENE_PATH+"data/data"+projectNum);
         if(!file.exists()||!file.isDirectory())