dengsixing 1 yıl önce
ebeveyn
işleme
2ae1e11bf5

+ 6 - 0
pom.xml

@@ -189,6 +189,12 @@
             <version>3.0.0-SNAPSHOT</version>
             <version>3.0.0-SNAPSHOT</version>
         </dependency>
         </dependency>
 
 
+        <dependency>
+            <groupId>com.fdkankan</groupId>
+            <artifactId>4dkankan-utils-fyun-oss</artifactId>
+            <version>3.0.0-SNAPSHOT</version>
+        </dependency>
+
     </dependencies>
     </dependencies>
 
 
     <dependencyManagement>
     <dependencyManagement>

+ 109 - 0
src/main/java/com/fdkankan/external/bean/SceneEditControlsBean.java

@@ -0,0 +1,109 @@
+package com.fdkankan.external.bean;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/1/18
+ **/
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SceneEditControlsBean implements Serializable {
+
+    /**
+     * 是否展示小地图(0-不展示,1-展示)
+     */
+    private Integer showMap;
+
+    /**
+     * 是否需要密码(0-不需要,1-需要)
+     */
+    private Integer showLock;
+
+    /**
+     * 是否展示标题(0-不需要,1-需要)
+     */
+    private Integer showTitle;
+
+    /**
+     * 是否展示漫游按钮(0-不需要,1-需要)
+     */
+    private Integer showPanorama;
+
+    /**
+     * 是否展示3D按钮(0-不需要,1-需要)
+     */
+    private Integer showDollhouse;
+
+    /**
+     * 是否展示2D按钮(0-不需要,1-需要)
+     */
+    private Integer showFloorplan;
+
+    /**
+     * 是否展示VR(0-不需要,1-需要)
+     */
+    private Integer showVR;
+
+    /**
+     * 是否展示自动导览(0-不需要,1-需要)
+     */
+    private Integer showTour;
+
+    /**
+     * 是否展示测量线(0-不需要,1-需要)
+     */
+    private Integer showRule;
+
+    /**
+     * 是否展示标尺(0-不需要,1-需要)
+     */
+    private Integer showScale;
+
+    /**
+     * 是否展示分享场景(0-不需要,1-需要)
+     */
+    private Integer showShare;
+
+    /**
+     * 是否展示分享热点(0-不需要,1-需要)
+     */
+    private Integer showTagshare;
+
+    /**
+     * 是否展示合照开关(0-不需要,1-需要)
+     */
+    private Integer showCapture;
+
+    /**
+     * 多媒体标签标题
+     */
+    private Integer showTagTitle;
+
+    /**
+     * 指示牌标签标题
+     */
+    private Integer showBillboardTitle;
+
+    /**
+     * 视频监控标签标题
+     */
+    private Integer showCameraTitle;
+
+    /**
+     * 场景关联标签标题
+     */
+    private Integer showLinkTitle;
+
+}

+ 257 - 0
src/main/java/com/fdkankan/external/bean/SceneInfoBean.java

@@ -0,0 +1,257 @@
+package com.fdkankan.external.bean;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/1/19
+ **/
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SceneInfoBean {
+
+    /**
+     * 场景码
+     */
+    private String num;
+
+    /**
+     * 地面logo名称
+     */
+    private String floorLogo;
+
+    /**
+     * 地面logo大小
+     */
+    private Integer floorLogoSize;
+
+    /**
+     * 地面logo文件名称
+     */
+    private String floorLogoFile;
+
+    /**
+     * 背景音乐
+     */
+    private String music;
+
+    /**
+     * 背景音乐文件名称
+     */
+    private String musicFile;
+
+    /**
+     * 浏览密码
+     */
+    private String scenePassword;
+
+    /**
+     * 场景标题
+     */
+    private String title;
+
+    /**
+     * 场景描述
+     */
+    private String description;
+
+    private SceneEditControlsBean controls;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+//    /**
+//     * 点位数量
+//     */
+//    private Integer panoCount;
+//
+//    /**
+//     * 球幕视频数量
+//     */
+//    private Integer videoCount;
+
+    /**
+     * 版本
+     */
+    private Integer version;
+
+    /**
+     * 图片版本
+     */
+    private Integer imgVersion;
+
+    /**
+     * 场景关联版本
+     */
+    private Integer linkVersion;
+
+    /**
+     * 是否上传了户型图(0-否,1-是)
+     */
+    private Byte floorPlanUser;
+
+//    private String cadInfo;
+//
+//    private Byte isUploadObj;
+//
+//    private Integer floorEditVer;
+//
+//    private Integer floorPublishVer;
+
+    /**
+     * 初始点信息
+     */
+    private String entry;
+
+    /**
+     * 全景图加载方式,tiles/1k:1k瓦片图,tiles/2:2k瓦片图,tiles/4k:4k瓦片图,pan:全景图 ,local:本地切片,cube:立体图
+     */
+    private String sceneResolution;
+
+    /**
+     * 场景来源,lite:双目lite相机,pro:八目相机,minion:双面转台相机,laser:激光相机,virtual:虚拟场景,sketch:图片建模场景
+     */
+    private String sceneFrom;
+
+    /**
+     * 切图方式(tiles:瓦片图,face:切片图,pan:全景图 ,local:本地切片,cube:立体图)
+     */
+    private String sceneKind;
+
+    /**
+     * 算法模型类型(dam,3dtiles)
+     */
+    private String modelKind;
+
+    /**
+     * 空间视频数据
+     */
+    private String boxVideos;
+    /**
+     * 空间贴图数据
+     */
+    private String boxPhotos;
+
+    /**
+     * 空间模型数据
+     */
+    private String boxModels;
+
+    /**
+     *点位视频
+     */
+    private String videos;
+
+    /**
+     * 是否有热点数据
+     */
+    private Integer tags;
+
+    /**
+     * 加载logo名
+     */
+    private String loadingLogo;
+
+    /**
+     * 加载logo文件名
+     */
+    private String loadingLogoFile;
+
+    /**
+     * 数据同步方式
+     */
+    private String dataSync;
+
+    /**
+     * 户型角度
+     */
+    private Float floorPlanAngle;
+
+    /**
+     * 指南针角度
+     */
+    private Float floorPlanCompass;
+
+    /**
+     * 用户上传自定义平面图
+     */
+    private JSONArray floorPlanUpload;
+
+    /**
+     * 是否保存导览
+     */
+    private Integer tours;
+
+    /**
+     * 是否有马赛克
+     */
+    private Integer mosaic;
+
+    /**
+     * 马赛克列表
+     */
+    private List<JSONObject> mosaicList;
+
+    /**
+     * 水印文件名
+     */
+    private String waterMark;
+
+    /**
+     * 是否有场景关联(0-否,1-是)
+     */
+    private Integer links;
+
+    /**
+     * 是否有滤镜(0-否,1-是)
+     */
+    private Integer filters;
+
+    /**
+     * 是否有监控摄像头数据
+     */
+    private Integer surveillances;
+
+    /**
+     * 场景容量 单位 MB
+     */
+    private Integer space;
+
+    /**
+     * 分享信息
+     */
+    private JSONObject sns;
+
+    /**
+     * 是否有指示牌(0-否,1-是)
+     */
+    private Integer billboards;
+
+    /**
+     * 是否有模型裁剪(0-否,1-是)
+     */
+    private Integer cutModel = 0;
+
+    /**
+     * 启动页配置信息
+     */
+    private JSONObject started;
+
+
+}

+ 53 - 7
src/main/java/com/fdkankan/external/service/impl/SceneOfflinePackagePushServiceImpl.java

@@ -13,14 +13,13 @@ import cn.hutool.core.util.ZipUtil;
 import cn.hutool.http.HttpUtil;
 import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
-import com.fdkankan.common.constant.CommonStatus;
-import com.fdkankan.common.constant.CommonSuccessStatus;
-import com.fdkankan.common.constant.FileSizeUnitType;
-import com.fdkankan.common.constant.SceneSource;
+import com.fdkankan.common.constant.*;
 import com.fdkankan.common.util.DateExtUtil;
 import com.fdkankan.common.util.DateExtUtil;
 import com.fdkankan.common.util.FileSizeUtil;
 import com.fdkankan.common.util.FileSizeUtil;
 import com.fdkankan.external.bean.DownloadProcessBean;
 import com.fdkankan.external.bean.DownloadProcessBean;
 import com.fdkankan.external.bean.LaserDownloadBean;
 import com.fdkankan.external.bean.LaserDownloadBean;
+import com.fdkankan.external.bean.SceneEditControlsBean;
+import com.fdkankan.external.bean.SceneInfoBean;
 import com.fdkankan.external.callback.ErrorCallback;
 import com.fdkankan.external.callback.ErrorCallback;
 import com.fdkankan.external.callback.SuccessCallback;
 import com.fdkankan.external.callback.SuccessCallback;
 import com.fdkankan.external.entity.*;
 import com.fdkankan.external.entity.*;
@@ -28,6 +27,7 @@ import com.fdkankan.external.httpclient.HttpClient;
 import com.fdkankan.external.mapper.SceneOfflinePackagePushMapper;
 import com.fdkankan.external.mapper.SceneOfflinePackagePushMapper;
 import com.fdkankan.external.service.*;
 import com.fdkankan.external.service.*;
 import com.fdkankan.external.util.CmdUtils;
 import com.fdkankan.external.util.CmdUtils;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.util.RedisUtil;
 import com.fdkankan.redis.util.RedisUtil;
 import com.fdkankan.web.response.Result;
 import com.fdkankan.web.response.Result;
@@ -100,6 +100,8 @@ public class SceneOfflinePackagePushServiceImpl extends ServiceImpl<SceneOffline
     private ICameraService cameraService;
     private ICameraService cameraService;
     @Resource
     @Resource
     private RedisUtil redisUtil;
     private RedisUtil redisUtil;
+    @Resource
+    private FYunFileServiceInterface fYunFileService;
 
 
 
 
 
 
@@ -181,9 +183,10 @@ public class SceneOfflinePackagePushServiceImpl extends ServiceImpl<SceneOffline
                     SceneOfflinePackagePush lastPush = sceneOfflinePackagePushService.getLastByCondition(condition);
                     SceneOfflinePackagePush lastPush = sceneOfflinePackagePushService.getLastByCondition(condition);
 
 
                     //查询版本号
                     //查询版本号
-                    String getInfo = fdkkSceneHost.concat(String.format(getInfoUrl, scenePlus.getNum()));
-                    ResultData<Map<String, Object>> mapResultData = httpClient.get(getInfo, new HashMap<>(), new SuccessCallback(), new ErrorCallback());
-                    int version =  (int)mapResultData.getData().get("version");
+//                    String getInfo = fdkkSceneHost.concat(String.format(getInfoUrl, scenePlus.getNum()));
+//                    ResultData<Map<String, Object>> mapResultData = httpClient.get(getInfo, new HashMap<>(), new SuccessCallback(), new ErrorCallback());
+                    SceneInfoBean sceneInfoBean = this.getSceneInfo(scenePlus.getNum());
+                    int version =  sceneInfoBean.getVersion();
 
 
                     //如果没有推送过或者推送过但是版本号不一致,就需要推送
                     //如果没有推送过或者推送过但是版本号不一致,就需要推送
                     if(Objects.isNull(lastPush) || lastPush.getVersion() != version){
                     if(Objects.isNull(lastPush) || lastPush.getVersion() != version){
@@ -204,6 +207,46 @@ public class SceneOfflinePackagePushServiceImpl extends ServiceImpl<SceneOffline
             }
             }
         }
         }
     }
     }
+    private SceneInfoBean getSceneInfo(String num){
+
+        ScenePlus scenePlus = scenePlusService.getByNum(num);
+        ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
+
+
+        String key = String.format(RedisKey.SCENE_JSON, num);
+        String sceneJson = redisUtil.get(key);
+        //先查询redis
+        if(StrUtil.isEmpty(sceneJson)) {
+            String objectName = String.format("scene_view_data/%s/data/scene.json", num);
+            sceneJson = fYunFileService.getFileContent(scenePlusExt.getYunFileBucket(), objectName);
+            redisUtil.set(key, sceneJson);
+        }
+        SceneInfoBean  sceneInfoVO = JSON.parseObject(sceneJson, SceneInfoBean.class);
+        sceneInfoVO.setScenePassword(null);
+        if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
+            sceneInfoVO.setFloorPlanAngle(0f);
+        }
+        if(Objects.isNull(sceneInfoVO.getFloorPlanCompass())){
+            sceneInfoVO.setFloorPlanCompass(0f);
+        }
+        SceneEditControlsBean controls = sceneInfoVO.getControls();
+        if(Objects.isNull(controls.getShowShare())){
+            controls.setShowShare(CommonStatus.YES.code().intValue());
+        }
+        if(Objects.isNull(controls.getShowCapture())){
+            controls.setShowCapture(CommonStatus.YES.code().intValue());
+        }
+        if(Objects.isNull(controls.getShowBillboardTitle())){
+            controls.setShowBillboardTitle(CommonStatus.YES.code().intValue());
+        }
+
+        //随心装特殊要求,由于随心装场景无法提供vision2.txt,故默认随心装场景关闭标尺功能
+        if(SceneFrom.SXZ.code().equals(scenePlusExt.getSceneFrom())){
+            controls.setShowRule(CommonStatus.NO.code().intValue());
+        }
+
+        return sceneInfoVO;
+    }
 
 
     private String genZipUrl4Kankan(String num){
     private String genZipUrl4Kankan(String num){
         String downloadUrl = null;
         String downloadUrl = null;
@@ -342,6 +385,8 @@ public class SceneOfflinePackagePushServiceImpl extends ServiceImpl<SceneOffline
             FileUtil.del(zipDir);
             FileUtil.del(zipDir);
             String volumeName = zipDir.concat(num).concat(".zip");
             String volumeName = zipDir.concat(num).concat(".zip");
             FileUtil.mkParentDirs(volumeName);
             FileUtil.mkParentDirs(volumeName);
+            //下载算法日志 https://4dkk.4dage.com/build_log/06TRwcBTiC/console.log
+            HttpUtil.downloadFile(ossHost4dkkOld.concat("/build_log/").concat(num).concat("/console.log"), dirPath.concat("/").concat(num).concat("/console.log"));
             String cmd = "cd " + dirPath + " && zip -r " + volumeName + " " + num + " -s 500M";
             String cmd = "cd " + dirPath + " && zip -r " + volumeName + " " + num + " -s 500M";
             log.info("压缩命令:{}", cmd);
             log.info("压缩命令:{}", cmd);
             CmdUtils.callLineSh(cmd, 200);
             CmdUtils.callLineSh(cmd, 200);
@@ -383,6 +428,7 @@ public class SceneOfflinePackagePushServiceImpl extends ServiceImpl<SceneOffline
             params.put("downloadUrl", downloadUrl);
             params.put("downloadUrl", downloadUrl);
             params.put("version", push.getVersion());
             params.put("version", push.getVersion());
             params.put("calcTime", DateExtUtil.format(scenePlusExt.getAlgorithmTime(), DateExtUtil.dateStyle8));
             params.put("calcTime", DateExtUtil.format(scenePlusExt.getAlgorithmTime(), DateExtUtil.dateStyle8));
+            params.put("computeTime", scenePlusExt.getComputeTime());
             String post = HttpUtil.post(push.getDestUrl(), params, 60 * 60 * 1000);
             String post = HttpUtil.post(push.getDestUrl(), params, 60 * 60 * 1000);
             log.info("场景推送成功,接收端返回结果:{}", post);
             log.info("场景推送成功,接收端返回结果:{}", post);
             push.setPushStatus(CommonSuccessStatus.SUCCESS.code());
             push.setPushStatus(CommonSuccessStatus.SUCCESS.code());

+ 8 - 0
src/main/resources/application-prod.yml

@@ -76,6 +76,14 @@ oss:
       old: https://4dkk.4dage.com
       old: https://4dkk.4dage.com
       new: https://zgwwzzzx-download.4dage.com
       new: https://zgwwzzzx-download.4dage.com
 
 
+fyun:
+  type: oss
+  key: LTAIUrvuHqj8pvry
+  secret: JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4
+  bucket: 4dkankan
+  endPoint: http://oss-cn-shenzhen.aliyuncs.com
+  host: https://4dkk.4dage.com/
+
 file:
 file:
   offlineZip:
   offlineZip:
     dir: /mnt/external/temp/
     dir: /mnt/external/temp/

+ 8 - 0
src/main/resources/application.yml

@@ -76,6 +76,14 @@ oss:
       old: https://4dkk.4dage.com
       old: https://4dkk.4dage.com
       new: https://zgwwzzzx-download.4dage.com
       new: https://zgwwzzzx-download.4dage.com
 
 
+fyun:
+  type: oss
+  key: LTAIUrvuHqj8pvry
+  secret: JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4
+  bucket: 4dkankan
+  endPoint: http://oss-cn-shenzhen.aliyuncs.com
+  host: https://4dkk.4dage.com/
+
 file:
 file:
   offlineZip:
   offlineZip:
     dir: /mnt/external/temp/
     dir: /mnt/external/temp/