Kaynağa Gözat

Merge branch 'release' into project-jmga-v1.4.0

# Conflicts:
#	src/main/java/com/fdkankan/download/service/impl/SceneDownloadHandlerServiceImpl.java
#	src/main/resources/bootstrap-test.yml
dengsixing 1 yıl önce
ebeveyn
işleme
41b1998974

+ 116 - 0
src/main/java/com/fdkankan/download/bean/SceneEditControlsVO.java

@@ -0,0 +1,116 @@
+package com.fdkankan.download.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 SceneEditControlsVO 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;
+
+    /**
+     * 空间绘制
+     */
+    private Integer showDrawTitle;
+
+    private Integer showAllModel;
+
+}

+ 265 - 0
src/main/java/com/fdkankan/download/bean/SceneViewInfo.java

@@ -0,0 +1,265 @@
+package com.fdkankan.download.bean;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.*;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/1/19
+ **/
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SceneViewInfo implements Serializable {
+
+    private static final long serialVersionUID = 1l;
+
+    /**
+     * 场景码
+     */
+    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 SceneEditControlsVO 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;
+
+    /**
+     * 空间绘制
+     */
+    private Integer sceneDraw;
+
+    //动态面板
+    private int dynamicPanel;
+
+
+}

+ 62 - 33
src/main/java/com/fdkankan/download/service/impl/SceneDownloadHandlerServiceImpl.java

@@ -11,19 +11,12 @@ import cn.hutool.core.util.ZipUtil;
 import cn.hutool.http.HttpUtil;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
-import com.fdkankan.common.constant.ErrorCode;
-import com.fdkankan.common.constant.SceneDownloadProgressStatus;
-import com.fdkankan.common.constant.SceneFrom;
-import com.fdkankan.common.constant.SceneKind;
-import com.fdkankan.common.constant.SceneResolution;
-import com.fdkankan.common.constant.ServerCode;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.fdkankan.common.constant.*;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.util.FileUtils;
-import com.fdkankan.download.bean.CurrentDownloadNumUtil;
-import com.fdkankan.download.bean.DownLoadProgressBean;
-import com.fdkankan.download.bean.DownLoadTaskBean;
-import com.fdkankan.download.bean.ImageType;
-import com.fdkankan.download.bean.ImageTypeDetail;
+import com.fdkankan.download.bean.*;
 import com.fdkankan.download.entity.ScenePlus;
 import com.fdkankan.download.entity.ScenePlusExt;
 import com.fdkankan.download.entity.ScenePro;
@@ -89,6 +82,7 @@ public class SceneDownloadHandlerServiceImpl {
 
     private static final List<ImageType> imageTypes = Lists.newArrayList();
     static{
+        imageTypes.add(ImageType.builder().name("4k_face").size("4096").ranges(new String[]{"0", "511", "1023", "1535", "2047","2559","3071","3583"}).build());
         imageTypes.add(ImageType.builder().name("2k_face").size("2048").ranges(new String[]{"0", "511", "1023", "1535"}).build());
         imageTypes.add(ImageType.builder().name("1k_face").size("1024").ranges(new String[]{"0", "511"}).build());
         imageTypes.add(ImageType.builder().name("512_face").size("512").ranges(new String[]{"0"}).build());
@@ -110,7 +104,7 @@ public class SceneDownloadHandlerServiceImpl {
     private String wwwroot;
     @Value("${zip.nThreads}")
     private int zipNthreads;
-    @Value("${oss.bucket:4dkankan}")
+    @Value("${fyun.bucket:4dkankan}")
     private String bucket;
     @Value("${fyun.type}")
     private String uploadType;
@@ -234,16 +228,15 @@ public class SceneDownloadHandlerServiceImpl {
                 zipFile.getParentFile().mkdirs();
             }
 
-            String sceneJsonData = fYunFileService.getFileContent(bucket, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json");
-            JSONObject sceneJson = JSONUtil.parseObj(sceneJsonData);
-            String resolution = sceneJson.getStr("sceneResolution");
+            SceneViewInfo sceneViewInfo = this.getSceneJson(num);
+            String resolution = sceneViewInfo.getSceneResolution();
             //国际版存在已经切好图的情况,下载时不需要再切图,只需要把文件直接下载下来打包就可以了
-            if(SceneKind.FACE.code().equals(sceneJson.getStr("sceneKind"))){
+            if(SceneKind.FACE.code().equals(sceneViewInfo.getSceneKind())){
                 resolution = "notNeadCut";
             }
 
             int imagesVersion = -1;
-            Integer version = sceneJson.getInt("version");
+            Integer version = sceneViewInfo.getVersion();
             if(Objects.nonNull(version)){
                 imagesVersion = version;
             }
@@ -257,7 +250,7 @@ public class SceneDownloadHandlerServiceImpl {
             log.info("打包oss文件耗时, num:{}, time:{}", num, timer.intervalRestart());
 
             //重新写入scene.json(去掉密码访问设置)
-            this.zipSceneJson(num, sceneJson);
+            this.zipSceneJson(num, sceneViewInfo);
 
             //写入启动命令
             this.zipBat(num, "v4");
@@ -278,11 +271,42 @@ public class SceneDownloadHandlerServiceImpl {
             this.updateProgress( null, num, SceneDownloadProgressStatus.DOWNLOAD_FAILED.code(), null, "v4");
             throw e;
         }finally {
-//            FileUtil.del(zipPath);
-//            FileUtil.del(String.format(this.sourceLocal, num, ""));
+            FileUtil.del(zipPath);
+            FileUtil.del(String.format(this.sourceLocal, num, ""));
         }
     }
 
+    private SceneViewInfo getSceneJson(String num){
+        String sceneJsonData = redisUtil.get(String.format(RedisKey.SCENE_JSON, num));
+        if(StrUtil.isEmpty(sceneJsonData)){
+            sceneJsonData = fYunFileService.getFileContent(bucket, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json");
+        }
+        sceneJsonData = sceneJsonData.replace(this.publicUrl, "");
+        SceneViewInfo sceneInfoVO = JSON.parseObject(sceneJsonData, SceneViewInfo.class);
+        sceneInfoVO.setScenePassword(null);
+        if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
+            sceneInfoVO.setFloorPlanAngle(0f);
+        }
+        if(Objects.isNull(sceneInfoVO.getFloorPlanCompass())){
+            sceneInfoVO.setFloorPlanCompass(0f);
+        }
+        SceneEditControlsVO 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());
+        }
+        if(Objects.isNull(controls.getShowDrawTitle())){
+            controls.setShowDrawTitle(CommonStatus.YES.code().intValue());
+        }
+
+        return sceneInfoVO;
+    }
+
     public void downloadHandlerV3(DownLoadTaskBean downLoadTaskBean) throws Exception{
 
         String num = downLoadTaskBean.getSceneNum();
@@ -412,6 +436,7 @@ public class SceneDownloadHandlerServiceImpl {
                 zipSuccess = false;
             }
         }
+        executorService.shutdown();
         if(!zipSuccess){
             throw new Exception("打包oss文件失败");
         }
@@ -438,6 +463,9 @@ public class SceneDownloadHandlerServiceImpl {
             if((filePath.contains(imageNumPath + "panorama/") && filePath.contains("tiles/" + resolution))
                 || filePath.contains(imageNumPath + "tiles/" + resolution + "/")) {
                 this.processImage(num, filePath, resolution, imagesVersion, cacheKeys);
+                //更新进度
+                this.updateProgress(new BigDecimal(count.incrementAndGet()).divide(new BigDecimal(total), 6, BigDecimal.ROUND_HALF_UP),
+                    num, SceneDownloadProgressStatus.DOWNLOADING.code(), null, version);
                 return;
             }
         }
@@ -545,25 +573,20 @@ public class SceneDownloadHandlerServiceImpl {
         return map;
     }
 
-    private void zipSceneJson(String num, JSONObject sceneJson) throws Exception{
+    private void zipSceneJson(String num, SceneViewInfo sceneViewInfo) throws Exception{
         //访问密码置0
-        JSONObject controls = sceneJson.getJSONObject("controls");
-        controls.set("showLock", 0);
-        String videos = sceneJson.getStr("videos");
-        videos = videos.replaceAll(File.separator.concat("oss").concat(File.separator), "");
-        sceneJson.replace("videos", videos);
-        log.info("videos:{}",videos);
+        SceneEditControlsVO controls = sceneViewInfo.getControls();
+        controls.setShowLock(CommonStatus.NO.code().intValue());
         String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json";
-        log.info("sceneJson.toString():{}",sceneJson.toString());
-        FileUtil.writeUtf8String(sceneJson.toString().replaceAll(File.separator.concat("oss").concat(File.separator), "")
-                , String.format(this.sourceLocal, num, this.wwwroot + sceneJsonPath));
+        FileUtil.writeUtf8String(JSON.toJSONString(sceneViewInfo, SerializerFeature.WriteNullStringAsEmpty, SerializerFeature.WriteNullNumberAsZero), String.format(this.sourceLocal, num, this.wwwroot + sceneJsonPath));
     }
 
     private void zipGetInfoJson(String num, JSONObject getInfo) throws Exception{
 
         //访问密码置0
         String getInfoKey = String.format("data/data%s/", num) + "getInfo.json";
-        FileUtil.writeUtf8String(getInfo.toString(), String.format(this.sourceLocal, num, this.wwwroot + getInfoKey));
+        String getInfoStr = getInfo.toString().replace(this.publicUrl, "");
+        FileUtil.writeUtf8String(getInfoStr, String.format(this.sourceLocal, num, this.wwwroot + getInfoKey));
     }
 
     private void processImage(String sceneNum, String key, String resolution, int imagesVersion, Set<String> imgKeys) throws Exception{
@@ -586,6 +609,10 @@ public class SceneDownloadHandlerServiceImpl {
         }
         for (ImageType imageType : imageTypes) {
 
+            if(imageType.getName().equals("4k_face") && !"4k".equals(resolution)){
+                continue;
+            }
+
             List<ImageTypeDetail> items = Lists.newArrayList();
             String[] ranges = imageType.getRanges();
             for(int i = 0; i < ranges.length; i++){
@@ -650,9 +677,11 @@ public class SceneDownloadHandlerServiceImpl {
         String fileName = key.substring(key.lastIndexOf("/") + 1);
         String url = this.resourceUrl + key.replace(fileName, URLEncoder.encode(fileName, "UTF-8")) + "?t=" + Calendar.getInstance().getTimeInMillis();
         if(key.contains("hot.json") || key.contains("link-scene.json")){
-//            String content = FileUtils.getStringFromUrl(url);
             String content = fYunFileService.getFileContent(key);
-            content.replace(publicUrl, "")
+            if(StrUtil.isEmpty(content)){
+                return;
+            }
+            content = content.replace(publicUrl, "")
 //                .replace(publicUrl+"v3/", "")
                 .replace("https://spc.html","spc.html")
                 .replace("https://smobile.html", "smobile.html");

+ 9 - 17
src/main/resources/bootstrap-prod-eur.yml

@@ -1,36 +1,28 @@
 spring:
-  jackson:
-    serialization:
-      #关闭jackson转换 实体属性空值校验
-      FAIL_ON_EMPTY_BEANS: false
   application:
     name: 4dkankan-center-scene-download
   cloud:
     nacos:
+      server-addr: 172.31.47.163:8848
+      namespace: 4dkankan-v4-prod-eur
       config:
-        server-addr: 172.31.42.151:8848
         file-extension: yaml
-        namespace: 4dkankan-pro-eur
-        extension-configs:
-          - data-id: 4dkankan-center-scene-download.yaml
+        namespace: ${spring.cloud.nacos.namespace}
+        shared-configs:
+          - data-id: common-redis-config.yaml
             group: DEFAULT_GROUP
             refresh: true
-        shared-configs:
 
-          - data-id: common-redis-config.yaml
+          - data-id: common-config.yaml
             group: DEFAULT_GROUP
             refresh: true
 
-          - data-id: other-config.yaml
+          - data-id: common-fyun-config.yaml
             group: DEFAULT_GROUP
             refresh: true
 
-          - data-id: common-upload-config.yaml
+          - data-id: common-db-config.yaml
             group: DEFAULT_GROUP
             refresh: true
       discovery:
-        server-addr: 172.31.42.151:8848
-        namespace: 4dkankan-pro-eur
-
-
-
+        namespace: ${spring.cloud.nacos.namespace}

+ 11 - 14
src/main/resources/bootstrap-test-eur.yml

@@ -1,35 +1,32 @@
 spring:
-  jackson:
-    serialization:
-      #关闭jackson转换 实体属性空值校验
-      FAIL_ON_EMPTY_BEANS: false
   application:
     name: 4dkankan-center-scene-download
   cloud:
     nacos:
+      server-addr: 120.24.144.164:8848
+      namespace: 4dkankan-v4-test-eur
       config:
-        server-addr: 120.24.144.164:8848
         file-extension: yaml
-        namespace: 4dkankan-test-eur
-        extension-configs:
-          - data-id: 4dkankan-center-scene-download.yaml
+        namespace: ${spring.cloud.nacos.namespace}
+        shared-configs:
+          - data-id: common-redis-config.yaml
             group: DEFAULT_GROUP
             refresh: true
-        shared-configs:
 
-          - data-id: common-redis-config.yaml
+          - data-id: common-config.yaml
             group: DEFAULT_GROUP
             refresh: true
 
-          - data-id: other-config.yaml
+          - data-id: common-fyun-config.yaml
             group: DEFAULT_GROUP
             refresh: true
 
-          - data-id: common-upload-config.yaml
+          - data-id: common-db-config.yaml
             group: DEFAULT_GROUP
             refresh: true
       discovery:
-        server-addr: 120.24.144.164:8848
-        namespace: 4dkankan-test-eur
+        namespace: ${spring.cloud.nacos.namespace}
+
+