Quellcode durchsuchen

场景中心代码迁移

by su vor 3 Jahren
Ursprung
Commit
fa732b82be
100 geänderte Dateien mit 35494 neuen und 181 gelöschten Zeilen
  1. 2 7
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/SceneApplication.java
  2. 21 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/controller/SceneExtController.java
  3. 14 122
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/Scene.java
  4. 2 2
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/Scene3dfamily.java
  5. 6 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/SceneCooperation.java
  6. 169 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/SceneExt.java
  7. 223 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/ScenePO.java
  8. 7 1
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/SceneProEditExt.java
  9. 6 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/SceneProExt.java
  10. 177 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/SceneProPO.java
  11. 7 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/IScene3dNumMapper.java
  12. 4 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/IScene3dfamilyMapper.java
  13. 18 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/ISceneExtMapper.java
  14. 24 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/ISceneMapper.java
  15. 5 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/ISceneProEditExtMapper.java
  16. 1 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/ISceneProExtMapper.java
  17. 37 2
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/ISceneProMapper.java
  18. 34 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/schedule/ScheduleJob.java
  19. 8 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/IScene3dNumService.java
  20. 14 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/IScene3dfamilyService.java
  21. 37 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneAppService.java
  22. 6 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneCooperationService.java
  23. 2 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneDataDownloadService.java
  24. 6 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneDownloadLogService.java
  25. 18 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneExtService.java
  26. 3 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneFeedbackService.java
  27. 8 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneFileBuildService.java
  28. 4 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneFileUploadService.java
  29. 63 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneProAppService.java
  30. 9 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneProEditExtService.java
  31. 10 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneProEditService.java
  32. 3 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneProExtService.java
  33. 155 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneProService.java
  34. 5 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneResourceCameraService.java
  35. 1 1
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneResourceCooperationService.java
  36. 7 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneResourceService.java
  37. 79 1
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneService.java
  38. 3 3
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/FolderServiceImpl.java
  39. 28 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/Scene3dNumServiceImpl.java
  40. 153 1
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/Scene3dfamilyServiceImpl.java
  41. 848 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneAppServiceImpl.java
  42. 40 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneCooperationServiceImpl.java
  43. 20 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneDataDownloadServiceImpl.java
  44. 48 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneDownloadLogServiceImpl.java
  45. 25 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneExtServiceImpl.java
  46. 139 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneFileBuildServiceImpl.java
  47. 34 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneFileUploadServiceImpl.java
  48. 1923 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProAppServiceImpl.java
  49. 65 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProEditExtServiceImpl.java
  50. 51 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProEditServiceImpl.java
  51. 6 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProExtServiceImpl.java
  52. 4418 6
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java
  53. 20 1
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneResourceCameraServiceImpl.java
  54. 6 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneResourceCooperationServiceImpl.java
  55. 55 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneResourceServiceImpl.java
  56. 1054 2
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneServiceImpl.java
  57. 74 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/Scene3dfamilyVO.java
  58. 187 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/SceneEditVO.java
  59. 171 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/SceneParamVO.java
  60. 210 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/SceneProEditVO.java
  61. 181 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/SceneProVO.java
  62. 0 17
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/SceneProVo.java
  63. 234 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/SceneVO.java
  64. 0 15
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/TestDto.java
  65. 22 0
      4dkankan-center-scene/src/main/resources/bootstrap.yml
  66. 11 0
      4dkankan-center-scene/src/main/resources/mapper/scene/Scene3dNumMapper.xml
  67. 11 0
      4dkankan-center-scene/src/main/resources/mapper/scene/Scene3dfamilyMapper.xml
  68. 5 0
      4dkankan-center-scene/src/main/resources/mapper/scene/SceneExtMapper.xml
  69. 262 0
      4dkankan-center-scene/src/main/resources/mapper/scene/SceneMapper.xml
  70. 10 0
      4dkankan-center-scene/src/main/resources/mapper/scene/SceneProEditExtMapper.xml
  71. 1 0
      4dkankan-center-scene/src/main/resources/mapper/scene/SceneProExtMapper.xml
  72. 244 0
      4dkankan-center-scene/src/main/resources/mapper/scene/SceneProMapper.xml
  73. 79 0
      4dkankan-common/pom.xml
  74. 52 0
      4dkankan-common/src/main/java/com/fdkankan/common/constant/ConstantCmd.java
  75. 39 0
      4dkankan-common/src/main/java/com/fdkankan/common/constant/ConstantFileName.java
  76. 54 0
      4dkankan-common/src/main/java/com/fdkankan/common/constant/ConstantFilePath.java
  77. 29 0
      4dkankan-common/src/main/java/com/fdkankan/common/constant/ConstantUrl.java
  78. 25 0
      4dkankan-common/src/main/java/com/fdkankan/common/constant/DownloadStatus.java
  79. 43 0
      4dkankan-common/src/main/java/com/fdkankan/common/constant/ErrorCode.java
  80. 26 0
      4dkankan-common/src/main/java/com/fdkankan/common/constant/PayStatus.java
  81. 62 0
      4dkankan-common/src/main/java/com/fdkankan/common/constant/RedisKey.java
  82. 91 0
      4dkankan-common/src/main/java/com/fdkankan/common/constant/RedisUtil.java
  83. 25 0
      4dkankan-common/src/main/java/com/fdkankan/common/constant/SceneEditType.java
  84. 26 0
      4dkankan-common/src/main/java/com/fdkankan/common/constant/SceneStatus.java
  85. 29 0
      4dkankan-common/src/main/java/com/fdkankan/common/constant/SceneType.java
  86. 25 0
      4dkankan-common/src/main/java/com/fdkankan/common/constant/UploadStatus.java
  87. 26 0
      4dkankan-common/src/main/java/com/fdkankan/common/constant/ZipStatus.java
  88. 7340 0
      4dkankan-common/src/main/java/com/fdkankan/common/proto/BigSceneProto.java
  89. 4654 0
      4dkankan-common/src/main/java/com/fdkankan/common/proto/Common.java
  90. 4345 0
      4dkankan-common/src/main/java/com/fdkankan/common/proto/Visionmodeldata.java
  91. 156 0
      4dkankan-common/src/main/java/com/fdkankan/common/proto/format/CouchDBFormat.java
  92. 703 0
      4dkankan-common/src/main/java/com/fdkankan/common/proto/format/HtmlFormat.java
  93. 1338 0
      4dkankan-common/src/main/java/com/fdkankan/common/proto/format/JavaPropsFormat.java
  94. 1603 0
      4dkankan-common/src/main/java/com/fdkankan/common/proto/format/JsonFormat.java
  95. 602 0
      4dkankan-common/src/main/java/com/fdkankan/common/proto/format/SmileFormat.java
  96. 1333 0
      4dkankan-common/src/main/java/com/fdkankan/common/proto/format/XmlFormat.java
  97. 221 0
      4dkankan-common/src/main/java/com/fdkankan/common/util/ConvertCommonUtils.java
  98. 221 0
      4dkankan-common/src/main/java/com/fdkankan/common/util/ConvertUtils.java
  99. 593 0
      4dkankan-common/src/main/java/com/fdkankan/common/util/CreateObjUtil.java
  100. 0 0
      4dkankan-common/src/main/java/com/fdkankan/common/util/DateExtUtil.java

+ 2 - 7
4dkankan-center-scene/src/main/java/com/fdkankan/scene/SceneApplication.java

@@ -1,23 +1,18 @@
 package com.fdkankan.scene;
 
 import com.fdkankan.common.exception.GlobalExceptionHandler;
-import com.fdkankan.common.response.ResultData;
-import com.fdkankan.scene.vo.TestDto;
 import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.Bean;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
 @SpringBootApplication
 @EnableFeignClients
 @EnableDiscoveryClient
+@EnableScheduling
 @MapperScan("com.fdkankan.**.mapper")
 public class SceneApplication {
 

+ 21 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/controller/SceneExtController.java

@@ -0,0 +1,21 @@
+package com.fdkankan.scene.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 场景表 前端控制器
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2021-12-30
+ */
+@RestController
+@RequestMapping("/scene/sceneExt")
+public class SceneExtController {
+
+}
+

+ 14 - 122
4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/Scene.java

@@ -15,7 +15,7 @@ import lombok.Setter;
  * </p>
  *
  * @author dengsixing
- * @since 2021-12-23
+ * @since 2021-12-30
  */
 @Getter
 @Setter
@@ -52,16 +52,10 @@ public class Scene implements Serializable {
     private String thumb;
 
     /**
-     * 创建时间
-     */
-    @TableField("create_time")
-    private Date createTime;
-
-    /**
      * 0表示未建好,1表示建好,-1表示出错,-2表示不要在官网上显示
      */
-    @TableField("status")
-    private Integer status;
+    @TableField("scene_status")
+    private Integer sceneStatus;
 
     /**
      * 原始的大场景数据(七牛)
@@ -96,8 +90,8 @@ public class Scene implements Serializable {
     /**
      * 大场景序号
      */
-    @TableField("num")
-    private String num;
+    @TableField("scene_code")
+    private String sceneCode;
 
     /**
      * 大场景的密钥
@@ -148,130 +142,28 @@ public class Scene implements Serializable {
     private Integer floorLogoSize;
 
     /**
-     * 要上传的热点的id集合,用逗号隔开
-     */
-    @TableField("hots_ids")
-    private String hotsIds;
-
-    /**
-     * 表示初始点信息
-     */
-    @TableField("entry")
-    private String entry;
-
-    /**
-     * 拍摄数量
-     */
-    @TableField("shoot_count")
-    private Integer shootCount;
-
-    /**
-     * 风格
-     */
-    @TableField("style")
-    private Integer style;
-
-    /**
-     * 要gps定位
-     */
-    @TableField("gps")
-    private String gps;
-
-    /**
-     * 方案:1是双目,2是转台,3是六目,4是八目
-     */
-    @TableField("scene_scheme")
-    private Integer sceneScheme;
-
-    /**
-     * 背景音乐名称
-     */
-    @TableField("bg_music")
-    private String bgMusic;
-
-    /**
      * 记录的状态,A: 生效,I: 禁用
      */
     @TableField("rec_status")
     private String recStatus;
 
     /**
-     * 更新时间
-     */
-    @TableField("update_time")
-    private Date updateTime;
-
-    /**
-     * 普通录屏文件地址
-     */
-    @TableField("screencap_voice_src")
-    private String screencapVoiceSrc;
-
-    /**
-     * 旧版录屏数据地址
-     */
-    @TableField("screencap_music")
-    private String screencapMusic;
-
-    /**
-     * 录屏文件个数
-     */
-    @TableField("screencap_len")
-    private Integer screencapLen;
-
-    /**
-     * 录音文件地址
-     */
-    @TableField("screencap_voice_sound")
-    private String screencapVoiceSound;
-
-    /**
-     * 选择的类型,sound为screencapVoiceSound,file为screencapVoiceSrc
-     */
-    @TableField("screencap_voice_type")
-    private String screencapVoiceType;
-
-    /**
-     * 录屏文件地址
-     */
-    @TableField("play_data")
-    private String playData;
-
-    /**
-     * 算法类型
-     */
-    @TableField("algorithm")
-    private String algorithm;
-
-    /**
-     * oss服务商
-     */
-    @TableField("oss")
-    private String oss;
-
-    /**
-     * 重新建模的版本
-     */
-    @TableField("floor_edit_ver")
-    private Integer floorEditVer;
-
-    /**
-     * 正式发布重新建模的版本
+     * 创建时间
      */
-    @TableField("floor_publish_ver")
-    private Integer floorPublishVer;
+    @TableField("create_time")
+    private Date createTime;
 
     /**
-     * 使用容量
+     * 更新时间
      */
-    @TableField("space")
-    private Long space;
+    @TableField("update_time")
+    private Date updateTime;
 
     /**
-     * 录屏图片存放文件
+     * 0-有效,1-删除
      */
-    @TableField("screencap_thumb")
-    private String screencapThumb;
+    @TableField("tb_status")
+    private Integer tbStatus;
 
 
 }

+ 2 - 2
4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/Scene3dfamily.java

@@ -30,8 +30,8 @@ public class Scene3dfamily implements Serializable {
     /**
      * 场景码
      */
-    @TableField("scene_num")
-    private String sceneNum;
+    @TableField("scene_code")
+    private String sceneCode;
 
     /**
      * zip包存放路径

+ 6 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/SceneCooperation.java

@@ -40,6 +40,12 @@ public class SceneCooperation implements Serializable {
     private Long userId;
 
     /**
+     * 协作的用户名
+     */
+    @TableField("user_name")
+    private String userName;
+
+    /**
      * 创建时间
      */
     @TableField("create_time")

+ 169 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/SceneExt.java

@@ -0,0 +1,169 @@
+package com.fdkankan.scene.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 场景表
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2021-12-30
+ */
+@Getter
+@Setter
+@TableName("t_scene_ext")
+public class SceneExt implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 外键id
+     */
+    @TableField("scene_id")
+    private Long sceneId;
+
+    /**
+     * 要上传的热点的id集合,用逗号隔开
+     */
+    @TableField("hots_ids")
+    private String hotsIds;
+
+    /**
+     * 表示初始点信息
+     */
+    @TableField("entry")
+    private String entry;
+
+    /**
+     * 拍摄数量
+     */
+    @TableField("shoot_count")
+    private Integer shootCount;
+
+    /**
+     * 风格
+     */
+    @TableField("style")
+    private Integer style;
+
+    /**
+     * 要gps定位
+     */
+    @TableField("gps")
+    private String gps;
+
+    /**
+     * 方案:1是双目,2是转台,3是六目,4是八目
+     */
+    @TableField("scene_scheme")
+    private Integer sceneScheme;
+
+    /**
+     * 背景音乐名称
+     */
+    @TableField("bg_music")
+    private String bgMusic;
+
+    /**
+     * 普通录屏文件地址
+     */
+    @TableField("screencap_voice_src")
+    private String screencapVoiceSrc;
+
+    /**
+     * 旧版录屏数据地址
+     */
+    @TableField("screencap_music")
+    private String screencapMusic;
+
+    /**
+     * 录屏文件个数
+     */
+    @TableField("screencap_len")
+    private Integer screencapLen;
+
+    /**
+     * 录音文件地址
+     */
+    @TableField("screencap_voice_sound")
+    private String screencapVoiceSound;
+
+    /**
+     * 选择的类型,sound为screencapVoiceSound,file为screencapVoiceSrc
+     */
+    @TableField("screencap_voice_type")
+    private String screencapVoiceType;
+
+    /**
+     * 录屏文件地址
+     */
+    @TableField("play_data")
+    private String playData;
+
+    /**
+     * 算法类型
+     */
+    @TableField("algorithm")
+    private String algorithm;
+
+    /**
+     * oss服务商
+     */
+    @TableField("oss")
+    private String oss;
+
+    /**
+     * 重新建模的版本
+     */
+    @TableField("floor_edit_ver")
+    private Integer floorEditVer;
+
+    /**
+     * 正式发布重新建模的版本
+     */
+    @TableField("floor_publish_ver")
+    private Integer floorPublishVer;
+
+    /**
+     * 使用容量
+     */
+    @TableField("space")
+    private Long space;
+
+    /**
+     * 录屏图片存放文件
+     */
+    @TableField("screencap_thumb")
+    private String screencapThumb;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * 0-有效,1-删除
+     */
+    @TableField("tb_status")
+    private Integer tbStatus;
+
+
+}

+ 223 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/ScenePO.java

@@ -0,0 +1,223 @@
+package com.fdkankan.scene.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class ScenePO{
+
+    private Long id;
+
+    /**
+     * 场景名称
+     */
+    private String sceneName;
+
+    /**
+     * 场景描述
+     */
+    private String sceneDec;
+
+    /**
+     * 场景的链接地址
+     */
+    private String webSite;
+
+    /**
+     * 场景缩略图
+     */
+    private String thumb;
+
+    /**
+     * 0表示未建好,1表示建好,-1表示出错,-2表示不要在官网上显示
+     */
+    private Integer sceneStatus;
+
+    /**
+     * 原始的大场景数据(七牛)
+     */
+    private String dataSource;
+
+    /**
+     * 用户表t_user的id
+     */
+    private Long userId;
+
+    /**
+     * 0表示未付款,1表示付款了,-1表示欠费
+     */
+    private Integer payStatus;
+
+    /**
+     * 相机主表t_camera的id
+     */
+    private Long cameraId;
+
+    /**
+     * 手机id
+     */
+    private String phoneId;
+
+    /**
+     * 大场景序号
+     */
+    private String sceneCode;
+
+    /**
+     * 大场景的密钥
+     */
+    private String sceneKey;
+
+    /**
+     * 0表示其他,1表示文博,2表示地产,3表示电商,4表示餐饮,5表示家居
+     */
+    private Integer sceneType;
+
+    /**
+     * 1表示推荐,0表示正常
+     */
+    private Integer recommend;
+
+    /**
+     * 浏览次数
+     */
+    private Integer viewCount;
+
+    /**
+     * 版本
+     */
+    private Integer version;
+
+    /**
+     * 表示缩略图是否存在
+     */
+    private Integer thumbStatus;
+
+    /**
+     * 0表示默认,1表示自己上传
+     */
+    private String floorLogo;
+
+    /**
+     * 标记大小
+     */
+    private Integer floorLogoSize;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 0-有效,1-删除
+     */
+    private Integer tbStatus;
+
+    private String hotsIds;
+
+    /**
+     * 表示初始点信息
+     */
+    private String entry;
+
+    /**
+     * 拍摄数量
+     */
+    private Integer shootCount;
+
+    /**
+     * 风格
+     */
+    private Integer style;
+
+    /**
+     * 要gps定位
+     */
+    private String gps;
+
+    /**
+     * 方案:1是双目,2是转台,3是六目,4是八目
+     */
+    private Integer sceneScheme;
+
+    /**
+     * 背景音乐名称
+     */
+    private String bgMusic;
+
+    /**
+     * 记录的状态,A: 生效,I: 禁用
+     */
+    private String recStatus;
+
+    /**
+     * 普通录屏文件地址
+     */
+    private String screencapVoiceSrc;
+
+    /**
+     * 旧版录屏数据地址
+     */
+    private String screencapMusic;
+
+    /**
+     * 录屏文件个数
+     */
+    private Integer screencapLen;
+
+    /**
+     * 录音文件地址
+     */
+    private String screencapVoiceSound;
+
+    /**
+     * 选择的类型,sound为screencapVoiceSound,file为screencapVoiceSrc
+     */
+    private String screencapVoiceType;
+
+    /**
+     * 录屏文件地址
+     */
+    private String playData;
+
+    /**
+     * 算法类型
+     */
+    private String algorithm;
+
+    /**
+     * oss服务商
+     */
+    private String oss;
+
+    /**
+     * 重新建模的版本
+     */
+    private Integer floorEditVer;
+
+    /**
+     * 正式发布重新建模的版本
+     */
+    private Integer floorPublishVer;
+
+    /**
+     * 使用容量
+     */
+    private Long space;
+
+    /**
+     * 录屏图片存放文件
+     */
+    private String screencapThumb;
+
+}

+ 7 - 1
4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/SceneProEditExt.java

@@ -34,6 +34,12 @@ public class SceneProEditExt implements Serializable {
     private Long proEditId;
 
     /**
+     * proid
+     */
+    @TableField("pro_id")
+    private Long proId;
+
+    /**
      * 小地图浏览
      */
     @TableField("map_visi")
@@ -100,7 +106,7 @@ public class SceneProEditExt implements Serializable {
      * 是否显示底部logo,1显示,0不显示
      */
     @TableField("show_logo_bottom")
-    private Boolean showLogoBottom;
+    private Integer showLogoBottom;
 
     /**
      * 全景图版本号

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

@@ -115,6 +115,12 @@ public class SceneProExt implements Serializable {
     private String unicode;
 
     /**
+     * 相机类型
+     */
+    @TableField("camera_type")
+    private Integer cameraType;
+
+    /**
      * 创建时间
      */
     @TableField("create_time")

+ 177 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/SceneProPO.java

@@ -0,0 +1,177 @@
+package com.fdkankan.scene.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class SceneProPO {
+
+    private Long id;
+
+    /**
+     * 场景名称
+     */
+    private String sceneName;
+
+    /**
+     * 场景描述
+     */
+    private String sceneDec;
+
+    /**
+     * 场景的链接地址
+     */
+    private String webSite;
+
+    /**
+     * 场景缩略图
+     */
+    private String thumb;
+
+    /**
+     * 用户表t_user的id
+     */
+    private Long userId;
+
+    /**
+     * 相机主表t_camera的id
+     */
+    private Long cameraId;
+
+    /**
+     * 场景logo
+     */
+    private String sceneLogo;
+
+    /**
+     * 大场景序号
+     */
+    private String sceneCode;
+
+    /**
+     * 0-其他,1-文博,2-地产,3-电商,4-餐饮,5-家居,99-一件换装虚拟房源
+     */
+    private Integer sceneType;
+
+    /**
+     * 浏览次数
+     */
+    private Integer viewCount;
+
+    /**
+     * 拍摄数量
+     */
+    private Integer shootCount;
+
+    /**
+     * 点位视频
+     */
+    private String videos;
+
+    /**
+     * 要gps定位
+     */
+    private String gps;
+
+    /**
+     * 方案:1-双目,2-转台,3-六目,4-八目,10-获取4k图,11-获取2k,12-获取1k
+     */
+    private Integer sceneScheme;
+
+    /**
+     * 记录的状态,A: 生效,I: 禁用
+     */
+    private String recStatus;
+
+    /**
+     * 算法类型(V2,V3)
+     */
+    private String buildType;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 0-有效,1-删除
+     */
+    private Integer tbStatus;
+
+    private Integer sceneStatus;
+
+    /**
+     * 原始的大场景数据(七牛)
+     */
+    private String dataSource;
+
+    /**
+     * 0表示未付款,1表示付款了,-1表示欠费,-2表示容量不足
+     */
+    private Integer payStatus;
+
+    /**
+     * 手机id
+     */
+    private String phoneId;
+
+    /**
+     * 1表示推荐,0表示正常
+     */
+    private Integer recommend;
+
+    /**
+     * 所有资源文件名
+     */
+    private String filesName;
+
+    /**
+     * 算法类型
+     */
+    private String algorithm;
+
+    /**
+     * 服务器的服务商
+     */
+    private String ecs;
+
+    /**
+     * 使用容量
+     */
+    private Long space;
+
+    /**
+     * 固件版本
+     */
+    private String firmwareVersion;
+
+    /**
+     * 计算时间(秒为单位)
+     */
+    private Long computeTime;
+
+    /**
+     * 场景来源,相机拍摄10以内表示,1表示八目,2双目,3转台,4 激光  其他来源10以上,11:一键换装,12:123看房,13文通虚拟场景
+     */
+    private Integer sceneSource;
+
+    /**
+     * 大场景序号(随心装场景码)
+     */
+    private String vrnum;
+
+    private String unicode;
+
+    /**
+     * 相机类型
+     */
+    private Integer cameraType;
+
+}

+ 7 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/IScene3dNumMapper.java

@@ -3,6 +3,9 @@ package com.fdkankan.scene.mapper;
 import com.fdkankan.scene.entity.Scene3dNum;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -15,4 +18,8 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface IScene3dNumMapper extends BaseMapper<Scene3dNum> {
 
+    List<String> findSceneNum();
+
+    void updateUsedStatus(@Param("sceneCodes") List<String> sceneCodes);
+
 }

+ 4 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/IScene3dfamilyMapper.java

@@ -2,7 +2,9 @@ package com.fdkankan.scene.mapper;
 
 import com.fdkankan.scene.entity.Scene3dfamily;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fdkankan.scene.vo.Scene3dfamilyVO;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * <p>
@@ -15,4 +17,6 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface IScene3dfamilyMapper extends BaseMapper<Scene3dfamily> {
 
+    Scene3dfamily findSceneCodeByCode(Scene3dfamilyVO param);
+
 }

+ 18 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/ISceneExtMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.scene.mapper;
+
+import com.fdkankan.scene.entity.SceneExt;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 场景表 Mapper 接口
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2021-12-30
+ */
+@Mapper
+public interface ISceneExtMapper extends BaseMapper<SceneExt> {
+
+}

+ 24 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/ISceneMapper.java

@@ -1,8 +1,17 @@
 package com.fdkankan.scene.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.scene.entity.Scene;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fdkankan.scene.entity.ScenePO;
+import com.fdkankan.scene.entity.SceneProPO;
+import com.fdkankan.scene.vo.SceneParamVO;
+import com.fdkankan.scene.vo.SceneVO;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -15,4 +24,19 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface ISceneMapper extends BaseMapper<Scene> {
 
+    ScenePO findByNum(@Param("sceneCode")String sceneCode);
+
+    List<SceneVO> queryByParam(Page<SceneVO> page, SceneParamVO param);
+
+    List<SceneVO> queryByParamNew(Page<SceneVO> page, SceneParamVO param);
+
+//    List<SceneVO> findSceneProBySnCode(SceneParamVO param);
+
+    List<ScenePO> findAllByYesterday();
+
+    List<SceneProPO> findAllScene(SceneParamVO param);
+
+    List<ScenePO> unionSearchBySceneName(@Param("searchKey") String searchKey);
+
+    List<SceneProPO> getOnlySceneList(SceneParamVO param);
 }

+ 5 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/ISceneProEditExtMapper.java

@@ -3,6 +3,7 @@ package com.fdkankan.scene.mapper;
 import com.fdkankan.scene.entity.SceneProEditExt;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * <p>
@@ -15,4 +16,8 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface ISceneProEditExtMapper extends BaseMapper<SceneProEditExt> {
 
+    Integer selectCntDownloadNum();
+
+    void updateImageVersionByProEditId(@Param("proEditId") Long proEditId);
+
 }

+ 1 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/ISceneProExtMapper.java

@@ -15,4 +15,5 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface ISceneProExtMapper extends BaseMapper<SceneProExt> {
 
+
 }

+ 37 - 2
4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/ISceneProMapper.java

@@ -1,9 +1,15 @@
 package com.fdkankan.scene.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.scene.entity.ScenePro;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.fdkankan.scene.vo.SceneProVo;
+import com.fdkankan.scene.entity.SceneProPO;
+import com.fdkankan.scene.vo.SceneProVO;
+import com.fdkankan.scene.vo.SceneVO;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -16,6 +22,35 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface ISceneProMapper extends BaseMapper<ScenePro> {
 
-    Integer findFolderIdScence(SceneProVo param);
+    Integer findFolderIdScence(SceneProVO param);
+
+    ScenePro findLikeNum(@Param("sceneCode")String sceneCode);
+
+    ScenePro findByNum(@Param("sceneCode")String sceneCode);
+
+    SceneProPO getSceneStatusByUnicode(@Param("unicode") String unicode, @Param("recStatus") String recStatus);
+
+    List<SceneProPO> findByUserIdAndCameraType(@Param("userId") Long userId, @Param("cameraType") Integer cameraType);
+
+    List<SceneProPO> findByUserId(@Param("userId") Long userId, @Param("excludeNums") List<String> excludeNums);
+
+    List<SceneProPO> findBySceneNums(@Param("sceneCodeList") List<String> sceneCodeList, @Param("cameraType") Integer cameraType);
+
+    SceneVO findLatestOneByUserId(@Param("userId")Long userId);
+
+    List<SceneProPO> findByCameraIdPro(@Param("cameraId")Long cameraId);
+
+    SceneProPO findByFileId(@Param("fileId") String fileId);
+
+    List<ScenePro> findTempScenes();
+
+    List<SceneVO> getAppAllSceneByPage(Page<SceneVO> page, @Param("cameraId")Long cameraId, @Param("userId")Long userId,
+                                       @Param("cameraType")int cameraType, @Param("sceneType")Integer sceneType,
+                                       @Param("sceneCodeList")List<String> sceneCodeList, @Param("sceneName") String sceneName, @Param("orderBy") String orderBy);
+
+    SceneProPO findLastSceneByCameraId(Long cameraId);
+
+    SceneProPO findByNumWithOutCheckRecStatus(String sceneNum);
+
 
 }

+ 34 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/schedule/ScheduleJob.java

@@ -0,0 +1,34 @@
+package com.fdkankan.scene.schedule;
+
+import com.fdkankan.scene.service.ISceneService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component
+public class ScheduleJob {
+
+    @Autowired
+    ISceneService sceneService;
+
+    @Value("${environment}")
+    private String environment;
+
+    @Scheduled(cron = "0 0/10 * * * ? ")
+    public void job4() {
+        if("hq".equals(environment)){
+            return;
+        }
+        log.info("每10分钟开始执行定时任务:更新浏览量");
+        try {
+            //更新浏览量
+            sceneService.updatePv();
+        } catch (Exception e) {
+            log.error("更新浏览量定时任务出错:", e);
+        }
+    }
+
+}

+ 8 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/IScene3dNumService.java

@@ -3,6 +3,8 @@ package com.fdkankan.scene.service;
 import com.fdkankan.scene.entity.Scene3dNum;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * <p>
  * 八目场景编码表 服务类
@@ -13,4 +15,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IScene3dNumService extends IService<Scene3dNum> {
 
+    List<String> findSceneNum();
+
+    Scene3dNum findByNum(String sceneCode);
+//
+    void updateUsedStatus(List<String> nums);
+
 }

+ 14 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/IScene3dfamilyService.java

@@ -1,7 +1,12 @@
 package com.fdkankan.scene.service;
 
+import com.fdkankan.common.response.ResultData;
 import com.fdkankan.scene.entity.Scene3dfamily;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.scene.vo.Scene3dfamilyVO;
+import com.fdkankan.scene.vo.SceneProVO;
+
+import java.util.Map;
 
 /**
  * <p>
@@ -13,4 +18,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IScene3dfamilyService extends IService<Scene3dfamily> {
 
+    ResultData createZip (SceneProVO sceneProVo);
+
+    Scene3dfamily findSceneNumByNum(Scene3dfamilyVO scene3dfamilyVO);
+
+    Map<String, String> findSceneNumByNum2(Scene3dfamilyVO scene3dfamilyVO);
+
+    void updateSceneNumByNum (Scene3dfamily scene3dfamily);
+
+
 }

+ 37 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneAppService.java

@@ -0,0 +1,37 @@
+package com.fdkankan.scene.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.scene.entity.Scene;
+import com.fdkankan.scene.vo.SceneEditVO;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+
+public interface ISceneAppService extends IService<Scene> {
+
+    int saveInitialPage(SceneEditVO base) throws IOException;
+
+    int saveFloorLogo(SceneEditVO base);
+
+    int saveHot(SceneEditVO base) throws Exception;
+
+    int saveBackgroundMusic(SceneEditVO base);
+
+    int saveSceneInfo(SceneEditVO base) throws Exception;
+
+    int saveSceneKey(SceneEditVO base);
+
+    int saveTourList(SceneEditVO base);
+
+    Object uploadPic(String sceneNum, String folderName, MultipartFile file) throws IOException;
+
+    Object uploadScreencapVoice(String sceneNum, MultipartFile file) throws IOException;
+
+    int saveScreencapFile(SceneEditVO base) throws IOException;
+
+    int saveHotVisible(SceneEditVO base) throws IOException;
+
+    int saveLinkPano(SceneEditVO base) throws Exception;
+
+    Object getRecordAudioFromWeixin(SceneEditVO base) throws Exception;
+}

+ 6 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneCooperationService.java

@@ -13,4 +13,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISceneCooperationService extends IService<SceneCooperation> {
 
+    void updateRecStatus(String sceneNum);
+
+    String findUserName(String sceneNum);
+
+    SceneCooperation findBySceneNum(String sceneNum);
+
 }

+ 2 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneDataDownloadService.java

@@ -13,4 +13,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISceneDataDownloadService extends IService<SceneDataDownload> {
 
+    SceneDataDownload findBySceneNum(String sceneNum);
+
 }

+ 6 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneDownloadLogService.java

@@ -13,4 +13,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISceneDownloadLogService extends IService<SceneDownloadLog> {
 
+    void updateStatusByNum(String sceneNum, Integer status);
+
+    void deleteStatusByNum(String sceneNum);
+
+    SceneDownloadLog findByStatusAndNum(String sceneNum, Integer status);
+
 }

+ 18 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneExtService.java

@@ -0,0 +1,18 @@
+package com.fdkankan.scene.service;
+
+import com.fdkankan.scene.entity.SceneExt;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 场景表 服务类
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2021-12-30
+ */
+public interface ISceneExtService extends IService<SceneExt> {
+
+    SceneExt getBySceneId(long sceneId);
+
+}

+ 3 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneFeedbackService.java

@@ -3,6 +3,8 @@ package com.fdkankan.scene.service;
 import com.fdkankan.scene.entity.SceneFeedback;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * <p>
  * 大场景反馈信息表 服务类
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISceneFeedbackService extends IService<SceneFeedback> {
 
+
 }

+ 8 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneFileBuildService.java

@@ -13,4 +13,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISceneFileBuildService extends IService<SceneFileBuild> {
 
+    SceneFileBuild findByFileId(String fileId);
+
+    boolean uploadSuccess(String fileId, StringBuilder filePathBuffer);
+
+    SceneFileBuild findByUnicode(String unicode);
+
+    void unzipSingleFile(String filePath);
+
 }

+ 4 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneFileUploadService.java

@@ -13,4 +13,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISceneFileUploadService extends IService<SceneFileUpload> {
 
+    Long countUploadSuccessByFileId(String fileId);
+
+    SceneFileUpload findByFileIdAndChunk(String fileId, Integer chunk);
+
 }

+ 63 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneProAppService.java

@@ -0,0 +1,63 @@
+package com.fdkankan.scene.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.common.response.ResultData;
+import com.fdkankan.scene.entity.ScenePro;
+import com.fdkankan.scene.vo.SceneEditVO;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * <p>
+ * pro场景表 服务类
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2021-12-23
+ */
+public interface ISceneProAppService extends IService<ScenePro> {
+
+    ResultData saveInitialPage(SceneEditVO base) throws Exception;
+
+    ResultData saveFloorLogo(SceneEditVO base) throws Exception;
+
+    ResultData saveHot(SceneEditVO base) throws Exception;
+
+    ResultData saveBackgroundMusic(SceneEditVO base) throws Exception;
+
+    ResultData saveSceneInfo(SceneEditVO base) throws Exception;
+
+    ResultData saveSceneKey(SceneEditVO base) throws Exception;
+
+    ResultData saveTourList(SceneEditVO base) throws Exception;
+
+    ResultData uploadPic(String sceneNum, String folderName, MultipartFile file) throws Exception;
+
+    ResultData uploadScreencapVoice(String sceneNum, MultipartFile file) throws Exception;
+
+    ResultData saveScreencapFile(SceneEditVO base) throws Exception;
+
+    ResultData saveHotVisible(SceneEditVO sceneEdit) throws Exception;
+
+    ResultData saveLinkPano(SceneEditVO base) throws Exception;
+
+    ResultData getRecordAudioFromWeixin(SceneEditVO base) throws Exception;
+
+    ResultData getRecordAudioFromWeixinV3(String sceneNum, String id, String type, String fileName, String length, String replace, String times, String index) throws Exception;
+
+    ResultData getRecordAudioFromAppV3(String sceneNum, String soundFile, String type, String fileName, String length, String replace, String times, String index) throws Exception;
+
+    ResultData deleteRecordAudioPart(String sceneNum, String fileName, String times, String index, String type) throws Exception;
+
+    ResultData uploadFloorJsonAndRebuild(SceneEditVO base) throws Exception;
+
+    ResultData saveScreencapData(SceneEditVO base) throws Exception;
+
+    ResultData saveAllVisi(SceneEditVO base) throws Exception;
+
+    ResultData uploadFloorplanPng(String sceneNum, MultipartFile file, String cadInfo) throws Exception;
+
+    ResultData uploadBgMusic(String sceneNum, String fileName, MultipartFile file) throws Exception;
+
+    ResultData deleteUploadBgMusic(String sceneNum) throws Exception;
+
+}

+ 9 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneProEditExtService.java

@@ -1,5 +1,7 @@
 package com.fdkankan.scene.service;
 
+import com.fdkankan.common.response.ResultData;
+import com.fdkankan.scene.entity.ScenePro;
 import com.fdkankan.scene.entity.SceneProEditExt;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -13,4 +15,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISceneProEditExtService extends IService<SceneProEditExt> {
 
+    SceneProEditExt getByProEditId(Long proEditId);
+
+    ResultData updateimageVersion(String sceneNum) throws Exception;
+
+    SceneProEditExt findEdit(ScenePro scenePro);
+
+
 }

+ 10 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneProEditService.java

@@ -1,7 +1,11 @@
 package com.fdkankan.scene.service;
 
+import com.fdkankan.common.response.ResultData;
+import com.fdkankan.scene.entity.ScenePro;
 import com.fdkankan.scene.entity.SceneProEdit;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.scene.entity.SceneProEditExt;
+import com.fdkankan.scene.vo.SceneProEditVO;
 
 /**
  * <p>
@@ -13,4 +17,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISceneProEditService extends IService<SceneProEdit> {
 
+     SceneProEdit findByProId(Long proId);
+
+     int findDownloadNum();
+
+     void updateImageVersionByProId(Long id);
+
 }

+ 3 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneProExtService.java

@@ -13,4 +13,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISceneProExtService extends IService<SceneProExt> {
 
+    SceneProExt findBySceneProId(Long sceneProId);
+
+
 }

+ 155 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneProService.java

@@ -1,7 +1,16 @@
 package com.fdkankan.scene.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.fdkankan.common.response.ResultData;
 import com.fdkankan.scene.entity.ScenePro;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.scene.entity.SceneProPO;
+import com.fdkankan.scene.vo.SceneEditVO;
+import com.fdkankan.scene.vo.SceneProVO;
+import com.fdkankan.scene.vo.SceneVO;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,6 +22,152 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISceneProService extends IService<ScenePro> {
 
+    List<SceneVO> convert(List<ScenePro> list);
+
+    Long getSceneCount(Long cameraId);
+
+    ScenePro findBySceneNum(String sceneNum);
+
+    ScenePro findLikeSceneNum(String sceneNum);
+
+    ScenePro findDeleteSceneBySceneNum(String sceneNum);
+
+    SceneProPO getSceneStatusByUnicode(String unicode, String recStatus);
+
+    List<SceneProPO> findByUserIdAndCameraType(Long userId, Integer cameraType);
+
+    List<SceneProPO> findBySceneNums(List<String> sceneCodeList, Integer cameraType);
+
+    void updateStatus(String sceneNum, int sceneStatus);
+
+    ResultData resetUploadFloorJson(SceneEditVO sceneEdit) throws Exception;
+
+    ResultData uploadFloorJson(SceneEditVO sceneEdit) throws Exception;
+
+    ResultData uploadFloorJsonAjk(String sceneNum, String ajkJson, String cameraJson, String floorPlanJson, MultipartFile[] file) throws Exception;
+
+    ResultData addHotMediaInfo(SceneEditVO base) throws Exception;
+
+    ResultData saveScreencapFile(SceneEditVO base) throws Exception;
+
+    ResultData saveSceneKey(SceneEditVO base) throws Exception;
+
+    ResultData saveFloorLogo(SceneEditVO base) throws Exception;
+
+    ResultData saveBackgroundMusic(SceneEditVO base) throws Exception;
+
+    ResultData saveInitialPage(SceneEditVO base) throws Exception;
+
+    ResultData getScreencapVoice(SceneEditVO base) throws Exception;
+
+    ResultData uploadScreencapVoiceNew(String sceneNum, String type, String fileName, MultipartFile file, String length, String replace) throws Exception;
+
+    ResultData uploadScreencapVoiceNewV3(String sceneNum, String type, String fileName, MultipartFile file, String length, String replace, String times, String index) throws Exception;
+
+    ResultData deleteScreencapVoicePart(String sceneNum, String fileName, String times, String index) throws Exception;
+
+    ResultData deleteScreencapVoice(SceneEditVO base) throws Exception;
+
+    ResultData deleteScreencap(SceneEditVO base) throws Exception;
+
+    ResultData saveTourList(SceneEditVO base) throws Exception;
+
+    ResultData saveSceneInfo(SceneEditVO base) throws Exception;
+
+    ResultData uploadHotMedia(String sceneId, MultipartFile file, String sid) throws Exception;
+
+    ResultData saveHot(SceneEditVO base) throws Exception;
+
+    ResultData saveShopHot(SceneEditVO base) throws Exception;
+
+    ResultData saveOverlay(SceneEditVO base) throws Exception;
+
+    ResultData uploadOverlayMedia(String sceneNum, MultipartFile file, String sid) throws Exception;
+
+    ResultData saveScreencapData(SceneEditVO base) throws Exception;
+
+    ResultData saveLinkPano(SceneEditVO base) throws Exception;
+
+    ResultData saveHotVisible(SceneEditVO base) throws Exception;
+
+    ResultData uploadShareLogo(SceneEditVO base, MultipartFile file) throws Exception;
+
+    ResultData uploadPic(String sceneNum, String folderName, MultipartFile file, String toOss) throws Exception;
+
+    ResultData uploadHotJsonToOss(String sceneNum) throws Exception;
+
+    ResultData deleteOss(String filePath) throws Exception;
+
+    ResultData uploadFloorplanPng(String sceneNum, MultipartFile[] file, String cadInfo) throws Exception;
+
+    void updateTime(String sceneNum, Long space, int payStatus, String videos, long computeTime);
+
+    void updateTime2(String sceneNum, String videos, long computeTime);
+
+    SceneVO findLatestOneByUserId(Long userId);
+
+    void updateUserIdByCameraId(Long userId, Long cameraId);
+
+    List<SceneProPO> findByCameraIdPro(Long cameraId);
+
+    void updateCameraIdByCameraIdPro(Long oldCameraId, Long cameraId);
+
+    void updateRecStatus(String unicode);
+
+    SceneProPO findByFileId(String fileId);
+
+    List<ScenePro> findTempScenes() throws Exception;
+
+    List<String> findByCameraId(Long cameraId) throws Exception;
+
+    ResultData uploadObjAndImg(String sceneNum, MultipartFile file) throws Exception;
+
+    ResultData uploadLogoBottomStatus(String sceneNum, String status) throws Exception;
+
+    ResultData saveJsonData(String sceneNum, String fileName, String jsonData) throws Exception;
+
+    String downloadPanoramaOrVideo(String sceneNum, String fileName, String type, String planId) throws Exception;
+
+    ResultData uploadPanoramaOrVideo(String sceneNum, String fileName, String type, MultipartFile file, String planId) throws Exception;
+
+    ResultData uploadROIVideo(String sceneNum, String fileName, MultipartFile file, String planId, String rect,
+                          String videoDirMatrix, String dir, String hfov, String vfov) throws Exception;
+
+    ResultData deleteROIVideo(String sceneNum, String fileName, String planId) throws Exception;
+
+    ResultData uploadBgMusic(String sceneNum, String fileName, MultipartFile file) throws Exception;
+
+    ResultData deleteUploadBgMusic(String sceneNum) throws Exception;
+
+    ResultData savePanorama(String sceneNum, String sid, MultipartFile file, String imagesName) throws Exception;
+
+    ResultData savePanoramaJson(String sceneNum, String fileData, String fileName, String sid) throws Exception;
+
+    ResultData copyAndUpdateFloorJson(String sceneNum, String floorJsonData) throws Exception;
+
+    ResultData updateFloorJson(String sceneNum, String floorJsonData) throws Exception;
+
+    IPage<SceneVO> getAppAllSceneByPage(Long cameraId, Long userId, int cameraType, int pageNum, Integer pageSize, String orderBy, Integer sceneType, List<String> sceneCodeList, String sceneName);
+
+    Long findSceneNumByCameraId(Long cameraId);
+
+    SceneProPO findLastSceneByCameraId(Long cameraId);
+
+    Long findTotalSpaceByCameraId(Long cameraId);
+
+    void updatePayStatusByCameraId(Integer payStatus, Long cameraId);
+
+    ResultData downloadPanoramaData(String sceneNum) throws Exception;
+
+    ResultData getSceneAndCameras(Long userId,List<String> excludeNums);
+
+    SceneProPO findBySceneNumWithOutCheckRecStatus(String sceneNum) throws Exception;
+
     Integer findFolderIdScence(Long folderId, Long userId);
 
+    ResultData downloadVisionData(String sceneNum) throws Exception;
+
+    SceneVO getInfo(String sceneNum);
+
+
 }

+ 5 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneResourceCameraService.java

@@ -3,6 +3,8 @@ package com.fdkankan.scene.service;
 import com.fdkankan.scene.entity.SceneResourceCamera;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * <p>
  * 场景资源和相机关联表 服务类
@@ -13,4 +15,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISceneResourceCameraService extends IService<SceneResourceCamera> {
 
+    void deleteByCameraId(Long id);
+
+    List<SceneResourceCamera> findListByCameraId(Long id);
 }

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

@@ -12,5 +12,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @since 2021-12-23
  */
 public interface ISceneResourceCooperationService extends IService<SceneResourceCooperation> {
-
+    void deleteByCooperationId(Long id);
 }

+ 7 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneResourceService.java

@@ -3,6 +3,8 @@ package com.fdkankan.scene.service;
 import com.fdkankan.scene.entity.SceneResource;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * <p>
  * 场景资源表 服务类
@@ -13,4 +15,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISceneResourceService extends IService<SceneResource> {
 
+    List<SceneResource> findByCooperationId(Long id);
+
+    List<SceneResource> findByCameraId(Long id);
+
+
 }

+ 79 - 1
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/ISceneService.java

@@ -1,7 +1,20 @@
 package com.fdkankan.scene.service;
 
-import com.fdkankan.scene.entity.Scene;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.common.response.ResultData;
+import com.fdkankan.scene.entity.Scene;
+import com.fdkankan.scene.entity.ScenePO;
+import com.fdkankan.scene.entity.SceneProPO;
+import com.fdkankan.scene.vo.SceneEditVO;
+import com.fdkankan.scene.vo.SceneParamVO;
+import com.fdkankan.scene.vo.SceneProVO;
+import com.fdkankan.scene.vo.SceneVO;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +26,69 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISceneService extends IService<Scene> {
 
+    Scene getValidById(long id);
+
+    List<SceneVO> convert(List<ScenePO> list) throws Exception;
+
+    List<SceneVO> convertPro(List<SceneProPO> list) throws Exception;
+
+    List<ScenePO> findAllByYesterday() throws Exception;
+
+    void updateUserIdByCameraId(Long userId, Long cameraId) throws Exception;
+
+    void uploadHotMedia(String sceneId, MultipartFile file) throws IOException;
+
+    void uploadGuidePic(String sceneId, MultipartFile file) throws IOException;
+
+    ResultData saveGuideInfo(SceneParamVO base) throws Exception;
+
+    ResultData recoveryFloor(SceneParamVO base) throws Exception;
+
+    ResultData saveEditInfo(SceneParamVO base) throws Exception;
+
+    ResultData publishScene(SceneParamVO base) throws Exception;
+
+    ResultData deleteHot(SceneParamVO base) throws Exception;
+
+    ResultData saveHot(SceneEditVO base) throws Exception;
+
+    ResultData saveLinkPano(SceneEditVO base) throws Exception;
+
+    ResultData saveHotVisible(SceneEditVO base) throws Exception;
+
+    IPage<SceneVO> queryByParam(SceneParamVO param) throws Exception;
+
+    IPage<SceneVO> queryByParamNew(SceneParamVO param) throws Exception;
+
+    ScenePO findBySceneNum(String sceneNum) throws Exception;
+
+    Scene getSceneBySceneCode(String sceneCode);
+
+    ResultData recover(String sceneNum) throws Exception;
+
+    Scene getSceneStatusByUnicode(String unicode, String recStatus);
+
+    void updateStatus(String sceneNum, int status);
+
+    void updateTime(String sceneNum, Long space, int payStatus);
+
+    ResultData addHotMediaInfo(SceneEditVO base) throws Exception;
+
+    ResultData saveScreencapFile(SceneEditVO base) throws Exception;
+
+    List<SceneProPO> findAllScene(String order, String sceneType, Integer sceneScheme,
+                                  Integer pageNum, Integer pageSize, Long userId,
+                                  String sceneName, Long cameraId, Date startDate,
+                                  Date endDate, String num, String type, String likeNum, List<String> nums);
+
+    List<ScenePO> unionSearchBySceneName(String searchKey);
+
+    List<SceneProPO> getOnlySceneList(SceneParamVO param) throws Exception;
+
+    ResultData updateViewCount(String sceneNum);
+
+    void updatePv();
+
+
+
 }

+ 3 - 3
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/FolderServiceImpl.java

@@ -103,11 +103,11 @@ public class FolderServiceImpl extends ServiceImpl<IFolderMapper, Folder> implem
     public void move(FolderVO folderVO) {
 
         if(StrUtil.isEmpty(folderVO.getFolderIds()) && StrUtil.isEmpty(folderVO.getSceneIds())){
-            throw new BusinessException(ErrorCode.FAILURE_CODE_3001.code(), ErrorCode.FAILURE_CODE_3001.message());
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
         }
 
         if(Objects.isNull(folderVO.getFolderType())){
-            throw new BusinessException(ErrorCode.FAILURE_CODE_3001.code(), ErrorCode.FAILURE_CODE_3001.message());
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
         }
 
         String[] folderIds = folderVO.getFolderIds().split(",");
@@ -130,7 +130,7 @@ public class FolderServiceImpl extends ServiceImpl<IFolderMapper, Folder> implem
                 if(subList.get(0).getId().equals(Long.parseLong(folderId))){
                     return;
                 }
-                throw new BusinessException(ErrorCode.FAILURE_CODE_5030.code(), ErrorCode.FAILURE_CODE_5030.message());
+                throw new BusinessException(ErrorCode.FAILURE_CODE_5030);
             }
 
             updateById(folder);

+ 28 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/Scene3dNumServiceImpl.java

@@ -1,11 +1,17 @@
 package com.fdkankan.scene.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fdkankan.common.constant.RecStatus;
+import com.fdkankan.common.constant.TbStatus;
 import com.fdkankan.scene.entity.Scene3dNum;
 import com.fdkankan.scene.mapper.IScene3dNumMapper;
 import com.fdkankan.scene.service.IScene3dNumService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 八目场景编码表 服务实现类
@@ -17,4 +23,26 @@ import org.springframework.stereotype.Service;
 @Service
 public class Scene3dNumServiceImpl extends ServiceImpl<IScene3dNumMapper, Scene3dNum> implements IScene3dNumService {
 
+    @Override
+    public List<String> findSceneNum() {
+        return baseMapper.findSceneNum();
+    }
+
+    @Override
+    public Scene3dNum findByNum(String sceneCode) {
+        List<Scene3dNum> list = this.list(new QueryWrapper<Scene3dNum>()
+                .eq("tb_status", TbStatus.VALID.code())
+                .eq("rec_status", RecStatus.VALID.code())
+                .eq("scene_code", sceneCode));
+        if(CollUtil.isEmpty(list)){
+            return null;
+        }
+        return list.get(0);
+    }
+
+    @Override
+    public void updateUsedStatus(List<String> nums) {
+        baseMapper.updateUsedStatus(nums);
+    }
+
 }

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

@@ -1,11 +1,34 @@
 package com.fdkankan.scene.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.constant.RecStatus;
+import com.fdkankan.common.constant.ZipStatus;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.response.ResultData;
+import com.fdkankan.common.util.CreateObjUtil;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.common.util.UploadToOssUtil;
 import com.fdkankan.scene.entity.Scene3dfamily;
 import com.fdkankan.scene.mapper.IScene3dfamilyMapper;
 import com.fdkankan.scene.service.IScene3dfamilyService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.scene.service.ISceneProService;
+import com.fdkankan.scene.vo.Scene3dfamilyVO;
+import com.fdkankan.scene.vo.SceneProVO;
+import com.fdkankan.scene.vo.SceneVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.io.File;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
 /**
  * <p>
  * 三维家表 服务实现类
@@ -14,7 +37,136 @@ import org.springframework.stereotype.Service;
  * @author dengsixing
  * @since 2021-12-23
  */
+@Slf4j
 @Service
 public class Scene3dfamilyServiceImpl extends ServiceImpl<IScene3dfamilyMapper, Scene3dfamily> implements IScene3dfamilyService {
 
+    private static String DIR_NAME = "downloads/furnished/";
+
+    @Value("${prefix.ali}")
+    private String prefixAli;
+
+    @Autowired
+    ISceneProService sceneProService;
+    @Autowired
+    UploadToOssUtil uploadToOssUtil;
+
+
+    @Override
+    public ResultData createZip(SceneProVO sceneProVo) {
+        Scene3dfamily scene3dfamily =
+                baseMapper.findSceneCodeByCode(
+                        Scene3dfamilyVO
+                            .builder()
+                            .sceneCode(sceneProVo.getSceneCode())
+                            .zipStatus(ZipStatus.DOING.code())
+                            .build());
+        String path = sceneProVo.getDataSource() + "_3df" + File.separator + sceneProVo.getSceneCode();
+        try {
+            if(scene3dfamily == null){
+                throw new BusinessException(ErrorCode.FAILURE_CODE_5032);
+            }
+
+            log.info("三维家 信息保存 路径 : " + path);
+            //创建文件夹
+            FileUtils.createDir(path);
+
+            //生成vision.json
+            sceneProService.downloadVisionData(sceneProVo.getSceneCode());
+            //拉取data
+            CreateObjUtil.ossUtilCp("data" + File.separator + "data" + sceneProVo.getSceneCode()  + File.separator,
+                    path + File.separator + "scene" + File.separator + "data" + File.separator + "data" + sceneProVo.getSceneCode());
+
+
+            //写入 scene.json 改名为 getinfo.json
+            SceneVO sceneVo = sceneProService.getInfo(sceneProVo.getSceneCode());
+
+            JSONObject dataJson = (JSONObject) JSONObject.toJSON(sceneVo);
+
+            FileUtils.writeFile(path + File.separator + "scene"  + File.separator + "data" +  File.separator  + "data"
+                    + sceneProVo.getSceneCode() + File.separator + "getinfo.json", dataJson.toString());
+
+            //拉取images
+            CreateObjUtil.ossUtilCp("images" + File.separator + "images" + sceneProVo.getSceneCode()  + File.separator + "floorLogoImg.png",
+                    path + File.separator + "scene"  + File.separator + "images" + File.separator + "images" + sceneProVo.getSceneCode());
+            CreateObjUtil.ossUtilCp("images" + File.separator + "images" + sceneProVo.getSceneCode()  + File.separator + "floorplan.png",
+                    path + File.separator + "scene"  + File.separator + "images" + File.separator + "images" + sceneProVo.getSceneCode());
+            CreateObjUtil.ossUtilCp("images" + File.separator + "images" + sceneProVo.getSceneCode()  + File.separator + "logo-main.png",
+                    path + File.separator + "scene"  + File.separator + "images" + File.separator + "images" + sceneProVo.getSceneCode());
+            CreateObjUtil.ossUtilCp("images" + File.separator + "images" + sceneProVo.getSceneCode()  + File.separator + "logo-main-en.png",
+                    path + File.separator + "scene"  + File.separator + "images" + File.separator + "images" + sceneProVo.getSceneCode());
+            CreateObjUtil.ossUtilCp("images" + File.separator + "images" + sceneProVo.getSceneCode()  + File.separator + "smallPic.jpg",
+                    path + File.separator + "scene"  + File.separator + "images" + File.separator + "images" + sceneProVo.getSceneCode());
+            CreateObjUtil.ossUtilCp("images" + File.separator + "images" + sceneProVo.getSceneCode()  + File.separator + "thumbBigImg.jpg",
+                    path + File.separator + "scene"  + File.separator + "images" + File.separator + "images" + sceneProVo.getSceneCode());
+            CreateObjUtil.ossUtilCp("images" + File.separator + "images" + sceneProVo.getSceneCode()  + File.separator + "thumbSmallImg.jpg",
+                    path + File.separator + "scene"  + File.separator + "images" + File.separator + "images" + sceneProVo.getSceneCode());
+            CreateObjUtil.ossUtilCp("images" + File.separator + "images" + sceneProVo.getSceneCode()  + File.separator + "pan",
+                    path + File.separator + "scene"  + File.separator + "images" + File.separator + "images" + sceneProVo.getSceneCode());
+
+            //拉取video
+            CreateObjUtil.ossUtilCp("video" + File.separator + "video" + sceneProVo.getSceneCode()  + File.separator,
+                    path + File.separator + "scene"  + File.separator + "video" + File.separator + "video" + sceneProVo.getSceneCode());
+
+            //拉取voice
+            CreateObjUtil.ossUtilCp("voice" + File.separator + "voice" + sceneProVo.getSceneCode()  + File.separator,
+                    path + File.separator + "scene"  + File.separator + "voice" + File.separator + "voice" + sceneProVo.getSceneCode());
+
+            //压缩zip
+            FileUtils.zipFile(path + ".zip", path);
+            log.info("三维家 zip完成 : " + path);
+
+            //上传oss
+            // 上传到阿里云sso
+            uploadToOssUtil.upload(path + ".zip", DIR_NAME + sceneProVo.getSceneCode() + ".zip");
+            log.info("upload success");
+
+            String url = prefixAli + DIR_NAME + sceneProVo.getSceneCode() + ".zip";
+
+            log.info("upload url: {}" + url);
+
+            scene3dfamily.setZipLink(url);
+            scene3dfamily.setZipStatus(ZipStatus.SUCCESS.code());
+            scene3dfamily.setZipEndTime(new Date());
+            scene3dfamily.setUpdateTime(new Date());
+            baseMapper.updateById(scene3dfamily);
+        }catch (Exception e){
+            scene3dfamily.setZipStatus(ZipStatus.FAILD.code());
+            scene3dfamily.setZipEndTime(new Date());
+            scene3dfamily.setUpdateTime(new Date());
+            baseMapper.updateById(scene3dfamily);
+            log.error("场景打包失败", e);
+        }finally {
+            FileUtils.deleteDirectory(path);
+            FileUtils.deleteDirectory(path + ".zip");
+        }
+
+        return ResultData.ok();
+    }
+
+    @Override
+    public Scene3dfamily findSceneNumByNum(Scene3dfamilyVO scene3dfamilyVO) {
+        return baseMapper.findSceneCodeByCode(scene3dfamilyVO);
+    }
+
+    @Override
+    public Map<String, String> findSceneNumByNum2(Scene3dfamilyVO scene3dfamilyVO) {
+        Map<String, String> result = new HashMap<>();
+        result.put("url","");
+        result.put("status",ZipStatus.OTHER.code().toString());
+        Scene3dfamily scene3dfamily = baseMapper.findSceneCodeByCode(scene3dfamilyVO);
+        if(Objects.nonNull(scene3dfamily)){
+            result.put("url",scene3dfamily.getZipLink() == null ?"":scene3dfamily.getZipLink());
+            result.put("status",scene3dfamily.getZipStatus().toString());
+        }
+        //验证是否在打包
+        return result;
+    }
+
+    @Override
+    public void updateSceneNumByNum(Scene3dfamily scene3dfamily) {
+        this.update(new LambdaUpdateWrapper<Scene3dfamily>()
+                .eq(Scene3dfamily::getSceneCode, scene3dfamily.getSceneCode())
+                .set(Scene3dfamily::getRecStatus, RecStatus.DISABLE.code()));
+    }
 }

+ 848 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneAppServiceImpl.java

@@ -0,0 +1,848 @@
+package com.fdkankan.scene.service.impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.common.constant.*;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.ConvertCommonUtils;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.common.util.UploadToOssUtil;
+import com.fdkankan.common.util.WeiXinUtils;
+import com.fdkankan.scene.entity.Scene;
+import com.fdkankan.scene.mapper.ISceneMapper;
+import com.fdkankan.scene.service.ISceneAppService;
+import com.fdkankan.scene.vo.SceneEditVO;
+import lombok.extern.slf4j.Slf4j;
+import net.coobird.thumbnailator.Thumbnails;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * <p>
+ * 八目场景编码表 服务实现类
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2021-12-23
+ */
+@Slf4j
+@Service
+public class SceneAppServiceImpl extends ServiceImpl<ISceneMapper, Scene> implements ISceneAppService {
+
+    @Value("${prefix.ali}")
+    private String prefixAli;
+
+    @Value("${oss.type}")
+    private String type;
+
+    @Autowired
+    UploadToOssUtil uploadToOssUtil;
+    @Autowired
+    RedisTemplate redisTemplate;
+
+
+    @Override
+    public int saveInitialPage(SceneEditVO base) throws IOException {
+        if(StrUtil.isEmpty(base.getSceneNum()) || StrUtil.isEmpty(base.getInitialPoint())){
+            return -102;
+        }
+
+        Scene scene = baseMapper.findByNum(base.getSceneNum());
+        if(Objects.isNull(scene)){
+            return -2;
+        }
+
+        StringBuffer dataBuf = new StringBuffer()
+                .append("data").append(File.separator)
+                .append("data").append(scene.getNum())
+                .append(File.separator);
+        StringBuffer imagesBuf = new StringBuffer()
+                .append("images").append(File.separator)
+                .append("images").append(scene.getNum())
+                .append(File.separator);
+
+        StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
+        StringBuffer imagesBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(imagesBuf.toString());
+
+        String path1 = imagesBuffer.append("thumbBigImg.jpg").toString();
+        String path2 = imagesBuffer.append("thumbSmallImg.jpg").toString();
+
+        //生成缩略图
+        //按指定大小把图片进行缩和放(会遵循原图高宽比例)
+        //此处把图片压成1024×512的缩略图
+        Thumbnails.of(path1).size(1024,512).toFile(path2);//变为1024×512
+
+        Map map = new HashMap();
+        map.put("entry", JSONObject.parseObject(base.getInitialPoint()));
+        map.put("thumbImg", 1);
+        map.put("version", scene.getVersion()+1);
+        FileUtils.writeJsonFile(dataBuffer.toString() + "scene.json", map);
+
+        Map<String,String> uploadMap = new HashMap<String,String>();
+        map.put(imagesBuffer.append("thumbBigImg.jpg").toString(), imagesBuf.append("thumbBigImg.jpg").toString());
+        map.put(imagesBuffer.append("thumbFishBigImg.jpg").toString(), imagesBuf.append("thumbFishBigImg.jpg").toString());
+        map.put(imagesBuffer.append("thumbSmallImg.jpg").toString(), imagesBuf.append("thumbSmallImg.jpg").toString());
+        map.put(imagesBuffer.append("smallPic.jpg").toString(), imagesBuf.append("smallPic.jpg").toString());
+        map.put(dataBuffer.toString() + "scene.json", dataBuf.toString() + "scene.json");
+
+        uploadToOssUtil.uploadMulFiles(uploadMap);
+
+        scene.setEntry(base.getInitialPoint());
+        scene.setThumbStatus(1);
+        scene.setThumb(prefixAli + imagesBuf.append("thumbSmallImg.jpg").toString());
+        if("s3".equals(type)){
+            scene.setThumb(ConstantUrl.PREFIX_AWS + imagesBuf.append("thumbSmallImg.jpg").toString());
+        }
+        scene.setVersion(scene.getVersion() + 1);
+        scene.setUpdateTime(Calendar.getInstance().getTime());
+        this.updateById(scene);
+
+        return 1;
+    }
+
+    @Override
+    public int saveFloorLogo(SceneEditVO base) {
+        if(StrUtil.isEmpty(base.getSceneNum()) || StrUtil.isEmpty(base.getSize()) ||
+                StrUtil.isEmpty(base.getLogoType())){
+            return -102;
+        }
+
+        Scene scene = baseMapper.findByNum(base.getSceneNum());
+        if(scene == null){
+            return -2;
+        }
+
+        StringBuffer dataBuf = new StringBuffer()
+                .append("data").append(File.separator)
+                .append("data").append(scene.getNum())
+                .append(File.separator);
+
+        StringBuffer imagesBuf = new StringBuffer()
+                .append("images").append(File.separator)
+                .append("images").append(scene.getNum())
+                .append(File.separator);
+
+        StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
+        StringBuffer imagesBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(imagesBuf.toString());
+
+        Map map = new HashMap();
+        map.put("floorLogo", base.getLogoType());
+        map.put("floorLogoSize", base.getSize());
+        map.put("version", scene.getVersion()+1);
+
+        FileUtils.writeJsonFile(dataBuffer.toString() + "scene.json", map);
+
+        scene.setFloorLogo(base.getLogoType());
+        scene.setFloorLogoSize(Integer.parseInt(base.getSize()));
+        scene.setVersion(scene.getVersion() + 1);
+        scene.setUpdateTime(Calendar.getInstance().getTime());
+        this.updateById(scene);
+
+        uploadToOssUtil.upload(imagesBuffer.append("floorLogoImg.png").toString(), imagesBuf.append("floorLogoImg.png").toString());
+        uploadToOssUtil.upload(dataBuffer.toString() + "scene.json", dataBuf.toString() + "scene.json");
+
+        return 1;
+    }
+
+    @Override
+    public int saveHot(SceneEditVO base) throws Exception {
+        if(StrUtil.isEmpty(base.getType())){
+            return -102;
+        }
+
+        String sid = base.getSid();
+
+        Scene scene = baseMapper.findByNum(base.getSceneNum());
+        if (scene == null ) {
+            return -2;
+        }
+
+        JSONObject jsonhot = JSONObject.parseObject(base.getHotData());
+
+        StringBuffer dataBuf = new StringBuffer()
+                .append("data").append(File.separator)
+                .append("data").append(scene.getNum())
+                .append(File.separator);
+        StringBuffer imagesBuf = new StringBuffer()
+                .append("images").append(File.separator)
+                .append("images").append(scene.getNum())
+                .append(File.separator);
+
+        StringBuffer imagesBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(imagesBuf.toString());
+        StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
+
+        String str = FileUtils.readFile(dataBuffer.toString() + "hot.json");
+        JSONArray jsonhots = null;
+        if (StringUtils.isNotEmpty(str)) {
+            jsonhots = JSONArray.parseArray(str);
+        }else {
+            File file = new File(dataBuffer.toString() + "hot.json");
+            if(!file.getParentFile().exists()){
+                file.getParentFile().mkdirs();
+            }
+            if(!file.exists()){
+                file.createNewFile();
+            }
+        }
+
+        String hotsids = "";
+        //添加或者修改
+        if("1".equals(base.getType())){
+            sid = jsonhot.getString("sid");
+            if(StrUtil.isEmpty(sid)){
+                return -102;
+            }
+            jsonhots.add(jsonhot);
+        }
+        else if("0".equals(base.getType())){
+            sid = jsonhot.getString("sid");
+            if(StrUtil.isEmpty(sid)){
+                return -102;
+            }
+        }
+        else if("-1".equals(base.getType())){
+            if(StrUtil.isEmpty(sid)){
+                return -102;
+            }
+        }
+
+
+        for(int i=0;i<jsonhots.size();++i) {
+            JSONObject ele = jsonhots.getJSONObject(i);
+            hotsids += ele.getString("sid") +",";
+            if(ele.getString("sid").equals(sid)) {
+                if("-1".equals(base.getType())) {
+                    jsonhots.remove(i);
+                    jsonhot = ele;
+                }
+                else if("0".equals(base.getType())) {
+                    jsonhots.set(i, jsonhot);
+
+                }
+            }
+        }
+
+        Map<String,String> map = new HashMap<String,String>();
+        if(jsonhot.containsKey("media")) {
+            String fileType = jsonhot.getString("media");
+            if(fileType.contains("photo")) {
+                if("-1".equals(base.getType())) {
+                    FileUtils.deleteFile(imagesBuffer.append("hot").append(sid).append(".jpg").toString());
+                }
+                else {
+                    map.put(imagesBuffer.append("hot").append(sid).append(".jpg").toString(), imagesBuf.append("hot").append(sid).append(".jpg").toString());
+                }
+            }
+            if(fileType.contains("audio")) {
+                if("-1".equals(base.getType())) {
+                    FileUtils.deleteFile(imagesBuffer.append("hot").append(sid).append(".mp3").toString());
+                }
+                else {
+                    map.put(imagesBuffer.append("hot").append(sid).append(".mp3").toString(), imagesBuf.append("hot").append(sid).append(".mp3").toString());
+                }
+            }
+            if(fileType.contains("video")) {
+                if("-1".equals(base.getType())) {
+                    FileUtils.deleteFile(imagesBuffer.append("hot").append(sid).append(".mp4").toString());
+                }
+                else
+                {
+                    map.put(imagesBuffer.append("hot").append(sid).append(".mp4").toString(), imagesBuf.append("hot").append(sid).append(".mp4").toString());
+                }
+            }
+        }
+
+        FileUtils.deleteFile(dataBuffer.toString() + "hot.json");
+        File dataPath = new File(dataBuffer.toString());
+        if(!dataPath.exists()){
+            dataPath.mkdirs();
+        }
+        FileUtils.writeFile(dataBuffer.toString() + "hot.json", jsonhots.toString());
+
+        map.put(dataBuffer.toString() + "hot.json", dataBuf.toString() + "hot.json");
+        uploadToOssUtil.uploadMulFiles(map);
+
+        scene.setHotsIds(hotsids);
+        scene.setVersion(scene.getVersion() + 1);
+        scene.setUpdateTime(Calendar.getInstance().getTime());
+        this.updateById(scene);
+
+        String strsceneInfos = FileUtils.readFile(dataBuffer.toString() + "scene.json");
+        JSONObject scenejson = new JSONObject();
+        if(strsceneInfos!=null){
+            scenejson = JSONObject.parseObject(strsceneInfos);
+        }
+        if(jsonhots.size()>0){
+            scenejson.put("hots", 1);
+        }
+        else{
+            scenejson.put("hots", 0);
+        }
+        FileUtils.writeFile(dataBuffer.toString() + "scene.json", scenejson.toString());
+
+        return 1;
+    }
+
+    @Override
+    public int saveBackgroundMusic(SceneEditVO base) {
+        if(StrUtil.isEmpty(base.getSceneNum()) || StrUtil.isEmpty(base.getMusicName())){
+            return -102;
+        }
+
+        Scene scene = baseMapper.findByNum(base.getSceneNum());
+        if(scene == null){
+            return -2;
+        }
+
+        StringBuffer dataBuf = new StringBuffer()
+                .append("data").append(File.separator)
+                .append("data").append(scene.getNum())
+                .append(File.separator);
+
+        StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
+
+        Map map = new HashMap();
+        map.put("bgMusic", base.getMusicName());
+        map.put("version", scene.getVersion()+1);
+
+        FileUtils.writeJsonFile(dataBuffer.toString() + "scene.json", map);
+
+        scene.setBgMusic(base.getMusicName());
+        scene.setVersion(scene.getVersion() + 1);
+        scene.setUpdateTime(Calendar.getInstance().getTime());
+        this.updateById(scene);
+
+        return 1;
+    }
+
+    @Override
+    public int saveSceneInfo(SceneEditVO base) throws Exception {
+        if(StrUtil.isEmpty(base.getSceneNum()) || StrUtil.isEmpty(base.getSceneName()) ||
+                StrUtil.isEmpty(base.getSceneType()) || StrUtil.isEmpty(base.getSceneDec())){
+            return -102;
+        }
+
+        Scene scene = baseMapper.findByNum(base.getSceneNum());
+        if(scene == null){
+            return -2;
+        }
+
+        StringBuffer dataBuf = new StringBuffer()
+                .append("data").append(File.separator)
+                .append("data").append(scene.getNum())
+                .append(File.separator);
+
+        StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
+
+        Map map = new HashMap();
+        map.put("sceneName", base.getSceneName());
+        map.put("sceneDec", base.getSceneDec());
+        map.put("sceneType", base.getSceneType());
+        if(base.getSceneKey() != null){
+            map.put("sceneKey", base.getSceneKey());
+        }
+        map.put("version", scene.getVersion()+1);
+
+        FileUtils.writeJsonFile(dataBuffer.toString() + "scene.json", map);
+
+        scene.setSceneName(base.getSceneName());
+        scene.setSceneDec(base.getSceneDec());
+        scene.setSceneType(Integer.parseInt(base.getSceneType()));
+        scene.setSceneKey(base.getSceneKey());
+        scene.setVersion(scene.getVersion() + 1);
+        scene.setUpdateTime(Calendar.getInstance().getTime());
+        this.updateById(scene);
+
+        return 1;
+    }
+
+    @Override
+    public int saveSceneKey(SceneEditVO base) {
+        if(StrUtil.isEmpty(base.getSceneNum()) || StrUtil.isEmpty(base.getSceneKey())){
+            return -102;
+        }
+
+        Scene scene = baseMapper.findByNum(base.getSceneNum());
+        if(scene == null){
+            return -2;
+        }
+
+        StringBuffer dataBuf = new StringBuffer()
+                .append("data").append(File.separator)
+                .append("data").append(scene.getNum())
+                .append(File.separator);
+
+        StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
+
+
+        Map map = new HashMap();
+        map.put("sceneKey", base.getSceneKey());
+        map.put("version", scene.getVersion()+1);
+
+        FileUtils.writeJsonFile(dataBuffer.toString() + "scene.json", map);
+
+        scene.setSceneKey(base.getSceneKey());
+        scene.setVersion(scene.getVersion() + 1);
+        scene.setUpdateTime(Calendar.getInstance().getTime());
+        this.updateById(scene);
+
+        return 1;
+    }
+
+    @Override
+    public int saveTourList(SceneEditVO base) {
+        if(StrUtil.isEmpty(base.getSceneNum()) || StrUtil.isEmpty(base.getTourList())){
+            return -102;
+        }
+
+        Scene scene = baseMapper.findByNum(base.getSceneNum());
+        if(scene == null){
+            return -2;
+        }
+        StringBuffer dataBuf = new StringBuffer()
+                .append("data").append(File.separator)
+                .append("data").append(scene.getNum())
+                .append(File.separator);
+
+        StringBuffer imagesBuf = new StringBuffer()
+                .append("images").append(File.separator)
+                .append("images").append(scene.getNum())
+                .append(File.separator);
+
+        StringBuffer imagesBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(imagesBuf.toString());
+        StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
+
+        Map<String,String> map = new HashMap<String,String>();
+
+        log.info("editForApp/saveTourList:生成tourList.json文件");
+        String tourListPath = dataBuffer.toString() + ConstantFileName.TOUR_LIST;
+        FileUtils.writeFile(tourListPath, base.getTourList());
+        map.put(tourListPath, dataBuf.toString() + ConstantFileName.TOUR_LIST);
+
+        JSONArray tourJsons = JSONArray.parseArray(base.getTourList());
+
+        String path = imagesBuffer.append(ConstantFileName.TOURLIST_FOLDER).toString();
+
+        for(int i=0;i<tourJsons.size();++i)
+        {
+            String fileName = path + File.separator +"guide"+i+".jpg";
+            map.put(fileName, imagesBuf.append(ConstantFileName.TOURLIST_FOLDER).append(File.separator).append("guide").append(i).append(".jpg").toString());
+        }
+
+        File file = new File(dataBuffer.toString() + ConstantFileName.TOURLIST_FOLDER);
+        String[] strs = file.list();
+        if(strs!=null) {
+            int screencapLen = 0;
+            for(int i=0;i<strs.length;++i)
+            {
+                if(strs[i].indexOf(ConstantFileName.SCREEN_CRP_DATAFILE)>-1)
+                {
+                    map.put(dataBuffer.toString() + ConstantFileName.TOURLIST_FOLDER + File.separator + strs[i], dataBuf.toString() + ConstantFileName.TOURLIST_FOLDER + File.separator + strs[i]);
+                    ++screencapLen;
+                }
+            }
+
+            Map<String, Object> jsonMap = new HashMap();
+            jsonMap.put("screenCapLen", screencapLen);
+            jsonMap.put("version", scene.getVersion() + 1);
+
+            FileUtils.writeJsonFile(dataBuffer.toString() + "scene.json", jsonMap);
+
+            scene.setScreencapLen(screencapLen);
+            scene.setVersion(scene.getVersion() + 1);
+            scene.setUpdateTime(Calendar.getInstance().getTime());
+            this.updateById(scene);
+        }
+
+        uploadToOssUtil.uploadMulFiles(map);
+
+        return 1;
+    }
+
+    @Autowired
+    RedisUtil redisUtil;
+
+    @Override
+    public Object uploadPic(String sceneNum, String folderName, MultipartFile file) throws IOException {
+        if(StrUtil.isEmpty(sceneNum)){
+            return -102;
+        }
+
+        Scene scene = baseMapper.findByNum(sceneNum);
+        if(scene == null){
+            return -2;
+        }
+
+        if (file.isEmpty() && file.getSize() <= 0) {
+            return -99;
+        }
+
+        String lockKey = String.format(RedisKey.LOCK_UPLOAD_PIC, sceneNum);
+//        Boolean lock = redisTemplate.opsForValue()
+//                                    .setIfAbsent(lockKey, Thread.currentThread().getId(), RedisKey.EXPIRE_TIME_10_MINUTE, TimeUnit.MILLISECONDS);
+        Boolean lock = redisUtil.lock(lockKey, RedisKey.EXPIRE_TIME_10_MINUTE);
+
+        if(!lock){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5036);
+        }
+
+        File targetFile = null;
+
+        try {
+            //文件上传的位置可以自定义
+            String path = ConstantFilePath.SCENE_PATH+"images"+File.separator+"images"+sceneNum;
+            if(StrUtil.isNotEmpty(folderName)) {
+                path = path+File.separator + folderName;
+            }
+            targetFile = new File(path);
+            if (!targetFile.exists()) {
+                targetFile.mkdirs();
+            }
+            String fileName = file.getOriginalFilename();
+            targetFile = new File(path + File.separator + fileName);
+            // 保存
+            if(targetFile.exists())
+            {
+                FileUtils.deleteFile(path + File.separator + fileName);
+            }
+            file.transferTo(targetFile);
+        }catch (Exception e){
+            log.error("上传图片失败", e);
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5037);
+        }finally {
+//            if(redisTemplate.hasKey(lockKey)){
+//                redisTemplate.delete(lockKey);
+//
+//            }
+            redisUtil.unlock(lockKey, Thread.currentThread().getId());
+        }
+
+        return targetFile.getName();
+    }
+
+    @Override
+    public Object uploadScreencapVoice(String sceneNum, MultipartFile file) throws IOException {
+        if(StrUtil.isEmpty(sceneNum)){
+            return -102;
+        }
+
+        Scene scene = baseMapper.findByNum(sceneNum);
+        if(scene == null){
+            return -2;
+        }
+
+        if (file.isEmpty() && file.getSize() <= 0) {
+            return -99;
+        }
+
+        String lockKey = String.format(RedisKey.LOCK_UPLOAD_VOICE, sceneNum);
+        Boolean lock = redisUtil.lock(lockKey, RedisKey.EXPIRE_TIME_30_MINUTE);
+
+        if(!lock){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5036);
+        }
+
+        String originalFileName = null;
+        try {
+            //文件上传的位置可以自定义
+            String path = ConstantFilePath.SCENE_PATH+"voice"+File.separator+"voice"+sceneNum;
+            File targetFile = new File(path);
+            if (!targetFile.exists()) {
+                targetFile.mkdirs();
+            }
+            originalFileName = file.getOriginalFilename();
+            targetFile = new File(path + File.separator +originalFileName);
+            // 保存
+            if(targetFile.exists())
+            {
+                FileUtils.deleteFile(path + File.separator + originalFileName);
+            }
+            file.transferTo(targetFile);
+
+            uploadToOssUtil.upload(path + File.separator +originalFileName, "voice/voice"+sceneNum+"/"+originalFileName);
+
+            Map map = new HashMap();
+            map.put("screencapVoiceFileName", originalFileName);
+            String voiceSrc = prefixAli + "voice/voice"+sceneNum+"/"+originalFileName;
+            if("s3".equals(type)){
+                voiceSrc = ConstantUrl.PREFIX_AWS + "voice/voice"+sceneNum+"/"+originalFileName;
+            }
+            map.put("screencapVoiceSrc", voiceSrc);
+            map.put("version", scene.getVersion()+1);
+            FileUtils.writeJsonFile(ConstantFilePath.SCENE_PATH + "data/data" + sceneNum + "/scene.json", map);
+
+            scene.setScreencapVoiceSrc(voiceSrc);
+            scene.setVersion(scene.getVersion() + 1);
+            scene.setUpdateTime(Calendar.getInstance().getTime());
+            this.updateById(scene);
+        }catch (Exception e){
+            log.error("上传图片失败", e);
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5040);
+        }finally {
+            redisUtil.unlock(lockKey, Thread.currentThread().getId());
+        }
+
+        return originalFileName;
+    }
+
+    @Override
+    public int saveScreencapFile(SceneEditVO base) throws IOException {
+        if(StrUtil.isEmpty(base.getSceneNum()) || StrUtil.isEmpty(base.getIndex()) ||
+                StringUtils.isEmpty(base.getCamerasData())){
+            return -102;
+        }
+
+        Scene scene = baseMapper.findByNum(base.getSceneNum());
+        if(scene == null){
+            return -2;
+        }
+
+        StringBuffer dataBuf = new StringBuffer()
+                .append("data").append(File.separator)
+                .append("data").append(scene.getNum())
+                .append(File.separator);
+
+        StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
+
+        if("1".equals(base.getIndex())){
+            File file = new File(dataBuffer.toString() + ConstantFileName.TOURLIST_FOLDER);
+            if(file.isDirectory()){
+                String[] strs = file.list();
+                if(strs!=null){
+                    for(int i=0;i<strs.length;++i) {
+
+                        if(strs[i].indexOf(ConstantFileName.SCREEN_CRP_DATAFILE)>-1) {
+                            FileUtils.deleteFile(dataBuffer.toString() + ConstantFileName.TOURLIST_FOLDER + File.separator + strs[i]);
+                        }
+                    }
+                }
+            } else {
+                file.mkdirs();
+            }
+
+            Map<String, Object> map = new HashMap<>();
+            map.put("screencapLen", "0");
+            map.put("version", scene.getVersion()+1);
+            FileUtils.writeJsonFile(dataBuffer.toString() + "scene.json", map);
+
+            scene.setScreencapLen(0);
+            scene.setVersion(scene.getVersion() + 1);
+            scene.setUpdateTime(Calendar.getInstance().getTime());
+            this.updateById(scene);
+        }
+
+        String filePath = dataBuffer.toString() + ConstantFileName.TOURLIST_FOLDER + File.separator + ConstantFileName.SCREEN_CRP_DATAFILE + base.getIndex() + ".json";
+        File file = new File(filePath);
+        if(!file.exists())
+        {
+            log.info("创建文件:" + filePath);
+            file.createNewFile();
+        }
+        FileUtils.writeFile(filePath, base.getCamerasData());
+
+        return 1;
+    }
+
+    @Override
+    public int saveHotVisible(SceneEditVO base) throws IOException {
+        if(StrUtil.isEmpty(base.getData())){
+            return -102;
+        }
+
+        Scene scene = baseMapper.findByNum(base.getSceneNum());
+        if (scene == null ) {
+            return -2;
+        }
+
+        JSONArray visiblePanos = JSONArray.parseArray(base.getData());
+
+        StringBuffer dataBuf = new StringBuffer()
+                .append("data").append(File.separator)
+                .append("data").append(scene.getNum())
+                .append(File.separator);
+        StringBuffer imagesBuf = new StringBuffer()
+                .append("images").append(File.separator)
+                .append("images").append(scene.getNum())
+                .append(File.separator);
+
+        StringBuffer imagesBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(imagesBuf.toString());
+        StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
+
+        File file = new File(dataBuffer.toString() + "hot.json");
+        if (!file.exists()) {
+            return -99;
+        }
+
+        String str = FileUtils.readFile(dataBuffer.toString() + "hot.json");
+        JSONArray hots = JSONArray.parseArray(str);
+        for (int i = 0; i < hots.size(); ++i) {
+            JSONObject hot = hots.getJSONObject(i);
+            for (int j = 0; j < visiblePanos.size(); ++j) {
+                if (hot.getString("sid").equals(((JSONObject) visiblePanos.get(j)).getString("sid"))) {
+                    hot.put("visiblePanos", ((JSONObject) visiblePanos.get(j)).getJSONArray("value"));
+                }
+            }
+        }
+
+        scene.setVersion(scene.getVersion() + 1);
+        this.updateById(scene);
+
+        FileUtils.deleteFile(dataBuffer.toString() + "hot.json");
+        FileUtils.writeFileContent(dataBuffer.toString() + "hot.json", hots.toString());
+
+        uploadToOssUtil.upload(dataBuffer.toString() + "hot.json", dataBuf.toString() + "hot.json");
+        return 1;
+    }
+
+    @Override
+    public int saveLinkPano(SceneEditVO base) throws Exception {
+        if(StrUtil.isEmpty(base.getData()) || StrUtil.isEmpty(base.getSceneNum())){
+            return -102;
+        }
+
+        Scene scene = baseMapper.findByNum(base.getSceneNum());
+        if (scene == null ) {
+            return -2;
+        }
+
+        JSONArray inputData = JSONObject.parseArray(base.getData());
+
+        StringBuffer dataBuf = new StringBuffer()
+                .append("data").append(File.separator)
+                .append("data").append(scene.getNum())
+                .append(File.separator);
+        StringBuffer imagesBuf = new StringBuffer()
+                .append("images").append(File.separator)
+                .append("images").append(scene.getNum())
+                .append(File.separator);
+
+        StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH).append(dataBuf.toString());
+
+        File directory = new File(dataBuffer.toString());
+        if (!directory.exists()) {
+            directory.mkdirs();
+        }
+
+        String modeldataUrl = prefixAli + imagesBuf.toString() + "vision.modeldata?t=" + System.currentTimeMillis();
+        if("s3".equals(type)){
+            modeldataUrl = ConstantUrl.PREFIX_AWS + imagesBuf.toString() + "vision.modeldata?t=" + System.currentTimeMillis();
+        }
+        FileUtils.downLoadFromUrl(modeldataUrl, "vision.modeldata", dataBuffer.toString());
+        File file = new File(dataBuffer.toString() + "vision.modeldata");
+        if(file.exists()) {
+            return -1;
+        }
+        ConvertCommonUtils.convertVisionModelDataToTxt(dataBuffer.toString() + "vision.modeldata", dataBuffer.toString() + "vision.json");
+
+        String str = FileUtils.readFile(dataBuffer.toString() + "vision.json");
+        JSONObject json = JSONObject.parseObject(str);
+        JSONArray panos = json.getJSONArray("sweepLocations");
+        for (int i = 0; i < panos.size(); ++i) {
+            JSONObject pano = panos.getJSONObject(i);
+            for (int j = 0; j < inputData.size(); ++j) {
+                JSONObject jo = inputData.getJSONObject(j);
+                String currentPanoId = jo.getString("panoID");
+                JSONArray visibles = jo.getJSONArray("visibles");
+                JSONArray visibles3 = jo.getJSONArray("visibles3");
+                if (pano.getString("uuid").equals(currentPanoId)) {
+                    pano.put("visibles", visibles);
+                    pano.put("visibles3", visibles3);
+                }
+            }
+        }
+        FileUtils.deleteFile(dataBuffer.toString() + "vision.json");
+        FileUtils.deleteFile(dataBuffer.toString() + "vision.modeldata");
+        FileUtils.writeFileContent(dataBuffer.toString() + "vision.json", json.toString());
+        ConvertCommonUtils.convertTxtToVisionModelData(dataBuffer.toString() + "vision.json", dataBuffer.toString() + "vision.modeldata");
+        uploadToOssUtil.upload(dataBuffer.toString() + "vision.modeldata", imagesBuf.toString() + "vision.modeldata");
+        return 1;
+    }
+
+    @Override
+    public Object getRecordAudioFromWeixin(SceneEditVO base) throws Exception {
+        if(StrUtil.isEmpty(base.getData()) || StrUtil.isEmpty(base.getId())){
+            return -102;
+        }
+
+        Scene scene = baseMapper.findByNum(base.getSceneNum());
+        if (scene == null ) {
+            return -2;
+        }
+
+        String accessToken = WeiXinUtils.getAccessToken();
+
+        InputStream is = null;
+        String url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token="+ accessToken + "&media_id=" + base.getId();
+        URL urlGet = new URL(url);
+        HttpURLConnection http = (HttpURLConnection) urlGet
+                .openConnection();
+        http.setRequestMethod("GET"); // 必须是get方式请求
+        http.setRequestProperty("Content-Type",
+                "application/x-www-form-urlencoded");
+        http.setDoOutput(true);
+        http.setDoInput(true);
+        System.setProperty("sun.net.client.defaultConnectTimeout", "30000");// 连接超时30秒
+        System.setProperty("sun.net.client.defaultReadTimeout", "30000"); // 读取超时30秒
+        http.connect();
+        // 获取文件转化为byte流
+        is = http.getInputStream();
+        File dic = new File(ConstantFilePath.SCENE_PATH+"voice"+File.separator+"voice"+base.getSceneNum());
+        if(!dic.exists())
+        {
+            dic.mkdirs();
+        }
+        File voice = new File(ConstantFilePath.SCENE_PATH+"voice"+File.separator+"voice"+base.getSceneNum()+File.separator+ConstantFileName.VOICE_NAME+".amr");
+        if(voice.exists())
+        {
+            FileUtils.deleteFile(ConstantFilePath.SCENE_PATH+"voice"+File.separator+"voice"+base.getSceneNum()+File.separator+ConstantFileName.VOICE_NAME+".amr");
+        }
+        FileUtils.saveImageToDisk( accessToken,  base.getId(), ConstantFileName.VOICE_NAME, ConstantFilePath.SCENE_PATH+"voice"+File.separator+"voice"+base.getSceneNum()+File.separator, is);
+
+        try
+        {
+            FileUtils.changeVoiceToMp3(ConstantFilePath.SCENE_PATH+"voice"+File.separator+"voice"+base.getSceneNum()+File.separator+ConstantFileName.VOICE_NAME+".amr",
+                    ConstantFilePath.SCENE_PATH+"voice"+File.separator+"voice"+base.getSceneNum()+File.separator+ConstantFileName.VOICE_NAME+".mp3");
+        }
+        catch(Exception e)
+        {
+            StringWriter trace=new StringWriter();
+            e.printStackTrace(new PrintWriter(trace));
+            log.error("voice:"+ConstantFilePath.SCENE_PATH+"voice"+File.separator+"voice"+base.getSceneNum()+File.separator+ConstantFileName.VOICE_NAME+".amr");
+            log.error(trace.toString());
+            return -97;
+        }
+        String originalFileName = ConstantFileName.VOICE_NAME+".mp3";
+        uploadToOssUtil.upload(ConstantFilePath.SCENE_PATH+"voice"+File.separator+"voice"+base.getSceneNum()+File.separator +originalFileName, "voice/voice"+base.getSceneNum()+"/"+originalFileName);
+
+        Map map = new HashMap();
+        map.put("screencapVoiceFileName", originalFileName);
+        String voiceSrc = prefixAli+"voice/voice"+base.getSceneNum()+"/"+originalFileName;
+        if("s3".equals(type)){
+            voiceSrc = ConstantUrl.PREFIX_AWS+"voice/voice"+base.getSceneNum()+"/"+originalFileName;
+        }
+        map.put("screencapVoiceSrc", voiceSrc);
+        map.put("version", scene.getVersion()+1);
+        FileUtils.writeJsonFile(ConstantFilePath.SCENE_PATH + "data/data" + base.getSceneNum() + "/scene.json", map);
+
+        scene.setScreencapVoiceSrc(voiceSrc);
+        scene.setVersion(scene.getVersion());
+        scene.setUpdateTime(Calendar.getInstance().getTime());
+        this.updateById(scene);
+        FileUtils.deleteFile(ConstantFilePath.SCENE_PATH+"voice"+File.separator+"voice"+base.getSceneNum()+File.separator+ConstantFileName.VOICE_NAME+".amr");
+        return originalFileName;
+    }
+}

+ 40 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneCooperationServiceImpl.java

@@ -1,11 +1,21 @@
 package com.fdkankan.scene.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.common.constant.RecStatus;
+import com.fdkankan.common.constant.TbStatus;
+import com.fdkankan.scene.entity.Scene3dfamily;
 import com.fdkankan.scene.entity.SceneCooperation;
 import com.fdkankan.scene.mapper.ISceneCooperationMapper;
 import com.fdkankan.scene.service.ISceneCooperationService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.Calendar;
+import java.util.List;
+import java.util.Objects;
+
 /**
  * <p>
  *  服务实现类
@@ -17,4 +27,34 @@ import org.springframework.stereotype.Service;
 @Service
 public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMapper, SceneCooperation> implements ISceneCooperationService {
 
+    @Override
+    public void updateRecStatus(String sceneNum) {
+        this.update(new LambdaUpdateWrapper<SceneCooperation>()
+                .eq(SceneCooperation::getSceneCode, sceneNum)
+                .set(SceneCooperation::getUpdateTime, Calendar.getInstance().getTime())
+                .set(SceneCooperation::getRecStatus, RecStatus.DISABLE.code()));
+    }
+
+    @Override
+    public String findUserName(String sceneNum) {
+
+        SceneCooperation sceneCooperation = this.findBySceneNum(sceneNum);
+        if(Objects.isNull(sceneCooperation)) return null;
+
+        return sceneCooperation.getUserName();
+    }
+
+    @Override
+    public SceneCooperation findBySceneNum(String sceneNum) {
+        List<SceneCooperation> list = this.list(new QueryWrapper<SceneCooperation>()
+                .eq("tb_status", TbStatus.VALID.code())
+                .eq("rec_status", RecStatus.VALID.code())
+                .eq("scene_code", sceneNum)
+                .orderByDesc("id"));
+        if(CollUtil.isEmpty(list)){
+            return null;
+        }
+        return list.get(0);
+    }
+
 }

+ 20 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneDataDownloadServiceImpl.java

@@ -1,11 +1,18 @@
 package com.fdkankan.scene.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fdkankan.common.constant.RecStatus;
+import com.fdkankan.common.constant.TbStatus;
+import com.fdkankan.scene.entity.SceneCooperation;
 import com.fdkankan.scene.entity.SceneDataDownload;
 import com.fdkankan.scene.mapper.ISceneDataDownloadMapper;
 import com.fdkankan.scene.service.ISceneDataDownloadService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 安居客场景数据下载 服务实现类
@@ -17,4 +24,17 @@ import org.springframework.stereotype.Service;
 @Service
 public class SceneDataDownloadServiceImpl extends ServiceImpl<ISceneDataDownloadMapper, SceneDataDownload> implements ISceneDataDownloadService {
 
+    @Override
+    public SceneDataDownload findBySceneNum(String sceneNum) {
+
+        List<SceneDataDownload> list = this.list(new QueryWrapper<SceneDataDownload>()
+                .eq("tb_status", TbStatus.VALID.code())
+                .eq("rec_status", RecStatus.VALID.code())
+                .eq("scene_code", sceneNum)
+                .orderByDesc("id"));
+        if(CollUtil.isEmpty(list)){
+            return null;
+        }
+        return list.get(0);
+    }
 }

+ 48 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneDownloadLogServiceImpl.java

@@ -1,11 +1,22 @@
 package com.fdkankan.scene.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.common.constant.DownloadStatus;
+import com.fdkankan.common.constant.RecStatus;
+import com.fdkankan.common.constant.TbStatus;
+import com.fdkankan.scene.entity.SceneCooperation;
+import com.fdkankan.scene.entity.SceneDataDownload;
 import com.fdkankan.scene.entity.SceneDownloadLog;
 import com.fdkankan.scene.mapper.ISceneDownloadLogMapper;
 import com.fdkankan.scene.service.ISceneDownloadLogService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.Calendar;
+import java.util.List;
+
 /**
  * <p>
  * 场景下载记录 服务实现类
@@ -17,4 +28,41 @@ import org.springframework.stereotype.Service;
 @Service
 public class SceneDownloadLogServiceImpl extends ServiceImpl<ISceneDownloadLogMapper, SceneDownloadLog> implements ISceneDownloadLogService {
 
+    @Override
+    public void updateStatusByNum(String sceneNum, Integer status) {
+        this.update(new LambdaUpdateWrapper<SceneDownloadLog>()
+                .eq(SceneDownloadLog::getSceneCode, sceneNum)
+                .eq(SceneDownloadLog::getRecStatus, RecStatus.VALID.code())
+                .set(SceneDownloadLog::getUpdateTime, Calendar.getInstance().getTime())
+                .set(SceneDownloadLog::getDownloadStatus, status));
+    }
+
+    @Override
+    public void deleteStatusByNum(String sceneNum) {
+
+        this.update(new LambdaUpdateWrapper<SceneDownloadLog>()
+                .eq(SceneDownloadLog::getSceneCode, sceneNum)
+                .eq(SceneDownloadLog::getRecStatus, RecStatus.VALID.code())
+                .eq(SceneDownloadLog::getDownloadStatus, DownloadStatus.SUCCESS.code())
+                .set(SceneDownloadLog::getUpdateTime, Calendar.getInstance().getTime())
+                .set(SceneDownloadLog::getRecStatus, RecStatus.DISABLE.code()));
+
+    }
+
+    @Override
+    public SceneDownloadLog findByStatusAndNum(String sceneNum, Integer status) {
+
+        List<SceneDownloadLog> list = this.list(new QueryWrapper<SceneDownloadLog>()
+                .eq("tb_status", TbStatus.VALID.code())
+                .eq("rec_status", RecStatus.VALID.code())
+                .eq("scene_code", sceneNum)
+                .eq("download_status", status)
+                .orderByDesc("id"));
+        if(CollUtil.isEmpty(list)){
+            return null;
+        }
+        return list.get(0);
+
+    }
+
 }

+ 25 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneExtServiceImpl.java

@@ -0,0 +1,25 @@
+package com.fdkankan.scene.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.scene.entity.SceneExt;
+import com.fdkankan.scene.mapper.ISceneExtMapper;
+import com.fdkankan.scene.service.ISceneExtService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 场景表 服务实现类
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2021-12-30
+ */
+@Service
+public class SceneExtServiceImpl extends ServiceImpl<ISceneExtMapper, SceneExt> implements ISceneExtService {
+
+    @Override
+    public SceneExt getBySceneId(long sceneId) {
+        return this.getOne(new LambdaQueryWrapper<SceneExt>().eq(SceneExt::getSceneId, sceneId));
+    }
+}

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

@@ -1,11 +1,32 @@
 package com.fdkankan.scene.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.constant.RecStatus;
+import com.fdkankan.common.constant.TbStatus;
+import com.fdkankan.common.constant.UploadStatus;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.scene.entity.SceneDownloadLog;
 import com.fdkankan.scene.entity.SceneFileBuild;
+import com.fdkankan.scene.entity.SceneFileUpload;
 import com.fdkankan.scene.mapper.ISceneFileBuildMapper;
 import com.fdkankan.scene.service.ISceneFileBuildService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.scene.service.ISceneFileUploadService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Objects;
+
 /**
  * <p>
  * 场景文件建模表 服务实现类
@@ -14,7 +35,125 @@ import org.springframework.stereotype.Service;
  * @author dengsixing
  * @since 2021-12-23
  */
+@Slf4j
 @Service
 public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper, SceneFileBuild> implements ISceneFileBuildService {
 
+    @Autowired
+    ISceneFileUploadService sceneFileUploadService;
+
+    @Override
+    public SceneFileBuild findByFileId(String fileId) {
+
+        List<SceneFileBuild> list = this.list(new QueryWrapper<SceneFileBuild>()
+                .eq("tb_status", TbStatus.VALID.code())
+                .eq("rec_status", RecStatus.VALID.code())
+                .eq("file_id", fileId)
+                .orderByDesc("id"));
+        if(CollUtil.isEmpty(list))
+            return null;
+
+        return list.get(0);
+    }
+
+    @Override
+    public boolean uploadSuccess(String fileId, StringBuilder filePathBuffer) {
+        SceneFileBuild sceneFileBuild = findByFileId(fileId);
+        if (Objects.isNull(sceneFileBuild))
+            return false;
+
+        Long uploadSuccessCount = sceneFileUploadService.countUploadSuccessByFileId(fileId);
+        sceneFileBuild.setUploadStatus(UploadStatus.SUCCESS.code());
+        sceneFileBuild.setChunks(Integer.valueOf(uploadSuccessCount.toString()));
+        sceneFileBuild.setUpdateTime(Calendar.getInstance().getTime());
+        this.updateById(sceneFileBuild);
+        return true;
+    }
+
+    @Override
+    public SceneFileBuild findByUnicode(String unicode) {
+        List<SceneFileBuild> list = this.list(new QueryWrapper<SceneFileBuild>()
+                .eq("tb_status", TbStatus.VALID.code())
+                .eq("rec_status", RecStatus.VALID.code())
+                .eq("unicode", unicode)
+                .orderByDesc("id"));
+        if(CollUtil.isEmpty(list))
+            return null;
+
+        return list.get(0);
+    }
+
+    @Async
+    @Override
+    public void unzipSingleFile(String filePath) {
+        log.info("文件路径:{}", filePath);
+        File file = new File(filePath);
+        if (file.exists()){
+            log.error(filePath + ":文件不存在");
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5038);
+        }
+        String parentFilePath = file.getParentFile().getPath();
+        log.info("解压目标目录:{}", parentFilePath);
+        StringBuffer exec = new StringBuffer(" tar xvf  ");
+        exec.append(filePath);
+        exec.append(" -C ").append(parentFilePath).append(File.separator);
+        System.out.println(exec.toString());
+        String[] cmdExec = new String[]{"/bin/sh", "-c", exec.toString()};
+        int code = executeLinuxShell(cmdExec);
+        if (code == 0){
+            log.info("解压完成,文件路径:{}, 开始执行删除压缩文件", filePath);
+            file.delete();
+        }else {
+            log.error("解压失败,文件路径:{},解压状态:{}", filePath, code);
+        }
+    }
+
+    private int executeLinuxShell(String[] command) {
+        Process shellProcess = null;
+        BufferedReader shellErrorResultReader = null;
+        BufferedReader shellInfoResultReader = null;
+        try {
+            shellProcess = Runtime.getRuntime().exec(command);
+            shellErrorResultReader = new BufferedReader(new InputStreamReader(shellProcess.getErrorStream()));
+            shellInfoResultReader = new BufferedReader(new InputStreamReader(shellProcess.getInputStream()));
+            String infoLine;
+            while ((infoLine = shellInfoResultReader.readLine()) != null) {
+                log.info("linux环境脚本执行信息:{}", infoLine);
+            }
+            String errorLine;
+            while ((errorLine = shellErrorResultReader.readLine()) != null) {
+                log.warn("linux环境脚本执行信息:{}", errorLine);
+            }
+            // 等待程序执行结束并输出状态
+            int exitCode = shellProcess.waitFor();
+            if (0 == exitCode) {
+                log.info("linux环境脚本执行成功");
+            } else {
+                log.error("linux环境脚本执行失败:" + exitCode);
+            }
+            return exitCode;
+        } catch (Exception e) {
+            log.error("linux环境shell脚本执行错误", e);
+            return 1;
+        } finally {
+            if (null != shellInfoResultReader) {
+                try {
+                    shellInfoResultReader.close();
+                } catch (IOException e) {
+                    log.error("linux环境脚本流文件关闭异常:", e);
+                }
+            }
+            if (null != shellErrorResultReader) {
+                try {
+                    shellErrorResultReader.close();
+                } catch (IOException e) {
+                    log.error("linux环境脚本流文件关闭异常:", e);
+                }
+            }
+            if (null != shellProcess) {
+                shellProcess.destroy();
+            }
+        }
+    }
+
 }

+ 34 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneFileUploadServiceImpl.java

@@ -1,11 +1,18 @@
 package com.fdkankan.scene.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fdkankan.common.constant.RecStatus;
+import com.fdkankan.common.constant.TbStatus;
+import com.fdkankan.common.constant.UploadStatus;
 import com.fdkankan.scene.entity.SceneFileUpload;
 import com.fdkankan.scene.mapper.ISceneFileUploadMapper;
 import com.fdkankan.scene.service.ISceneFileUploadService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 场景文件上传表 服务实现类
@@ -17,4 +24,31 @@ import org.springframework.stereotype.Service;
 @Service
 public class SceneFileUploadServiceImpl extends ServiceImpl<ISceneFileUploadMapper, SceneFileUpload> implements ISceneFileUploadService {
 
+
+    @Override
+    public Long countUploadSuccessByFileId(String fileId) {
+
+        return this.count(new QueryWrapper<SceneFileUpload>()
+                            .eq("tb_status", TbStatus.VALID.code())
+                            .eq("rec_status", RecStatus.VALID.code())
+                            .eq("file_id", fileId)
+                            .eq("upload_status", UploadStatus.SUCCESS.code()));
+
+    }
+
+    @Override
+    public SceneFileUpload findByFileIdAndChunk(String fileId, Integer chunk) {
+
+        List<SceneFileUpload> list = this.list(new QueryWrapper<SceneFileUpload>()
+                .eq("tb_status", TbStatus.VALID.code())
+                .eq("rec_status", RecStatus.VALID.code())
+                .eq("file_id", fileId)
+                .eq("chunk", chunk)
+                .orderByDesc("id"));
+
+        if(CollUtil.isEmpty(list))
+            return  null;
+
+        return list.get(0);
+    }
 }

Datei-Diff unterdrückt, da er zu groß ist
+ 1923 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProAppServiceImpl.java


+ 65 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProEditExtServiceImpl.java

@@ -1,11 +1,25 @@
 package com.fdkankan.scene.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fdkankan.common.constant.RecStatus;
+import com.fdkankan.common.constant.TbStatus;
+import com.fdkankan.common.response.ResultData;
+import com.fdkankan.scene.entity.ScenePro;
+import com.fdkankan.scene.entity.SceneProEdit;
 import com.fdkankan.scene.entity.SceneProEditExt;
 import com.fdkankan.scene.mapper.ISceneProEditExtMapper;
 import com.fdkankan.scene.service.ISceneProEditExtService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.scene.service.ISceneProEditService;
+import com.fdkankan.scene.service.ISceneProService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+import java.util.stream.Collectors;
+
 /**
  * <p>
  * pro场景编辑数据表 服务实现类
@@ -17,4 +31,55 @@ import org.springframework.stereotype.Service;
 @Service
 public class SceneProEditExtServiceImpl extends ServiceImpl<ISceneProEditExtMapper, SceneProEditExt> implements ISceneProEditExtService {
 
+    @Autowired
+    ISceneProService sceneProService;
+    @Autowired
+    ISceneProEditService sceneProEditService;
+
+    @Override
+    public SceneProEditExt getByProEditId(Long proEditId) {
+        return this.getOne(new QueryWrapper<SceneProEditExt>().eq("pro_edit_id", proEditId));
+    }
+
+    @Override
+    public ResultData updateimageVersion(String sceneNum) throws Exception {
+
+        List<ScenePro> sceneProList = sceneProService.list(
+                new LambdaQueryWrapper<ScenePro>()
+                        .select(ScenePro::getId)
+                        .eq(ScenePro::getTbStatus, TbStatus.VALID.code())
+                        .eq(ScenePro::getSceneCode, sceneNum)
+                        .eq(ScenePro::getRecStatus, RecStatus.VALID.code()));
+        if(CollUtil.isEmpty(sceneProList)){
+            ResultData.ok(0);
+        }
+
+        List<Long> sceneProIds = sceneProList.stream().map(scenePro -> {
+            return scenePro.getId();
+        }).collect(Collectors.toList());
+
+        List<SceneProEditExt> extList = this.list(new LambdaQueryWrapper<SceneProEditExt>()
+                .in(SceneProEditExt::getProId, sceneProIds));
+        if(CollUtil.isEmpty(extList)){
+            ResultData.ok(0);
+        }
+        extList.stream().forEach(ext -> {
+            ext.setImagesVersion(ext.getImagesVersion()+1);
+        });
+
+        this.updateBatchById(extList);
+
+        return ResultData.ok(extList.size());
+    }
+
+    @Override
+    public SceneProEditExt findEdit(ScenePro scenePro) {
+        SceneProEdit edit = sceneProEditService.getOne(
+                new LambdaQueryWrapper<SceneProEdit>()
+                        .select(SceneProEdit::getId)
+                        .eq(SceneProEdit::getProId, scenePro.getId())
+                        .eq(SceneProEdit::getRecStatus, RecStatus.VALID.code()));
+
+        return this.getOne(new LambdaQueryWrapper<SceneProEditExt>().eq(SceneProEditExt::getProEditId, edit.getId()));
+    }
 }

+ 51 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProEditServiceImpl.java

@@ -1,11 +1,28 @@
 package com.fdkankan.scene.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.common.constant.RecStatus;
+import com.fdkankan.common.constant.TbStatus;
+import com.fdkankan.common.response.ResultData;
+import com.fdkankan.scene.entity.ScenePro;
 import com.fdkankan.scene.entity.SceneProEdit;
+import com.fdkankan.scene.entity.SceneProEditExt;
+import com.fdkankan.scene.mapper.ISceneProEditExtMapper;
 import com.fdkankan.scene.mapper.ISceneProEditMapper;
+import com.fdkankan.scene.service.ISceneProEditExtService;
 import com.fdkankan.scene.service.ISceneProEditService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.scene.service.ISceneProService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
 /**
  * <p>
  * pro场景编辑数据表 服务实现类
@@ -17,4 +34,38 @@ import org.springframework.stereotype.Service;
 @Service
 public class SceneProEditServiceImpl extends ServiceImpl<ISceneProEditMapper, SceneProEdit> implements ISceneProEditService {
 
+    @Autowired
+    ISceneProEditExtMapper sceneProEditExtMapper;
+    @Autowired
+    ISceneProService sceneProService;
+    @Autowired
+    ISceneProEditService sceneProEditService;
+    @Autowired
+    ISceneProEditExtService sceneProEditExtService;
+
+    @Override
+    public SceneProEdit findByProId(Long proId) {
+        return this.getOne(new QueryWrapper<SceneProEdit>()
+                            .eq("tb_status", TbStatus.VALID.code())
+                            .eq("rec_status", RecStatus.VALID.code())
+                            .eq("pro_id", proId));
+
+    }
+
+    @Override
+    public int findDownloadNum() {
+        return sceneProEditExtMapper.selectCntDownloadNum();
+    }
+
+    @Override
+    public void updateImageVersionByProId(Long id) {
+        SceneProEdit sceneProEdit = this.findByProId(id);
+        if(Objects.isNull(sceneProEdit)){
+            return;
+        }
+        sceneProEditExtMapper.updateImageVersionByProEditId(sceneProEdit.getId());
+    }
+
+
+
 }

+ 6 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProExtServiceImpl.java

@@ -1,5 +1,6 @@
 package com.fdkankan.scene.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fdkankan.scene.entity.SceneProExt;
 import com.fdkankan.scene.mapper.ISceneProExtMapper;
 import com.fdkankan.scene.service.ISceneProExtService;
@@ -17,4 +18,9 @@ import org.springframework.stereotype.Service;
 @Service
 public class SceneProExtServiceImpl extends ServiceImpl<ISceneProExtMapper, SceneProExt> implements ISceneProExtService {
 
+
+    @Override
+    public SceneProExt findBySceneProId(Long sceneProId) {
+        return this.getOne(new LambdaQueryWrapper<SceneProExt>().eq(SceneProExt::getSceneProId, sceneProId));
+    }
 }

Datei-Diff unterdrückt, da er zu groß ist
+ 4418 - 6
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java


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

@@ -1,11 +1,17 @@
 package com.fdkankan.scene.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.common.constant.RecStatus;
+import com.fdkankan.common.constant.TbStatus;
 import com.fdkankan.scene.entity.SceneResourceCamera;
 import com.fdkankan.scene.mapper.ISceneResourceCameraMapper;
 import com.fdkankan.scene.service.ISceneResourceCameraService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 场景资源和相机关联表 服务实现类
@@ -17,4 +23,17 @@ import org.springframework.stereotype.Service;
 @Service
 public class SceneResourceCameraServiceImpl extends ServiceImpl<ISceneResourceCameraMapper, SceneResourceCamera> implements ISceneResourceCameraService {
 
+    @Override
+    public void deleteByCameraId(Long id) {
+        this.update(new LambdaUpdateWrapper<SceneResourceCamera>()
+                .eq(SceneResourceCamera::getCameraId, id)
+                .set(SceneResourceCamera::getRecStatus, RecStatus.DISABLE.code()));
+    }
+
+    @Override
+    public List<SceneResourceCamera> findListByCameraId(Long id) {
+        return this.list(new LambdaQueryWrapper<SceneResourceCamera>()
+                .eq(SceneResourceCamera::getRecStatus, RecStatus.VALID.code())
+                .eq(SceneResourceCamera::getTbStatus, TbStatus.VALID.code()).eq(SceneResourceCamera::getCameraId, id));
+    }
 }

+ 6 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneResourceCooperationServiceImpl.java

@@ -1,5 +1,7 @@
 package com.fdkankan.scene.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
 import com.fdkankan.scene.entity.SceneResourceCooperation;
 import com.fdkankan.scene.mapper.ISceneResourceCooperationMapper;
 import com.fdkankan.scene.service.ISceneResourceCooperationService;
@@ -17,4 +19,8 @@ import org.springframework.stereotype.Service;
 @Service
 public class SceneResourceCooperationServiceImpl extends ServiceImpl<ISceneResourceCooperationMapper, SceneResourceCooperation> implements ISceneResourceCooperationService {
 
+    @Override
+    public void deleteByCooperationId(Long id) {
+        this.remove(new LambdaQueryWrapper<SceneResourceCooperation>().eq(SceneResourceCooperation::getSceneCooperationId, id));
+    }
 }

+ 55 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneResourceServiceImpl.java

@@ -1,11 +1,23 @@
 package com.fdkankan.scene.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.common.constant.RecStatus;
+import com.fdkankan.common.constant.TbStatus;
 import com.fdkankan.scene.entity.SceneResource;
+import com.fdkankan.scene.entity.SceneResourceCamera;
+import com.fdkankan.scene.entity.SceneResourceCooperation;
 import com.fdkankan.scene.mapper.ISceneResourceMapper;
+import com.fdkankan.scene.service.ISceneResourceCameraService;
+import com.fdkankan.scene.service.ISceneResourceCooperationService;
 import com.fdkankan.scene.service.ISceneResourceService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+import java.util.stream.Collectors;
+
 /**
  * <p>
  * 场景资源表 服务实现类
@@ -17,4 +29,47 @@ import org.springframework.stereotype.Service;
 @Service
 public class SceneResourceServiceImpl extends ServiceImpl<ISceneResourceMapper, SceneResource> implements ISceneResourceService {
 
+    @Autowired
+    ISceneResourceCooperationService sceneResourceCooperationService;
+    @Autowired
+    ISceneResourceCameraService sceneResourceCameraService;
+
+    @Override
+    public List<SceneResource> findByCooperationId(Long id) {
+
+        List<SceneResourceCooperation> sceneResourceCooperationList = sceneResourceCooperationService.list(
+                new LambdaQueryWrapper<SceneResourceCooperation>()
+                        .select(SceneResourceCooperation::getSceneResourceId)
+                        .eq(SceneResourceCooperation::getTbStatus, TbStatus.VALID.code())
+                        .eq(SceneResourceCooperation::getRecStatus, RecStatus.VALID.code())
+                        .eq(SceneResourceCooperation::getSceneCooperationId, id));
+        if(CollUtil.isEmpty(sceneResourceCooperationList)){
+            return null;
+        }
+        List<Long> sceneResIdList = sceneResourceCooperationList.stream().map(srCoo -> {
+            return srCoo.getSceneResourceId();
+        }).collect(Collectors.toList());
+
+        return this.list(new LambdaQueryWrapper<SceneResource>().in(SceneResource::getId, sceneResIdList));
+    }
+
+    @Override
+    public List<SceneResource> findByCameraId(Long id) {
+
+        List<SceneResourceCamera> sceneResourceCameraList = sceneResourceCameraService.list(
+                new LambdaQueryWrapper<SceneResourceCamera>()
+                        .select(SceneResourceCamera::getSceneResourceId)
+                        .eq(SceneResourceCamera::getTbStatus, TbStatus.VALID.code())
+                        .eq(SceneResourceCamera::getRecStatus, RecStatus.VALID.code())
+                        .eq(SceneResourceCamera::getCameraId, id));
+        if(CollUtil.isEmpty(sceneResourceCameraList)){
+            return null;
+        }
+        List<Long> sceneResIdList = sceneResourceCameraList.stream().map(srCoo -> {
+            return srCoo.getSceneResourceId();
+        }).collect(Collectors.toList());
+
+        return this.list(new LambdaQueryWrapper<SceneResource>().in(SceneResource::getId, sceneResIdList));
+
+    }
 }

Datei-Diff unterdrückt, da er zu groß ist
+ 1054 - 2
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneServiceImpl.java


+ 74 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/Scene3dfamilyVO.java

@@ -0,0 +1,74 @@
+package com.fdkankan.scene.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fdkankan.scene.entity.Scene3dfamily;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+@Builder
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Scene3dfamilyVO{
+
+    private Long id;
+
+    /**
+     * 场景码
+     */
+    private String sceneCode;
+
+    /**
+     * zip包存放路径
+     */
+    private String zipLink;
+
+    /**
+     * 状态 1 - 打包完成  0 - 打包中
+     */
+    private Integer zipStatus;
+
+    /**
+     * 打包开始时间
+     */
+    private Date zipStartTime;
+
+    /**
+     * 打包结束时间
+     */
+    private Date zipEndTime;
+
+    /**
+     * 创建人
+     */
+    private Long createUesr;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新人
+     */
+    private Long updateUesr;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 记录的状态,A: 生效,I: 禁用
+     */
+    private String recStatus;
+
+    /**
+     * 0-有效,1-删除
+     */
+    private Integer tbStatus;
+}

+ 187 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/SceneEditVO.java

@@ -0,0 +1,187 @@
+package com.fdkankan.scene.vo;
+
+import lombok.Data;
+
+/**
+ * Created by Hb_zzZ on 2019/6/26.
+ */
+@Data
+public class SceneEditVO {
+
+    private String sceneNum;
+
+    /**
+     * scene.json的数据内容
+     */
+    private String sceneData;
+
+    /**
+     * floorplan.json的数据
+     */
+    private String floor;
+
+    /**
+     * 画墙重算需要的floor.json
+     */
+    private String webFloor;
+
+    /**
+     * json数据
+     */
+    private String data;
+
+    /**
+     * 热点数据
+     */
+    private String hotData;
+
+    /**
+     * overlay数据
+     */
+    private String overlayData;
+
+    /**
+     * 0表示修改,-1表示删除,1表示添加
+     */
+    private String type;
+
+    private String sid;
+
+    /**
+     * 媒体文件数据
+     */
+    private String info;
+
+    private String name;
+
+    /**
+     * 录屏数据
+     */
+    private String camerasData;
+
+    /**
+     * 为1删除tour文件
+     */
+    private String index;
+
+    /**
+     * 场景秘钥
+     */
+    private String sceneKey;
+
+    /**
+     * logo大小
+     */
+    private String size;
+
+    /**
+     * logo类型
+     */
+    private String logoType;
+
+    /**
+     * 背景音乐名称
+     */
+    private String musicName;
+
+    /**
+     * 初始封面数据
+     */
+    private String initialPoint;
+
+    private String tourList;
+
+    private String screencapLen;
+
+    /**
+     * 背景音乐
+     */
+    private String bgMusic;
+
+    /**
+     * 是否上传热点
+     */
+    private String hotFlag;
+
+    /**
+     * 场景名称
+     */
+    private String sceneName;
+
+    /**
+     * 场景描述
+     */
+    private String sceneDec;
+
+    /**
+     * 场景类型
+     */
+    private String sceneType;
+
+    /**
+     * 地面logo类型
+     */
+    private String floorLogoType;
+
+    /**
+     * 地面logo大小
+     */
+    private String floorLogoSize;
+
+    private String entry;
+
+    private String sceneIndex;
+
+    /**
+     * 选择的类型,sound为screencapVoiceSound,file为screencapVoiceSrc
+     */
+    private String screencapVoiceType;
+
+    private String capData;
+
+    private String frameData;
+
+    private String playData;
+
+    private String id;
+
+    /**
+     * 录屏图片
+     */
+    private String screencapThumb;
+
+    /**
+     * 录制方式,1原始过渡,2平滑过渡
+     */
+    private String recordType;
+
+    private String mapVisi;
+
+    private String tourVisi;
+
+    private String vrVisi;
+
+    private String rulerVisi;
+
+    private String cadImgVisi;
+
+    /**
+     * cad平面图
+     */
+    private String floorPlanPng;
+
+    private String panoVisi;
+
+    private String m2dVisi;
+
+    private String m3dVisi;
+
+    private String measureVisi;
+
+    private String styleName;
+
+    /**
+     * 旋转角度
+     */
+    private String floorPlanAngle;
+}

+ 171 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/SceneParamVO.java

@@ -0,0 +1,171 @@
+package com.fdkankan.scene.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class SceneParamVO implements Serializable {
+
+    private static final long serialVersionUID = 3939730189762555357L;
+
+    private Long sceneId;
+
+    private String type;
+
+    private String item;
+
+    private String order;
+
+    private String searchKey;
+
+    private String keywordType;
+
+    private String guideSid;
+
+    private String guideName;
+
+    private String sceneNum;
+
+    private String childName;
+    //场景的二维设计图数据
+    private String geoData;
+    //	场景序号
+    private String index;
+    //模型的中心(可以忽略)
+    private String center;
+    //模型的缩放系数
+    private String zoom;
+    //模型测量线的缩放系数
+    private String realScale;
+    //场景二维设计图
+    private String imgData;
+    //场景标题
+    private String sceneName;
+    //场景描述信息
+    private String sceneDec;
+    //场景所属行业
+    private String sceneType;
+    //场景密码
+    private String sceneKey;
+    //版本号,每编辑一次加1
+    private String version;
+    //场景封面图是否默认
+    private String thumbImg;
+    //场景封面图(大)
+    private String thumbBigImg;
+    //场景封面图(小)
+    private String thumbSmallImg;
+    //初始点的uuid
+    private String currentPanoId;
+    //	地面的logo是否默认
+    private String floorLogo;
+    // 地面logo图片
+    private String floorLogoImg;
+    // 地面logo图片的大小
+    private String floorLogoSize;
+    // 模型贴图的风格
+    private String sceneIndex;
+    // 模型的初始信息:坐标,朝向等
+    private String entry;
+    // 场景封面图(移动端,鱼眼)
+    private String thumbFishBigImg;
+    // 设计页面的元素信息
+    private String floorPlaneInfo;
+
+    private String visiblePanos;
+
+    private String hotData;
+
+    private String data;
+
+    private String solveType;
+
+    private Long feedBackId;
+    // 排序
+    private String sceneInterest;
+
+    private String phone;
+
+    private String message;
+    /**
+     * 普通录屏文件地址
+     */
+    private String screencapMusic;
+
+    private String originalFileName;
+
+    private Integer sceneScheme;
+
+    /**
+     * 源相机sn
+     */
+    private String sourceSn;
+
+    /**
+     * 目标相机sn
+     */
+    private String targetSn;
+
+    /**
+     * 源手机验证码
+     */
+    private String sourceCode;
+
+    /**
+     * 目标手机验证码
+     */
+    private String targetCode;
+
+    private String snCode;
+
+    private String num;
+
+    private String objName;
+
+    private String mntName;
+
+    private Long userId;
+
+    private String userName;
+
+    private String userIds;
+
+    private String cameraIds;
+
+    private String nums;
+
+    private List<String> numList;
+
+    private Long folderId;
+
+    /**
+     * true,计算成功的,false:计算失败的,null:全部
+     */
+    private Boolean calculated;
+
+    private Integer folderType;
+
+    private Integer sceneSource;
+
+    private Date startTime;
+
+    private Date endTime;
+
+    /**
+     * 用户拥有的相机id列表
+     */
+    private String ownCameraIds;
+
+    private List<String> sceneNumList;
+
+    private Long cameraId;
+
+    private String likeNum;
+
+    private int pageNum;
+
+    private int pageSize;
+}

+ 210 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/SceneProEditVO.java

@@ -0,0 +1,210 @@
+package com.fdkankan.scene.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+
+import java.util.Date;
+
+public class SceneProEditVO {
+
+    private Long id;
+
+    /**
+     * pro场景id
+     */
+    private Long proId;
+
+    /**
+     * 大场景的密钥
+     */
+    private String sceneKey;
+
+    /**
+     * 展示页面密码,0不需要,1需要
+     */
+    private Integer needKey;
+
+    /**
+     * 版本
+     */
+    private Integer version;
+
+    /**
+     * 表示缩略图是否存在
+     */
+    private Integer thumbStatus;
+
+    /**
+     * 地面点位标志
+     */
+    private String markerLogo;
+
+    /**
+     * 0表示默认,1表示自己上传
+     */
+    private String floorLogo;
+
+    /**
+     * 标记大小
+     */
+    private Integer floorLogoSize;
+
+    /**
+     * 要上传的热点的id集合,用逗号隔开
+     */
+    private String hotsIds;
+
+    /**
+     * 表示初始点信息
+     */
+    private String entry;
+
+    /**
+     * 背景音乐名称
+     */
+    private String bgMusic;
+
+    /**
+     * 记录的状态,A: 生效,I: 禁用
+     */
+    private String recStatus;
+
+    /**
+     * 普通录屏文件地址
+     */
+    private String screencapVoiceSrc;
+
+    /**
+     * 录音文件地址
+     */
+    private String screencapVoiceSound;
+
+    /**
+     * 同步录音地址
+     */
+    private String screencapVoiceSoundsync;
+
+    /**
+     * 选择的类型,sound为screencapVoiceSound,file为screencapVoiceSrc,soundsync为screencap_voice_soundsync
+     */
+    private String screencapVoiceType;
+
+    /**
+     * 录屏文件地址
+     */
+    private String playData;
+
+    /**
+     * 重新建模的版本
+     */
+    private Integer floorEditVer;
+
+    /**
+     * 正式发布重新建模的版本
+     */
+    private Integer floorPublishVer;
+
+    /**
+     * 录屏图片存放文件
+     */
+    private String screencapThumb;
+
+    /**
+     * 分享的logo和生成二维码的logo
+     */
+    private String shareLogo;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    private Integer mapVisi;
+
+    /**
+     * 自动导览
+     */
+    private Integer tourVisi;
+
+    /**
+     * vr模式
+     */
+    private Integer vrVisi;
+
+    /**
+     * 展示页面是否显示标尺
+     */
+    private Integer rulerVisi;
+
+    /**
+     * 展示页面cad图在平面图是否显示
+     */
+    private Integer cadImgVisi;
+
+    /**
+     * cad平面图
+     */
+    private String floorPlanPng;
+
+    /**
+     * cad平面图参数
+     */
+    private String cadInfo;
+
+    private Integer panoVisi;
+
+    private Integer m2dVisi;
+
+    private Integer m3dVisi;
+
+    private Integer measureVisi;
+
+    /**
+     * 肖安需求,场景于场景之间的关联
+     */
+    private String linkScene;
+
+    private String overlay;
+
+    /**
+     * 是否显示底部logo,1显示,0不显示
+     */
+    private Boolean showLogoBottom;
+
+    /**
+     * 全景图版本号
+     */
+    private Integer imagesVersion;
+
+    /**
+     * 上传的背景音乐
+     */
+    private String bgMusicName;
+
+    private Boolean jumpScene;
+
+    /**
+     * 旋转角度
+     */
+    private String floorPlanAngle;
+
+    /**
+     * 场景下载次数
+     */
+    private Integer downloadNum;
+
+    /**
+     * 绿幕抠图json数据
+     */
+    private String videosUser;
+
+    /**
+     * 大场景序号(随心装场景码)
+     */
+    private String vrNum;
+
+}

+ 181 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/SceneProVO.java

@@ -0,0 +1,181 @@
+package com.fdkankan.scene.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+@Builder
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class SceneProVO {
+
+    private Long id;
+
+    /**
+     * 场景名称
+     */
+    private String sceneName;
+
+    /**
+     * 场景描述
+     */
+    private String sceneDec;
+
+    /**
+     * 场景的链接地址
+     */
+    private String webSite;
+
+    /**
+     * 场景缩略图
+     */
+    private String thumb;
+
+    /**
+     * 用户表t_user的id
+     */
+    private Long userId;
+
+    /**
+     * 相机主表t_camera的id
+     */
+    private Long cameraId;
+
+    /**
+     * 场景logo
+     */
+    private String sceneLogo;
+
+    /**
+     * 大场景序号
+     */
+    private String sceneCode;
+
+    /**
+     * 0-其他,1-文博,2-地产,3-电商,4-餐饮,5-家居,99-一件换装虚拟房源
+     */
+    private Integer sceneType;
+
+    /**
+     * 浏览次数
+     */
+    private Integer viewCount;
+
+    /**
+     * 拍摄数量
+     */
+    private Integer shootCount;
+
+    /**
+     * 点位视频
+     */
+    private String videos;
+
+    /**
+     * 要gps定位
+     */
+    private String gps;
+
+    /**
+     * 方案:1-双目,2-转台,3-六目,4-八目,10-获取4k图,11-获取2k,12-获取1k
+     */
+    private Integer sceneScheme;
+
+    /**
+     * 记录的状态,A: 生效,I: 禁用
+     */
+    private String recStatus;
+
+    /**
+     * 算法类型(V2,V3)
+     */
+    private String buildType;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 0-有效,1-删除
+     */
+    private Integer tbStatus;
+
+    private Long folderId;
+
+    private Integer sceneStatus;
+
+    /**
+     * 原始的大场景数据(七牛)
+     */
+    private String dataSource;
+
+    /**
+     * 0表示未付款,1表示付款了,-1表示欠费,-2表示容量不足
+     */
+    private Integer payStatus;
+
+    /**
+     * 手机id
+     */
+    private String phoneId;
+
+    /**
+     * 1表示推荐,0表示正常
+     */
+    private Integer recommend;
+
+    /**
+     * 所有资源文件名
+     */
+    private String filesName;
+
+    /**
+     * 算法类型
+     */
+    private String algorithm;
+
+    /**
+     * 服务器的服务商
+     */
+    private String ecs;
+
+    /**
+     * 使用容量
+     */
+    private Long space;
+
+    /**
+     * 固件版本
+     */
+    private String firmwareVersion;
+
+    /**
+     * 计算时间(秒为单位)
+     */
+    private Long computeTime;
+
+    /**
+     * 场景来源,相机拍摄10以内表示,1表示八目,2双目,3转台,4 激光  其他来源10以上,11:一键换装,12:123看房,13文通虚拟场景
+     */
+    private Integer sceneSource;
+
+    /**
+     * 大场景序号(随心装场景码)
+     */
+    private String vrnum;
+
+    private String unicode;
+
+
+}

+ 0 - 17
4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/SceneProVo.java

@@ -1,17 +0,0 @@
-package com.fdkankan.scene.vo;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@Builder
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-public class SceneProVo {
-
-    private Long userId;
-
-    private Long folderId;
-}

+ 234 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/SceneVO.java

@@ -0,0 +1,234 @@
+package com.fdkankan.scene.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+@Data
+public class SceneVO implements Serializable{
+
+    private static final long serialVersionUID = 2454435822930272529L;
+
+    private Long id;
+
+    private String thumb;
+
+    private String sceneKey;
+
+    private String sceneName;
+
+    private String sceneDec;
+
+    private int sceneType;
+
+    private int thumbImg;
+
+    private int version;
+
+    private String markerLogo;
+
+    private String floorLogo;
+
+    private int floorLogoSize;
+
+    private String entry;
+
+    private String createTime;
+
+    private int shootCount;
+
+    private int status;
+
+    private int sceneIndex;
+
+    private String hasBGM;
+
+    private int cameraType;
+
+    private int isPublic;
+
+    private String gps;
+
+    private String childName;
+
+    private String userName;
+
+    private String nickName;
+
+    private int viewCount;
+
+    private String webSite;
+
+    private String dataSource;
+
+    private int payStatus;
+
+    private String phoneId;
+
+    private String num;
+
+    private int recommend;
+
+    private int thumbStatus;
+
+    private String hotsIds;
+
+    private String initialPointId;
+
+    private int style;
+
+    private int sceneScheme;
+
+    private String bgMusic;
+
+    private Long userId;
+
+    private Long cameraId;
+
+    private BigInteger space;
+
+    private Long createDate;
+
+    private String shareLogo;
+
+    private int mapVisi;
+
+    private int tourVisi;
+
+    private int vrVisi;
+
+
+    /**
+     * 普通录屏文件地址
+     */
+    private String screencapVoiceSrc;
+
+    /**
+     * 录音文件地址
+     */
+    private String screencapVoiceSound;
+
+    /**
+     * 同步录音文件地址
+     */
+    private String screencapVoiceSoundsync;
+
+    /**
+     * 选择的类型,sound为screencapVoiceSound,file为screencapVoiceSrc
+     */
+    private String screencapVoiceType;
+
+    /**
+     * 录屏文件地址
+     */
+    private String playData;
+
+
+    /**
+     * 重新建模的版本
+     */
+    private int floorEditVer;
+
+    /**
+     * 正式发布重新建模的版本
+     */
+    private int floorPublishVer;
+
+    /**
+     * 录屏图片
+     */
+    private String screencapThumb;
+
+    /**
+     * cad平面图参数
+     */
+    private String cadInfo;
+
+    /**
+     * cad平面图参数
+     */
+    private String floorPlanPng;
+
+    /**
+     * 展示页面是否显示标尺
+     */
+    private int rulerVisi;
+
+    /**
+     * 展示页面cad图在平面图是否显示
+     */
+    private int cadImgVisi;
+
+    private int panoVisi;
+
+    private int m2dVisi;
+
+    private int m3dVisi;
+
+    private int measureVisi;
+
+    private String videos;
+
+    private String snCode;
+
+    private String overlay;
+
+    private Integer showLogoBottom;
+
+    private String recStatus;
+
+    private Integer needKey;
+
+    private String buildType;
+
+    private Integer imagesVersion;
+
+    private String bgMusicName;
+
+    /**
+     * 协作者用户id
+     */
+    private String cooperationUserId;
+
+    private String cooperationUserName;
+
+    private Integer sceneSource;
+
+    private boolean jumpScene;
+
+    /**
+     * 服务器的服务商
+     */
+    private String ecs;
+
+    /**
+     * 场景来源方式,为app提供,0相机,1用户,2协作者
+     */
+    private Integer sceneSourceType;
+
+    /**
+     * 随心装场景码
+     */
+    private String vrNum;
+
+    /**
+     * 旋转角度
+     */
+    private String floorPlanAngle;
+
+    private Integer isFolder;
+
+    private String videosUser;
+
+    private Integer pageNum;
+
+    private Integer pageSize;
+
+}

+ 0 - 15
4dkankan-center-scene/src/main/java/com/fdkankan/scene/vo/TestDto.java

@@ -1,15 +0,0 @@
-package com.fdkankan.scene.vo;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@NoArgsConstructor
-@Data
-public class TestDto {
-
-    @JsonProperty("id")
-    private Integer id;
-    @JsonProperty("name")
-    private String name;
-}

+ 22 - 0
4dkankan-center-scene/src/main/resources/bootstrap.yml

@@ -14,3 +14,25 @@ spring:
       discovery:
         server-addr: 192.168.0.47:8848
         namespace: 4dkankan-dev
+
+prefix:
+  ali: https://4dkk:4dage:com/
+
+oss:
+  type: oss
+
+hot:
+  #获取含有热点的领域路径列表
+  domain:
+    list: https://testopen.4dkankan.com/domainList/hot
+  #删除领域中的热点数据
+  delete: /deleteHot
+
+main:
+  url: https://test.4dkankan.com
+scene:
+  url: show.html?m=
+  pro:
+    url: showProMobile.html?m=
+    new:
+      url: smobile.html?m=

+ 11 - 0
4dkankan-center-scene/src/main/resources/mapper/scene/Scene3dNumMapper.xml

@@ -2,4 +2,15 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fdkankan.scene.mapper.IScene3dNumMapper">
 
+    <select id="findSceneNum" resultType="java.lang.String">
+        select code from t_scene_3d_num_new  where used = 0 AND rec_status = 'A' limit 500
+    </select>
+
+    <select id="updateUsedStatus">
+        update t_scene_3d_num_new set used = 1 , update_time = now() where code in
+        <foreach item="sceneCode" collection="sceneCodes" open="(" separator="," close=")">
+          #{sceneCode}
+        </foreach>
+    </select>
+
 </mapper>

+ 11 - 0
4dkankan-center-scene/src/main/resources/mapper/scene/Scene3dfamilyMapper.xml

@@ -2,4 +2,15 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fdkankan.scene.mapper.IScene3dfamilyMapper">
 
+    <select id="findSceneCodeByCode" resultType="com.fdkankan.scene.entity.Scene3dfamily">
+        select * from t_scene_3dfamily
+        where tb_status = 0
+        AND rec_status = 'A'
+        and scene_code = #{sceneCode}
+        <if test="zipStatus != null">
+            AND zip_status = #{zipStatus}
+        </if>
+        limit 1
+    </select>
+
 </mapper>

+ 5 - 0
4dkankan-center-scene/src/main/resources/mapper/scene/SceneExtMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.scene.mapper.ISceneExtMapper">
+
+</mapper>

+ 262 - 0
4dkankan-center-scene/src/main/resources/mapper/scene/SceneMapper.xml

@@ -2,4 +2,266 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fdkankan.scene.mapper.ISceneMapper">
 
+    <sql id="Scene_column">
+        id, scene_name, scene_dec, web_site, thumb, scene_status,
+        data_source, user_id, pay_status, camera_id, phone_id,
+        scene_type, scene_code, scene_key, recommend, view_count,
+        version, thumb_status, floor_logo, floor_logo_size, rec_status,
+        create_time, update_time, tb_status
+    </sql>
+
+    <sql id="SceneExt_column" >
+        hots_ids, entry, shoot_count, style,
+        gps, scene_scheme, bg_music, screencap_voice_src, screencap_music, screencap_len,
+        screencap_voice_sound, screencap_voice_type, play_data, algorithm, oss,floor_edit_ver,floor_publish_ver,space,screencap_thumb
+    </sql>
+
+
+    <select id="findByNum" resultType="com.fdkankan.scene.entity.ScenePO">
+        SELECT
+        <include refid="Scene_column" />,
+        <include refid="SceneExt_column" />
+        FROM t_scene t
+        left join  t_scene_ext ext on t.id = ext.scene_id
+        WHERE t.scene_code = #{sceneCode}
+        AND t.rec_status = 'A'
+        LIMIT 1
+    </select>
+
+    <select id="queryByParam" resultType="com.fdkankan.scene.vo.SceneVO">
+        SELECT * FROM (
+            SELECT t.id, t.thumb, t.scene_code, t.scene_type, t.scene_name, t.create_time, ext.gps,
+            t.scene_key, t.view_count, t.scene_status, ext.scene_scheme, t.web_site, t.rec_status, t.user_id, t.camera_id
+            FROM t_scene t
+            left join  t_scene_ext ext on t.id = ext.scene_id
+            UNION
+            SELECT t.id, t.thumb, t.scene_code, t.scene_type, t.scene_name, t.create_time, t.gps,
+            'pro' as scene_key, t.view_count, ext.scene_status, t.scene_scheme, t.web_site, t.rec_status, t.user_id, t.camera_id
+            FROM t_scene_pro t
+            left join t_scene_pro_ext ext on t.id = ext.scene_pro_id
+        ) a
+         WHERE rec_status = 'A'
+        <if test= "type != null">
+            and status = #{type}
+        </if>
+        <if test= "searchKey != null" >
+            and (scene_name like CONCAT('%',#{searchKey},'%') or user_id in (${userIds}) or camera_id in (${cameraIds}) )
+        </if>
+        order by create_time desc
+    </select>
+
+    <select id="queryByParamNew" resultType="com.fdkankan.scene.vo.SceneVO">
+        SELECT * FROM (
+            SELECT t.id, t.thumb, t.scene_code, t.scene_type, t.scene_name, t.create_time, ext.gps,
+            t.scene_key, t.view_count, t.scene_status, ext.scene_scheme, t.web_site, t.rec_status, t.user_id, t.camera_id
+            FROM t_scene t
+            left join  t_scene_ext ext on t.id = ext.scene_id
+            UNION
+            SELECT t.id, t.thumb, t.num, t.scene_type, t.scene_name, t.create_time, t.gps,
+            'pro' as scene_key, t.view_count, ext.scene_status, t.scene_scheme, t.web_site, t.rec_status, t.user_id, t.camera_id
+            FROM t_scene_pro t
+            left join t_scene_pro_ext ext on t.id = ext.scene_pro_id
+         ) a
+         WHERE rec_status = 'A'
+         <if test= 'type != null'>
+           and status = #{type}
+         </if>
+         <if test= 'cameraIds != null' >
+           and camera_id in (${cameraIds})
+         </if>
+         <if test= 'ownCameraIds != null' >
+           and camera_id in (${ownCameraIds})
+         </if>
+         <if test= 'sceneName != null' >
+           and scene_name like CONCAT('%',#{sceneName},'%')
+         </if>
+         <if test= 'sceneSource != null' >
+           and scene_name = #{sceneSource}
+         </if>
+    </select>
+
+    <select id="findAllByYesterday" resultType="com.fdkankan.scene.entity.ScenePO">
+        SELECT
+        <include refid="Scene_column" />,
+        <include refid="SceneExt_column" />
+        FROM t_scene t
+        left join  t_scene_ext ext on t.id = ext.scene_id
+        WHERE (DATEDIFF(t.create_time,NOW())=-1)
+        AND t.scene_code in (1, -2)
+        AND pay_status = 0
+        AND scene_scheme != 4
+        AND rec_status = 'A'
+    </select>
+
+    <select id="findAllScene" parameterType="com.fdkankan.scene.vo.SceneParamVO"
+            resultType="com.fdkankan.scene.entity.SceneProPO">
+        select a.* from (
+            SELECT t.id,scene_name, scene_dec, web_site, thumb, scene_type,
+            t.create_time, scene_status, user_id, pay_status, camera_id, scene_code, scene_scheme, shoot_count,
+            rec_status, SPACE, recommend, view_count, 'V1' AS build_type
+            FROM `t_scene` t
+            LEFT JOIN  t_scene_ext ext ON t.id = ext.scene_id
+            UNION
+            SELECT t.id,t.scene_name, t.scene_dec, t.web_site, t.thumb, t.scene_type,
+            t.create_time, ext.scene_status, t.user_id, ext.pay_status, t.camera_id, t.scene_code, t.scene_scheme, t.shoot_count,
+            t.rec_status, ext.space, ext.recommend, t.view_count, t.build_type
+            FROM `t_scene_pro` t
+            LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
+        ) a
+        where 1 = 1 and rec_status = 'A' and a.scene_type != 99
+        <if test="sceneType != null and sceneType!= ''">
+            and a.scene_type = #{sceneType}
+        </if>
+        <if test="sceneScheme != null">
+            <choose>
+                <when test="sceneScheme >= 4">
+                    and a.scene_scheme >= #{sceneScheme}
+                </when>
+                <otherwise>
+                    and a.scene_scheme <![CDATA[ < ]]> #{sceneScheme}
+                </otherwise>
+            </choose>
+        </if>
+        <if test="type != null and type == '11'">
+            and a.scene_status in (1, -2)
+            and a.pay_status = 1
+            and a.build_type = 'V3'
+        </if>
+        <if test="userId != null">
+            and a.user_id = #{userId}
+        </if>
+        <if test="userId == null">
+            and a.scene_status = 1
+            and a.pay_status = 1
+        </if>
+        <choose>
+            <when test="nums != null and nums.size() > 0">
+                <choose>
+                    <when test="sceneName != null and sceneName != '' and cameraId != null">
+                        and (a.scene_name like CONCAT('%',#{sceneName},'%')
+                            or a.scene_code like #{likeNum}
+                            or a.camera_id = #{cameraId}
+                            or a.scene_code in
+                            <foreach collection="numList" item="item" open="(" close=")" separator=",">
+                                #{item}
+                            </foreach>
+                        )
+                    </when>
+                    <when test="sceneName != null and sceneName !=''">
+                        and (a.scene_name like CONCAT('%',#{sceneName},'%')
+                            or a.scene_code like #{likeNum}
+                            or a.scene_code in
+                            <foreach collection="numList" item="item" open="(" close=")" separator=",">
+                                #{item}
+                            </foreach>
+                        )
+                    </when>
+                    <otherwise>
+                        and (a.camera_id = #{cameraId}
+                            or a.scene_code in
+                            <foreach collection="numList" item="item" open="(" close=")" separator=",">
+                                #{item}
+                            </foreach>
+                        )
+                    </otherwise>
+                </choose>
+            </when>
+            <otherwise>
+                <choose>
+                    <when test="sceneName != null and sceneName != '' and cameraId != null">
+                        and (a.scene_name like CONCAT('%',#{sceneName},'%')
+                            or a.scene_code like #{likeNum}
+                            or a.camera_id = #{cameraId}
+                            or a.scene_code in
+                        )
+                    </when>
+                    <when test="sceneName != null and sceneName !=''">
+                        and (a.scene_name like CONCAT('%',#{sceneName},'%')
+                            or a.scene_code like #{likeNum}
+                        )
+                    </when>
+                    <otherwise>
+                        and a.camera_id = #{cameraId}
+                    </otherwise>
+                </choose>
+            </otherwise>
+        </choose>
+        <if test="startTime != null">
+            and a.create_time >= #{startTime}
+        </if>
+        <if test="endTime != null">
+            and a.create_time <![CDATA[ <= ]]> #{endDate}
+        </if>
+        <if test="num != null and num != ''">
+            and a.scene_code = #{num}
+        </if>
+        <if test="order != null and order != ''">
+            order by ${order}
+        </if>
+    </select>
+
+    <select id="unionSearchBySceneName" resultType="com.fdkankan.scene.entity.ScenePO">
+        select a.* from (
+            SELECT t.id,scene_name, scene_dec, web_site, thumb, scene_type,
+            t.create_time, scene_status, user_id, pay_status, camera_id, scene_code, scene_scheme, shoot_count,
+            rec_status, SPACE, recommend, view_count, 'V1' AS build_type
+            FROM `t_scene` t
+            LEFT JOIN  t_scene_ext ext ON t.id = ext.scene_id
+            UNION
+            SELECT t.id,t.scene_name, t.scene_dec, t.web_site, t.thumb, t.scene_type,
+            t.create_time, ext.scene_status, t.user_id, ext.pay_status, t.camera_id, t.scene_code, t.scene_scheme, t.shoot_count,
+            t.rec_status, ext.space, ext.recommend, t.view_count, t.build_type
+            FROM `t_scene_pro` t
+            LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
+        ) a
+        where scene_status = 1 and rec_status = 'A' and pay_status = 1
+        <if test="searchKey != null and searchKey!= ''">
+            AND scene_name LIKE CONCAT('%',#{searchKey},'%')
+        </if>
+    </select>
+    
+    <select id="getOnlySceneList" parameterType="com.fdkankan.scene.vo.SceneParamVO"
+            resultType="com.fdkankan.scene.entity.SceneProPO">
+        select a.* from (
+            SELECT t.id,scene_name, scene_dec, web_site, thumb, scene_type,
+            t.create_time, scene_status, user_id, pay_status, camera_id, scene_code, scene_scheme, shoot_count,
+            rec_status, SPACE, recommend, view_count, 'V1' AS build_type, '2' AS scene_source
+            FROM `t_scene` t
+            LEFT JOIN  t_scene_ext ext ON t.id = ext.scene_id
+            UNION
+            SELECT t.id,t.scene_name, t.scene_dec, t.web_site, t.thumb, t.scene_type,
+            t.create_time, ext.scene_status, t.user_id, ext.pay_status, t.camera_id, t.scene_code, t.scene_scheme, t.shoot_count,
+            t.rec_status, ext.space, ext.recommend, t.view_count, t.build_type, ext.scene_source
+            FROM `t_scene_pro` t
+            LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
+        ) a 
+        WHERE a.rec_status = 'A' AND a.scene_source != 11 and a.user_id = #{userId}
+        <if test="sceneSource != null"> 
+          and a.scene_source = #{sceneSource}
+        </if> 
+        <if test="sceneType != null"> 
+          and a.scene_type = #{sceneType}
+        </if> 
+        <if test="startTime != null"> 
+          and a.create_time &gt;= #{startTime}
+        </if> 
+        <if test="endTime != null"> 
+          and a.create_time &lt;= #{endTime}
+        </if> 
+        <if test="nums != null"> 
+          and a.scene_code in (${nums})
+        </if> 
+        <if test="calculated  != null and calculated == true"> 
+          and (a.status = 1 or a.status = -2)
+        </if> 
+        <if test="cameraIds != null"> 
+          and a.camera_id in (${cameraIds})
+        </if> 
+        <if test="sceneName != null"> 
+          and a.scene_name like CONCAT('%',#{sceneName},'%')
+        </if> 
+        order by a.create_time desc
+        
+    </select>
+
 </mapper>

+ 10 - 0
4dkankan-center-scene/src/main/resources/mapper/scene/SceneProEditExtMapper.xml

@@ -2,4 +2,14 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fdkankan.scene.mapper.ISceneProEditExtMapper">
 
+    <select id="selectCntDownloadNum" resultType="java.lang.Integer">
+        SELECT SUM(download_num) FROM t_scene_pro_edit_ext
+    </select>
+
+    <select id="updateImageVersionByProEditId">
+        update t_scene_pro_edit
+        set images_version = images_version + 1
+        where pro_edit_id = #{proEditId}
+    </select>
+
 </mapper>

+ 1 - 0
4dkankan-center-scene/src/main/resources/mapper/scene/SceneProExtMapper.xml

@@ -2,4 +2,5 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fdkankan.scene.mapper.ISceneProExtMapper">
 
+
 </mapper>

+ 244 - 0
4dkankan-center-scene/src/main/resources/mapper/scene/SceneProMapper.xml

@@ -2,6 +2,60 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fdkankan.scene.mapper.ISceneProMapper">
 
+    <resultMap id="SceneProResultMap" type="com.fdkankan.scene.entity.ScenePro" >
+        <id column="id" property="id" jdbcType="BIGINT" />
+        <result column="scene_name" property="sceneName" jdbcType="BIGINT" />
+        <result column="scene_dec" property="sceneDec" jdbcType="VARCHAR" />
+        <result column="web_site" property="webSite" jdbcType="varchar" />
+        <result column="thumb" property="thumb" jdbcType="VARCHAR" />
+        <result column="user_id" property="userId" jdbcType="BIGINT" />
+        <result column="camera_id" property="cameraId" jdbcType="BIGINT" />
+        <result column="scene_logo" property="sceneLogo" jdbcType="VARCHAR" />
+        <result column="scene_code" property="sceneCode" jdbcType="VARCHAR" />
+        <result column="scene_type" property="sceneType" jdbcType="TINYINT" />
+        <result column="view_count" property="viewCount" jdbcType="INTEGER" />
+        <result column="shoot_count" property="shootCount" jdbcType="INTEGER" />
+        <result column="videos" property="videos" jdbcType="VARCHAR" />
+        <result column="gps" property="gps" jdbcType="VARCHAR" />
+        <result column="scene_scheme" property="sceneScheme" jdbcType="TINYINT" />
+        <result column="rec_status" property="recStatus" jdbcType="VARCHAR" />
+        <result column="build_type" property="buildType" jdbcType="VARCHAR" />
+        <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
+        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
+        <result column="tb_status" property="tbStatus" jdbcType="TINYINT" />
+    </resultMap>
+
+    <sql id="ScenePro_column">
+        id, scene_name, scene_dec, web_site, thumb, user_id,
+        camera_id, scene_logo, scene_code, scene_type, view_count,
+        shoot_count, videos, gps, scene_scheme, rec_status, build_type,
+        create_time, update_time, tb_status
+    </sql>
+
+    <resultMap id="SceneProExtResultMap" type="com.fdkankan.scene.entity.SceneProExt" >
+        <result column="scene_pro_id" property="sceneProId" jdbcType="BIGINT" />
+        <result column="scene_status" property="sceneStatus" jdbcType="INTEGER" />
+        <result column="data_source" property="dataSource" jdbcType="VARCHAR" />
+        <result column="pay_status" property="payStatus" jdbcType="TINYINT" />
+        <result column="phone_id" property="phoneId" jdbcType="VARCHAR" />
+        <result column="recommend" property="recommend" jdbcType="TINYINT" />
+        <result column="files_name" property="filesName" jdbcType="VARCHAR" />
+        <result column="algorithm" property="algorithm" jdbcType="VARCHAR" />
+        <result column="ecs" property="ecs" jdbcType="VARCHAR" />
+        <result column="space" property="space" jdbcType="BIGINT" />
+        <result column="firmware_version" property="firmwareVersion" jdbcType="VARCHAR" />
+        <result column="compute_time" property="computeTime" jdbcType="BIGINT" />
+        <result column="scene_source" property="sceneSource" jdbcType="INTEGER" />
+        <result column="vrnum" property="vrnum" jdbcType="VARCHAR" />
+        <result column="unicode" property="unicode" jdbcType="VARCHAR" />
+    </resultMap>
+
+    <sql id="SceneProExt_column" >
+        scene_pro_id, scene_status, data_source, pay_status,
+        phone_id, recommend, files_name, algorithm, ecs, space,
+        firmware_version, compute_time, scene_source, vrnum, unicode
+    </sql>
+
     <select id="findFolderIdScence">
         SELECT count(id)
         FROM t_scene_pro
@@ -9,4 +63,194 @@
         and user_id = #{userId}
     </select>
 
+    <select id="findLikeNum" resultType="com.fdkankan.scene.entity.ScenePro">
+        SELECT * FROM t_scene_pro
+        WHERE scene_code like CONCAT(#{sceneCode}, '%')
+        AND rec_status = 'A'
+        ORDER BY id desc
+        limit 1
+    </select>
+
+    <select id="findByNum" resultType="com.fdkankan.scene.entity.ScenePro">
+        SELECT * FROM t_scene_pro WHERE scene_code = #{sceneCode} AND rec_status = 'A' LIMIT 1
+    </select>
+
+    <select id="getSceneStatusByUnicode" resultType="com.fdkankan.scene.entity.SceneProPO">
+        select
+        <include refid="ScenePro_column"/>,
+        <include refid="SceneProExt_column"/>
+        from t_scene_pro t
+        left join t_scene_pro_ext ext on t.id = ext.scene_pro_id
+        WHERE ext.data_source LIKE CONCAT('%',#{unicode},'%') AND t.rec_status = #{recStatus}
+        order by t.create_time desc
+        LIMIT 1
+    </select>
+
+    <select id="findByUserIdAndCameraType" resultType="com.fdkankan.scene.entity.SceneProPO">
+        SELECT
+        <include refid="ScenePro_column"/>,
+        <include refid="SceneProExt_column"/>
+        FROM t_scene_pro t
+        LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
+        WHERE t.user_id = #{userId}
+        AND ext.camera_type = #{cameraType}
+        AND t.rec_status = 'A'
+        AND ext.scene_status IN (1,-2)
+        AND t.scene_type != 99
+        ORDER BY t.create_time DESC
+    </select>
+
+    <select id="findByUserId" resultType="com.fdkankan.scene.entity.SceneProPO">
+        SELECT
+        <include refid="ScenePro_column"/>,
+        <include refid="SceneProExt_column"/>
+        FROM t_scene_pro t
+        LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
+        WHERE t.user_id = #{userId}
+        AND t.rec_status = 'A'
+        AND ext.scene_status in (1, -2)
+        AND t.scene_type != 99
+        AND ext.scene_source = 1
+        <if test= 'excludeNums != null and excludeNums.size > 0'>
+            and t.scene_code not in
+            <foreach item='num' collection='excludeNums' open='(' separator=',' close=')'>
+                #{num}
+            </foreach>
+        </if>
+        order by t.id desc
+    </select>
+
+    <select id="findBySceneNums" resultType="com.fdkankan.scene.entity.SceneProPO">
+        SELECT
+        <include refid="ScenePro_column"/>,
+        <include refid="SceneProExt_column"/>
+        FROM t_scene_pro t
+        LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
+        WHERE ext.camera_type = #{cameraType}
+        AND t.rec_status = 'A'
+        AND ext.scene_status IN (1,-2)
+        AND t.scene_type != 99
+        <if test= 'sceneCodeList != null and sceneCodeList.size > 0'>
+            and t.scene_code in
+            <foreach item='sceneCode' collection='sceneCodeList' open='(' separator=',' close=')'>
+                #{sceneCode}
+            </foreach>
+        </if>
+        ORDER BY t.create_time DESC
+    </select>
+
+    <select id="findLatestOneByUserId" resultType="com.fdkankan.scene.vo.SceneVO">
+        SELECT
+        <include refid="ScenePro_column"/>,
+        <include refid="SceneProExt_column"/>
+        FROM t_scene_pro t
+        LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
+        WHERE t.user_id = #{userId}
+        AND t.rec_status = 'A'
+        AND t.camera_id is not null
+        ORDER BY t.create_time DESC
+        LIMIT 1
+    </select>
+
+    <select id="findByCameraIdPro" resultType="com.fdkankan.scene.entity.SceneProPO">
+        SELECT
+        <include refid="ScenePro_column"/>,
+        <include refid="SceneProExt_column"/>
+        FROM t_scene_pro t
+        LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
+        WHERE t.camera_id = #{cameraId}
+        AND t.rec_status = 'A'
+    </select>
+
+    <select id="findByFileId" resultType="com.fdkankan.scene.entity.SceneProPO">
+        SELECT
+        <include refid="ScenePro_column"/>,
+        <include refid="SceneProExt_column"/>
+        FROM t_scene_pro t
+        LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
+        WHERE ext.data_source LIKE CONCAT('%',#{fileId},'%')
+        AND t.rec_status = 'A'
+        order by create_time desc
+        LIMIT 1
+    </select>
+
+    <select id="findTempScenes" resultType="com.fdkankan.scene.entity.ScenePro">
+        SELECT
+        t.id, t.scene_code
+        FROM t_scene_pro t
+        LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
+        WHERE t.rec_status = 'A'
+        and ext.pay_status = -2
+        and (DATEDIFF(t.update_time,NOW()) <![CDATA[ <= ]]> -365)
+    </select>
+
+    <select id="getAppAllSceneByPage" resultType="com.fdkankan.scene.vo.SceneVO">
+        SELECT * FROM (
+        <if test= 'userId != null'>
+            SELECT
+            <include refid="ScenePro_column"/>,
+            <include refid="SceneProExt_column"/>
+            FROM t_scene_pro t
+            LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
+            WHERE t.user_id = #{userId} AND ext.camera_type = #{cameraType}
+            AND t.rec_status = 'A' AND ext.scene_status in (1, -2) AND t.scene_type != 99
+        </if>
+        <if test= 'userId != null and cameraId != null'>
+            UNION
+            SELECT
+            <include refid="ScenePro_column"/>,
+            <include refid="SceneProExt_column"/>
+            FROM t_scene_pro t
+            LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
+            WHERE t.camera_id = #{cameraId}
+            AND ext.scene_status in (1, -2) AND t.scene_type != 99 AND t.rec_status = 'A'
+        </if>
+        <if test= 'sceneCodeList != null and sceneCodeList.size() > 0'>
+            UNION
+            SELECT
+            <include refid="ScenePro_column"/>,
+            <include refid="SceneProExt_column"/>
+            FROM t_scene_pro t
+            LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
+            WHERE ext.scene_status in (1, -2)
+            AND  t.scene_code IN
+            <foreach collection="sceneCodeList" item="sceneCode" open="(" close=")" separator=",">
+                #{sceneCode}
+            </foreach>
+        </if>
+         ) a WHERE rec_status = 'A'
+        <if test= 'sceneType != null'>
+           AND scene_type = #{sceneType}
+        </if>
+        <if test= 'sceneName != null'>
+           AND scene_name like CONCAT('%', #{sceneName}, '%')
+        </if>
+        <if test="orderBy != null and orderBy != ''">
+            ${orderBy}
+        </if>
+    </select>
+
+    <select id="findLastSceneByCameraId" resultType="com.fdkankan.scene.entity.SceneProPO">
+        select
+        <include refid="ScenePro_column"/>,
+        <include refid="SceneProExt_column"/>
+        from t_scene_pro t
+        LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
+        where t.rec_status = 'A' and t.camera_id = #{cameraId}
+        order by t.create_time desc
+        limit 1
+    </select>
+
+    <select id="findByNumWithOutCheckRecStatus" resultType="com.fdkankan.scene.entity.SceneProPO">
+        select
+        <include refid="ScenePro_column"/>,
+        <include refid="SceneProExt_column"/>
+        from t_scene_pro t
+        LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
+        where t.scene_code = #{sceneCode}
+        limit 1
+    </select>
+
+
+
 </mapper>

+ 79 - 0
4dkankan-common/pom.xml

@@ -121,6 +121,85 @@
             <version>2.9.9</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.codehaus.jackson</groupId>
+            <artifactId>jackson-smile</artifactId>
+            <version>1.9.12</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.google.protobuf</groupId>
+            <artifactId>protobuf-java</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.aliyun.oss</groupId>
+            <artifactId>aliyun-sdk-oss</artifactId>
+            <version>2.8.3</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.amazonaws</groupId>
+            <artifactId>aws-java-sdk</artifactId>
+            <version>1.11.327</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.qiniu</groupId>
+            <artifactId>qiniu-java-sdk</artifactId>
+            <version>7.0.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.qiniu</groupId>
+            <artifactId>qiniu-java-sdk</artifactId>
+            <version>[7.2.0,7.2.99]</version>
+        </dependency>
+        <dependency>
+            <groupId>com.qiniu</groupId>
+            <artifactId>happy-dns-java</artifactId>
+            <version>0.1.4</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-pool2</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>net.coobird</groupId>
+            <artifactId>thumbnailator</artifactId>
+            <version>0.4.8</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.xingePush</groupId>
+            <artifactId>xinge</artifactId>
+            <version>1.2.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>core</artifactId>
+            <version>2.1</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>javase</artifactId>
+            <version>2.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.8.5</version>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 52 - 0
4dkankan-common/src/main/java/com/fdkankan/common/constant/ConstantCmd.java

@@ -0,0 +1,52 @@
+package com.fdkankan.common.constant;
+
+public class ConstantCmd {
+
+	//生成模型的命令
+	public static final String BUILD_MODEL_COMMAND = "bash /home/ubuntu/bin/Launcher.sh ";
+
+	//生成模型的命令
+	public static final String BUILD_MODEL_COMMAND2 = "bash /opt/ossutil/sshoss.sh ";
+
+	public static final String BUILD_MODEL_OLD_COMMAND = "bash /home/ubuntu/bin_old/Launcher.sh ";
+	public static final String BUILD_MODEL_SFM_COMMAND = "bash /home/ubuntu/run_sfm.sh ";
+
+	public static final String OBJ_TO_TXT = "bash /home/ubuntu/bin_old/obj2txt.sh ";
+
+	public static final String REBUILD_MODEL_FLLOR = "bash /home/ubuntu/bin/Panoramix_Floorplan.sh ";
+	//切图命令
+	public static final String CUT_IMG_COMMAND = "bash /home/ubuntu/OpenSfM/bin/run_cube.sh ";
+	//调整图片的命令
+	public static final String ADJUST_IMG_COMMAND = "/home/ubuntu/OpenSfM/bin/run_skybox ";
+	  
+	  
+	  
+	//转台拼图命令
+	public static final String BUILD_PANORAMA = "AutopanoGiga /home/ubuntu/data/";
+	//六目,拼图,计算,切图(二代)
+	public static final String BUILD_FOR_SIX = "bash /home/ubuntu/run_all_m6.sh ";
+
+	//合并音频
+	public static final String MERGE_VIDEO = "bash /monchickey/ffmpeg/bin/ff_synthesis.sh ";
+
+	//生成一段静音音频
+	public static final String CREATE_MUTE_VIDEO = "bash /monchickey/ffmpeg/bin/ff_mtue.sh ";
+
+	//将mp4文件转换成flv
+	public static final String MP4_TO_FLV = "bash /monchickey/ffmpeg/bin/ff_mp4TOflv.sh ";
+
+	//删除/mnt/data/下的数据脚本
+	public static final String DELETE_FILE = "bash /monchickey/ffmpeg/bin/delete.sh ";
+
+	public static final String OSS_UTIL_CP ="bash /opt/ossutil/oss.sh ";
+
+	public static final String OSS_FILE_CP = "bash /opt/ossutil/file.sh ";
+
+	public static final String MATTERPRO_CUT_IMG = "node /opt/4dkankan_scene/index.js ";
+
+	//激光相机 extra迁移
+	public static final String CP_JG_EXTRA = "bash /opt/ossutil/laser-copy.sh ";
+
+	public static final String CP_JG_ALL = "bash /opt/ossutil/laser-cp-r.sh ";
+
+}

+ 39 - 0
4dkankan-common/src/main/java/com/fdkankan/common/constant/ConstantFileName.java

@@ -0,0 +1,39 @@
+package com.fdkankan.common.constant;
+
+public class ConstantFileName {
+    //背景音乐
+    public static final String BACKGROUND_MUSIC = "bg.mp3";
+    //编辑页面,第二代
+    public static final String MODEL_DATAFILE = "modeldata.json";
+    public static final String HOT_DATAFILE = "hot.json";
+    public static final String MEDIA_DATAFILE = "mediaInfo.json";
+    public static final String SCREEN_CRP_DATAFILE = "screenCap";
+    //导览(一代)
+    public static final String GUIDE_DATAFILE = "tour.json";
+
+    //文件夹名称
+    public static final String GUIDE_MEDIA_FOLDER = "guide";
+    public static final String HOT_MEDIA_FOLDER = "hot";
+    public static final String OTHER_MEDIA_FOLDER = "other";
+
+    //论坛过滤文档
+    public static final String BBS_SENSITIVE = "SensitiveWord.txt";
+    public static final String LOGO_NAME = "logo.jpg";
+
+    //app部分
+    public static final String APP_FOLDER = "appupload";
+
+    public static final String FLOOR_LOGO_PIC_NAME = "floorLogoImg.png";
+
+    public static final String TOUR_LIST = "tourList.json";
+    public static final String VOICE_NAME = "201810";
+    public static final String WECHAT_VOICE_NAME = "wechat";
+    public static final String APP_VOICE_NAME = "app";
+
+    public static final String TOURLIST_FOLDER = "tour";
+    //public static final String TEMPFILES = "tempFiles";
+
+    public static final String modelUUID = "dacf7dfa24ae47fab8fcebfe4dc41ab9";
+
+    public static final String BUCKET_NAME = "4dkankan";
+}

+ 54 - 0
4dkankan-common/src/main/java/com/fdkankan/common/constant/ConstantFilePath.java

@@ -0,0 +1,54 @@
+package com.fdkankan.common.constant;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ConstantFilePath {
+    public static final String BASE_PATH = "/mnt/4Dkankan";
+    //论坛上传图片后,服务器存放的地址
+    public static final String BBS_IMAGES_PATH = "/mnt/4Dkankan/bbs/upload/image/";
+    // 用户上传图片
+    public static final String USER_IMAGES_PATH = "/mnt/4Dkankan/user/";
+    // 图片暂存地址(创建二维码等)
+    public static final String TEMP_IMAGES_PATH = "/mnt/4Dkankan/temp/upload/image/";
+    // 场景
+    public static final String SCENE_PATH = "/mnt/4Dkankan/scene/";
+    // 代理商
+    public static final String AGENT_PATH = "/mnt/4Dkankan/agent/";
+    //电子发票
+    public static final String INVOICE_PATH = "/mnt/4Dkankan/invoice/";
+    // 场景二维码
+    public static final String SCENE_QR_CODE_PATH = "/mnt/4Dkankan/sceneQRcode/";
+    // excel
+    public static final String EXCEL_PATH = "/mnt/4Dkankan/excel/";
+//    public static final String EXCEL_PATH = "F:\\excel\\";
+    // medias
+    public static final String MEDIAS_PATH = "/mnt/4Dkankan/medias/";
+    // logo
+    public static final String LOGO_PATH = "/mnt/4Dkankan/logo/";
+    // login qr code
+    public static final String LOGIN_QR_CODE_PATH = "/mnt/4Dkankan/login/qrcode/";
+
+    public static final String WEIXIN_CERT = "/mnt/home/ubuntu/user/apiclient_cert.p12";
+
+    public static final String PREFIX = "/home/user";
+    public static final String CREATE_MODEL_PATH = PREFIX + "/photo_data/model/";
+    //大场景
+    public static final String CREATE_BIG_SCENE_PATH = PREFIX + "/photo_data/bigscene/";
+    //生成模型的路径
+    public static final String BUILD_MODEL_PATH = "/mnt/data/";
+    //生成模型的路径
+    public static String BUILD_MODEL_LASER_PATH;
+
+    //支付二维码图片存放路径
+    public static final String ALI_QRCODE_FOLDER = "/mnt/4Dkankan/alicode/";
+    public static final String WEIXIN_QRCODE_FOLDER = "/mnt/4Dkankan/weixincode/";
+
+    public static final String OSS_PREFIX = "home/";
+
+    @Value("${file.route.hardDiskLaser}")
+    public void setHardDiskLaser(String value){
+        ConstantFilePath.BUILD_MODEL_LASER_PATH = value;
+    }
+}

+ 29 - 0
4dkankan-common/src/main/java/com/fdkankan/common/constant/ConstantUrl.java

@@ -0,0 +1,29 @@
+package com.fdkankan.common.constant;
+
+public class ConstantUrl {
+
+//	public static final String MAIN_URL = "https://www.4dkankan.com/";
+//	public static final String MAIN_URL = "http://120.79.15.136:8086/";
+//	public static final String MAIN_URL2 = "https://www.4dkankan.com/";
+//	public static final String DEFAULT_USER_HEAD = "https://scene3d.4dage.com/head.png";
+	public static final String DEFAULT_USER_HEAD = "https://4dkk.4dage.com/newHead.png";
+	public static final String BBS_TOUPLOAD = "https://scene3d.4dage.com/model/upload/image/";
+	public static final String DEFAULT_PREFIX_QINIU_PIC = "http://orw69myb5.bkt.clouddn.com/";
+	public static final String DEFAULT_SCENE_PIC="https://4dkk.4dage.com/loading/thumb.jpg";
+//	public static final String SCENE_URL = MAIN_URL + "show.html?m=";
+//	public static final String SCENE_URL2 = MAIN_URL + "showV2.html?m=";
+
+//	public static final String PRO_SCENE_URL = MAIN_URL + "showProMobile.html?m=";
+	public static final String PREFIX_ALI = "https://4dkk.4dage.com/";
+	//亚马逊S3
+	public static final String PREFIX_AWS = "https://testeurs3.4dkankan.com/";
+	public static final String PREFIX_QINIU = "https://scene3d.4dage.com/";
+	public static final String PREFIX_QINIU2 = "https://creator.4dkankan.com/";
+	public static final String WEIXIN_PAYURL = "https://www.4dkankan.com/weixinmobilepay/weixinInfo?orderId=";
+	public static final String WEIXIN_TOKEN_URL1 = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=";
+	public static final String WEIXIN_TOKEN_URL2 = "https://api.weixin.qq.com/sns/userinfo?access_token=";
+	public static final String WEIXIN_MOBILE_PAY_URL = "mobile.html#/pay?timeStamp=";
+	public static final String WEIXIN_NOTIFY_URL = "https://www.4dkankan.com/weixinpay/Notify";
+	public static final String WEIXIN_ORDER_URL="https://api.mch.weixin.qq.com/pay/unifiedorder";
+
+}

+ 25 - 0
4dkankan-common/src/main/java/com/fdkankan/common/constant/DownloadStatus.java

@@ -0,0 +1,25 @@
+package com.fdkankan.common.constant;
+
+public enum DownloadStatus {
+
+    DOWNLOADING(0, "下载中"),
+    SUCCESS(1, "下载成功"),
+    FAILD(2, "下载失败");
+
+    private Integer code;
+    private String message;
+
+    private DownloadStatus(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public Integer code() {
+        return code;
+    }
+
+    public String message() {
+        return message;
+    }
+
+}

+ 43 - 0
4dkankan-common/src/main/java/com/fdkankan/common/constant/ErrorCode.java

@@ -52,7 +52,50 @@ public enum ErrorCode {
     FAILURE_CODE_3033(3033, "60秒内不能重复获取验证码"),
 
 
+    FAILURE_CODE_5001(5001, "modeldata.json为空"),
+    FAILURE_CODE_5002(5002, "order值为空"),
+    FAILURE_CODE_5003(5003, "guideSid或order值为空"),
+    FAILURE_CODE_5004(5004, "guideSid或guideName值为空"),
+    FAILURE_CODE_5005(5005, "场景为空"),
+    FAILURE_CODE_5006(5006, "余额不足"),
+    FAILURE_CODE_5007(5007, "非八目场景"),
+    FAILURE_CODE_5008(5008, "该场景已经被封存,无法删除"),
+    FAILURE_CODE_5009(5009, "场景被删除"),
+    FAILURE_CODE_5010(5010, "场景不属于该相机"),
+    FAILURE_CODE_5011(5011, "创建"),
+    FAILURE_CODE_5012(5012, "数据不正常"),
+    FAILURE_CODE_5013(5013, "场景对应的用户名为空"),
+    FAILURE_CODE_5014(5014, "该用户无权操作该场景"),
+    FAILURE_CODE_5015(5015, "该场景不属于当前登录账号"),
+    FAILURE_CODE_5016(5016, "热点外链场景不对"),
+    FAILURE_CODE_5017(5017, "*上传模型失败,请参照右侧教程"),
+    FAILURE_CODE_5018(5018, "zip文件只能有一层目录或无目录"),
+    FAILURE_CODE_5019(5019, "必须有且仅有一个obj和mtl文件"),
+    FAILURE_CODE_5020(5020, "贴图需控制在1.5M以内,obj文件需要控制在20M以内。"),
+    FAILURE_CODE_5021(5021, "场景密钥不正确"),
+    FAILURE_CODE_5022(5022, "上传文件格式,名称不一致"),
+    FAILURE_CODE_5023(5023, "上传文件格式不正确,只能是jpg或mp4格式"),
+    FAILURE_CODE_5024(5024, "有场景打包中,请稍后重试"),
+    FAILURE_CODE_5025(5025, "数据包不存在,请先打成zip包"),
+    FAILURE_CODE_5026(5026, "上传的压缩包类型不正确"),
+    FAILURE_CODE_5027(5027, "文件夹不存在"),
+    FAILURE_CODE_5028(5028, "无权修改该文件夹"),
+    FAILURE_CODE_5029(5029, "场景下载失败,请稍后重试"),
     FAILURE_CODE_5030(5030, "同级文件夹名称不能重复"),
+    FAILURE_CODE_5031(5031, "场景打包中不能重复操作"),
+    FAILURE_CODE_5032(5032, "三维家打包记录不存在"),
+    FAILURE_CODE_5033(5033, "该场景正在计算中"),
+    FAILURE_CODE_5034(5034, "该场景已封存"),
+    FAILURE_CODE_5035(5035, "任务已存在"),
+    FAILURE_CODE_5036(5036, "获取锁失败"),
+    FAILURE_CODE_5037(5037, "上传图片失败"),
+    FAILURE_CODE_5038(5038, "文件不存在"),
+    FAILURE_CODE_5039(5039, "画墙重建模型失败"),
+    FAILURE_CODE_5040(5040, "上传音频失败"),
+    FAILURE_CODE_5041(5041, "上传图片多媒体数据失败"),
+    FAILURE_CODE_5042(5042, "算法计算失败"),
+    FAILURE_CODE_5043(5043, "打包zip失败"),
+
 
 
     ;

+ 26 - 0
4dkankan-common/src/main/java/com/fdkankan/common/constant/PayStatus.java

@@ -0,0 +1,26 @@
+package com.fdkankan.common.constant;
+
+public enum PayStatus {
+
+    NOT_PAY(0, "未付款"),
+    PAY(1, "已付款"),
+    ARREARS(-1, "欠费"),
+    NO_CAPACITY(-2, "容量不足");
+
+    private Integer code;
+    private String message;
+
+    private PayStatus(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public Integer code() {
+        return code;
+    }
+
+    public String message() {
+        return message;
+    }
+
+}

+ 62 - 0
4dkankan-common/src/main/java/com/fdkankan/common/constant/RedisKey.java

@@ -3,6 +3,21 @@ package com.fdkankan.common.constant;
 public class RedisKey {
 
     /**
+     * 过期时间:2小时
+     */
+    public static int EXPIRE_TIME_2_HOUR = 2*60*60*1000;
+
+    /**
+     * 过期时间:10分钟
+     */
+    public static int EXPIRE_TIME_10_MINUTE = 10*60*1000;
+
+    /**
+     * 过期时间:30分钟
+     */
+    public static int EXPIRE_TIME_30_MINUTE = 30*60*1000;
+
+    /**
      * 登录token
      */
     public static String TOKEN_USER_TYPE = "token:user:type:%s:%s";
@@ -12,4 +27,51 @@ public class RedisKey {
      */
     public static String TM_DEVELOPER = "developer:appid:%s";
 
+    /**
+     * 场景浏览量
+     */
+    public static String SCENE_VISIT_CNT = "scene:visit:cnt:scenecode:%s";
+
+    /**
+     * 场景访问量更新锁 hash
+     */
+    public static String LOCK_SCENE_VISIT_UPDATE = "lock:scene:visit:update";
+
+    /**
+     * 场景上传图片锁
+     */
+    public static String LOCK_UPLOAD_PIC = "lock:upload:pic:scenecode:%s";
+
+    /**
+     * 场景pro上传图片锁
+     */
+    public static String LOCK_UPLOAD_PRO_PIC = "lock:upload:pro:pic:scenecode:%s";
+
+    /**
+     * 场景上传音频锁
+     */
+    public static String LOCK_UPLOAD_VOICE = "lock:upload:voice:scenecode:%s";
+
+    /**
+     * 场景pro上传音频锁
+     */
+    public static String LOCK_UPLOAD_PRO_VOICE = "lock:upload:pro:voice:scenecode:%s";
+
+    /**
+     * 画墙重建模型锁
+     */
+    public static String LOCK_UPLOAD_FLOORJSON_REBUILD = "lock:upload:floorjson:rebuild:scenecode:%s";
+
+    /**
+     * 上传图片多媒体数据锁
+     */
+    public static String LOCK_UPLOAD_FLOORPLAN_PNG = "lock:upload:floorplan:png:scenecode:%s";
+
+
+
+
+
+
+
+
 }

+ 91 - 0
4dkankan-common/src/main/java/com/fdkankan/common/constant/RedisUtil.java

@@ -0,0 +1,91 @@
+package com.fdkankan.common.constant;
+
+import cn.hutool.core.util.StrUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.script.DefaultRedisScript;
+import org.springframework.stereotype.Component;
+
+import java.util.Arrays;
+import java.util.Objects;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+@Component
+@Slf4j
+public class RedisUtil {
+
+    @Autowired
+    private RedisTemplate redisTemplate;
+
+    private static final String UNLOCK_LUA = "if redis.call('get',KEYS[1]) == ARGV[1] then\n" +
+                                "    return redis.call('del',KEYS[1])\n" +
+                                "else\n" +
+                                "    return 0\n" +
+                                "end";
+
+    /**
+     * 加锁,自旋重试三次
+     *
+     * @param lockKey 锁key
+     * @param expireTime 锁过期时间 单位 毫秒
+     * @return
+     */
+    public boolean lock(String lockKey, int expireTime) {
+        boolean locked = false;
+        int tryCount = 3;
+        long threadId = Thread.currentThread().getId();
+        while (!locked && tryCount > 0) {
+            locked = redisTemplate.opsForValue().setIfAbsent(lockKey, threadId, expireTime, TimeUnit.MILLISECONDS);
+            tryCount--;
+            try {
+                Thread.sleep(300);
+            } catch (InterruptedException e) {
+                log.error("线程被中断[线程id:" + threadId + "]", e);
+            }
+        }
+        return locked;
+    }
+
+    /**
+     * 非原子解锁,可能解别人锁,不安全
+     *
+     * @param redisLockEntity
+     * @return
+     */
+    public boolean unlock(String lockKey, Long threadId) {
+        if (StrUtil.isEmpty(lockKey) || Objects.isNull(threadId))
+            return false;
+        boolean releaseLock = false;
+        Long val = (Long) redisTemplate.opsForValue().get(lockKey);
+        if (threadId.equals(val)) {
+            releaseLock = redisTemplate.delete(lockKey);
+        }
+        return releaseLock;
+    }
+
+    /**
+     * 使用lua脚本解锁,不会解除别人锁
+     *
+     * @param
+     * @return
+     */
+    public boolean unlockLua(String lockKey, Long threadId) {
+        if (StrUtil.isEmpty(lockKey) || Objects.isNull(threadId))
+            return false;
+        DefaultRedisScript<Long> redisScript = new DefaultRedisScript();
+//        redisScript.setLocation(new ClassPathResource("unlock.lua"));
+        redisScript.setScriptText(UNLOCK_LUA);
+        redisScript.setResultType(Long.class);
+
+        Object result = redisTemplate.execute(redisScript, Arrays.asList(lockKey), threadId);
+        return result.equals(Long.valueOf(1));
+    }
+
+
+
+
+
+}

+ 25 - 0
4dkankan-common/src/main/java/com/fdkankan/common/constant/SceneEditType.java

@@ -0,0 +1,25 @@
+package com.fdkankan.common.constant;
+
+public enum SceneEditType {
+
+    UPDATE(0, "修改"),
+    ADD(1, "添加"),
+    DELETE(-1, "删除");
+
+    private Integer code;
+    private String message;
+
+    private SceneEditType(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public Integer code() {
+        return code;
+    }
+
+    public String message() {
+        return message;
+    }
+
+}

+ 26 - 0
4dkankan-common/src/main/java/com/fdkankan/common/constant/SceneStatus.java

@@ -0,0 +1,26 @@
+package com.fdkankan.common.constant;
+
+public enum SceneStatus {
+
+    wait(0, "未建好"),
+    SUCCESS(1, "已建好"),
+    FAILD(-1, "出错"),
+    NO_DISPLAY(-2, "不要在官网上显示");
+
+    private Integer code;
+    private String message;
+
+    private SceneStatus(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public Integer code() {
+        return code;
+    }
+
+    public String message() {
+        return message;
+    }
+
+}

+ 29 - 0
4dkankan-common/src/main/java/com/fdkankan/common/constant/SceneType.java

@@ -0,0 +1,29 @@
+package com.fdkankan.common.constant;
+
+public enum SceneType {
+
+    OTHER(0, "其它"),
+    WB(1, "文博"),
+    DC(2, "地产"),
+    DS(3, "电商"),
+    CY(4, "餐饮"),
+    JU(5, "家居"),
+    YJHZXNFY(99, "一件换装虚拟房源");
+
+    private Integer code;
+    private String message;
+
+    private SceneType(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public Integer code() {
+        return code;
+    }
+
+    public String message() {
+        return message;
+    }
+
+}

+ 25 - 0
4dkankan-common/src/main/java/com/fdkankan/common/constant/UploadStatus.java

@@ -0,0 +1,25 @@
+package com.fdkankan.common.constant;
+
+public enum UploadStatus {
+
+    UPLOADING(0, "上传中"),
+    SUCCESS(1, "上传成功"),
+    FAILD(-1, "上传失败");
+
+    private Integer code;
+    private String message;
+
+    private UploadStatus(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public Integer code() {
+        return code;
+    }
+
+    public String message() {
+        return message;
+    }
+
+}

+ 26 - 0
4dkankan-common/src/main/java/com/fdkankan/common/constant/ZipStatus.java

@@ -0,0 +1,26 @@
+package com.fdkankan.common.constant;
+
+public enum ZipStatus {
+
+    DOING(0, "打包中"),
+    SUCCESS(1, "打包完成"),
+    FAILD(2, "打包失败"),
+    OTHER(3, "");
+
+    private Integer code;
+    private String message;
+
+    private ZipStatus(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public Integer code() {
+        return code;
+    }
+
+    public String message() {
+        return message;
+    }
+
+}

Datei-Diff unterdrückt, da er zu groß ist
+ 7340 - 0
4dkankan-common/src/main/java/com/fdkankan/common/proto/BigSceneProto.java


Datei-Diff unterdrückt, da er zu groß ist
+ 4654 - 0
4dkankan-common/src/main/java/com/fdkankan/common/proto/Common.java


Datei-Diff unterdrückt, da er zu groß ist
+ 4345 - 0
4dkankan-common/src/main/java/com/fdkankan/common/proto/Visionmodeldata.java


+ 156 - 0
4dkankan-common/src/main/java/com/fdkankan/common/proto/format/CouchDBFormat.java

@@ -0,0 +1,156 @@
+package com.fdkankan.common.proto.format;
+
+
+import com.google.protobuf.ExtensionRegistry;
+import com.google.protobuf.Message;
+import com.google.protobuf.UnknownFieldSet;
+
+import java.io.IOException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: aantonov
+ * Date: Mar 16, 2010
+ * Time: 4:06:05 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class CouchDBFormat extends JsonFormat {
+
+    /**
+     * Outputs a textual representation of the Protocol Message supplied into the parameter output.
+     * (This representation is the new version of the classic "ProtocolPrinter" output from the
+     * original Protocol Buffer system)
+     */
+    public static void print(Message message, Appendable output) throws IOException {
+        CouchDBGenerator generator = new CouchDBGenerator(output);
+        generator.print("{");
+        print(message, generator);
+        generator.print("}");
+    }
+
+    /**
+     * Outputs a textual representation of {@code fields} to {@code output}.
+     */
+    public static void print(UnknownFieldSet fields, Appendable output) throws IOException {
+        CouchDBGenerator generator = new CouchDBGenerator(output);
+        generator.print("{");
+        printUnknownFields(fields, generator);
+        generator.print("}");
+    }
+
+    /**
+     * Like {@code print()}, but writes directly to a {@code String} and returns it.
+     */
+    public static String printToString(Message message) {
+        try {
+            StringBuilder text = new StringBuilder();
+            print(message, text);
+            return text.toString();
+        } catch (IOException e) {
+            throw new RuntimeException("Writing to a StringBuilder threw an IOException (should never happen).",
+                                       e);
+        }
+    }
+
+    /**
+     * Like {@code print()}, but writes directly to a {@code String} and returns it.
+     */
+    public static String printToString(UnknownFieldSet fields) {
+        try {
+            StringBuilder text = new StringBuilder();
+            print(fields, text);
+            return text.toString();
+        } catch (IOException e) {
+            throw new RuntimeException("Writing to a StringBuilder threw an IOException (should never happen).",
+                                       e);
+        }
+    }
+
+    /**
+     * Parse a text-format message from {@code input} and merge the contents into {@code builder}.
+     */
+    public static void merge(Readable input, Message.Builder builder) throws IOException {
+        merge(input, ExtensionRegistry.getEmptyRegistry(), builder);
+    }
+
+    /**
+     * Parse a text-format message from {@code input} and merge the contents into {@code builder}.
+     */
+    public static void merge(CharSequence input, Message.Builder builder) throws ParseException {
+        merge(input, ExtensionRegistry.getEmptyRegistry(), builder);
+    }
+
+    /**
+     * Parse a text-format message from {@code input} and merge the contents into {@code builder}.
+     * Extensions will be recognized if they are registered in {@code extensionRegistry}.
+     */
+    public static void merge(Readable input,
+                             ExtensionRegistry extensionRegistry,
+                             Message.Builder builder) throws IOException {
+        // Read the entire input to a String then parse that.
+
+        // If StreamTokenizer were not quite so crippled, or if there were a kind
+        // of Reader that could read in chunks that match some particular regex,
+        // or if we wanted to write a custom Reader to tokenize our stream, then
+        // we would not have to read to one big String. Alas, none of these is
+        // the case. Oh well.
+
+        merge(JsonFormat.toStringBuilder(input), extensionRegistry, builder);
+    }
+
+    /**
+     * Parse a text-format message from {@code input} and merge the contents into {@code builder}.
+     * Extensions will be recognized if they are registered in {@code extensionRegistry}.
+     */
+    public static void merge(CharSequence input,
+                             ExtensionRegistry extensionRegistry,
+                             Message.Builder builder) throws ParseException {
+        Tokenizer tokenizer = new Tokenizer(input);
+
+        // Based on the state machine @ http://json.org/
+
+        tokenizer.consume("{"); // Needs to happen when the object starts.
+        while (!tokenizer.tryConsume("}")) { // Continue till the object is done
+            JsonFormat.mergeField(tokenizer, extensionRegistry, builder);
+        }
+    }
+
+    protected static class Tokenizer extends JsonFormat.Tokenizer {
+
+        /**
+         * Construct a tokenizer that parses tokens from the given text.
+         */
+        public Tokenizer(CharSequence text) {
+            super(text);
+        }
+
+        @Override
+        public String consumeIdentifier() throws ParseException {
+            String id = super.consumeIdentifier();
+            if ("_id".equals(id)) {
+                return "id";
+            } else if ("_rev".equals(id)) {
+                return "rev";
+            }
+            return id;
+        }
+    }
+
+    protected static class CouchDBGenerator extends JsonGenerator {
+
+        public CouchDBGenerator(Appendable output) {
+            super(output);
+        }
+
+        @Override
+        public void print(CharSequence text) throws IOException {
+            if ("id".equals(text)) {
+                super.print("_id");
+            } else if ("rev".equals(text)) {
+                super.print("_rev");
+            } else {
+                super.print(text);
+            }
+        }
+    }
+}

+ 703 - 0
4dkankan-common/src/main/java/com/fdkankan/common/proto/format/HtmlFormat.java

@@ -0,0 +1,703 @@
+package com.fdkankan.common.proto.format;
+/* 
+    Copyright (c) 2009, Orbitz World Wide
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without modification, 
+    are permitted provided that the following conditions are met:
+
+        * Redistributions of source code must retain the above copyright notice, 
+          this list of conditions and the following disclaimer.
+        * Redistributions in binary form must reproduce the above copyright notice, 
+          this list of conditions and the following disclaimer in the documentation 
+          and/or other materials provided with the distribution.
+        * Neither the name of the Orbitz World Wide nor the names of its contributors 
+          may be used to endorse or promote products derived from this software 
+          without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+import com.google.protobuf.ByteString;
+import com.google.protobuf.Descriptors.EnumValueDescriptor;
+import com.google.protobuf.Descriptors.FieldDescriptor;
+import com.google.protobuf.Message;
+import com.google.protobuf.UnknownFieldSet;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * Provide ascii html formatting support for proto2 instances.
+ * <p>
+ * (c) 2009-10 Orbitz World Wide. All Rights Reserved.
+ * 
+ * @author eliran.bivas@gmail.com Eliran Bivas
+ * @version $HtmlFormat.java Mar 12, 2009 4:00:33 PM$
+ */
+public final class HtmlFormat {
+
+    private static final String META_CONTENT = "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />";
+    private static final String MAIN_DIV_STYLE = "color: black; font-size: 14px; font-family: sans-serif; font-weight: bolder; margin-bottom: 10px;";
+    private static final String FIELD_NAME_STYLE = "font-weight: bold; color: #669966;font-size: 14px; font-family: sans-serif;";
+    private static final String FIELD_VALUE_STYLE = "color: #3300FF;font-size: 13px; font-family: sans-serif;";
+
+    /**
+     * Outputs a textual representation of the Protocol Message supplied into the parameter output.
+     * (This representation is the new version of the classic "ProtocolPrinter" output from the
+     * original Protocol Buffer system)
+     */
+    public static void print(Message message, Appendable output) throws IOException {
+        HtmlGenerator generator = new HtmlGenerator(output);
+        printTitle(message, generator);
+        print(message, generator);
+        generator.print("</body></html>");
+    }
+
+    private static void printTitle(final Message message, final HtmlGenerator generator) throws IOException {
+        generator.print("<html><head>");
+        generator.print(META_CONTENT);
+        generator.print("<title>");
+        generator.print(message.getDescriptorForType().getFullName());
+        generator.print("</title></head><body>");
+        generator.print("<div style=\"");
+        generator.print(MAIN_DIV_STYLE);
+        generator.print("\">message : ");
+        generator.print(message.getDescriptorForType().getFullName());
+        generator.print("</div>");
+    }
+
+    /**
+     * Outputs a textual representation of {@code fields} to {@code output}.
+     */
+    public static void print(UnknownFieldSet fields, Appendable output) throws IOException {
+        HtmlGenerator generator = new HtmlGenerator(output);
+        generator.print("<html>");
+        generator.print(META_CONTENT);
+        generator.print("</head><body>");
+        printUnknownFields(fields, generator);
+        generator.print("</body></html>");
+    }
+
+    /**
+     * Like {@code print()}, but writes directly to a {@code String} and returns it.
+     */
+    public static String printToString(Message message) {
+        try {
+            StringBuilder text = new StringBuilder();
+            print(message, text);
+            return text.toString();
+        } catch (IOException e) {
+            throw new RuntimeException("Writing to a StringBuilder threw an IOException (should never happen).",
+                                       e);
+        }
+    }
+
+    /**
+     * Like {@code print()}, but writes directly to a {@code String} and returns it.
+     */
+    public static String printToString(UnknownFieldSet fields) {
+        try {
+            StringBuilder text = new StringBuilder();
+            print(fields, text);
+            return text.toString();
+        } catch (IOException e) {
+            throw new RuntimeException("Writing to a StringBuilder threw an IOException (should never happen).",
+                                       e);
+        }
+    }
+
+    private static void print(Message message, HtmlGenerator generator) throws IOException {
+
+        for (Map.Entry<FieldDescriptor, Object> field : message.getAllFields().entrySet()) {
+            printField(field.getKey(), field.getValue(), generator);
+        }
+        printUnknownFields(message.getUnknownFields(), generator);
+    }
+
+    public static void printField(FieldDescriptor field, Object value, HtmlGenerator generator) throws IOException {
+
+        if (field.isRepeated()) {
+            // Repeated field. Print each element.
+            for (Object element : (List<?>) value) {
+                printSingleField(field, element, generator);
+            }
+        } else {
+            printSingleField(field, value, generator);
+        }
+    }
+
+    private static void printSingleField(FieldDescriptor field,
+                                         Object value,
+                                         HtmlGenerator generator) throws IOException {
+        if (field.isExtension()) {
+            generator.print("[<span style=\"");
+            generator.print(FIELD_NAME_STYLE);
+            generator.print("\">");
+            // We special-case MessageSet elements for compatibility with proto1.
+            if (field.getContainingType().getOptions().getMessageSetWireFormat()
+                            && (field.getType() == FieldDescriptor.Type.MESSAGE) && (field.isOptional())
+                            // object equality
+                            && (field.getExtensionScope() == field.getMessageType())) {
+                generator.print(field.getMessageType().getFullName());
+            } else {
+                generator.print(field.getFullName());
+            }
+            generator.print("</span>]");
+        } else {
+            generator.print("<span style=\"");
+            generator.print(FIELD_NAME_STYLE);
+            generator.print("\">");
+            if (field.getType() == FieldDescriptor.Type.GROUP) {
+                // Groups must be serialized with their original capitalization.
+                generator.print(field.getMessageType().getName());
+            } else {
+                generator.print(field.getName());
+            }
+            generator.print("</span>");
+        }
+
+        if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
+            generator.print(" <span style=\"color: red;\">{</span><br/>");
+            generator.indent();
+        } else {
+            generator.print(": ");
+        }
+
+        printFieldValue(field, value, generator);
+
+        if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
+            generator.outdent();
+            generator.print("<span style=\"color: red;\">}</span>");
+        }
+        generator.print("<br/>");
+    }
+
+    private static void printFieldValue(FieldDescriptor field, Object value, HtmlGenerator generator) throws IOException {
+        generator.print("<span style=\"");
+        generator.print(FIELD_VALUE_STYLE);
+        generator.print("\">");
+        switch (field.getType()) {
+            case INT32:
+            case INT64:
+            case SINT32:
+            case SINT64:
+            case SFIXED32:
+            case SFIXED64:
+            case FLOAT:
+            case DOUBLE:
+            case BOOL:
+                // Good old toString() does what we want for these types.
+                generator.print(value.toString());
+                break;
+
+            case UINT32:
+            case FIXED32:
+                generator.print(unsignedToString((Integer) value));
+                break;
+
+            case UINT64:
+            case FIXED64:
+                generator.print(unsignedToString((Long) value));
+                break;
+
+            case STRING:
+                generator.print("\"");
+                generator.print(value.toString());
+                generator.print("\"");
+                break;
+
+            case BYTES: {
+                generator.print("\"");
+                generator.print(escapeBytes((ByteString) value));
+                generator.print("\"");
+                break;
+            }
+
+            case ENUM: {
+                generator.print(((EnumValueDescriptor) value).getName());
+                break;
+            }
+
+            case MESSAGE:
+            case GROUP:
+                print((Message) value, generator);
+                break;
+        }
+        generator.print("</span>");
+    }
+
+    private static void printUnknownFields(UnknownFieldSet unknownFields, HtmlGenerator generator) throws IOException {
+        for (Map.Entry<Integer, UnknownFieldSet.Field> entry : unknownFields.asMap().entrySet()) {
+            UnknownFieldSet.Field field = entry.getValue();
+
+            for (long value : field.getVarintList()) {
+                generator.print(entry.getKey().toString());
+                generator.print(": ");
+                generator.print(unsignedToString(value));
+                generator.print("<br/>");
+            }
+            for (int value : field.getFixed32List()) {
+                generator.print(entry.getKey().toString());
+                generator.print(": ");
+                generator.print(String.format((Locale) null, "0x%08x", value));
+                generator.print("<br/>");
+            }
+            for (long value : field.getFixed64List()) {
+                generator.print(entry.getKey().toString());
+                generator.print(": ");
+                generator.print(String.format((Locale) null, "0x%016x", value));
+                generator.print("<br/>");
+            }
+            for (ByteString value : field.getLengthDelimitedList()) {
+                generator.print(entry.getKey().toString());
+                generator.print(": \"");
+                generator.print(escapeBytes(value));
+                generator.print("\"<br/>");
+            }
+            for (UnknownFieldSet value : field.getGroupList()) {
+                generator.print(entry.getKey().toString());
+                generator.print(" <span style=\"color: red;\">{</span><br/>");
+                generator.indent();
+                printUnknownFields(value, generator);
+                generator.outdent();
+                generator.print("<span style=\"color: red;\">}</span><br/>");
+            }
+        }
+    }
+
+    /**
+     * Convert an unsigned 32-bit integer to a string.
+     */
+    private static String unsignedToString(int value) {
+        if (value >= 0) {
+            return Integer.toString(value);
+        } else {
+            return Long.toString((value) & 0x00000000FFFFFFFFL);
+        }
+    }
+
+    /**
+     * Convert an unsigned 64-bit integer to a string.
+     */
+    private static String unsignedToString(long value) {
+        if (value >= 0) {
+            return Long.toString(value);
+        } else {
+            // Pull off the most-significant bit so that BigInteger doesn't think
+            // the number is negative, then set it again using setBit().
+            return BigInteger.valueOf(value & 0x7FFFFFFFFFFFFFFFL).setBit(63).toString();
+        }
+    }
+
+    /**
+     * An inner class for writing text to the output stream.
+     */
+    static private final class HtmlGenerator {
+
+        Appendable output;
+        boolean atStartOfLine = true;
+
+        public HtmlGenerator(Appendable output) {
+            this.output = output;
+        }
+
+        /**
+         * Indent text by two spaces. After calling Indent(), two spaces will be inserted at the
+         * beginning of each line of text. Indent() may be called multiple times to produce deeper
+         * indents.
+         * 
+         * @throws IOException
+         */
+        public void indent() throws IOException {
+            print("<div style=\"margin-left: 25px\">");
+        }
+
+        /**
+         * Reduces the current indent level by two spaces, or crashes if the indent level is zero.
+         * 
+         * @throws IOException
+         */
+        public void outdent() throws IOException {
+            print("</div>");
+        }
+
+        /**
+         * Print text to the output stream.
+         */
+        public void print(CharSequence text) throws IOException {
+            int size = text.length();
+            int pos = 0;
+
+            for (int i = 0; i < size; i++) {
+                if (text.charAt(i) == '\n') {
+                    write("<br/>", i - pos + 1);
+                    pos = i + 1;
+                    atStartOfLine = true;
+                }
+            }
+            write(text.subSequence(pos, size), size - pos);
+        }
+
+        private void write(CharSequence data, int size) throws IOException {
+            if (size == 0) {
+                return;
+            }
+            if (atStartOfLine) {
+                atStartOfLine = false;
+            }
+            output.append(data);
+        }
+    }
+
+    // =================================================================
+    // Utility functions
+    //
+    // Some of these methods are package-private because Descriptors.java uses
+    // them.
+
+    /**
+     * Escapes bytes in the format used in protocol buffer text format, which is the same as the
+     * format used for C string literals. All bytes that are not printable 7-bit ASCII characters
+     * are escaped, as well as backslash, single-quote, and double-quote characters. Characters for
+     * which no defined short-hand escape sequence is defined will be escaped using 3-digit octal
+     * sequences.
+     */
+    static String escapeBytes(ByteString input) {
+        StringBuilder builder = new StringBuilder(input.size());
+        for (int i = 0; i < input.size(); i++) {
+            byte b = input.byteAt(i);
+            switch (b) {
+                // Java does not recognize \a or \v, apparently.
+                case 0x07:
+                    builder.append("\\a");
+                    break;
+                case '\b':
+                    builder.append("\\b");
+                    break;
+                case '\f':
+                    builder.append("\\f");
+                    break;
+                case '\n':
+                    builder.append("\\n");
+                    break;
+                case '\r':
+                    builder.append("\\r");
+                    break;
+                case '\t':
+                    builder.append("\\t");
+                    break;
+                case 0x0b:
+                    builder.append("\\v");
+                    break;
+                case '\\':
+                    builder.append("\\\\");
+                    break;
+                case '\'':
+                    builder.append("\\\'");
+                    break;
+                case '"':
+                    builder.append("\\\"");
+                    break;
+                default:
+                    if (b >= 0x20) {
+                        builder.append((char) b);
+                    } else {
+                        builder.append('\\');
+                        builder.append((char) ('0' + ((b >>> 6) & 3)));
+                        builder.append((char) ('0' + ((b >>> 3) & 7)));
+                        builder.append((char) ('0' + (b & 7)));
+                    }
+                    break;
+            }
+        }
+        return builder.toString();
+    }
+
+    /**
+     * Un-escape a byte sequence as escaped using
+     * {@link #escapeBytes(com.googlecode.protobuf.format.ByteString)}. Two-digit hex escapes (starting with
+     * "\x") are also recognized.
+     */
+    static ByteString unescapeBytes(CharSequence input) throws InvalidEscapeSequence {
+        byte[] result = new byte[input.length()];
+        int pos = 0;
+        for (int i = 0; i < input.length(); i++) {
+            char c = input.charAt(i);
+            if (c == '\\') {
+                if (i + 1 < input.length()) {
+                    ++i;
+                    c = input.charAt(i);
+                    if (isOctal(c)) {
+                        // Octal escape.
+                        int code = digitValue(c);
+                        if ((i + 1 < input.length()) && isOctal(input.charAt(i + 1))) {
+                            ++i;
+                            code = code * 8 + digitValue(input.charAt(i));
+                        }
+                        if ((i + 1 < input.length()) && isOctal(input.charAt(i + 1))) {
+                            ++i;
+                            code = code * 8 + digitValue(input.charAt(i));
+                        }
+                        result[pos++] = (byte) code;
+                    } else {
+                        switch (c) {
+                            case 'a':
+                                result[pos++] = 0x07;
+                                break;
+                            case 'b':
+                                result[pos++] = '\b';
+                                break;
+                            case 'f':
+                                result[pos++] = '\f';
+                                break;
+                            case 'n':
+                                result[pos++] = '\n';
+                                break;
+                            case 'r':
+                                result[pos++] = '\r';
+                                break;
+                            case 't':
+                                result[pos++] = '\t';
+                                break;
+                            case 'v':
+                                result[pos++] = 0x0b;
+                                break;
+                            case '\\':
+                                result[pos++] = '\\';
+                                break;
+                            case '\'':
+                                result[pos++] = '\'';
+                                break;
+                            case '"':
+                                result[pos++] = '\"';
+                                break;
+
+                            case 'x':
+                                // hex escape
+                                int code = 0;
+                                if ((i + 1 < input.length()) && isHex(input.charAt(i + 1))) {
+                                    ++i;
+                                    code = digitValue(input.charAt(i));
+                                } else {
+                                    throw new InvalidEscapeSequence("Invalid escape sequence: '\\x' with no digits");
+                                }
+                                if ((i + 1 < input.length()) && isHex(input.charAt(i + 1))) {
+                                    ++i;
+                                    code = code * 16 + digitValue(input.charAt(i));
+                                }
+                                result[pos++] = (byte) code;
+                                break;
+
+                            default:
+                                throw new InvalidEscapeSequence("Invalid escape sequence: '\\" + c
+                                                                + "'");
+                        }
+                    }
+                } else {
+                    throw new InvalidEscapeSequence("Invalid escape sequence: '\\' at end of string.");
+                }
+            } else {
+                result[pos++] = (byte) c;
+            }
+        }
+
+        return ByteString.copyFrom(result, 0, pos);
+    }
+
+    /**
+     * Thrown by {@link JsonFormat#unescapeBytes} and {@link JsonFormat#unescapeText} when an
+     * invalid escape sequence is seen.
+     */
+    static class InvalidEscapeSequence extends IOException {
+
+        private static final long serialVersionUID = 1L;
+
+        public InvalidEscapeSequence(String description) {
+            super(description);
+        }
+    }
+
+    /**
+     * Like {@link #escapeBytes(com.googlecode.protobuf.format.ByteString)}, but escapes a text string.
+     * Non-ASCII characters are first encoded as UTF-8, then each byte is escaped individually as a
+     * 3-digit octal escape. Yes, it's weird.
+     */
+    static String escapeText(String input) {
+        return escapeBytes(ByteString.copyFromUtf8(input));
+    }
+
+    /**
+     * Un-escape a text string as escaped using {@link #escapeText(String)}. Two-digit hex escapes
+     * (starting with "\x") are also recognized.
+     */
+    static String unescapeText(String input) throws InvalidEscapeSequence {
+        return unescapeBytes(input).toStringUtf8();
+    }
+
+    /**
+     * Is this an octal digit?
+     */
+    private static boolean isOctal(char c) {
+        return ('0' <= c) && (c <= '7');
+    }
+
+    /**
+     * Is this a hex digit?
+     */
+    private static boolean isHex(char c) {
+        return (('0' <= c) && (c <= '9')) || (('a' <= c) && (c <= 'f'))
+        || (('A' <= c) && (c <= 'F'));
+    }
+
+    /**
+     * Interpret a character as a digit (in any base up to 36) and return the numeric value. This is
+     * like {@code Character.digit()} but we don't accept non-ASCII digits.
+     */
+    private static int digitValue(char c) {
+        if (('0' <= c) && (c <= '9')) {
+            return c - '0';
+        } else if (('a' <= c) && (c <= 'z')) {
+            return c - 'a' + 10;
+        } else {
+            return c - 'A' + 10;
+        }
+    }
+
+    /**
+     * Parse a 32-bit signed integer from the text. Unlike the Java standard {@code
+     * Integer.parseInt()}, this function recognizes the prefixes "0x" and "0" to signify
+     * hexidecimal and octal numbers, respectively.
+     */
+    static int parseInt32(String text) throws NumberFormatException {
+        return (int) parseInteger(text, true, false);
+    }
+
+    /**
+     * Parse a 32-bit unsigned integer from the text. Unlike the Java standard {@code
+     * Integer.parseInt()}, this function recognizes the prefixes "0x" and "0" to signify
+     * hexidecimal and octal numbers, respectively. The result is coerced to a (signed) {@code int}
+     * when returned since Java has no unsigned integer type.
+     */
+    static int parseUInt32(String text) throws NumberFormatException {
+        return (int) parseInteger(text, false, false);
+    }
+
+    /**
+     * Parse a 64-bit signed integer from the text. Unlike the Java standard {@code
+     * Integer.parseInt()}, this function recognizes the prefixes "0x" and "0" to signify
+     * hexidecimal and octal numbers, respectively.
+     */
+    static long parseInt64(String text) throws NumberFormatException {
+        return parseInteger(text, true, true);
+    }
+
+    /**
+     * Parse a 64-bit unsigned integer from the text. Unlike the Java standard {@code
+     * Integer.parseInt()}, this function recognizes the prefixes "0x" and "0" to signify
+     * hexidecimal and octal numbers, respectively. The result is coerced to a (signed) {@code long}
+     * when returned since Java has no unsigned long type.
+     */
+    static long parseUInt64(String text) throws NumberFormatException {
+        return parseInteger(text, false, true);
+    }
+
+    private static long parseInteger(String text, boolean isSigned, boolean isLong) throws NumberFormatException {
+        int pos = 0;
+
+        boolean negative = false;
+        if (text.startsWith("-", pos)) {
+            if (!isSigned) {
+                throw new NumberFormatException("Number must be positive: " + text);
+            }
+            ++pos;
+            negative = true;
+        }
+
+        int radix = 10;
+        if (text.startsWith("0x", pos)) {
+            pos += 2;
+            radix = 16;
+        } else if (text.startsWith("0", pos)) {
+            radix = 8;
+        }
+
+        String numberText = text.substring(pos);
+
+        long result = 0;
+        if (numberText.length() < 16) {
+            // Can safely assume no overflow.
+            result = Long.parseLong(numberText, radix);
+            if (negative) {
+                result = -result;
+            }
+
+            // Check bounds.
+            // No need to check for 64-bit numbers since they'd have to be 16 chars
+            // or longer to overflow.
+            if (!isLong) {
+                if (isSigned) {
+                    if ((result > Integer.MAX_VALUE) || (result < Integer.MIN_VALUE)) {
+                        throw new NumberFormatException("Number out of range for 32-bit signed integer: "
+                                                        + text);
+                    }
+                } else {
+                    if ((result >= (1L << 32)) || (result < 0)) {
+                        throw new NumberFormatException("Number out of range for 32-bit unsigned integer: "
+                                                        + text);
+                    }
+                }
+            }
+        } else {
+            BigInteger bigValue = new BigInteger(numberText, radix);
+            if (negative) {
+                bigValue = bigValue.negate();
+            }
+
+            // Check bounds.
+            if (!isLong) {
+                if (isSigned) {
+                    if (bigValue.bitLength() > 31) {
+                        throw new NumberFormatException("Number out of range for 32-bit signed integer: "
+                                                        + text);
+                    }
+                } else {
+                    if (bigValue.bitLength() > 32) {
+                        throw new NumberFormatException("Number out of range for 32-bit unsigned integer: "
+                                                        + text);
+                    }
+                }
+            } else {
+                if (isSigned) {
+                    if (bigValue.bitLength() > 63) {
+                        throw new NumberFormatException("Number out of range for 64-bit signed integer: "
+                                                        + text);
+                    }
+                } else {
+                    if (bigValue.bitLength() > 64) {
+                        throw new NumberFormatException("Number out of range for 64-bit unsigned integer: "
+                                                        + text);
+                    }
+                }
+            }
+
+            result = bigValue.longValue();
+        }
+
+        return result;
+    }
+}

Datei-Diff unterdrückt, da er zu groß ist
+ 1338 - 0
4dkankan-common/src/main/java/com/fdkankan/common/proto/format/JavaPropsFormat.java


Datei-Diff unterdrückt, da er zu groß ist
+ 1603 - 0
4dkankan-common/src/main/java/com/fdkankan/common/proto/format/JsonFormat.java


+ 602 - 0
4dkankan-common/src/main/java/com/fdkankan/common/proto/format/SmileFormat.java

@@ -0,0 +1,602 @@
+package com.fdkankan.common.proto.format;
+/* 
+	Copyright (c) 2009, Orbitz World Wide
+	All rights reserved.
+
+	Redistribution and use in source and binary forms, with or without modification, 
+	are permitted provided that the following conditions are met:
+
+		* Redistributions of source code must retain the above copyright notice, 
+		  this list of conditions and the following disclaimer.
+		* Redistributions in binary form must reproduce the above copyright notice, 
+		  this list of conditions and the following disclaimer in the documentation 
+		  and/or other materials provided with the distribution.
+		* Neither the name of the Orbitz World Wide nor the names of its contributors 
+		  may be used to endorse or promote products derived from this software 
+		  without specific prior written permission.
+
+	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+	"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+	LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+	A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+	OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+	LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+	DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+	THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+	(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+	OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+import com.google.protobuf.*;
+import com.google.protobuf.Descriptors.Descriptor;
+import com.google.protobuf.Descriptors.EnumDescriptor;
+import com.google.protobuf.Descriptors.EnumValueDescriptor;
+import com.google.protobuf.Descriptors.FieldDescriptor;
+import org.codehaus.jackson.JsonGenerator;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jackson.JsonToken;
+import org.codehaus.jackson.smile.SmileFactory;
+import org.codehaus.jackson.smile.SmileGenerator;
+import org.codehaus.jackson.smile.SmileParser;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.math.BigInteger;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+/**
+ * Provide ascii text parsing and formatting support for proto2 instances. The implementation
+ * largely follows google/protobuf/text_format.cc.
+ * <p>
+ * (c) 2011 Neustar, Inc. All Rights Reserved.
+ *
+ * @author jeffrey.damick@neustar.biz Jeffrey Damick
+ *         Based on the original code by:
+ * @author eliran.bivas@gmail.com Eliran Bivas
+ * @author aantonov@orbitz.com Alex Antonov
+ *         <p/>
+ * @author wenboz@google.com Wenbo Zhu
+ * @author kenton@google.com Kenton Varda
+ */
+public class SmileFormat {
+    private static SmileFactory smileFactory = new SmileFactory();
+	
+		
+    /**
+     * Outputs a Smile representation of the Protocol Message supplied into the parameter output.
+     * (This representation is the new version of the classic "ProtocolPrinter" output from the
+     * original Protocol Buffer system)
+     */
+    public static void print(Message message, OutputStream output) throws IOException {
+        JsonGenerator generator = createGenerator(output);
+    	print(message, generator);
+    	generator.close();
+    }
+    
+    /**
+     * Outputs a Smile representation of the Protocol Message supplied into the parameter output.
+     * (This representation is the new version of the classic "ProtocolPrinter" output from the
+     * original Protocol Buffer system)
+     */
+    public static void print(Message message, JsonGenerator generator) throws IOException {
+    	generator.writeStartObject();
+    	printMessage(message, generator);
+        generator.writeEndObject();
+        generator.flush();
+    }
+
+    /**
+     * Outputs a Smile representation of {@code fields} to {@code output}.
+     */
+    public static void print(UnknownFieldSet fields, OutputStream output) throws IOException {
+    	JsonGenerator generator = createGenerator(output);
+    	generator.writeStartObject();
+    	printUnknownFields(fields, generator);
+        generator.writeEndObject();
+        generator.close();
+    }
+    
+    
+    
+    /**
+     * Parse a text-format message from {@code input} and merge the contents into {@code builder}.
+     */
+    public static void merge(InputStream input, Message.Builder builder) throws IOException {
+        merge(input, ExtensionRegistry.getEmptyRegistry(), builder);
+    }
+
+        
+    /**
+     * Parse a text-format message from {@code input} and merge the contents into {@code builder}.
+     * Extensions will be recognized if they are registered in {@code extensionRegistry}.
+     * @throws IOException 
+     */
+    public static void merge(InputStream input,
+                             ExtensionRegistry extensionRegistry,
+                             Message.Builder builder) throws IOException {
+    	
+    	SmileParser parser = smileFactory.createJsonParser(input); 
+    	merge(parser, extensionRegistry, builder);
+    }
+    
+    /**
+     * Parse a text-format message from {@code input} and merge the contents into {@code builder}.
+     * Extensions will be recognized if they are registered in {@code extensionRegistry}.
+     * @throws IOException 
+     */
+    public static void merge(JsonParser parser,                 
+    						 ExtensionRegistry extensionRegistry,
+                             Message.Builder builder) throws IOException {
+    	
+        JsonToken token = parser.nextToken();
+        if (token.equals(JsonToken.START_OBJECT)) {
+        	token = parser.nextToken();
+        }
+        while (token != null && !token.equals(JsonToken.END_OBJECT)) {
+        	mergeField(parser, extensionRegistry, builder);
+        	token = parser.nextToken();
+        }
+        
+        // Test to make sure the tokenizer has reached the end of the stream.
+        if (parser.nextToken() != null) {
+            throw new RuntimeException("Expecting the end of the stream, but there seems to be more data!  Check the input for a valid JSON format.");
+        }
+    }
+    
+    
+    
+    protected static JsonGenerator createGenerator(OutputStream output) throws IOException {
+    	SmileGenerator generator = smileFactory.createJsonGenerator(output);
+    	generator.enable(SmileGenerator.Feature.WRITE_HEADER);
+    	generator.enable(SmileGenerator.Feature.WRITE_END_MARKER);
+    	return generator;
+    }
+
+    
+    protected static void printMessage(Message message, JsonGenerator generator) throws IOException {
+
+        for (Iterator<Map.Entry<FieldDescriptor, Object>> iter = message.getAllFields().entrySet().iterator(); iter.hasNext();) {
+            Map.Entry<FieldDescriptor, Object> field = iter.next();
+            printField(field.getKey(), field.getValue(), generator);
+        }
+        printUnknownFields(message.getUnknownFields(), generator);
+    }
+
+    public static void printField(FieldDescriptor field, Object value, JsonGenerator generator) throws IOException {
+
+        printSingleField(field, value, generator);
+    }
+
+    private static void printSingleField(FieldDescriptor field,
+                                         Object value,
+                                         JsonGenerator generator) throws IOException {
+        if (field.isExtension()) {
+            // We special-case MessageSet elements for compatibility with proto1.
+            if (field.getContainingType().getOptions().getMessageSetWireFormat()
+                && (field.getType() == FieldDescriptor.Type.MESSAGE) && (field.isOptional())
+                // object equality
+                && (field.getExtensionScope() == field.getMessageType())) {
+                generator.writeFieldName(field.getMessageType().getFullName());
+            } else {
+            	// extensions will have '.' in them, while normal fields wont..
+            	generator.writeFieldName(field.getFullName());
+            }
+        } else {
+            if (field.getType() == FieldDescriptor.Type.GROUP) {
+                // Groups must be serialized with their original capitalization.
+                generator.writeFieldName(field.getMessageType().getName());
+            } else {
+                generator.writeFieldName(field.getName());
+            }
+        }
+
+        // Done with the name, on to the value
+        if (field.isRepeated()) {
+            // Repeated field. Print each element.
+            generator.writeStartArray();
+            for (Iterator<?> iter = ((List<?>) value).iterator(); iter.hasNext();) {
+                printFieldValue(field, iter.next(), generator);
+            }
+            generator.writeEndArray();
+        } else {
+            printFieldValue(field, value, generator);
+        }
+    }
+
+    private static void printFieldValue(FieldDescriptor field, Object value, JsonGenerator generator) throws IOException {
+    	// TODO: look at using field.getType().getJavaType(), to simplify this..
+    	switch (field.getType()) {
+            case INT32:
+            case SINT32:
+            case SFIXED32:
+            	generator.writeNumber((Integer)value);
+            	break;
+            
+            case INT64:
+            case SINT64:
+            case SFIXED64:
+            	generator.writeNumber((Long)value);
+            	break;
+            	
+            case FLOAT:
+            	generator.writeNumber((Float)value);
+            	break;
+            	
+            case DOUBLE:
+            	generator.writeNumber((Double)value);
+            	break;
+            	
+            case BOOL:
+                // Good old toString() does what we want for these types.
+                generator.writeBoolean((Boolean)value);
+                break;
+
+            case UINT32:
+            case FIXED32:
+                generator.writeNumber(unsignedInt((Integer) value));
+                break;
+
+            case UINT64:
+            case FIXED64:
+                generator.writeNumber(unsignedLong((Long) value));
+                break;
+
+            case STRING:
+            	generator.writeString((String) value);
+                break;
+
+            case BYTES: {
+            	// Here we break with JsonFormat - since there is an issue with non-utf8 bytes..
+            	generator.writeBinary(((ByteString)value).toByteArray());
+                break;
+            }
+
+            case ENUM: {
+            	generator.writeString(((EnumValueDescriptor) value).getName());
+                break;
+            }
+
+            case MESSAGE:
+            case GROUP:
+            	generator.writeStartObject();
+                printMessage((Message) value, generator);
+                generator.writeEndObject();
+                break;
+        }
+    }
+
+    protected static void printUnknownFields(UnknownFieldSet unknownFields, JsonGenerator generator) throws IOException {
+        for (Map.Entry<Integer, UnknownFieldSet.Field> entry : unknownFields.asMap().entrySet()) {
+            UnknownFieldSet.Field field = entry.getValue();
+            
+            generator.writeArrayFieldStart(entry.getKey().toString());
+            for (long value : field.getVarintList()) {
+                generator.writeNumber(value);
+            }
+            for (int value : field.getFixed32List()) {
+                generator.writeNumber(value);
+            }
+            for (long value : field.getFixed64List()) {
+                generator.writeNumber(value);
+            }
+            for (ByteString value : field.getLengthDelimitedList()) {
+            	// here we break with the JsonFormat to support non-utf8 bytes
+            	generator.writeBinary(value.toByteArray());
+            }
+            for (UnknownFieldSet value : field.getGroupList()) {
+                generator.writeStartObject();
+                printUnknownFields(value, generator);
+                generator.writeEndObject();
+            }
+            generator.writeEndArray();
+        }
+    }
+
+
+
+    // =================================================================
+    // Parsing
+   
+    private static final Pattern DIGITS = Pattern.compile(
+          "[0-9]",
+          Pattern.CASE_INSENSITIVE);
+
+    /**
+     * Parse a single field from {@code parser} and merge it into {@code builder}. If a ',' is
+     * detected after the field ends, the next field will be parsed automatically
+     * @throws IOException 
+     * @throws JsonParseException 
+     */
+    protected static void mergeField(JsonParser parser,
+                                   ExtensionRegistry extensionRegistry,
+                                   Message.Builder builder) throws JsonParseException, IOException {
+        FieldDescriptor field = null;
+        Descriptor type = builder.getDescriptorForType();
+        boolean unknown = false;
+        ExtensionRegistry.ExtensionInfo extension = null;
+        JsonToken token = parser.getCurrentToken();
+
+        if (token != null) {
+            String name = parser.getCurrentName();
+            
+            if (name.contains(".")) {
+            	// should be an extension
+            	extension = extensionRegistry.findExtensionByName(name);
+                if (extension == null) {
+                    throw new RuntimeException("Extension \""
+                    		+ name + "\" not found in the ExtensionRegistry.");
+                } else if (extension.descriptor.getContainingType() != type) {
+                    throw new RuntimeException("Extension \"" + name
+                    		+ "\" does not extend message type \""
+                    		+ type.getFullName() + "\".");
+                }
+
+            	field = extension.descriptor;
+            } else {
+            	field = type.findFieldByName(name);
+            }
+
+            // Group names are expected to be capitalized as they appear in the
+            // .proto file, which actually matches their type names, not their field
+            // names.
+            if (field == null) {
+                // Explicitly specify US locale so that this code does not break when
+                // executing in Turkey.
+                String lowerName = name.toLowerCase(Locale.US);
+                field = type.findFieldByName(lowerName);
+                // If the case-insensitive match worked but the field is NOT a group,
+                if ((field != null) && (field.getType() != FieldDescriptor.Type.GROUP)) {
+                    field = null;
+                }
+            }
+            // Again, special-case group names as described above.
+            if ((field != null) && (field.getType() == FieldDescriptor.Type.GROUP)
+                && !field.getMessageType().getName().equals(name)
+                && !field.getMessageType().getFullName().equalsIgnoreCase(name) /* extension */) {
+                field = null;
+            }
+
+            // Last try to lookup by field-index if 'name' is numeric,
+            // which indicates a possible unknown field
+            if (field == null && DIGITS.matcher(name).matches()) {
+                field = type.findFieldByNumber(Integer.parseInt(name));
+                unknown = true;
+            }
+
+            // no throwing exceptions if field not found, since it could be a different version.
+            if (field == null) {
+            	UnknownFieldSet.Builder unknownsBuilder = UnknownFieldSet.newBuilder();
+            	handleMissingField(name, parser, extensionRegistry, unknownsBuilder);
+            	builder.setUnknownFields(unknownsBuilder.build());
+            }
+        }
+
+        if (field != null) {
+        	token = parser.nextToken();
+        	
+            boolean array = token.equals(JsonToken.START_ARRAY);
+
+            if (array) {
+            	token = parser.nextToken();
+                while (!token.equals(JsonToken.END_ARRAY)) {
+                    handleValue(parser, extensionRegistry, builder, field, extension, unknown);
+                    token = parser.nextToken();
+                }
+            } else {
+                handleValue(parser, extensionRegistry, builder, field, extension, unknown);
+            }
+        }
+    }
+
+    private static void handleMissingField(String fieldName, JsonParser parser,
+                                           ExtensionRegistry extensionRegistry,
+                                           UnknownFieldSet.Builder builder) throws IOException {
+    	
+        JsonToken token = parser.nextToken();
+        if (token.equals(JsonToken.START_OBJECT)) {
+            // Message structure
+        	token = parser.nextToken(); // skip name
+        	while (token != null && !token.equals(JsonToken.END_OBJECT)) {
+                handleMissingField(fieldName, parser, extensionRegistry, builder);
+                token = parser.nextToken(); // get } or field name
+            }
+        } else if (token.equals(JsonToken.START_ARRAY)) {
+            // Collection
+            do {
+                handleMissingField(fieldName, parser, extensionRegistry, builder);
+                token = parser.getCurrentToken(); // got value or ]
+            } while (token != null && !token.equals(JsonToken.END_ARRAY));
+        } else {
+            // Primitive value
+        	// NULL, INT, BOOL, STRING
+        	// nothing to do..
+        }
+    }
+
+    private static void handleValue(JsonParser parser,
+                                    ExtensionRegistry extensionRegistry,
+                                    Message.Builder builder,
+                                    FieldDescriptor field,
+                                    ExtensionRegistry.ExtensionInfo extension,
+                                    boolean unknown) throws IOException {
+
+        Object value = null;
+        if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
+            value = handleObject(parser, extensionRegistry, builder, field, extension, unknown);
+        } else {
+            value = handlePrimitive(parser, field);
+        }
+        if (value != null) {
+            if (field.isRepeated()) {
+                builder.addRepeatedField(field, value);
+            } else {
+                builder.setField(field, value);
+            }
+        }
+    }
+
+    private static Object handlePrimitive(JsonParser parser, FieldDescriptor field) throws IOException {
+        Object value = null;
+        
+        JsonToken token = parser.getCurrentToken();
+        
+        if (token.equals(JsonToken.VALUE_NULL)) {
+            return value;
+        }
+        
+        switch (field.getType()) {
+            case INT32:
+            case SINT32:
+            case SFIXED32:
+            	value = parser.getIntValue();
+                break;
+
+            case INT64:
+            case SINT64:
+            case SFIXED64:
+            	value = parser.getLongValue();
+                break;
+
+            case UINT32:
+            case FIXED32:
+            	int valueInt = parser.getIntValue();
+            	if (valueInt < 0) {
+            		throw new NumberFormatException("Number must be positive: " + valueInt);
+            	}
+            	value = valueInt;
+                break;
+
+            case UINT64:
+            case FIXED64:
+            	long valueLong = parser.getLongValue();
+            	if (valueLong < 0) {
+            		throw new NumberFormatException("Number must be positive: " + valueLong);
+            	}
+            	value = valueLong;
+                break;
+
+            case FLOAT:
+            	value = parser.getFloatValue();
+                break;
+
+            case DOUBLE:
+            	value = parser.getDoubleValue();
+                break;
+
+            case BOOL:
+            	value = parser.getBooleanValue();
+                break;
+
+            case STRING:
+            	value = parser.getText();
+                break;
+
+            case BYTES:
+            	value = ByteString.copyFrom(parser.getBinaryValue());
+                break;
+
+            case ENUM: {
+                EnumDescriptor enumType = field.getEnumType();
+                if (token.equals(JsonToken.VALUE_NUMBER_INT)) {
+                    int number = parser.getIntValue();
+                    value = enumType.findValueByNumber(number);
+                    if (value == null) {
+                        throw new RuntimeException("Enum type \""
+                        		+ enumType.getFullName()
+                        		+ "\" has no value with number "
+                        		+ number + ".");
+                    }
+                } else {
+                    String id = parser.getText();
+                    value = enumType.findValueByName(id);
+                    if (value == null) {
+                    	throw new RuntimeException("Enum type \""
+                    			+ enumType.getFullName()
+                    			+ "\" has no value named \""
+                    			+ id + "\".");
+                    }
+                }
+                break;
+            }
+
+            case MESSAGE:
+            case GROUP:
+                throw new RuntimeException("Can't get here.");
+        }
+        return value;
+    }
+    
+
+    private static Object handleObject(JsonParser parser,
+                                       ExtensionRegistry extensionRegistry,
+                                       Message.Builder builder,
+                                       FieldDescriptor field,
+                                       ExtensionRegistry.ExtensionInfo extension,
+                                       boolean unknown) throws IOException {
+
+        Message.Builder subBuilder;
+        if (extension == null) {
+            subBuilder = builder.newBuilderForField(field);
+        } else {
+            subBuilder = extension.defaultInstance.newBuilderForType();
+        }
+
+        JsonToken token = parser.getCurrentToken();
+
+        if (unknown) {
+        	ByteString data = ByteString.copyFrom(parser.getBinaryValue());
+            try {
+                subBuilder.mergeFrom(data);
+                return subBuilder.build();
+            } catch (InvalidProtocolBufferException e) {
+                throw new RuntimeException("Failed to build " + field.getFullName() + " from " + data);
+            }
+        }
+
+        //token = parser.nextToken();
+        if (token.equals(JsonToken.START_OBJECT)) {
+	        token = parser.nextToken();
+	        while (token != null && !token.equals(JsonToken.END_OBJECT)) {
+	            mergeField(parser, extensionRegistry, subBuilder);
+	            token = parser.nextToken();
+	        }
+        }
+        return subBuilder.build();
+    }
+
+    // =================================================================
+    // Utility functions
+    //
+    // Some of these methods are package-private because Descriptors.java uses
+    // them.
+    
+    /**
+     * Convert an unsigned 32-bit integer to a string.
+     */
+    private static Integer unsignedInt(int value) {
+        if (value < 0) {
+            return (int) ((value) & 0x00000000FFFFFFFFL);
+        }
+        return value;
+    }
+
+    /**
+     * Convert an unsigned 64-bit integer to a string.
+     */
+    private static Long unsignedLong(long value) {
+        if (value < 0) {
+            // Pull off the most-significant bit so that BigInteger doesn't think
+            // the number is negative, then set it again using setBit().
+            return BigInteger.valueOf(value & 0x7FFFFFFFFFFFFFFFL).setBit(63).longValue();
+        }
+        return value;
+    }
+}

Datei-Diff unterdrückt, da er zu groß ist
+ 1333 - 0
4dkankan-common/src/main/java/com/fdkankan/common/proto/format/XmlFormat.java


+ 221 - 0
4dkankan-common/src/main/java/com/fdkankan/common/util/ConvertCommonUtils.java

@@ -0,0 +1,221 @@
+package com.fdkankan.common.util;
+
+//import com.fdkankan.base.proto.Common;
+
+import com.fdkankan.common.proto.Common;
+import com.fdkankan.common.proto.format.JsonFormat;
+import lombok.extern.log4j.Log4j2;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+
+@Log4j2
+public class ConvertCommonUtils {
+
+    public static void convertVisionModelDataToTxt(String srcPath, String desPath) throws Exception {
+
+        BufferedOutputStream bos = null;
+        BufferedInputStream bis = null;
+        try {
+            File file = new File(srcPath);
+            FileInputStream fis = new FileInputStream(file);
+
+            Common.NavigationInfo data_NavigationInfo = Common.NavigationInfo.parseFrom(fis);
+
+            String jsonFormat1 = JsonFormat.printToString(data_NavigationInfo);
+            ByteArrayInputStream stream = new ByteArrayInputStream(jsonFormat1.getBytes());
+            bos = new BufferedOutputStream(new FileOutputStream(desPath));//设置输出路径
+            bis = new BufferedInputStream(stream);
+            int b = -1;
+            while ((b = bis.read()) != -1) {
+                bos.write(b);
+            }
+            //out.close();
+            bis.close();
+            bos.close();
+        } catch (Exception e) {
+            StringWriter trace = new StringWriter();
+            e.printStackTrace(new PrintWriter(trace));
+            log.error(trace.toString());
+        } finally {
+            if (bos != null) {
+                bos.close();
+            }
+            if (bis != null) {
+                bis.close();
+            }
+        }
+    }
+
+    public static void convertTxtToVisionModelData(String srcPath, String desPath) throws Exception {
+        BufferedOutputStream bos = null;
+        BufferedInputStream bis = null;
+        try {
+            Common.NavigationInfo.Builder builder = Common.NavigationInfo.newBuilder();
+            String jsonFormat = readTxtFileToJson(srcPath);
+            JsonFormat.merge(jsonFormat, builder);
+            byte[] buf = builder.build().toByteArray();
+
+            //把序列化后的数据写入本地磁盘
+            ByteArrayInputStream stream = new ByteArrayInputStream(buf);
+            bos = new BufferedOutputStream(new FileOutputStream(desPath));//设置输出路径
+            bis = new BufferedInputStream(stream);
+            int b = -1;
+            while ((b = bis.read()) != -1) {
+                bos.write(b);
+            }
+            bis.close();
+            bos.close();
+        } catch (Exception e) {
+            StringWriter trace = new StringWriter();
+            e.printStackTrace(new PrintWriter(trace));
+            log.error(trace.toString());
+        } finally {
+            if (bos != null) {
+                bos.close();
+            }
+            if (bis != null) {
+                bis.close();
+            }
+        }
+    }
+
+    public static String readTxtFileToJson(String filePath) {
+        try {
+            String encoding = "UTF-8";
+            File file = new File(filePath);
+            if (file.isFile() && file.exists()) {
+                InputStreamReader read = new InputStreamReader(
+                        new FileInputStream(file), encoding);
+                BufferedReader bufferedReader = new BufferedReader(read);
+                String lineTxt = null;
+                String result = "";
+                while ((lineTxt = bufferedReader.readLine()) != null) {
+                    result += lineTxt;
+                }
+                read.close();
+                return result;
+            } else {
+                return null;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+
+    public List<List<String>> descartes(List<List<String>> dimValue) {
+        List<List<String>> res = new ArrayList<>();
+        if (dimValue == null || dimValue.size() == 0)
+            return res;
+        backtrace(dimValue, 0, res, new ArrayList<>());
+        return res;
+
+    }
+
+    /**
+     * 递归回溯法求解
+     *
+     * @param dimValue 原始数据集合
+     * @param index 当前执行的集合索引
+     * @param result 结果集合
+     * @param curList 当前的单个结果集
+     */
+    private void backtrace(List<List<String>> dimValue, int index,
+                           List<List<String>> result, List<String> curList) {
+
+        if (curList.size() == dimValue.size())
+            result.add(new ArrayList<>(curList));
+        else
+            for (int j = 0; j < dimValue.get(index).size(); j++) {
+                curList.add(dimValue.get(index).get(j));
+                backtrace(dimValue, index + 1, result, curList);
+                curList.remove(curList.size() - 1);
+            }
+
+    }
+
+    public static void main(String[] args) {
+        List<String> list1 = new ArrayList<String>();
+        list1.add("普通会员");
+        list1.add("专业会员");
+        list1.add("商业会员");
+        List<String> list2 = new ArrayList<String>();
+        list2.add("1G");
+        list2.add("1T");
+        List<List<String>> dimValue = new ArrayList<List<String>>();
+        dimValue.add(list1);
+        dimValue.add(list2);
+
+        // 递归实现笛卡尔积
+        ConvertCommonUtils s = new ConvertCommonUtils();
+        List<List<String>> res = s.descartes(dimValue);
+        System.out.println("递归实现笛卡尔乘积: 共 " + res.size() + " 个结果");
+        for (List<String> list : res) {
+            for (String string : list) {
+                System.out.print(string + " ");
+            }
+            System.out.println();
+        }
+    }
+
+    public static void convertTxtToVisionmodeldata(String srcpath,String despath)throws Exception
+    {
+        try
+        {
+            Common.NavigationInfo.Builder builder = Common.NavigationInfo.newBuilder();
+            String jsonFormat = readTxtFileToJson(srcpath);
+            JsonFormat.merge(jsonFormat, builder);
+            byte[] buf= builder.build().toByteArray();
+
+            //把序列化后的数据写入本地磁盘
+            ByteArrayInputStream stream = new ByteArrayInputStream(buf);
+            BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
+            BufferedInputStream bis = new BufferedInputStream(stream);
+            int b = -1;
+            while ((b = bis.read()) != -1) {
+                bos.write(b);
+            }
+            bis.close();
+            bos.close();
+        }
+        catch(Exception e)
+        {
+            StringWriter trace=new StringWriter();
+            e.printStackTrace(new PrintWriter(trace));
+            log.error(trace.toString());
+        }
+    }
+
+    public static void convertVisionmodeldataToTxt(String srcpath,String despath)throws Exception
+    {
+        try
+        {
+            File file = new File(srcpath);
+            FileInputStream fis=new FileInputStream(file);
+
+            Common.NavigationInfo data_NavigationInfo = Common.NavigationInfo.parseFrom(fis);
+
+            //PrintStream out = new PrintStream(despath);
+            String jsonFormat1 = JsonFormat.printToString(data_NavigationInfo);
+            ByteArrayInputStream stream = new ByteArrayInputStream(jsonFormat1.getBytes());
+            BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
+            BufferedInputStream bis = new BufferedInputStream(stream);
+            int b = -1;
+            while ((b = bis.read()) != -1) {
+                bos.write(b);
+            }
+            //out.close();
+            bis.close();
+            bos.close();
+        }
+        catch(Exception e)
+        {
+            StringWriter trace=new StringWriter();
+            e.printStackTrace(new PrintWriter(trace));
+            log.error(trace.toString());
+        }
+    }
+}

+ 221 - 0
4dkankan-common/src/main/java/com/fdkankan/common/util/ConvertUtils.java

@@ -0,0 +1,221 @@
+package com.fdkankan.common.util;
+
+//import com.fdkankan.base.proto.Common;
+
+import com.fdkankan.common.proto.Visionmodeldata;
+import com.fdkankan.common.proto.format.JsonFormat;
+import lombok.extern.log4j.Log4j2;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+
+@Log4j2
+public class ConvertUtils {
+
+    public static void convertVisionModelDataToTxt(String srcPath, String desPath) throws Exception {
+
+        BufferedOutputStream bos = null;
+        BufferedInputStream bis = null;
+        try {
+            File file = new File(srcPath);
+            FileInputStream fis = new FileInputStream(file);
+
+            Visionmodeldata.NavigationInfo data_NavigationInfo = Visionmodeldata.NavigationInfo.parseFrom(fis);
+
+            String jsonFormat1 = JsonFormat.printToString(data_NavigationInfo);
+            ByteArrayInputStream stream = new ByteArrayInputStream(jsonFormat1.getBytes());
+            bos = new BufferedOutputStream(new FileOutputStream(desPath));//设置输出路径
+            bis = new BufferedInputStream(stream);
+            int b = -1;
+            while ((b = bis.read()) != -1) {
+                bos.write(b);
+            }
+            //out.close();
+            bis.close();
+            bos.close();
+        } catch (Exception e) {
+            StringWriter trace = new StringWriter();
+            e.printStackTrace(new PrintWriter(trace));
+            log.error(trace.toString());
+        } finally {
+            if (bos != null) {
+                bos.close();
+            }
+            if (bis != null) {
+                bis.close();
+            }
+        }
+    }
+
+    public static void convertTxtToVisionModelData(String srcPath, String desPath) throws Exception {
+        BufferedOutputStream bos = null;
+        BufferedInputStream bis = null;
+        try {
+            Visionmodeldata.NavigationInfo.Builder builder = Visionmodeldata.NavigationInfo.newBuilder();
+            String jsonFormat = readTxtFileToJson(srcPath);
+            JsonFormat.merge(jsonFormat, builder);
+            byte[] buf = builder.build().toByteArray();
+
+            //把序列化后的数据写入本地磁盘
+            ByteArrayInputStream stream = new ByteArrayInputStream(buf);
+            bos = new BufferedOutputStream(new FileOutputStream(desPath));//设置输出路径
+            bis = new BufferedInputStream(stream);
+            int b = -1;
+            while ((b = bis.read()) != -1) {
+                bos.write(b);
+            }
+            bis.close();
+            bos.close();
+        } catch (Exception e) {
+            StringWriter trace = new StringWriter();
+            e.printStackTrace(new PrintWriter(trace));
+            log.error(trace.toString());
+        } finally {
+            if (bos != null) {
+                bos.close();
+            }
+            if (bis != null) {
+                bis.close();
+            }
+        }
+    }
+
+    public static String readTxtFileToJson(String filePath) {
+        try {
+            String encoding = "UTF-8";
+            File file = new File(filePath);
+            if (file.isFile() && file.exists()) {
+                InputStreamReader read = new InputStreamReader(
+                        new FileInputStream(file), encoding);
+                BufferedReader bufferedReader = new BufferedReader(read);
+                String lineTxt = null;
+                String result = "";
+                while ((lineTxt = bufferedReader.readLine()) != null) {
+                    result += lineTxt;
+                }
+                read.close();
+                return result;
+            } else {
+                return null;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+
+    public List<List<String>> descartes(List<List<String>> dimValue) {
+        List<List<String>> res = new ArrayList<>();
+        if (dimValue == null || dimValue.size() == 0)
+            return res;
+        backtrace(dimValue, 0, res, new ArrayList<>());
+        return res;
+
+    }
+
+    /**
+     * 递归回溯法求解
+     *
+     * @param dimValue 原始数据集合
+     * @param index 当前执行的集合索引
+     * @param result 结果集合
+     * @param curList 当前的单个结果集
+     */
+    private void backtrace(List<List<String>> dimValue, int index,
+                           List<List<String>> result, List<String> curList) {
+
+        if (curList.size() == dimValue.size())
+            result.add(new ArrayList<>(curList));
+        else
+            for (int j = 0; j < dimValue.get(index).size(); j++) {
+                curList.add(dimValue.get(index).get(j));
+                backtrace(dimValue, index + 1, result, curList);
+                curList.remove(curList.size() - 1);
+            }
+
+    }
+
+    public static void main(String[] args) {
+        List<String> list1 = new ArrayList<String>();
+        list1.add("普通会员");
+        list1.add("专业会员");
+        list1.add("商业会员");
+        List<String> list2 = new ArrayList<String>();
+        list2.add("1G");
+        list2.add("1T");
+        List<List<String>> dimValue = new ArrayList<List<String>>();
+        dimValue.add(list1);
+        dimValue.add(list2);
+
+        // 递归实现笛卡尔积
+        ConvertUtils s = new ConvertUtils();
+        List<List<String>> res = s.descartes(dimValue);
+        System.out.println("递归实现笛卡尔乘积: 共 " + res.size() + " 个结果");
+        for (List<String> list : res) {
+            for (String string : list) {
+                System.out.print(string + " ");
+            }
+            System.out.println();
+        }
+    }
+
+    public static void convertTxtToVisionmodeldata(String srcpath,String despath)throws Exception
+    {
+        try
+        {
+            Visionmodeldata.NavigationInfo.Builder builder = Visionmodeldata.NavigationInfo.newBuilder();
+            String jsonFormat = readTxtFileToJson(srcpath);
+            JsonFormat.merge(jsonFormat, builder);
+            byte[] buf= builder.build().toByteArray();
+
+            //把序列化后的数据写入本地磁盘
+            ByteArrayInputStream stream = new ByteArrayInputStream(buf);
+            BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
+            BufferedInputStream bis = new BufferedInputStream(stream);
+            int b = -1;
+            while ((b = bis.read()) != -1) {
+                bos.write(b);
+            }
+            bis.close();
+            bos.close();
+        }
+        catch(Exception e)
+        {
+            StringWriter trace=new StringWriter();
+            e.printStackTrace(new PrintWriter(trace));
+            log.error(trace.toString());
+        }
+    }
+
+    public static void convertVisionmodeldataToTxt(String srcpath,String despath)throws Exception
+    {
+        try
+        {
+            File file = new File(srcpath);
+            FileInputStream fis=new FileInputStream(file);
+
+            Visionmodeldata.NavigationInfo data_NavigationInfo = Visionmodeldata.NavigationInfo.parseFrom(fis);
+
+            //PrintStream out = new PrintStream(despath);
+            String jsonFormat1 = JsonFormat.printToString(data_NavigationInfo);
+            ByteArrayInputStream stream = new ByteArrayInputStream(jsonFormat1.getBytes());
+            BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
+            BufferedInputStream bis = new BufferedInputStream(stream);
+            int b = -1;
+            while ((b = bis.read()) != -1) {
+                bos.write(b);
+            }
+            //out.close();
+            bis.close();
+            bos.close();
+        }
+        catch(Exception e)
+        {
+            StringWriter trace=new StringWriter();
+            e.printStackTrace(new PrintWriter(trace));
+            log.error(trace.toString());
+        }
+    }
+}

+ 593 - 0
4dkankan-common/src/main/java/com/fdkankan/common/util/CreateObjUtil.java

@@ -0,0 +1,593 @@
+package com.fdkankan.common.util;
+
+import com.fdkankan.base.proto.BigSceneProto.binary_mesh;
+import com.fdkankan.base.proto.Common;
+import com.fdkankan.base.proto.Visionmodeldata;
+import com.fdkankan.base.proto.format.JsonFormat;
+import com.fdkankan.common.constant.ConstantCmd;
+import com.fdkankan.common.constant.ConstantFileName;
+import com.fdkankan.common.constant.ConstantFilePath;
+import com.google.protobuf.TextFormat;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.time.StopWatch;
+
+import java.io.*;
+import java.util.HashMap;
+import java.util.Map;
+
+@Slf4j
+public class CreateObjUtil {
+
+	public void saveuploadImgs(String folderName) throws IOException, Exception
+	{
+		log.info("开始计算");
+		String command = "bash /home/ubuntu/photoscan-pro/build_model.sh "+folderName;
+		callshell(command);
+		boolean flag = false;
+		String sPath =  ConstantFilePath.CREATE_MODEL_PATH+folderName+File.separator+"mesh"+File.separator+"mesh.obj";
+		while(!flag)
+		{
+			flag = isModel(sPath,folderName);
+		}
+		log.info("计算完毕");
+	}
+	
+	public void saveuploadImgs2(String folderName) throws IOException, Exception
+	{
+		log.info("开始计算");
+		String command = "bash /home/ubuntu/photoscan-pro/build_bigscene.sh "+folderName;
+		callshell(command);
+		boolean flag = false;
+		String sPath = ConstantFilePath.CREATE_BIG_SCENE_PATH+folderName+File.separator+"mesh"+File.separator+"mesh.obj";
+		while(!flag)
+		{
+			flag = isModel(sPath,folderName);
+		}
+		log.info("计算完毕");
+		log.info("obj和camera转换成大场景要的格式");
+		convertobjTotxt( folderName);
+		
+	}
+
+	//开始建模
+	public static void unRar(String rarPath,String dataPath) throws Exception{
+		log.info("解压rar开始");
+		String command = "unrar e " + rarPath + " " + dataPath;
+		callshell(command);
+		log.info("解压rar完毕:" + command);
+	}
+
+	public static void unZip(String zipPath,String dataPath) throws Exception{
+		log.info("解压zip开始");
+		String command = "unzip -O GBK/GB18030CP936 " + zipPath + " -d " + dataPath;
+		callshell(command);
+		log.info("解压zip完毕:" + command);
+	}
+
+	//开始建模
+	public static void build3dModel(String folderName,String isModel) throws Exception{
+		log.info("开始建模");
+		String command = ConstantCmd.BUILD_MODEL_COMMAND+folderName;
+		callshell(command);
+		log.info("计算完毕:" + command);
+	}
+
+	//开始建模
+	public static void build3dModel2(String folderName,String isModel) throws Exception{
+		log.info("开始建模");
+		String command = ConstantCmd.BUILD_MODEL_COMMAND2+folderName;
+		callshell(command);
+		log.info("计算完毕:" + command);
+	}
+
+	//开始建模
+	public static void build3dModelOld(String folderName,String isModel) throws Exception{
+		log.info("开始v2建模");
+		String command = ConstantCmd.BUILD_MODEL_OLD_COMMAND+folderName;
+		callshell(command);
+		log.info("计算v2完毕:" + command);
+	}
+
+	//激光相机复制资源
+	public static void cpfile(String filepathOld,String filepathNew) throws Exception{
+		log.info("开始复制");
+		String command = ConstantCmd.CP_JG_EXTRA+ " " + filepathOld + " " + filepathNew;
+		callshell(command);
+		log.info("复制完毕:" + command);
+	}
+
+
+	//激光相机复制资源laser下的全部资源
+	public static void cplaserfile(String filepathOld,String filepathNew) throws Exception{
+		log.info("开始复制");
+		String command = ConstantCmd.CP_JG_ALL+ " " + filepathOld + " " + filepathNew;
+		callshell(command);
+		log.info("复制完毕:" + command);
+	}
+	
+	//开始建模
+	public void build3dModelSFM(String folderName,String isModel) throws Exception{
+		log.info("开始建模");
+		String command = ConstantCmd.BUILD_MODEL_SFM_COMMAND+folderName+" "+isModel;
+		callshell(command);
+		log.info("计算完毕");
+	}
+
+	//obj文件转换问txt
+	public static void objToTxt(String folderName,String isModel) throws Exception{
+		log.info("obj2txt开始转换");
+		String command = ConstantCmd.OBJ_TO_TXT+folderName;
+		callshell(command);
+		log.info("转换完毕:" + command);
+	}
+
+	public void rebuildModelFllor(String folderName, String isModel) {
+		try{
+			log.info("开始建模");
+			String command = ConstantCmd.REBUILD_MODEL_FLLOR+folderName+" "+isModel;
+			callshell(command);
+			log.info("计算完毕");
+		}
+		catch(Exception e)
+		{
+			e.printStackTrace();
+		}
+	}
+
+	//切图
+	public void cutImgs(String[] imgNames ,String folderName)
+	{
+		try{
+			log.info("开始切图");
+			for(int i=0;i<imgNames.length;++i)
+			{
+				String imgName=imgNames[i].replace(".jpg", "");
+				String command = ConstantCmd.CUT_IMG_COMMAND+folderName+" "+imgName;
+				callshell(command);
+			}
+			log.info("切图完毕");
+		}
+		catch(Exception e)
+		{
+			e.printStackTrace();
+		}
+	}
+	
+	//调整切图
+	public void adjustImgs(String folderName)
+	{
+		try{
+			String command = ConstantCmd.ADJUST_IMG_COMMAND + folderName;
+			log.info("开始调整图片");
+			callshell(command);
+			log.info("调整图片完毕");
+		}
+		catch(Exception e)
+		{
+			e.printStackTrace();
+		}
+	}
+	
+	//obj和camera转换成大场景要的格式
+	public void convertobjTotxt(String folderName) throws Exception
+	{
+		//obj
+		String command = "/home/ubuntu/photoscan-pro/main/mesh/mesh "+folderName;
+		callshell(command);
+		//camera
+		command = "/home/ubuntu/photoscan-pro/main/read_camera/read_camera "+folderName;
+		callshell(command);
+		
+		String prefix = ConstantFilePath.CREATE_BIG_SCENE_PATH+folderName+File.separator+"data"+File.separator;
+		String srcpath = prefix +"mesh.txt";
+		String despath = prefix +"dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam";
+				
+		convertTxtToDam( srcpath, despath);
+		//dam转换成lzma
+		command = "lzma /home/ubuntu/photo_data/bigscene/"+folderName+"/data/dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam";
+		callshell(command);
+		
+		srcpath = prefix +"vision.txt";
+		despath = prefix +"vision.modeldata";
+		convertTxtToVisionmodeldata( srcpath, despath);
+	}
+
+	public static void convertDamToLzma(String folderName)throws Exception
+	{
+		try
+		{
+			String command = "lzma "+ folderName+File.separator+ ConstantFileName.modelUUID+"_50k.dam";
+			log.info("开始转换lzma");
+			callshell(command);
+			log.info("转换lzma完毕");
+		}
+		catch(Exception e)
+		{
+			StringWriter trace=new StringWriter();
+			e.printStackTrace(new PrintWriter(trace));
+			log.error(trace.toString());
+		}
+
+	}
+
+	public static void convertDamToLzma2(String folderName)throws Exception
+	{
+		try
+		{
+			String command = "lzma "+ folderName+File.separator+ ConstantFileName.modelUUID+"_50k2.dam";
+			log.info("开始转换lzma");
+			callshell(command);
+			log.info("转换lzma完毕");
+		}
+		catch(Exception e)
+		{
+			StringWriter trace=new StringWriter();
+			e.printStackTrace(new PrintWriter(trace));
+			log.error(trace.toString());
+		}
+
+	}
+	
+	public static void convertTxtToDam(String srcpath,String despath)throws Exception
+	{
+			binary_mesh.Builder builder= binary_mesh.newBuilder();
+			InputStream inputStream = new FileInputStream(srcpath);
+			InputStreamReader reader = new InputStreamReader(inputStream, "ASCII");
+			TextFormat.merge(reader, builder);
+			byte[] buf= builder.build().toByteArray();
+			
+			 //把序列化后的数据写入本地磁盘  
+	        ByteArrayInputStream stream = new ByteArrayInputStream(buf);  
+	        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径  
+	        BufferedInputStream bis = new BufferedInputStream(stream);  
+	        int b = -1;  
+	        while ((b = bis.read()) != -1) {  
+	            bos.write(b);  
+	        }  
+	        bis.close();  
+	        bos.close();
+	}
+	
+	public static void convertVisionmodeldataToTxt(String srcpath,String despath)throws Exception
+	{
+		try
+		{
+			File file = new File(srcpath); 
+			FileInputStream fis=new FileInputStream(file);
+
+			Visionmodeldata.NavigationInfo data_NavigationInfo = Visionmodeldata.NavigationInfo.parseFrom(fis);
+	
+			//PrintStream out = new PrintStream(despath); 
+			String jsonFormat1 = JsonFormat.printToString(data_NavigationInfo);
+			ByteArrayInputStream stream = new ByteArrayInputStream(jsonFormat1.getBytes());  
+	        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径  
+	        BufferedInputStream bis = new BufferedInputStream(stream);  
+	        int b = -1;  
+	        while ((b = bis.read()) != -1) {  
+	           bos.write(b);  
+	        }  
+			//out.close();
+	        bis.close();  
+	        bos.close(); 
+		}
+		catch(Exception e)
+		{
+			StringWriter trace=new StringWriter();
+	        e.printStackTrace(new PrintWriter(trace));
+	        log.error(trace.toString());
+		}
+	}
+	
+	public static void convertTxtToVisionmodeldata(String srcpath,String despath)throws Exception
+	{
+		try
+		{
+			Visionmodeldata.NavigationInfo.Builder builder = Visionmodeldata.NavigationInfo.newBuilder();
+			String jsonFormat = readTxtFileToJson(srcpath);
+			JsonFormat.merge(jsonFormat, builder);
+			byte[] buf= builder.build().toByteArray();
+			
+			 //把序列化后的数据写入本地磁盘  
+	        ByteArrayInputStream stream = new ByteArrayInputStream(buf);  
+	        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径  
+	        BufferedInputStream bis = new BufferedInputStream(stream);  
+	        int b = -1;  
+	        while ((b = bis.read()) != -1) {  
+	           bos.write(b);  
+	        }  
+	        bis.close();  
+	        bos.close(); 
+		}
+		catch(Exception e)
+		{
+			StringWriter trace=new StringWriter();
+	        e.printStackTrace(new PrintWriter(trace));
+	        log.error(trace.toString());
+		}
+	}
+
+	public static void convertVisionmodeldataToTxtCommon(String srcpath,String despath)throws Exception
+	{
+		try
+		{
+			File file = new File(srcpath);
+			FileInputStream fis=new FileInputStream(file);
+
+			Common.NavigationInfo data_NavigationInfo = Common.NavigationInfo.parseFrom(fis);
+
+			//PrintStream out = new PrintStream(despath);
+			String jsonFormat1 = JsonFormat.printToString(data_NavigationInfo);
+			ByteArrayInputStream stream = new ByteArrayInputStream(jsonFormat1.getBytes());
+			BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
+			BufferedInputStream bis = new BufferedInputStream(stream);
+			int b = -1;
+			while ((b = bis.read()) != -1) {
+				bos.write(b);
+			}
+			//out.close();
+			bis.close();
+			bos.close();
+		}
+		catch(Exception e)
+		{
+			StringWriter trace=new StringWriter();
+			e.printStackTrace(new PrintWriter(trace));
+			log.error(trace.toString());
+		}
+	}
+
+	public static void convertTxtToVisionmodeldataCommon(String srcpath,String despath)throws Exception
+	{
+		try
+		{
+			Common.NavigationInfo.Builder builder = Common.NavigationInfo.newBuilder();
+			String jsonFormat = readTxtFileToJson(srcpath);
+			JsonFormat.merge(jsonFormat, builder);
+			byte[] buf= builder.build().toByteArray();
+
+			//把序列化后的数据写入本地磁盘
+			ByteArrayInputStream stream = new ByteArrayInputStream(buf);
+			BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
+			BufferedInputStream bis = new BufferedInputStream(stream);
+			int b = -1;
+			while ((b = bis.read()) != -1) {
+				bos.write(b);
+			}
+			bis.close();
+			bos.close();
+		}
+		catch(Exception e)
+		{
+			StringWriter trace=new StringWriter();
+			e.printStackTrace(new PrintWriter(trace));
+			log.error(trace.toString());
+		}
+	}
+	
+	public static void callshell(String command)
+	{ 
+        try {
+			 StopWatch stopWatch = new StopWatch();
+			 stopWatch.start();
+			 Process process = Runtime.getRuntime().exec(command);
+        	 StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), "ERROR");           
+             errorGobbler.start();  
+             StreamGobbler outGobbler = new StreamGobbler(process.getInputStream(), "STDOUT");  
+             outGobbler.start();  
+             process.waitFor();
+			log.info("脚本{}执行完毕,用时:{}",command,stopWatch.toString());
+        } catch (Exception e) {  
+            e.printStackTrace();  
+        }  
+	}
+	
+	public static int doWaitFor(Process process) {
+		  InputStream in = null;
+		  InputStream err = null;
+		  int exitValue = -1; // returned to caller when p is finished
+		  try {
+		    in = process.getInputStream();
+		    err = process.getErrorStream();
+		    boolean finished = false; // Set to true when p is finished
+		    while (!finished) {
+		      try {
+		        while (in.available() > 0) {
+		          // Print the output of our system call
+		          Character c = new Character((char) in.read());
+		          System.out.print(c);
+		        }
+		        while (err.available() > 0) {
+		          // Print the output of our system call
+		          Character c = new Character((char) err.read());
+		          System.out.print(c);
+		        }
+		        // Ask the process for its exitValue. If the process
+		        // is not finished, an IllegalThreadStateException
+		        // is thrown. If it is finished, we fall through and
+		        // the variable finished is set to true.
+		        exitValue = process.exitValue();
+		        finished = true;
+		      } catch (IllegalThreadStateException e) {
+		        // Process is not finished yet;
+		        // Sleep a little to save on CPU cycles
+		        Thread.currentThread().sleep(500);
+		      }
+		    }
+		  } catch (Exception e) {
+		    e.printStackTrace();
+		  } finally {
+		    try {
+		      if (in != null) {
+		        in.close();
+		      }
+		    } catch (IOException e) {
+		      e.printStackTrace();
+		    }
+		    if (err != null) {
+		      try {
+		        err.close();
+		      } catch (IOException e) {
+		        e.printStackTrace();
+		      }
+		    }
+		  }
+		  return exitValue;
+		}
+
+	
+	private boolean isModel(String sPath,String folderName)
+	{
+		boolean flag = false;  
+		File file = new File(sPath);  
+	    if (file.isFile() && file.exists()) {  
+	        flag = true;  
+	    }  
+	    log.info("等待...");
+	    return flag;  
+	}
+	
+	public static String readTxtFileToJson(String filePath){
+        try { 
+                String encoding="UTF-8"; 
+                File file=new File(filePath); 
+                if(file.isFile() && file.exists()){ 
+                    InputStreamReader read = new InputStreamReader( 
+                    new FileInputStream(file),encoding);
+                    BufferedReader bufferedReader = new BufferedReader(read); 
+                    String lineTxt = null; 
+                    String result="";
+                    while((lineTxt = bufferedReader.readLine()) != null){ 
+                    	result+=lineTxt;
+                        //log.info(lineTxt); 
+                    } 
+                    read.close(); 
+                    return result;
+        }else{ 
+            return null;
+        } 
+        } catch (Exception e) { 
+            e.printStackTrace(); 
+            return null;
+        } 
+      
+    }
+	
+	public Map<String,String> getAllFile(String dPath,String prefix)
+	{
+		File dirFile = new File(dPath);
+	    if (!dirFile.isDirectory()) {
+        }
+	    Map<String,String> map = new HashMap<String,String>();
+	    File[] files = dirFile.listFiles();
+	    for (int i = 0; i < files.length; i++) {
+            if (files[i].isFile()) {
+            	String path = files[i].getPath();
+            	map.put(path, prefix+path.substring(path.lastIndexOf("/")+1));
+            }
+        }
+	    return map;
+	}
+	
+	public Map<String,String> getchildFile(String dPath,String prefix,String childname)
+	{
+		File dirFile = new File(dPath+File.separator+childname);
+	    if (!dirFile.isDirectory()) {
+	    	return null;
+        }
+	    Map<String,String> map = new HashMap<String,String>();
+	    File[] files = dirFile.listFiles();
+	    for (int i = 0; i < files.length; i++) {
+            if (files[i].isFile()) {
+            	String path = files[i].getPath();
+            	map.put(path, prefix+childname+path.substring(path.lastIndexOf("/")));
+            }
+        }
+	    return map;
+	}
+	
+	//转台拼图
+	public void buildPanoramicImgs(String folderName)throws Exception
+	{
+		String command = ConstantCmd.BUILD_PANORAMA + folderName;
+		log.info("开始拼全景图");
+		callshell(command);
+		log.info("全景图拼接完毕");
+	}
+	
+	//六目拼图、切图,计算
+	public void buildForSix(String folderName)throws Exception
+	{
+		String command = ConstantCmd.BUILD_FOR_SIX + folderName;
+		log.info("开始处理数据(六目)");
+		callshell(command);
+		log.info("数据处理完毕(六目)");
+	}
+
+	public static void createSoftConnection(String source, String target) {
+		String command = "ln -s " + source + " " + target;
+		log.info("开始创建文件夹软连接");
+		callshell(command);
+		log.info("数据处理完毕(六目):" + command);
+	}
+
+	//合并音频
+	public static void mergeVideo(String oldVideo , String newVideo, String targetVideo) throws Exception{
+		String command = ConstantCmd.MERGE_VIDEO + " " + oldVideo + " " + newVideo + " " + targetVideo + " -y";
+		log.info("开始合并视频");
+		callshell(command);
+		log.info("合并视频完毕:" + command);
+	}
+
+	//生成一段静音音频
+	public static void createMuteViode(double time , String targetVideo) throws Exception{
+		String command = ConstantCmd.CREATE_MUTE_VIDEO + " " + time + " " + targetVideo + " -y";
+		log.info("开始生成一段静音音频");
+		callshell(command);
+		log.info("生成一段静音音频完毕:" + command);
+	}
+
+	//mp4文件转换成flv文件
+	public static void mp4ToFlv(String oldVideo, String newVideo) throws Exception{
+		String command = ConstantCmd.MP4_TO_FLV + " " + oldVideo + " " + newVideo;
+		log.info("mp4文件转换成flv文件");
+		callshell(command);
+		log.info("mp4文件转换成flv文件完毕:" + command);
+	}
+
+	//删除/mnt/data/下的数据
+	public static void deleteFile(String filePath) throws Exception{
+		String command = ConstantCmd.DELETE_FILE + " " + filePath;
+		log.info("删除/mnt/data/下的数据");
+		callshell(command);
+		log.info("删除/mnt/data/下的数据完毕:" + command);
+	}
+
+	public static void ossUtilCp(String fileUrl , String path) throws Exception{
+		String command = ConstantCmd.OSS_UTIL_CP + " " + fileUrl + " " + path;
+		Long start = System.currentTimeMillis();
+		log.info("开始oss下载文件:" + command);
+		callshell(command);
+		log.info("oss下载文件完成,时间为:" + (System.currentTimeMillis() - start));
+	}
+
+	public static void ossFileCp(String fileUrl , String path) throws Exception{
+		String command = ConstantCmd.OSS_FILE_CP + " " + fileUrl + " " + path;
+		Long start = System.currentTimeMillis();
+		log.info("开始s3文件下载文件:" + command);
+		callshell(command);
+		log.info("s3文件下载文件完成,时间为:" + (System.currentTimeMillis() - start));
+	}
+
+	/**
+	 * matterpro场景获取阿里云的切图数据
+	 * @param path
+	 * @throws Exception
+     */
+	public static void matterproCutImg(String num , String path) throws Exception{
+		String command = ConstantCmd.MATTERPRO_CUT_IMG + " -s " + num + " -d " + path;
+		Long start = System.currentTimeMillis();
+		log.info("开始matterpro获取阿里云图片方法:" + command);
+		callshell(command);
+		log.info("matterpro获取阿里云图片方法完成,时间为:" + (System.currentTimeMillis() - start));
+	}
+}

+ 0 - 0
4dkankan-common/src/main/java/com/fdkankan/common/util/DateExtUtil.java


Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.