dengsixing недель назад: 2
Родитель
Сommit
58a6ca46f6

+ 26 - 0
src/main/java/com/fdkankan/contro/bean/SceneJsonBean.java

@@ -1,5 +1,6 @@
 package com.fdkankan.contro.bean;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.fdkankan.contro.vo.SceneEditControlsVO;
@@ -172,6 +173,11 @@ public class SceneJsonBean implements Serializable {
     private Float floorPlanCompass;
 
     /**
+     * 用户上传自定义平面图
+     */
+    private JSONArray floorPlanUpload;
+
+    /**
      * 是否保存导览
      */
     private Integer tours;
@@ -207,6 +213,11 @@ public class SceneJsonBean implements Serializable {
     private Integer surveillances;
 
     /**
+     * 分享信息
+     */
+    private JSONObject sns;
+
+    /**
      * 是否有指示牌
      */
     private Integer billboards;
@@ -223,6 +234,9 @@ public class SceneJsonBean implements Serializable {
 
     private Integer sceneDraw;
 
+    //动态面板
+    private int dynamicPanel;
+
     private String orientation;
 
     private Integer hasFloorplanAi;
@@ -231,5 +245,17 @@ public class SceneJsonBean implements Serializable {
 
     private Integer hasRecognition;
 
+    /**
+     * 标题logo名称
+     */
+    private String titleLogo;
+
+    /**
+     * 标题logo文件名称
+     */
+    private String titleLogoFile;
+
+    private Integer evidence;
+
 
 }

+ 31 - 0
src/main/java/com/fdkankan/contro/constant/UploadSceneSourceType.java

@@ -0,0 +1,31 @@
+package com.fdkankan.contro.constant;
+
+/**
+ * 用户状态
+ *
+ * @author fdkk
+ */
+public enum UploadSceneSourceType
+{
+    ORIG("orig", "本地版原始资源包"),
+    OFFLINE("offline", "离线包");
+
+    private final String code;
+    private final String info;
+
+    UploadSceneSourceType(String code, String info)
+    {
+        this.code = code;
+        this.info = info;
+    }
+
+    public String getCode()
+    {
+        return code;
+    }
+
+    public String getInfo()
+    {
+        return info;
+    }
+}

+ 54 - 0
src/main/java/com/fdkankan/contro/entity/SceneEditControls.java

@@ -146,5 +146,59 @@ public class SceneEditControls implements Serializable {
     @TableLogic("A")
     private String recStatus;
 
+    /**
+     * 是否显示多媒体标签标题(0-否,1-是)
+     */
+    @TableField("show_tag_title")
+    private Integer showTagTitle;
+
+    /**
+     * 是否显示指示牌标签标题(0-否,1-是)
+     */
+    @TableField("show_billboard_title")
+    private Integer showBillboardTitle;
+
+    /**
+     * 是否显示视频监控标签标题(0-否,1-是)
+     */
+    @TableField("show_camera_title")
+    private Integer showCameraTitle;
+
+    /**
+     * 是否显示场景关联标签标题(0-否,1-是)
+     */
+    @TableField("show_link_title")
+    private Integer showLinkTitle;
+
+    /**
+     * 是否显示全部模型
+     */
+    @TableField("show_all_model")
+    private Integer showAllModel;
+
+    /**
+     * 是否显示监控范围
+     */
+    @TableField("show_surveil_scope")
+    private Integer showSurveilScope;
+
+    /**
+     * 是否显示cad底图
+     */
+    @TableField("show_texture")
+    private Integer showTexture;
+
+    /**
+     * 是否显示cad底图
+     */
+    @TableField("show_panos")
+    private Integer showPanos;
+
+    @TableField("show_music")
+    private Integer showMusic;
+
+    @TableField("show_inquest")
+    private Integer showInquest;
+
 
 }

+ 26 - 3
src/main/java/com/fdkankan/contro/entity/SceneEditInfo.java

@@ -21,7 +21,6 @@ import java.util.Date;
 public class SceneEditInfo implements Serializable {
 
     private static final long serialVersionUID = 1L;
-
     /**
      * 主键
      */
@@ -179,6 +178,12 @@ public class SceneEditInfo implements Serializable {
     private String loadingLogoFile;
 
     /**
+     * 用户上传自定义平面图数据
+     */
+    @TableField("floor_plan_upload")
+    private String floorPlanUpload;
+
+    /**
      * 创建时间
      */
     @TableField("create_time")
@@ -191,11 +196,29 @@ public class SceneEditInfo implements Serializable {
     private Date updateTime;
 
     /**
-     * A正常,I删除
+     * 记录的状态,A: 生效,I: 禁用
      */
     @TableField("rec_status")
-    @TableLogic("A")
+    @TableLogic(value = "A", delval = "I")
     private String recStatus;
 
+    /**
+     * 标题logo名称
+     */
+    @TableField("title_logo")
+    private String titleLogo;
+
+
+    /**
+     * 标题logo文件名称
+     */
+    @TableField("title_logo_file")
+    private String titleLogoFile;
+
+    /**
+     * 是否有痕迹物证数据(0-否,1-是)
+     */
+    @TableField("evidence")
+    private Byte evidence;
 
 }

+ 10 - 0
src/main/java/com/fdkankan/contro/entity/SceneEditInfoExt.java

@@ -136,5 +136,15 @@ public class SceneEditInfoExt {
     @TableLogic("A")
     private String recStatus;
 
+    /**
+     * 是否有马赛克
+     */
+    @TableField("mosaic")
+    private Integer mosaic;
 
+    /**
+     * 分享配置信息
+     */
+    @TableField("sns_info")
+    private String snsInfo;
 }

+ 21 - 24
src/main/java/com/fdkankan/contro/entity/ScenePlus.java

@@ -98,18 +98,6 @@ public class ScenePlus implements Serializable {
     private Integer houseType;
 
     /**
-     * 第三方相机类型(yzl-圆周率)
-     */
-    @TableField("three_cam_type")
-    private String threeCamType;
-
-    /**
-     * 是否有ai识别
-     */
-    @TableField("has_ai")
-    private Integer hasAi;
-
-    /**
      * 创建时间
      */
     @TableField("create_time")
@@ -122,39 +110,48 @@ public class ScenePlus implements Serializable {
     private Date updateTime;
 
     /**
-     * A正常,I删除
+     * 记录的状态,A: 生效,I: 禁用
      */
     @TableField("rec_status")
-    @TableLogic("A")
+    @TableLogic(value = "A", delval = "I")
     private String recStatus;
 
     @TableField("other_type")
     private String otherType;
 
-    @TableField("source_id")
-    private Long sourceId;
-
     @TableField("task_id")
     private String taskId;
 
     @TableField("k_no")
     private String kNo;
 
-    /**
-     * 是否有平面图i识别
-     */
     @TableField("has_floorplan_ai")
     private Integer hasFloorplanAi;
 
-    @TableField("build_fail_reason")
-    private String buildFailReason;
-
     @TableField("preview")
-    private int preview;
+    private Integer preview;
 
     @TableField("start_build_time")
     private Date startBuildTime;
 
+    /**
+     * 是否有ai识别
+     */
+    @TableField("has_ai")
+    private Integer hasAi;
+
+    @TableField("three_cam_type")
+    private String threeCamType;
+
+
+    @TableField("source_id")
+    private Long sourceId;
+
+
+    @TableField("build_fail_reason")
+    private String buildFailReason;
+
+
     @TableField("push_address")
     private String pushAddress;
 

+ 29 - 23
src/main/java/com/fdkankan/contro/entity/ScenePlusExt.java

@@ -62,12 +62,6 @@ public class ScenePlusExt implements Serializable {
     private Long space;
 
     /**
-     * 原始文件容量
-     */
-    @TableField("orig_space")
-    private Long origSpace;
-
-    /**
      * 云服务器类型
      */
     @TableField("ecs")
@@ -134,6 +128,12 @@ public class ScenePlusExt implements Serializable {
     private String modelKind;
 
     /**
+     * 算法计算完成时间
+     */
+    @TableField("algorithm_time")
+    private Date algorithmTime;
+
+    /**
      * 计算耗时
      */
     @TableField("compute_time")
@@ -148,11 +148,8 @@ public class ScenePlusExt implements Serializable {
     @TableField("yun_file_bucket")
     private String yunFileBucket;
 
-    @TableField("location")
-    private Integer location;
-
-    @TableField("mixture")
-    private Integer mixture;
+    @TableField("orientation")
+    private String orientation;
 
     /**
      * 创建时间
@@ -167,27 +164,36 @@ public class ScenePlusExt implements Serializable {
     private Date updateTime;
 
     /**
-     * A正常,I删除
+     * 记录的状态,A: 生效,I: 禁用
      */
     @TableField("rec_status")
-    @TableLogic(value = "A",delval = "I")
+    @TableLogic(value = "A", delval = "I")
     private String recStatus;
 
     /**
-     * 计算时间
-     */
-    @TableField("algorithm_time")
-    private Date algorithmTime;
-
-    /**
-     * 计算时间
+     * 是否是mesh场景
      */
     @TableField("is_obj")
-    private int isObj;
+    private Integer isObj;
+
+    @TableField("location")
+    private Integer location;
 
     @TableField("has_recognition")
     private Integer hasRecognition;
 
-    @TableField("orientation")
-    private String orientation;
+    @TableField("rtk_location")
+    private String rtkLocation;
+
+    @TableField("has_seg_ai")
+    private Integer hasSegAi;
+
+    /**
+     * 原始文件容量
+     */
+    @TableField("orig_space")
+    private Long origSpace;
+
+    @TableField("mixture")
+    private Integer mixture;
 }

+ 110 - 24
src/main/java/com/fdkankan/contro/mq/listener/UploadSceneListener.java

@@ -1,16 +1,27 @@
 package com.fdkankan.contro.mq.listener;
 
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.codec.Base64;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.ZipUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.CmdUtils;
+import com.fdkankan.contro.bean.SceneJsonBean;
+import com.fdkankan.contro.constant.UploadSceneSourceType;
 import com.fdkankan.contro.constant.ZipConstant;
+import com.fdkankan.contro.entity.*;
+import com.fdkankan.contro.service.*;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.model.constants.ConstantFilePath;
 import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.web.util.RSAEncrypt;
 import com.rabbitmq.client.Channel;
 import lombok.extern.slf4j.Slf4j;
 import net.lingala.zip4j.core.ZipFile;
+import org.apache.commons.io.filefilter.NameFileFilter;
 import org.springframework.amqp.core.Message;
 import org.springframework.amqp.rabbit.annotation.Queue;
 import org.springframework.amqp.rabbit.annotation.RabbitListener;
@@ -18,8 +29,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.io.File;
+import java.io.FileFilter;
 import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
+import java.util.List;
 
 @Slf4j
 @Component
@@ -27,6 +40,21 @@ public class UploadSceneListener {
 
     @Autowired
     private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private ISceneFileBuildService sceneFileBuildService;
+    @Autowired
+    private IUserService userService;
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private ISceneEditInfoService sceneEditInfoService;
+    @Autowired
+    private ISceneEditInfoExtService sceneEditInfoExtService;
+    @Autowired
+    private ISceneEditControlsService sceneEditControlsService;
+
 
     /**
      * @param channel
@@ -55,32 +83,14 @@ public class UploadSceneListener {
             } else {
                 ZipUtil.unzip(zipPath, zipDir + uuid);
             }
-
-            //去读data.fdage
-            String dataFdagePath = zipDir + uuid + "/data.fdage";
-            if(!FileUtil.exist(dataFdagePath)){
-                log.warn("---------dataFdagePath:{}", dataFdagePath);
-                throw new BusinessException(ErrorCode.FAILURE_CODE_4002.code(), ErrorCode.FAILURE_CODE_4002.formatMessage("data.fdage"));
-            }
-            JSONObject dataFdageObj = JSONObject.parseObject(FileUtil.readUtf8String(dataFdagePath));
-            int camType = dataFdageObj.getJSONObject("cam").getIntValue("type");
-            String snCode = dataFdageObj.getJSONObject("cam").getString("uuid");
-            String uuidTime = dataFdageObj.getString("uuidtime");
-            String uniCode = snCode + "_" + uuidTime;
-            String fileId = sceneFileBuildService.getFileId(snCode, uniCode);
-            String homePath = "/oss/4dkankan/" + ConstantFilePath.OSS_PREFIX + snCode + "/" + fileId + "/" + uniCode;
-            FileUtil.mkdir(homePath);
-            String cpCmd = "cp -p -r " + zipDir + uuid + "/* " + homePath;
-            CmdUtils.callLineSh(cpCmd);
-
-            String params = snCode + "#" + fileId + "#" + uniCode;
-            String encode = Base64.encode(RSAEncrypt.encrypt(RSAEncrypt.loadPublicKeyByStr(RSAEncrypt.loadPublicKeyByFile()), params.getBytes(StandardCharsets.UTF_8)));
-            if(camType == 9 || camType == 10 || camType == 11){
-                sceneFileBuildService.turntableUploadSuccess(encode, user);
-            }else{
-                sceneFileBuildService.uploadSuccessBuild(encode, user);
+            //资源包类型 orig-原始数据  offline 离线包
+            if(UploadSceneSourceType.ORIG.getCode().equalsIgnoreCase(sourceType)){
+                this.uploadSceneOirg(num, zipDir + uuid);
             }
 
+            if(UploadSceneSourceType.OFFLINE.getCode().equalsIgnoreCase(sourceType)){
+                this.uploadSceneOffline(num, zipDir + uuid);
+            }
 
         }catch (Exception e){
             log.error("处理管理后台上传场景报错, content:{}", msg, e);
@@ -90,4 +100,80 @@ public class UploadSceneListener {
         log.info("结束处理管理后台上传场景,content:{}", msg);
     }
 
+    private void uploadSceneOirg(String num, String sourcePath) throws Exception {
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+        NameFileFilter fileFilter = new NameFileFilter("data.fdage");
+        File dataFdageFile = FileUtil.loopFiles(sourcePath, fileFilter).stream().findFirst().filter(v -> !v.getAbsolutePath().contains("/backup/")).get();
+
+        //去读data.fdage
+        if(dataFdageFile != null && !dataFdageFile.exists()){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_4002.code(), ErrorCode.FAILURE_CODE_4002.formatMessage("data.fdage"));
+        }
+        JSONObject dataFdageObj = JSONObject.parseObject(FileUtil.readUtf8String(dataFdageFile));
+        int camType = dataFdageObj.getJSONObject("cam").getIntValue("type");
+        String snCode = dataFdageObj.getJSONObject("cam").getString("uuid");
+        String uuidTime = dataFdageObj.getString("uuidtime");
+        String uniCode = snCode + "_" + uuidTime;
+        String fileId = sceneFileBuildService.getFileId(snCode, uniCode);
+        String homePath = "/oss/4dkankan/" + ConstantFilePath.OSS_PREFIX + snCode + "/" + fileId + "/" + uniCode;
+        FileUtil.mkdir(homePath);
+        String fileDir = sourcePath + "/" + uniCode;//本地版压缩包包含了一层unicode目录
+        String cpCmd = "cp -p -r " + fileDir + "/* " + homePath;
+        CmdUtils.callLineSh(cpCmd);
+
+        Long userId = scenePlus.getUserId();
+        User user = userService.getById(userId);
+        String params = snCode + "#" + fileId + "#" + uniCode;
+        String encode = Base64.encode(RSAEncrypt.encrypt(RSAEncrypt.loadPublicKeyByStr(RSAEncrypt.loadPublicKeyByFile()), params.getBytes(StandardCharsets.UTF_8)));
+        if(camType == 9 || camType == 10 || camType == 11){
+            sceneFileBuildService.turntableUploadSuccess(encode, user);
+        }else{
+            sceneFileBuildService.uploadSuccessBuild(encode, user);
+        }
+    }
+
+    private void uploadSceneOffline(String num, String sourcePath) throws Exception {
+        ScenePlus scenePlusDb = scenePlusService.getScenePlusByNum(num);
+        ScenePlusExt scenePlusExtDb = scenePlusExtService.getScenePlusExtByPlusId(scenePlusDb.getId());
+        NameFileFilter fileFilter = new NameFileFilter("scene.json");
+        File sceneJsonFile = FileUtil.loopFiles(sourcePath, fileFilter).get(0);
+
+        //去读data.fdage
+        if(sceneJsonFile != null && !sceneJsonFile.exists()){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_4002.code(), ErrorCode.FAILURE_CODE_4002.formatMessage("scene.json"));
+        }
+
+        SceneJsonBean sceneJsonBean = JSONObject.parseObject(FileUtil.readUtf8String(sceneJsonFile), SceneJsonBean.class);
+        String sceneViewDataPath = "/oss/4dkankan/" + String.format(UploadFilePath.VIEW_PATH, num);
+        FileUtil.mkdir(sceneViewDataPath);
+        String cpCmd = "cp -p -r " + sourcePath + "/* " + sceneViewDataPath;
+        CmdUtils.callLineSh(cpCmd);
+
+        String sceneJsonStr = FileUtil.readUtf8String(sceneJsonFile);
+        ScenePlus scenePlus = JSON.parseObject(sceneJsonStr, ScenePlus.class);
+        scenePlus.setId(scenePlusDb.getId());
+        scenePlusService.updateById(scenePlus);
+
+        ScenePlusExt scenePlusExt = JSON.parseObject(sceneJsonStr, ScenePlusExt.class);
+        scenePlusExt.setPlusId(scenePlusExtDb.getPlusId());
+        scenePlusExt.setId(scenePlusExtDb.getId());
+        scenePlusExtService.updateById(scenePlusExt);
+
+        SceneEditInfo sceneEditInfo = JSON.parseObject(sceneJsonStr, SceneEditInfo.class);
+        sceneEditInfo.setId(null);
+        sceneEditInfo.setScenePlusId(scenePlusDb.getId());
+        sceneEditInfoService.save(sceneEditInfo);
+
+        SceneEditInfoExt sceneEditInfoExt = JSON.parseObject(sceneJsonStr, SceneEditInfoExt.class);
+        sceneEditInfoExt.setId(null);
+        sceneEditInfoExt.setScenePlusId(scenePlusDb.getId());
+        sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
+        sceneEditInfoExtService.save(sceneEditInfoExt);
+
+        SceneEditControls sceneEditControls = JSON.parseObject(sceneJsonStr, SceneEditControls.class);
+        sceneEditControls.setId(null);
+        sceneEditControls.setEditInfoId(sceneEditInfo.getId());
+        sceneEditControlsService.save(sceneEditControls);
+    }
+
 }

+ 53 - 5
src/main/java/com/fdkankan/contro/vo/SceneEditControlsVO.java

@@ -65,21 +65,69 @@ public class SceneEditControlsVO implements Serializable {
      */
     private Integer showRule;
 
-    private Integer showCapture;
-
+    /**
+     * 是否展示标尺(0-不需要,1-需要)
+     */
     private Integer showScale;
 
+    /**
+     * 是否展示分享场景(0-不需要,1-需要)
+     */
     private Integer showShare;
 
-    private Integer tagshare;
+    /**
+     * 是否展示分享热点(0-不需要,1-需要)
+     */
+    private Integer showTagshare;
+
+    /**
+     * 是否展示合照开关(0-不需要,1-需要)
+     */
+    private Integer showCapture;
+
+    /**
+     * 多媒体标签标题
+     */
+    private Integer showTagTitle;
+
+    /**
+     * 指示牌标签标题
+     */
+    private Integer showBillboardTitle;
 
+    /**
+     * 视频监控标签标题
+     */
+    private Integer showCameraTitle;
+
+    /**
+     * 场景关联标签标题
+     */
+    private Integer showLinkTitle;
+
+    /**
+     * 空间绘制信息
+     */
     private Integer showDrawTitle;
 
-    private Integer showTagshare;
+    /**
+     * 是否显示全部模型
+     */
+    private Integer showAllModel;
 
-    private Integer showAi;
+    private Integer showTexture;
+
+    private Integer showPanos;
+
+    private Integer showMusic;
 
     private Integer showTitleLogo;
 
+    private Integer showSurveilScope;
+
+    private Integer showAi;
+
+    private Integer showInquest;
+
 
 }