Browse Source

Merge branch 'release'

dengsixing 10 months ago
parent
commit
0eb54f6856
100 changed files with 5102 additions and 946 deletions
  1. 2 1
      pom.xml
  2. 17 0
      src/main/java/com/fdkankan/contro/bean/SceneJsonBean.java
  3. 26 0
      src/main/java/com/fdkankan/contro/bean/SyncLaserResultBean.java
  4. 3 0
      src/main/java/com/fdkankan/contro/constant/UserEditDataType.java
  5. 49 0
      src/main/java/com/fdkankan/contro/controller/InnerController.java
  6. 43 2
      src/main/java/com/fdkankan/contro/controller/SceneFileController.java
  7. 5 3
      src/main/java/com/fdkankan/contro/controller/TestController.java
  8. 52 0
      src/main/java/com/fdkankan/contro/entity/AppCameraFailLog.java
  9. 3 0
      src/main/java/com/fdkankan/contro/entity/CameraDetail.java
  10. 66 0
      src/main/java/com/fdkankan/contro/entity/CameraType.java
  11. 75 0
      src/main/java/com/fdkankan/contro/entity/ExceedSpaceScene.java
  12. 7 1
      src/main/java/com/fdkankan/contro/entity/IncrementType.java
  13. 61 0
      src/main/java/com/fdkankan/contro/entity/MqSendLog.java
  14. 4 1
      src/main/java/com/fdkankan/contro/entity/SceneBuildProcessLog.java
  15. 69 0
      src/main/java/com/fdkankan/contro/entity/SceneCleanOrig.java
  16. 72 0
      src/main/java/com/fdkankan/contro/entity/SceneColdStorage.java
  17. 81 0
      src/main/java/com/fdkankan/contro/entity/SceneColdStorageLog.java
  18. 51 0
      src/main/java/com/fdkankan/contro/entity/SceneCopyLog.java
  19. 32 2
      src/main/java/com/fdkankan/contro/entity/SceneEditControls.java
  20. 26 2
      src/main/java/com/fdkankan/contro/entity/SceneEditInfoExt.java
  21. 60 0
      src/main/java/com/fdkankan/contro/entity/SceneInfoSyncMqConfig.java
  22. 12 0
      src/main/java/com/fdkankan/contro/entity/ScenePlusExt.java
  23. 49 0
      src/main/java/com/fdkankan/contro/entity/SceneRebuildLog.java
  24. 51 0
      src/main/java/com/fdkankan/contro/entity/SceneUploadCount.java
  25. 2 1
      src/main/java/com/fdkankan/contro/enums/CameraTypeEnum.java
  26. 145 0
      src/main/java/com/fdkankan/contro/factory/UserEditData/FiltersHandler.java
  27. 60 0
      src/main/java/com/fdkankan/contro/factory/UserEditData/FloorplanHandler.java
  28. 1 1
      src/main/java/com/fdkankan/contro/factory/UserEditData/UserEditDataHandler.java
  29. 1 1
      src/main/java/com/fdkankan/contro/generate/AutoGenerate.java
  30. 18 0
      src/main/java/com/fdkankan/contro/mapper/IAppCameraFailLogMapper.java
  31. 18 0
      src/main/java/com/fdkankan/contro/mapper/ICameraTypeMapper.java
  32. 18 0
      src/main/java/com/fdkankan/contro/mapper/IExceedSpaceSceneMapper.java
  33. 18 0
      src/main/java/com/fdkankan/contro/mapper/IMqSendLogMapper.java
  34. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneCleanOrigMapper.java
  35. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneColdStorageLogMapper.java
  36. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneColdStorageMapper.java
  37. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneCopyLogMapper.java
  38. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneInfoSyncMqConfigMapper.java
  39. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneRebuildLogMapper.java
  40. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneUploadCountMapper.java
  41. 14 10
      src/main/java/com/fdkankan/contro/mq/listener/AbstrackBuildSceneListener.java
  42. 121 0
      src/main/java/com/fdkankan/contro/mq/listener/BuildE57Listener.java
  43. 54 0
      src/main/java/com/fdkankan/contro/mq/listener/BuildIntermitSceneListener.java
  44. 54 0
      src/main/java/com/fdkankan/contro/mq/listener/BuildLiguangListener.java
  45. 2 2
      src/main/java/com/fdkankan/contro/mq/listener/BuildObjListener.java
  46. 2 2
      src/main/java/com/fdkankan/contro/mq/listener/BuildSceneListener.java
  47. 2 2
      src/main/java/com/fdkankan/contro/mq/listener/BuildSceneProcessLogListener.java
  48. 2 2
      src/main/java/com/fdkankan/contro/mq/listener/BuildV3SceneListener.java
  49. 2 2
      src/main/java/com/fdkankan/contro/mq/listener/IBuildSceneListener.java
  50. 65 0
      src/main/java/com/fdkankan/contro/mq/listener/UpdateSceneStatusListener.java
  51. 0 29
      src/main/java/com/fdkankan/contro/mq/service/ICommonService.java
  52. 185 0
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildE57SceneServiceImpl.java
  53. 359 0
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildIntermitSceneServiceImpl.java
  54. 591 0
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildLiguangServiceImpl.java
  55. 69 59
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java
  56. 169 430
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java
  57. 74 52
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java
  58. 0 228
      src/main/java/com/fdkankan/contro/mq/service/impl/CommonServiceImpl.java
  59. 0 27
      src/main/java/com/fdkankan/contro/schedule/ScheduleJob.java
  60. 23 0
      src/main/java/com/fdkankan/contro/service/IAppCameraFailLogService.java
  61. 2 0
      src/main/java/com/fdkankan/contro/service/IBuildSceneDTService.java
  62. 1 1
      src/main/java/com/fdkankan/contro/service/ICameraDetailService.java
  63. 2 0
      src/main/java/com/fdkankan/contro/service/ICameraService.java
  64. 18 0
      src/main/java/com/fdkankan/contro/service/ICameraTypeService.java
  65. 61 0
      src/main/java/com/fdkankan/contro/service/ICommonService.java
  66. 29 0
      src/main/java/com/fdkankan/contro/service/IExceedSpaceSceneService.java
  67. 5 3
      src/main/java/com/fdkankan/contro/service/IFdkkLaserService.java
  68. 7 0
      src/main/java/com/fdkankan/contro/service/IInnerService.java
  69. 16 0
      src/main/java/com/fdkankan/contro/service/IMqSendLogService.java
  70. 3 3
      src/main/java/com/fdkankan/contro/service/ISceneBuildProcessLogService.java
  71. 21 0
      src/main/java/com/fdkankan/contro/service/ISceneCleanOrigService.java
  72. 22 0
      src/main/java/com/fdkankan/contro/service/ISceneColdStorageLogService.java
  73. 20 0
      src/main/java/com/fdkankan/contro/service/ISceneColdStorageService.java
  74. 22 0
      src/main/java/com/fdkankan/contro/service/ISceneCopyLogService.java
  75. 3 1
      src/main/java/com/fdkankan/contro/service/ISceneFileBuildService.java
  76. 21 0
      src/main/java/com/fdkankan/contro/service/ISceneInfoSyncMqConfigService.java
  77. 3 0
      src/main/java/com/fdkankan/contro/service/IScenePlusExtService.java
  78. 1 0
      src/main/java/com/fdkankan/contro/service/IScenePlusService.java
  79. 4 0
      src/main/java/com/fdkankan/contro/service/ISceneProService.java
  80. 16 0
      src/main/java/com/fdkankan/contro/service/ISceneRebuildLogService.java
  81. 27 0
      src/main/java/com/fdkankan/contro/service/ISceneUploadCountService.java
  82. 7 0
      src/main/java/com/fdkankan/contro/service/IWbService.java
  83. 9 0
      src/main/java/com/fdkankan/contro/service/IntermitSceneService.java
  84. 27 0
      src/main/java/com/fdkankan/contro/service/impl/AppCameraFailLogServiceImpl.java
  85. 21 21
      src/main/java/com/fdkankan/contro/service/impl/BuildSceneDTServiceImpl.java
  86. 7 10
      src/main/java/com/fdkankan/contro/service/impl/CameraDetailServiceImpl.java
  87. 14 0
      src/main/java/com/fdkankan/contro/service/impl/CameraServiceImpl.java
  88. 24 0
      src/main/java/com/fdkankan/contro/service/impl/CameraTypeServiceImpl.java
  89. 790 0
      src/main/java/com/fdkankan/contro/service/impl/CommonServiceImpl.java
  90. 134 0
      src/main/java/com/fdkankan/contro/service/impl/ExceedSpaceSceneServiceImpl.java
  91. 57 23
      src/main/java/com/fdkankan/contro/service/impl/IFdkkLaserServiceImpl.java
  92. 339 0
      src/main/java/com/fdkankan/contro/service/impl/InnerServiceImpl.java
  93. 60 0
      src/main/java/com/fdkankan/contro/service/impl/IntermitSceneServiceImpl.java
  94. 20 0
      src/main/java/com/fdkankan/contro/service/impl/MqSendLogServiceImpl.java
  95. 11 3
      src/main/java/com/fdkankan/contro/service/impl/Scene3dNumServiceImpl.java
  96. 43 21
      src/main/java/com/fdkankan/contro/service/impl/SceneBuildProcessLogServiceImpl.java
  97. 29 0
      src/main/java/com/fdkankan/contro/service/impl/SceneCleanOrigServiceImpl.java
  98. 32 0
      src/main/java/com/fdkankan/contro/service/impl/SceneColdStorageLogServiceImpl.java
  99. 63 0
      src/main/java/com/fdkankan/contro/service/impl/SceneColdStorageServiceImpl.java
  100. 0 0
      src/main/java/com/fdkankan/contro/service/impl/SceneCopyLogServiceImpl.java

+ 2 - 1
pom.xml

@@ -196,6 +196,7 @@
 
   </dependencies>
   <build>
+    <finalName>${artifactId}</finalName>
     <plugins>
       <plugin>
         <groupId>org.springframework.boot</groupId>
@@ -215,4 +216,4 @@
   </build>
 
 
-</project>
+</project>

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

@@ -204,5 +204,22 @@ public class SceneJsonBean {
      */
     private Integer surveillances;
 
+    /**
+     * 是否有指示牌
+     */
+    private Integer billboards;
+
+    /**
+     * 模型裁剪
+     */
+    private Integer cutModel;
+
+    /**
+     * 入场设置
+     */
+    private JSONObject started;
+
+    private Integer sceneDraw;
+
 
 }

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

@@ -0,0 +1,26 @@
+package com.fdkankan.contro.bean;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SyncLaserResultBean {
+
+    private String num;
+    private String dataSource;
+    private Integer sceneStatus;
+    private Date createTime;
+    private Integer shootCount;
+    private Integer payStatus;
+    private Integer mixture;
+    private String version;
+
+
+}

+ 3 - 0
src/main/java/com/fdkankan/contro/constant/UserEditDataType.java

@@ -6,6 +6,9 @@ package com.fdkankan.contro.constant;
 public enum UserEditDataType {
 
     BOX_MODEL("boxModel", "boxModelHandler"),
+    FLOORPLAN("floorplan", "floorplanHandler"),
+
+    FILTERS("filters", "filtersHandler"),
     ;
 
     private String code;

+ 49 - 0
src/main/java/com/fdkankan/contro/controller/InnerController.java

@@ -0,0 +1,49 @@
+package com.fdkankan.contro.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.constant.ModelingBuildStatus;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.contro.service.IAppCameraFailLogService;
+import com.fdkankan.contro.service.IInnerService;
+import com.fdkankan.contro.service.ISceneFileBuildService;
+import com.fdkankan.contro.service.ISceneUploadCountService;
+import com.fdkankan.contro.vo.ReportFailLogVO;
+import com.fdkankan.contro.vo.ResponseSceneFile;
+import com.fdkankan.contro.vo.SceneUploadCountParamVO;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
+import com.fdkankan.web.response.ResultData;
+import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 场景文件上传模块
+ */
+@Log4j2
+@RestController
+@RequestMapping("/api/inner")
+public class InnerController {
+
+    @Autowired
+    private IInnerService innerService;
+
+    @GetMapping("uploadArtificialResult")
+    public ResultData uploadArtificialResult(String num) throws Exception {
+        innerService.uploadArtificialResult(num);
+        return ResultData.ok();
+    }
+
+
+}

+ 43 - 2
src/main/java/com/fdkankan/contro/controller/SceneFileController.java

@@ -5,8 +5,12 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.contro.service.IAppCameraFailLogService;
 import com.fdkankan.contro.service.ISceneFileBuildService;
+import com.fdkankan.contro.service.ISceneUploadCountService;
+import com.fdkankan.contro.vo.ReportFailLogVO;
 import com.fdkankan.contro.vo.ResponseSceneFile;
+import com.fdkankan.contro.vo.SceneUploadCountParamVO;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.web.response.ResultData;
 import lombok.extern.log4j.Log4j2;
@@ -14,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.validation.Valid;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -34,6 +39,12 @@ public class SceneFileController{
     @Autowired
     private FYunFileServiceInterface fYunFileService;
 
+    @Autowired
+    private ISceneUploadCountService sceneUploadCountService;
+
+    @Autowired
+    private IAppCameraFailLogService appCameraFailLogService;
+
 
     /**
      * 场景文件上传之前先获取fileId
@@ -69,8 +80,11 @@ public class SceneFileController{
     }
 
     @GetMapping("rebuildScene")
-    public ResultData rebuildScene(@RequestParam(value = "num") String num,@RequestParam(value = "force",defaultValue = "false") Boolean force ,@RequestParam(value = "deleteExtras",defaultValue = "true") Boolean deleteExtras) throws IOException {
-        return sceneFileBuildService.rebuildScene(num,force,deleteExtras);
+    public ResultData rebuildScene(@RequestParam(value = "num") String num,
+                                   @RequestParam(value = "force",defaultValue = "false") Boolean force ,
+                                   @RequestParam(value = "deleteExtras",defaultValue = "true") Boolean deleteExtras,
+                                   @RequestParam(value = "from", defaultValue = "api") String from) throws IOException {
+        return sceneFileBuildService.rebuildScene(num,force,deleteExtras, from);
     }
 
 
@@ -119,4 +133,31 @@ public class SceneFileController{
                                        @RequestParam(value = "sourceBucket") String sourceBucket) throws Exception {
         return sceneFileBuildService.copyDataAndBuild(sourceBucket,dataSource ,sceneVer);
     }
+
+    /**
+     * 记录app触发上传场景
+     * @param param
+     * @return
+     */
+    @PostMapping("/increSceneUploadCount")
+    public ResultData increSceneUploadCount(@RequestBody @Valid SceneUploadCountParamVO param){
+        sceneUploadCountService.increSceneUploadCount(param);
+        return ResultData.ok();
+    }
+
+    @PostMapping("/reportFailLog")
+    public ResultData reportFailLog(@RequestBody @Valid ReportFailLogVO param){
+        appCameraFailLogService.reportFailLog(param);
+        return ResultData.ok();
+    }
+
+    /**
+     * 计算理光相机格式场景
+     * @return
+     */
+    @PostMapping("uploadLiguang")
+    public ResultData uploadLiguang(String num, String snCode, String ossPath) throws Exception {
+        return sceneFileBuildService.uploadLiguang(num, snCode, ossPath);
+    }
+
 }

+ 5 - 3
src/main/java/com/fdkankan/contro/controller/TestController.java

@@ -1,9 +1,10 @@
 package com.fdkankan.contro.controller;
 
-import com.fdkankan.contro.mq.service.ICommonService;
+import com.fdkankan.contro.service.ICommonService;
 import com.fdkankan.contro.service.IScene3dNumService;
 import com.fdkankan.web.response.ResultData;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -24,11 +25,12 @@ public class TestController {
     private IScene3dNumService scene3dNumService;
     @Autowired
     private ICommonService commonService;
+    @Value("${4dkk.laserService.bucket}")
+    private String bucket;
 
     @GetMapping("/test")
     public ResultData test(String num) throws Exception {
-        commonService.sendEmail(num);
-        return ResultData.ok();
+        return ResultData.ok(bucket);
     }
 
 }

+ 52 - 0
src/main/java/com/fdkankan/contro/entity/AppCameraFailLog.java

@@ -0,0 +1,52 @@
+package com.fdkankan.contro.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>
+ * app错误上报
+ * </p>
+ *
+ * @author 
+ * @since 2024-05-20
+ */
+@Getter
+@Setter
+@TableName("t_app_camera_fail_log")
+public class AppCameraFailLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    @TableField("uuid")
+    private String uuid;
+
+    /**
+     * 错误来源(app,camera)
+     */
+    @TableField("source")
+    private String source;
+
+    /**
+     * 错误原因
+     */
+    @TableField("reason")
+    private String reason;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+
+}

+ 3 - 0
src/main/java/com/fdkankan/contro/entity/CameraDetail.java

@@ -147,5 +147,8 @@ public class CameraDetail implements Serializable {
     @TableField("last_request_time")
     private Date lastRequestTime;
 
+    @TableField("unit")
+    private String unit;
+
 
 }

+ 66 - 0
src/main/java/com/fdkankan/contro/entity/CameraType.java

@@ -0,0 +1,66 @@
+package com.fdkankan.contro.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2023-04-11
+ */
+@Getter
+@Setter
+@TableName("t_camera_type")
+public class CameraType implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 相机类型表
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 0 旧双目相机,1思维看看pro八目相机(看看),2看看lite,5指房宝,9双目转台(看见),10激光转台(深时),11激光转台(深光)
+     */
+    @TableField("camera_type")
+    private Integer cameraType;
+
+    /**
+     * 场景码前缀
+     */
+    @TableField("scene_prefix")
+    private String scenePrefix;
+
+    /**
+     * 相机WiFiname前缀
+     */
+    @TableField("wifi_name_prefix")
+    private String wifiNamePrefix;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A", delval = "I")
+    private String recStatus;
+
+    @TableField("remark")
+    private String remark;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+
+}

+ 75 - 0
src/main/java/com/fdkankan/contro/entity/ExceedSpaceScene.java

@@ -0,0 +1,75 @@
+package com.fdkankan.contro.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 超出容量场景码表
+ * </p>
+ *
+ * @author 
+ * @since 2023-06-29
+ */
+@Getter
+@Setter
+@TableName("t_exceed_space_scene")
+public class ExceedSpaceScene implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 场景码
+     */
+    @TableField("num")
+    private String num;
+
+    /**
+     * 初次上传用户id
+     */
+    @TableField("user_id")
+    private Long userId;
+
+    /**
+     * 相机id
+     */
+    @TableField("camera_id")
+    private Long cameraId;
+
+    @TableField("file_id")
+    private String fileId;
+
+    @TableField("unicode")
+    private String unicode;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+    /**
+     * 修改时间
+     */
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * A-有效,I-无效
+     */
+    @TableField("rec_status")
+    @TableLogic(value = "A", delval = "I")
+    private String recStatus;
+
+
+}

+ 7 - 1
src/main/java/com/fdkankan/contro/entity/IncrementType.java

@@ -53,7 +53,13 @@ public class IncrementType implements Serializable {
      * 相机容量 单位 G
      */
     @TableField("camera_capacity")
-    private Integer cameraCapacity;
+    private Long cameraCapacity;
+
+    /**
+     * 相机容量 单位 G
+     */
+    @TableField("camera_space")
+    private Long cameraSpace;
 
     /**
      * 购买之后,有效期天数,-1代表无限制

+ 61 - 0
src/main/java/com/fdkankan/contro/entity/MqSendLog.java

@@ -0,0 +1,61 @@
+package com.fdkankan.contro.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 
+ * @since 2024-03-27
+ */
+@Getter
+@Setter
+@TableName("mq_send_log")
+public class MqSendLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 发送的队列
+     */
+    @TableField("queue")
+    private String queue;
+
+    /**
+     * 发送的mq消息
+     */
+    @TableField("content")
+    private String content;
+
+    @TableField("num")
+    private String num;
+
+    @TableField("es_name")
+    private String esName;
+
+    /**
+     * 0未发送,1已发送
+     */
+    @TableField("status")
+    private Integer status;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+
+}

+ 4 - 1
src/main/java/com/fdkankan/contro/entity/SceneBuildProcessLog.java

@@ -15,7 +15,7 @@ import lombok.Setter;
  * 场景计算流程状态表
  * </p>
  *
- * @author 
+ * @author
  * @since 2023-01-28
  */
 @Getter
@@ -77,5 +77,8 @@ public class SceneBuildProcessLog implements Serializable {
     @TableLogic(value = "A", delval = "I")
     private String recStatus;
 
+    @TableField("biz_type")
+    private String bizType;
+
 
 }

+ 69 - 0
src/main/java/com/fdkankan/contro/entity/SceneCleanOrig.java

@@ -0,0 +1,69 @@
+package com.fdkankan.contro.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 删除oss原始资源记录
+ * </p>
+ *
+ * @author 
+ * @since 2023-04-17
+ */
+@Getter
+@Setter
+@TableName("t_scene_clean_orig")
+public class SceneCleanOrig implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    @TableField("num")
+    private String num;
+
+    @TableField("type")
+    private Integer type;
+
+    /**
+     * 0-处理中,1-成功,-1失败
+     */
+    @TableField("state")
+    private Integer state;
+
+    /**
+     * 失败原因
+     */
+    @TableField("reason")
+    private String reason;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+    /**
+     * 修改时间
+     */
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * A-有效,I-删除
+     */
+    @TableField("rec_status")
+    @TableLogic(value = "A")
+    private String recStatus;
+
+
+}

+ 72 - 0
src/main/java/com/fdkankan/contro/entity/SceneColdStorage.java

@@ -0,0 +1,72 @@
+package com.fdkankan.contro.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 场景封存状态表
+ * </p>
+ *
+ * @author 
+ * @since 2023-07-25
+ */
+@Getter
+@Setter
+@TableName("t_scene_cold_storage")
+public class SceneColdStorage implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 场景码
+     */
+    @TableField("num")
+    private String num;
+
+    /**
+     * 1-封存,2-未封存
+     */
+    @TableField("state")
+    private Integer state;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+    /**
+     * 修改时间
+     */
+    @TableField("update_time")
+    private Date updateTime;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A", delval = "I")
+    private String recStatus;
+
+    /**
+     * 冷存储bucket
+     */
+    @TableField("cold_bucket")
+    private String coldBucket;
+
+    /**
+     * 正常使用bucket
+     */
+    @TableField("bucket")
+    private String bucket;
+
+
+}

+ 81 - 0
src/main/java/com/fdkankan/contro/entity/SceneColdStorageLog.java

@@ -0,0 +1,81 @@
+package com.fdkankan.contro.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 场景冷归档日志表
+ * </p>
+ *
+ * @author 
+ * @since 2023-07-14
+ */
+@Getter
+@Setter
+@TableName("t_scene_cold_storage_log")
+public class SceneColdStorageLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 场景码
+     */
+    @TableField("num")
+    private String num;
+
+    /**
+     * 封存地址
+     */
+    @TableField("path")
+    private String path;
+
+    /**
+     * 操作类型(1-封存,2-解封存)
+     */
+    @TableField("type")
+    private Integer type;
+
+    /**
+     * 0-处理中,1-成功,-1-失败
+     */
+    @TableField("state")
+    private Integer state;
+
+    /**
+     * 失败原因
+     */
+    @TableField("reason")
+    private String reason;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+    /**
+     * 修改时间
+     */
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * A-有效,I-无效
+     */
+    @TableField("rec_status")
+    @TableLogic(value = "A", delval = "I")
+    private String recStatus;
+
+
+}

+ 51 - 0
src/main/java/com/fdkankan/contro/entity/SceneCopyLog.java

@@ -0,0 +1,51 @@
+package com.fdkankan.contro.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2023-04-17
+ */
+@Getter
+@Setter
+@TableName("t_scene_copy_log")
+public class SceneCopyLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("old_num")
+    private String oldNum;
+
+    @TableField("new_num")
+    private String newNum;
+
+    @TableField("copy_user_id")
+    private Integer copyUserId;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+
+}

+ 32 - 2
src/main/java/com/fdkankan/contro/entity/SceneEditControls.java

@@ -9,10 +9,10 @@ import java.util.Date;
 
 /**
  * <p>
- * 
+ *
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-01-20
  */
 @Getter
@@ -89,6 +89,36 @@ public class SceneEditControls implements Serializable {
     private Integer showRule;
 
     /**
+     * 是否展示标尺(0-不需要,1-需要)
+     */
+    @TableField("show_scale")
+    private Integer showScale;
+
+    /**
+     * 是否展示分享场景(0-不需要,1-需要)
+     */
+    @TableField("show_share")
+    private Integer showShare;
+
+    /**
+     * 是否展示分享热点(0-不需要,1-需要)
+     */
+    @TableField("show_tagshare")
+    private Integer showTagshare;
+
+    /**
+     * 是否显示合照开关(0-不需要,1-需要)
+     */
+    @TableField("show_capture")
+    private Integer showCapture;
+
+    /**
+     * 是否显示空间绘制标题
+     */
+    @TableField("show_draw_title")
+    private Integer showDrawTitle;
+
+    /**
      * 创建时间
      */
     @TableField("create_time")

+ 26 - 2
src/main/java/com/fdkankan/contro/entity/SceneEditInfoExt.java

@@ -11,10 +11,10 @@ import lombok.Setter;
 
 /**
  * <p>
- * 
+ *
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-03-07
  */
 @Getter
@@ -91,6 +91,30 @@ public class SceneEditInfoExt {
     private String shareLogoImg;
 
     /**
+     * 是否有指示牌
+     */
+    @TableField("billboards")
+    private Integer billboards;
+
+    /**
+     * 模型裁剪
+     */
+    @TableField("cut_model")
+    private Integer cutModel;
+
+    /**
+     * 入厂设置
+     */
+    @TableField("started")
+    private String started;
+
+    /**
+     * 是否有空间绘制
+     */
+    @TableField("scene_draw")
+    private Integer sceneDraw;
+
+    /**
      * 创建时间
      */
     @TableField("create_time")

+ 60 - 0
src/main/java/com/fdkankan/contro/entity/SceneInfoSyncMqConfig.java

@@ -0,0 +1,60 @@
+package com.fdkankan.contro.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 场景信息变更需要发送mq信息队列配置表
+ * </p>
+ *
+ * @author
+ * @since 2024-04-16
+ */
+@Getter
+@Setter
+@TableName("t_scene_info_sync_mq_config")
+public class SceneInfoSyncMqConfig implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 需要同步的消息类型
+     */
+    @TableField("info_type")
+    private String infoType;
+
+    /**
+     * 队列名
+     */
+    @TableField("queue_name")
+    private String queueName;
+
+    /**
+     * 需要同步信息的应用名
+     */
+    @TableField("app_name")
+    private String appName;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * A正常,I删除
+     */
+    @TableField("rec_status")
+    @TableLogic("A")
+    private String recStatus;
+
+
+}

+ 12 - 0
src/main/java/com/fdkankan/contro/entity/ScenePlusExt.java

@@ -65,6 +65,12 @@ public class ScenePlusExt implements Serializable {
     private Long space;
 
     /**
+     * 原始文件容量
+     */
+    @TableField("orig_space")
+    private Long origSpace;
+
+    /**
      * 云服务器类型
      */
     @TableField("ecs")
@@ -145,6 +151,12 @@ public class ScenePlusExt implements Serializable {
     @TableField("yun_file_bucket")
     private String yunFileBucket;
 
+    @TableField("location")
+    private Integer location;
+
+    @TableField("mixture")
+    private Integer mixture;
+
     /**
      * 创建时间
      */

+ 49 - 0
src/main/java/com/fdkankan/contro/entity/SceneRebuildLog.java

@@ -0,0 +1,49 @@
+package com.fdkankan.contro.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
+ * @since 2024-05-17
+ */
+@Getter
+@Setter
+@TableName("t_scene_rebuild_log")
+public class SceneRebuildLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 场景码
+     */
+    @TableField("num")
+    private String num;
+
+    /**
+     * 调用来源(api-接口调用,manage-管理后台调用,laser-点位校准调用)
+     */
+    @TableField("source")
+    private String source;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+
+}

+ 51 - 0
src/main/java/com/fdkankan/contro/entity/SceneUploadCount.java

@@ -0,0 +1,51 @@
+package com.fdkankan.contro.entity;
+
+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>
+ * app触发场景上传统计表
+ * </p>
+ *
+ * @author 
+ * @since 2024-05-20
+ */
+@Getter
+@Setter
+@TableName("t_scene_upload_count")
+public class SceneUploadCount implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId("id")
+    private Long id;
+
+    @TableField("uuid")
+    private String uuid;
+
+    /**
+     * 相机码
+     */
+    @TableField("sn_code")
+    private String snCode;
+
+    /**
+     * 触发上传次数
+     */
+    @TableField("count")
+    private Integer count;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+
+}

+ 2 - 1
src/main/java/com/fdkankan/contro/enums/CameraTypeEnum.java

@@ -9,7 +9,8 @@ public enum CameraTypeEnum {
     FDKK_LITE(2,"KK-","4DKKLITE_","四维看看lite"),
     ZHIHOUSE_REDHOUSE(5,"KK-","4DKKLITE_","指房宝小红屋相机"),
     DOUBLE_EYE_TURN(9,"KJ-","4DKKLITE_","双目转台"),
-    LASER_TURN(10,"SS-","4DKKLA_","激光转台");
+    LASER_TURN(10,"SS-","4DKKLA_","激光转台"),
+    LASER_SG(11,"SG-","4DSG_","深光");
 
 
     private int type;

+ 145 - 0
src/main/java/com/fdkankan/contro/factory/UserEditData/FiltersHandler.java

@@ -0,0 +1,145 @@
+package com.fdkankan.contro.factory.UserEditData;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.constant.CommonStatus;
+import com.fdkankan.common.constant.SceneSource;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.entity.SceneEditInfo;
+import com.fdkankan.contro.entity.SceneEditInfoExt;
+import com.fdkankan.contro.entity.ScenePlus;
+import com.fdkankan.contro.entity.ScenePlusExt;
+import com.fdkankan.contro.service.ISceneEditInfoExtService;
+import com.fdkankan.contro.service.ISceneEditInfoService;
+import com.fdkankan.contro.service.IScenePlusExtService;
+import com.fdkankan.contro.service.IScenePlusService;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.model.utils.SceneUtil;
+import com.fdkankan.redis.constant.RedisKey;
+import com.fdkankan.redis.constant.RedisLockKey;
+import com.fdkankan.redis.util.RedisLockUtil;
+import com.fdkankan.redis.util.RedisUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * 初始化空间模型
+ */
+@Slf4j
+@Component("filtersHandler")
+public class FiltersHandler implements UserEditDataHandler {
+
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private ISceneEditInfoService sceneEditInfoService;
+    @Autowired
+    private ISceneEditInfoExtService sceneEditInfoExtService;
+    @Resource
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private RedisUtil redisUtil;
+    @Value("${env:gn}")
+    private String env;
+    @Resource
+    private RedisLockUtil redisLockUtil;
+
+    @Override
+    public void init(String num, Map<String, Object> params) throws Exception {
+
+        //国际服且看看且没有滤镜数据的才需要生成默认滤镜信息
+        if(!"eur".equals(env)){
+            return;
+        }
+        log.info("国际环境,开始初始化滤镜,num:{}", num);
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+        if(scenePlus.getSceneSource() != SceneSource.BM.code()){
+            return;
+        }
+        log.info("看看场景,开始初始化滤镜,num:{}", num);
+        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+        String dataSource = scenePlusExt.getDataSource();
+        SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
+        SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
+//        if(Objects.nonNull(sceneEditInfoExt.getFilters())
+//                && sceneEditInfoExt.getFilters() == CommonStatus.YES.code().intValue()){
+//            return;
+//        }
+
+        //获取全景图id
+        String visionPath = dataSource + File.separator + "results" + File.separator + "vision.txt";
+
+        List<String> panoramaUuidList = SceneUtil.getPanoramaUuidList(visionPath);
+        log.info("点位id,{}",JSON.toJSONString(panoramaUuidList));
+        //{saturation: 0.35, brightness: 0.35, contrast: 0.4, temperature: 0.25, id: "0"}
+        List<JSONObject> collect = panoramaUuidList.stream().map(v -> {
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("id", v);
+            jsonObject.put("saturation", new BigDecimal(-4).divide(new BigDecimal(20)).setScale(2));//饱和度
+            jsonObject.put("brightness", new BigDecimal(0).divide(new BigDecimal(20)).setScale(2));//亮度
+            jsonObject.put("contrast", new BigDecimal(0).divide(new BigDecimal(20)).setScale(2));//对比度
+            jsonObject.put("temperature", new BigDecimal(2).divide(new BigDecimal(20)).setScale(2));//对比度
+            return jsonObject;
+        }).collect(Collectors.toList());
+
+        String key = String.format(RedisKey.SCENE_filter_DATA,num);
+        List<String> filterList = collect.stream().map(item->JSON.toJSONString(item)).collect(Collectors.toList());
+        log.info("滤镜数据,filterList,{}",JSON.toJSONString(filterList));
+        redisUtil.del(key);
+        redisUtil.lRightPushAll(key, filterList);
+
+        String userViewPath = String.format(UploadFilePath.USER_VIEW_PATH, num);
+        List<String> list = redisUtil.lGet(key, 0, -1);
+        JSONArray jsonArray = new JSONArray();
+        list.stream().forEach(str->jsonArray.add(JSON.parseObject(str)));
+        fYunFileService.uploadFile(JSON.toJSONBytes(jsonArray), userViewPath + "filter.json");
+
+        //写本地文件,作为备份
+        this.writeFilter(num);
+
+        sceneEditInfoExt.setFilters(CommonStatus.YES.code().intValue());
+        sceneEditInfoExtService.updateById(sceneEditInfoExt);
+
+    }
+
+    private void writeFilter(String num) throws Exception{
+
+        String filterPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + "filter.json";
+
+        String key = String.format(RedisKey.SCENE_filter_DATA, num);
+        List<String> filters = redisUtil.lGet(key, 0, -1);
+        if(CollUtil.isEmpty(filters)){
+            FileUtils.deleteFile(filterPath);
+            return;
+        }
+
+        String lockKey = String.format(RedisLockKey.LOCK_filter_JSON, num);
+        String lockVal = cn.hutool.core.lang.UUID.randomUUID().toString();
+        boolean lock = redisLockUtil.lock(lockKey, lockVal, RedisKey.EXPIRE_TIME_1_MINUTE);
+        if(!lock){
+            return;
+        }
+        try{
+            FileUtils.writeFile(filterPath, JSON.toJSONString(filters));
+        }finally {
+            redisLockUtil.unlockLua(lockKey, lockVal);
+        }
+    }
+}

+ 60 - 0
src/main/java/com/fdkankan/contro/factory/UserEditData/FloorplanHandler.java

@@ -0,0 +1,60 @@
+package com.fdkankan.contro.factory.UserEditData;
+
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.common.constant.CommonStatus;
+import com.fdkankan.contro.entity.SceneEditInfo;
+import com.fdkankan.contro.entity.ScenePlus;
+import com.fdkankan.contro.entity.ScenePlusExt;
+import com.fdkankan.contro.service.ISceneEditInfoService;
+import com.fdkankan.contro.service.IScenePlusExtService;
+import com.fdkankan.contro.service.IScenePlusService;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.redis.constant.RedisKey;
+import com.fdkankan.redis.util.RedisUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Map;
+
+/**
+ * 初始化空间模型
+ */
+@Component("floorplanHandler")
+public class FloorplanHandler implements UserEditDataHandler {
+
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private ISceneEditInfoService sceneEditInfoService;
+    @Autowired
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private RedisUtil redisUtil;
+
+    @Override
+    public void init(String num, Map<String, Object> params) {
+        String floorplanCadJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num).concat("floorplan_cad.json");
+        String fileContent = fYunFileService.getFileContent(floorplanCadJsonPath);
+        if(StrUtil.isEmpty(fileContent)){
+            return;
+        }
+        JSONObject jsonObject = JSON.parseObject(fileContent);
+        JSONArray floors = jsonObject.getJSONArray("floors");
+        if(floors.size() < 2){
+            return;
+        }
+
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+        SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
+        sceneEditInfo.setFloorPlanUser(CommonStatus.NO.code());
+        sceneEditInfoService.updateById(sceneEditInfo);
+    }
+}

+ 1 - 1
src/main/java/com/fdkankan/contro/factory/UserEditData/UserEditDataHandler.java

@@ -4,6 +4,6 @@ import java.util.Map;
 
 public interface UserEditDataHandler {
 
-    void init(String num, Map<String, Object> params);
+    void init(String num, Map<String, Object> params) throws Exception;
 
 }

+ 1 - 1
src/main/java/com/fdkankan/contro/generate/AutoGenerate.java

@@ -17,7 +17,7 @@ public class AutoGenerate {
         String path =System.getProperty("user.dir");
 
         generate(path,"contro", getTables(new String[]{
-                "t_mail_template"
+                "t_app_camera_fail_log"
         }));
 
 //        generate(path,"goods", getTables(new String[]{

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/IAppCameraFailLogMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.AppCameraFailLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * app错误上报 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-05-20
+ */
+@Mapper
+public interface IAppCameraFailLogMapper extends BaseMapper<AppCameraFailLog> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/ICameraTypeMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.CameraType;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2023-04-11
+ */
+@Mapper
+public interface ICameraTypeMapper extends BaseMapper<CameraType> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/IExceedSpaceSceneMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.ExceedSpaceScene;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 超出容量场景码表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2023-06-29
+ */
+@Mapper
+public interface IExceedSpaceSceneMapper extends BaseMapper<ExceedSpaceScene> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/IMqSendLogMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.MqSendLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-03-27
+ */
+@Mapper
+public interface IMqSendLogMapper extends BaseMapper<MqSendLog> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/ISceneCleanOrigMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.SceneCleanOrig;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 删除oss原始资源记录 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2023-04-17
+ */
+@Mapper
+public interface ISceneCleanOrigMapper extends BaseMapper<SceneCleanOrig> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/ISceneColdStorageLogMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.SceneColdStorageLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 场景冷归档日志表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2023-07-14
+ */
+@Mapper
+public interface ISceneColdStorageLogMapper extends BaseMapper<SceneColdStorageLog> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/ISceneColdStorageMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.SceneColdStorage;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 场景封存状态表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2023-07-25
+ */
+@Mapper
+public interface ISceneColdStorageMapper extends BaseMapper<SceneColdStorage> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/ISceneCopyLogMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.SceneCopyLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2023-04-17
+ */
+@Mapper
+public interface ISceneCopyLogMapper extends BaseMapper<SceneCopyLog> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/ISceneInfoSyncMqConfigMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.SceneInfoSyncMqConfig;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 场景信息变更需要发送mq信息队列配置表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-04-16
+ */
+@Mapper
+public interface ISceneInfoSyncMqConfigMapper extends BaseMapper<SceneInfoSyncMqConfig> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/ISceneRebuildLogMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.SceneRebuildLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 场景重算接口调用日志表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-05-17
+ */
+@Mapper
+public interface ISceneRebuildLogMapper extends BaseMapper<SceneRebuildLog> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/ISceneUploadCountMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.SceneUploadCount;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * app触发场景上传统计表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-05-20
+ */
+@Mapper
+public interface ISceneUploadCountMapper extends BaseMapper<SceneUploadCount> {
+
+}

+ 14 - 10
src/main/java/com/fdkankan/contro/mq/listener/AbstrackBuildSceneListener.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.common.constant.CommonOperStatus;
 import com.fdkankan.contro.constant.RedisConstants;
 import com.fdkankan.contro.mq.service.IBuildSceneService;
+import com.fdkankan.contro.service.ICommonService;
 import com.fdkankan.contro.service.ISceneBuildProcessLogService;
 import com.fdkankan.model.constants.SceneBuildProcessType;
 import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
@@ -27,9 +28,11 @@ public class AbstrackBuildSceneListener implements IBuildSceneListener {
     private RedisLockUtil redisLockUtil;
     @Autowired
     private ISceneBuildProcessLogService sceneBuildProcessLogService;
+    @Autowired
+    private ICommonService commonService;
 
     @Override
-    public void preHandle(Channel channel, String queueName, Message message, IBuildSceneService buildSceneService) throws IOException {
+    public void preHandle(Channel channel, String queueName, Message message, IBuildSceneService buildSceneService, String bizType) throws IOException {
         // 添加消息幂等处理
         String messageId = message.getMessageProperties().getMessageId();
         if(!ObjectUtils.isEmpty(messageId)){
@@ -54,20 +57,21 @@ public class AbstrackBuildSceneListener implements IBuildSceneListener {
                 buildSceneMessage.getBuildContext().put("sceneNum",buildSceneMessage.getSceneNum());
             }
             //记录日志
-            sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName);
-            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, CommonOperStatus.WAITING.code(), null);
+            sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, bizType);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, CommonOperStatus.WAITING.code(), null, bizType);
             buildSceneService.buildScenePre(buildSceneMessage);
-            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, CommonOperStatus.SUCCESS.code(), null);
+            commonService.saveMqSendLog(num, buildSceneMessage);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, CommonOperStatus.SUCCESS.code(), null, bizType);
         }catch (Exception e){
             log.error("场景计算前置处理出错,num=" + num, e);
-            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, CommonOperStatus.FAILD.code(), ExceptionUtil.stacktraceToString(e, 3000));
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, CommonOperStatus.FAILD.code(), ExceptionUtil.stacktraceToString(e, 3000), bizType);
         }
         log.info("准备场景计算资源完成,队列名:{},id:{},消息体:{}", queueName, messageId, msg);
         channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
     }
 
     @Override
-    public void postHandle(Channel channel, String queueName, Message message, IBuildSceneService buildSceneService) throws Exception {
+    public void postHandle(Channel channel, String queueName, Message message, IBuildSceneService buildSceneService, String bizType) throws Exception {
         // 添加消息幂等处理
         String messageId = message.getMessageProperties().getMessageId();
         if(!ObjectUtils.isEmpty(messageId)){
@@ -85,13 +89,13 @@ public class AbstrackBuildSceneListener implements IBuildSceneListener {
         BuildSceneResultMqMessage buildSceneMessage = JSONObject.parseObject(msg, BuildSceneResultMqMessage.class);
         String num = buildSceneMessage.getBuildContext().get("sceneNum").toString();
         try {
-            sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName);
-            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, CommonOperStatus.WAITING.code(), null);
+            sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, bizType);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, CommonOperStatus.WAITING.code(), null, bizType);
             buildSceneService.buildScenePost(buildSceneMessage);
-            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, CommonOperStatus.SUCCESS.code(), null);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, CommonOperStatus.SUCCESS.code(), null, bizType);
         }catch (Exception e){
             log.error("场景计算结果处理出错,num=" + num, e);
-            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, CommonOperStatus.FAILD.code(), ExceptionUtil.stacktraceToString(e, 3000));
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, CommonOperStatus.FAILD.code(), ExceptionUtil.stacktraceToString(e, 3000), bizType);
         }
         log.info("场景计算结果处理完成,队列名:{},id:{},消息体:{}", queueName, messageId, msg);
         channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);

+ 121 - 0
src/main/java/com/fdkankan/contro/mq/listener/BuildE57Listener.java

@@ -0,0 +1,121 @@
+package com.fdkankan.contro.mq.listener;
+
+import cn.hutool.core.exceptions.ExceptionUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.constant.CommonOperStatus;
+import com.fdkankan.contro.constant.RedisConstants;
+import com.fdkankan.contro.mq.service.impl.BuildE57SceneServiceImpl;
+import com.fdkankan.contro.service.ICommonService;
+import com.fdkankan.contro.service.ISceneBuildProcessLogService;
+import com.fdkankan.model.constants.SceneBuildProcessType;
+import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
+import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
+import com.fdkankan.redis.util.RedisLockUtil;
+import com.rabbitmq.client.Channel;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.springframework.util.ObjectUtils;
+
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+
+@Slf4j
+@Component
+public class BuildE57Listener{
+
+    @Value("${queue.modeling.e57.modeling-pre:e57-modeling-pre}")
+    private String queueModelingPre;
+
+    @Value("${queue.modeling.e57.modeling-post:e57-modeling-post}")
+    private String queueModelingPost;
+
+    @Autowired
+    private RedisLockUtil redisLockUtil;
+
+    @Autowired
+    private ISceneBuildProcessLogService sceneBuildProcessLogService;
+    @Autowired
+    private ICommonService commonService;
+    @Autowired
+    private BuildE57SceneServiceImpl buildSceneService;
+
+
+    /**
+     * 场景计算前置资源准备处理
+     * @param channel
+     * @param message
+     * @throws Exception
+     */
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.modeling.e57.modeling-pre:e57-modeling-pre}"),
+            concurrency = "${maxThread.modeling.modeling-pre}"
+    )
+    public void buildScenePreHandler(Channel channel, Message message) throws Exception {
+        String messageId = message.getMessageProperties().getMessageId();
+        String msg = new String(message.getBody(), StandardCharsets.UTF_8);
+        HashMap<String, Object> map = JSON.parseObject(msg, HashMap.class);
+        String num = (String) map.get("num");
+        map.put("bizType", "e57");
+
+        log.info("开始准备e57计算资源,队列名:{},id:{},消息体:{}", queueModelingPre, messageId, msg);
+        BuildSceneCallMessage buildSceneMessage = new BuildSceneCallMessage();
+        buildSceneMessage.setSceneNum(num);
+        buildSceneMessage.setExt(map);
+        buildSceneMessage.setBuildType("V3");
+        try {
+            if(ObjectUtils.isEmpty(buildSceneMessage.getBuildContext())){
+                buildSceneMessage.setBuildContext(new HashMap<>());
+            }
+            if(!ObjectUtils.isEmpty(buildSceneMessage.getSceneNum())){
+                buildSceneMessage.getBuildContext().put("sceneNum",buildSceneMessage.getSceneNum());
+            }
+            //记录日志
+            sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueModelingPre, "e57");
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueModelingPre, CommonOperStatus.WAITING.code(), null, "e57");
+            buildSceneService.buildScenePre(buildSceneMessage);
+            commonService.saveMqSendLog(num, buildSceneMessage);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueModelingPre, CommonOperStatus.SUCCESS.code(), null,"e57");
+        }catch (Exception e){
+            log.error("e57计算前置处理出错,num=" + num, e);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueModelingPre, CommonOperStatus.FAILD.code(), ExceptionUtil.stacktraceToString(e, 3000), "e57");
+        }
+        log.info("准备e57计算资源完成,队列名:{},id:{},消息体:{}", queueModelingPre, messageId, msg);
+        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+    }
+
+    /**
+     * 场景计算后置结果处理
+     * @param channel
+     * @param message
+     * @throws Exception
+     */
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.modeling.e57.modeling-post:e57-modeling-post}"),
+            concurrency = "${maxThread.modeling.modeling-post}"
+    )
+    public void buildScenePostHandler(Channel channel, Message message) throws Exception {
+        String messageId = message.getMessageProperties().getMessageId();
+        String msg = new String(message.getBody(), StandardCharsets.UTF_8);
+        log.info("场景计算完成,开始处理e57计算结果,队列名:{},id:{},消息体:{}", queueModelingPost, messageId, msg);
+        BuildSceneResultMqMessage buildSceneMessage = JSONObject.parseObject(msg, BuildSceneResultMqMessage.class);
+        String num = buildSceneMessage.getBuildContext().get("sceneNum").toString();
+        try {
+            sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueModelingPost, "e57");
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueModelingPost, CommonOperStatus.WAITING.code(), null, "e57");
+            buildSceneService.buildScenePost(buildSceneMessage);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueModelingPost, CommonOperStatus.SUCCESS.code(), null, "e57");
+        }catch (Exception e){
+            log.error("场景计算结果处理出错,num=" + num, e);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueModelingPost, CommonOperStatus.FAILD.code(), ExceptionUtil.stacktraceToString(e, 3000), "e57");
+        }
+        log.info("场景计算结果处理完成,队列名:{},id:{},消息体:{}", queueModelingPost, messageId, msg);
+        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+
+    }
+}

+ 54 - 0
src/main/java/com/fdkankan/contro/mq/listener/BuildIntermitSceneListener.java

@@ -0,0 +1,54 @@
+package com.fdkankan.contro.mq.listener;
+
+import com.fdkankan.contro.mq.service.impl.BuildIntermitSceneServiceImpl;
+import com.fdkankan.contro.mq.service.impl.BuildSceneServiceImpl;
+import com.rabbitmq.client.Channel;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component
+public class BuildIntermitSceneListener extends AbstrackBuildSceneListener {
+
+    @Value("${queue.modeling.intermit.modeling-pre}")
+    private String queueModelingPre;
+    @Value("${queue.modeling.intermit.modeling-post}")
+    private String queueModelingPost;
+
+    @Autowired
+    private BuildIntermitSceneServiceImpl buildSceneService;
+
+    /**
+     * 场景计算前置资源准备处理
+     * @param channel
+     * @param message
+     * @throws Exception
+     */
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.modeling.intermit.modeling-pre}"),
+            concurrency = "${maxThread.modeling.modeling-pre}"
+    )
+    public void buildScenePreHandler(Channel channel, Message message) throws Exception {
+        preHandle(channel,queueModelingPre,message,buildSceneService, "intermit");
+    }
+
+    /**
+     * 场景计算后置结果处理
+     * @param channel
+     * @param message
+     * @throws Exception
+     */
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.modeling.intermit.modeling-post}"),
+            concurrency = "${maxThread.modeling.modeling-post}"
+    )
+    public void buildScenePostHandler(Channel channel, Message message) throws Exception {
+        postHandle(channel,queueModelingPost,message,buildSceneService, "intermit");
+
+    }
+}

+ 54 - 0
src/main/java/com/fdkankan/contro/mq/listener/BuildLiguangListener.java

@@ -0,0 +1,54 @@
+package com.fdkankan.contro.mq.listener;
+
+import com.fdkankan.contro.mq.service.impl.BuildLiguangServiceImpl;
+import com.fdkankan.contro.mq.service.impl.BuildSceneServiceImpl;
+import com.rabbitmq.client.Channel;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component
+public class BuildLiguangListener extends AbstrackBuildSceneListener {
+
+    @Value("${queue.modeling.liguang.modeling-pre:liguang-modeling-pre}")
+    private String queueModelingPre;
+    @Value("${queue.modeling.liguang.modeling-post:liguang-modeling-post}")
+    private String queueModelingPost;
+
+    @Autowired
+    private BuildLiguangServiceImpl buildSceneService;
+
+    /**
+     * 场景计算前置资源准备处理
+     * @param channel
+     * @param message
+     * @throws Exception
+     */
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.modeling.liguang.modeling-pre:liguang-modeling-pre}"),
+            concurrency = "${maxThread.modeling.modeling-pre}"
+    )
+    public void buildScenePreHandler(Channel channel, Message message) throws Exception {
+        preHandle(channel,queueModelingPre,message,buildSceneService, "standard");
+    }
+
+    /**
+     * 场景计算后置结果处理
+     * @param channel
+     * @param message
+     * @throws Exception
+     */
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.modeling.liguang.modeling-post:liguang-modeling-post}"),
+            concurrency = "${maxThread.modeling.modeling-post}"
+    )
+    public void buildScenePostHandler(Channel channel, Message message) throws Exception {
+        postHandle(channel,queueModelingPost,message,buildSceneService, "standard");
+
+    }
+}

+ 2 - 2
src/main/java/com/fdkankan/contro/mq/listener/BuildObjListener.java

@@ -44,7 +44,7 @@ public class BuildObjListener extends AbstrackBuildSceneListener {
             concurrency = "${maxThread.modeling.modeling-pre}"
     )
     public void buildObjScenePreHandler(Channel channel, Message message) throws Exception {
-        preHandle(channel, queueObjModelingPre, message, buildObjService);
+        preHandle(channel, queueObjModelingPre, message, buildObjService,"obj");
     }
 
 
@@ -60,7 +60,7 @@ public class BuildObjListener extends AbstrackBuildSceneListener {
             concurrency = "${maxThread.modeling.modeling-post}"
     )
     public void buildObjScenePostHandler(Channel channel, Message message) throws Exception {
-        postHandle(channel, queueObjModelingPost, message, buildObjService);
+        postHandle(channel, queueObjModelingPost, message, buildObjService, "obj");
 
     }
 }

+ 2 - 2
src/main/java/com/fdkankan/contro/mq/listener/BuildSceneListener.java

@@ -33,7 +33,7 @@ public class BuildSceneListener extends AbstrackBuildSceneListener {
             concurrency = "${maxThread.modeling.modeling-pre}"
     )
     public void buildScenePreHandler(Channel channel, Message message) throws Exception {
-        preHandle(channel,queueModelingPre,message,buildSceneService);
+        preHandle(channel,queueModelingPre,message,buildSceneService, "standard");
     }
 
     /**
@@ -47,7 +47,7 @@ public class BuildSceneListener extends AbstrackBuildSceneListener {
             concurrency = "${maxThread.modeling.modeling-post}"
     )
     public void buildScenePostHandler(Channel channel, Message message) throws Exception {
-        postHandle(channel,queueModelingPost,message,buildSceneService);
+        postHandle(channel,queueModelingPost,message,buildSceneService, "standard");
 
     }
 }

+ 2 - 2
src/main/java/com/fdkankan/contro/mq/listener/BuildSceneProcessLogListener.java

@@ -48,7 +48,7 @@ public class BuildSceneProcessLogListener{
             int buildStatus = buildSceneMessage.getBuildStatus();
             //新的计算开始,需要将之前的记录置为失效
             if(buildStatus == ModelingBuildStatus.CALCULATING.code()){
-                sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.CALL.code(),queueModelingCall);
+                sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.CALL.code(),queueModelingCall, buildSceneMessage.getBizType());
                 status = CommonOperStatus.WAITING.code();
             }else{
                 if(buildStatus != ModelingBuildStatus.SUCCESS.code()){
@@ -56,7 +56,7 @@ public class BuildSceneProcessLogListener{
                     reason = ModelingBuildStatus.get(buildStatus).message();
                 }
             }
-            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.CALL.code(), queueModelingCall, status, reason);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.CALL.code(), queueModelingCall, status, reason, buildSceneMessage.getBizType());
         }catch (Exception e){
             log.error("场景计算流程状态日志记录出错, num="+num, e);
         }finally {

+ 2 - 2
src/main/java/com/fdkankan/contro/mq/listener/BuildV3SceneListener.java

@@ -33,7 +33,7 @@ public class BuildV3SceneListener extends AbstrackBuildSceneListener {
             concurrency = "${maxThread.modeling.modeling-pre}"
     )
     public void buildScenePreHandler(Channel channel, Message message) throws Exception {
-        preHandle(channel,queueModelingPre,message,buildSceneService);
+        preHandle(channel,queueModelingPre,message,buildSceneService, "standard");
     }
 
     /**
@@ -47,7 +47,7 @@ public class BuildV3SceneListener extends AbstrackBuildSceneListener {
             concurrency = "${maxThread.modeling.modeling-post}"
     )
     public void buildScenePostHandler(Channel channel, Message message) throws Exception {
-        postHandle(channel,queueModelingPost,message,buildSceneService);
+        postHandle(channel,queueModelingPost,message,buildSceneService, "standard");
 
     }
 }

+ 2 - 2
src/main/java/com/fdkankan/contro/mq/listener/IBuildSceneListener.java

@@ -7,6 +7,6 @@ import org.springframework.amqp.core.Message;
 import java.io.IOException;
 
 public interface IBuildSceneListener {
-    void preHandle(Channel channel,String queueName, Message message, IBuildSceneService buildSceneService) throws IOException;
-    void postHandle(Channel channel,String queueName, Message message,IBuildSceneService buildSceneService) throws Exception;
+    void preHandle(Channel channel,String queueName, Message message, IBuildSceneService buildSceneService, String bizType) throws IOException;
+    void postHandle(Channel channel,String queueName, Message message,IBuildSceneService buildSceneService, String bizType) throws Exception;
 }

+ 65 - 0
src/main/java/com/fdkankan/contro/mq/listener/UpdateSceneStatusListener.java

@@ -0,0 +1,65 @@
+package com.fdkankan.contro.mq.listener;
+
+import cn.hutool.core.io.FileUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.service.ICommonService;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.rabbitmq.client.Channel;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+
+@Slf4j
+@Component
+public class UpdateSceneStatusListener {
+
+    @Autowired
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private ICommonService commonService;
+
+    /**
+     * 更新场景status.json状态
+     * @param channel
+     * @param message
+     * @throws Exception
+     */
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.scene.update-scene-status}")
+    )
+    public void buildScenePreHandler(Channel channel, Message message) throws Exception {
+        String msg = new String(message.getBody(), StandardCharsets.UTF_8);
+        log.info("开始更新场景的的status.json状态,content:{}", msg);
+        HashMap<String, Object> map = JSON.parseObject(msg, HashMap.class);
+        String num = (String) map.get("num");
+        Integer status = (Integer)map.get("status");
+        String statusJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num).concat("status.json");
+        try {
+            String fileContent = fYunFileService.getFileContent(statusJsonPath);
+            JSONObject jsonObject = JSON.parseObject(fileContent);
+            jsonObject.put("status", status);
+            FileUtil.writeUtf8String(jsonObject.toJSONString(),ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json");
+            fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJsonPath);
+            if(status == 1){
+                commonService.sendEmail(num, "standar");
+            }
+        }catch (Exception e){
+            log.error("更新场景的的status.json状态, content:{}", msg, e);
+        }finally {
+            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+        }
+        log.info("结束更新场景的的status.json状态,content:{}", msg);
+    }
+
+}

+ 0 - 29
src/main/java/com/fdkankan/contro/mq/service/ICommonService.java

@@ -1,29 +0,0 @@
-package com.fdkankan.contro.mq.service;
-
-import java.util.Map;
-import java.util.Set;
-
-public interface ICommonService {
-
-    /**
-     * 上传计算结果文件
-     * @param num
-     * @param dataSource
-     * @param version
-     */
-    public void uploadBuildResultData(String num, String dataSource, String version);
-
-    /**
-     * 删除用户编辑数据业务方法
-     * @param num 场景码
-     * @param bizs 业务集合
-     * @param params 业务处理所需参数
-     *               key : bizType
-     *               value: Map<String ,Object> 参数map
-     */
-    public void initUserEditData(String num, Set<String> bizs, Map<String, Map<String ,Object>> params);
-
-    public void uploadFloorplanJson(String num, String dataSource) throws Exception;
-
-    public void sendEmail(String num);
-}

+ 185 - 0
src/main/java/com/fdkankan/contro/mq/service/impl/BuildE57SceneServiceImpl.java

@@ -0,0 +1,185 @@
+package com.fdkankan.contro.mq.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.ZipUtil;
+import com.alibaba.fastjson.JSON;
+import com.fdkankan.common.constant.CommonSuccessStatus;
+import com.fdkankan.contro.entity.ScenePlus;
+import com.fdkankan.contro.entity.ScenePlusExt;
+import com.fdkankan.contro.mq.service.IBuildSceneService;
+import com.fdkankan.contro.service.*;
+import com.fdkankan.fyun.config.FYunFileConfig;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
+import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/4/20
+ **/
+@Slf4j
+@Service
+@RefreshScope
+public class BuildE57SceneServiceImpl implements IBuildSceneService {
+    public static final String logUrlFormat = "**algorithm-log**: [%sbuild_log/%s/e57/console.log](%sbuild_log/%s/e57/console.log)";
+
+    @Value("${queue.modeling.e57.modeling-post}")
+    private String queueModelingPost;
+    @Value("${model.type:#{null}}")
+    private String modelType;
+    @Value("${env:gn}")
+    private String env;
+    @Value("#{'${build.scene.post.not-delete-nas-nums:}'.split(',')}")
+    private List<String> notDeleteNasNumList;
+    @Value("${queue.application.laser.e57-modeling-done:e57-modeling-done}")
+    private String queueE57ModelingDone;
+    @Autowired
+    private RabbitMqProducer mqProducer;
+    @Resource
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private FYunFileConfig fYunFileConfig;
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private IBuildSceneDTService buildSceneDTService;
+    @Autowired
+    private ICommonService commonService;
+    @Autowired
+    private ISceneColdStorageService sceneColdStorageService;
+    @Autowired
+    private IntermitSceneService intermitSceneService;
+
+    @Override
+    public void buildScenePre(BuildSceneCallMessage message) throws Exception{
+        String num = message.getSceneNum();
+        try {
+            ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+            ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+            String dataSource = scenePlusExt.getDataSource();
+            String path = dataSource + "_e57";
+            message.setPath(dataSource);
+
+            //根据相机类型,组装资源路径
+            //下载资源到本地
+            this.downLoadSource(message, path);
+
+            //发送mq,就进行计算
+            message.setPath(path);
+            message.setResultReceiverMqName(queueModelingPost);
+            message.setBizType("e57");
+
+            log.info("e57计算资源准备结束,场景码:{}", message.getSceneNum());
+
+        }catch (Exception e){
+            log.error("e57计算前置处理出错,num"+num, e);
+            buildSceneDTService.handBaseFail("e57计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
+            throw e;
+        }
+    }
+
+    private String getOssPath(String path) {
+        String ossPath = ConstantFilePath.OSS_PREFIX
+                + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
+                .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "");
+        if (!ossPath.endsWith("/")) {
+            ossPath = ossPath.concat("/");
+        }
+        return ossPath;
+    }
+
+    @Override
+    public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path){
+        String ossPath = getOssPath(buildSceneMqMessage.getPath());
+        fYunFileService.downloadFileByCommand(path + "/capture", ossPath);
+
+        //下载点位校准文件
+        //上传点位校准相关文件(小)
+        String localExtraPath = path + "/extras/vision_edit.txt";
+        String ossExtras = String.format(UploadFilePath.scene_result_data_path, buildSceneMqMessage.getSceneNum()) + "extras";
+        List<String> extras = fYunFileService.listRemoteFiles(ossExtras);
+        log.info("key:{}, list:{}", ossExtras, JSON.toJSONString(extras));
+        if(CollUtil.isNotEmpty(extras)){
+            extras.parallelStream().forEach(key->{
+                fYunFileService.downloadFile(key, localExtraPath);
+            });
+        }
+    }
+
+    @Override
+    public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
+        String num = message.getBuildContext().get("sceneNum").toString();
+        String path = message.getPath();
+        String bucket = (String)message.getExt().get("bucket");
+        String bizId = (String)message.getExt().get("bizId");
+        String ossKeyFormat = (String)message.getExt().get("ossKey");
+        try {
+            // 上传计算日志
+            //如果是重复计算,没有走到计算逻辑,不需要上传日志文件
+            log.info("开始上传计算日志");
+            String buildLogPath = String.format(UploadFilePath.BUILD_LOG_PATH, num) + "e57/";
+            fYunFileService.uploadFile(path + File.separator + "console.log", buildLogPath + "console.log");
+            log.info("计算日志上传完成");
+            Map<String, Object> laserMqContent = new HashMap<>();
+            laserMqContent.put("num", num);
+            laserMqContent.put("bizId", bizId);
+            if (!message.getBuildSuccess()) {
+
+                //发送mq通知激光系统
+                laserMqContent.put("status", CommonSuccessStatus.FAIL.code());
+                mqProducer.sendByWorkQueue(queueE57ModelingDone, laserMqContent);
+
+                // 发送钉钉消息,计算失败
+                String logUrl = String.format(logUrlFormat,fYunFileConfig.getHost(),num,fYunFileConfig.getHost(),num);
+                buildSceneDTService.handModelFail("计算失败", message.getPath(), num, message.getHostName(), logUrl);
+                return;
+            }
+
+            //压缩e57
+            String localPath = path + "/results/laserData/laser.e57";
+            String zipPath = path + "/results/laserData/laser-e57.zip";
+            String ossKey = String.format(ossKeyFormat, num, num);
+            ZipUtil.zip(localPath, zipPath);
+            fYunFileService.uploadFileByCommand(bucket,zipPath, ossKey);
+
+            //发送mq通知激光系统
+            laserMqContent.put("status", CommonSuccessStatus.SUCCESS.code());
+            mqProducer.sendByWorkQueue(queueE57ModelingDone, laserMqContent);
+
+            try {
+                FileUtil.del(path);
+            }catch (Exception e){
+                log.error("删除计算目录失败,path:{}", path);
+            }
+
+            log.info("e57场景计算结果处理结束,场景码:{}", num);
+        }catch (Exception e){
+            log.error("e57场景计算结果处理出错,num"+num, e);
+            buildSceneDTService.handBaseFail("e57场景计算结果处理出错!", message.getPath(), num, "计算控制服务器");
+            throw e;
+        }
+    }
+
+}

+ 359 - 0
src/main/java/com/fdkankan/contro/mq/service/impl/BuildIntermitSceneServiceImpl.java

@@ -0,0 +1,359 @@
+package com.fdkankan.contro.mq.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.io.FileUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.common.constant.*;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.entity.ScenePlus;
+import com.fdkankan.contro.entity.ScenePlusExt;
+import com.fdkankan.contro.mq.service.IBuildSceneService;
+import com.fdkankan.contro.service.*;
+import com.fdkankan.fyun.config.FYunFileConfig;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.model.enums.ModelTypeEnums;
+import com.fdkankan.model.utils.CreateObjUtil;
+import com.fdkankan.model.utils.SceneUtil;
+import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
+import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
+
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/4/20
+ **/
+@Slf4j
+@Service
+@RefreshScope
+public class BuildIntermitSceneServiceImpl implements IBuildSceneService {
+
+    @Value("${queue.modeling.modeling-call}")
+    private String queueModelingCall;
+    @Value("${queue.modeling.intermit.modeling-post}")
+    private String queueModelingPost;
+    @Value("${model.type:#{null}}")
+    private String modelType;
+    @Value("${env:gn}")
+    private String env;
+    @Value("#{'${build.scene.post.not-delete-nas-nums:}'.split(',')}")
+    private List<String> notDeleteNasNumList;
+    @Autowired
+    private RabbitMqProducer mqProducer;
+    @Resource
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private FYunFileConfig fYunFileConfig;
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private IBuildSceneDTService buildSceneDTService;
+    @Autowired
+    private ICommonService commonService;
+    @Autowired
+    private ISceneColdStorageService sceneColdStorageService;
+    @Autowired
+    private IntermitSceneService intermitSceneService;
+
+    @Override
+    public void buildScenePre(BuildSceneCallMessage message) throws Exception{
+        String num = message.getSceneNum();
+        try {
+            //重新计算时需要删除文件夹,否知使用缓存
+            if(new File(message.getPath() + File.separator + "results").exists()){
+                FileUtils.deleteDirectory(message.getPath() + File.separator + "results");
+            }
+            //由于刘强说caches会影响计算结果,所以这里删除caches
+            if(new File(message.getPath() + File.separator + "caches").exists()){
+                FileUtils.deleteDirectory(message.getPath() + File.separator + "caches");
+            }
+
+            //删除点位校准数据
+            if (Objects.nonNull(message.getExt())
+                    && message.getExt().containsKey("deleteExtras")
+                    && (Boolean) message.getExt().get("deleteExtras")) {
+                String extras = String.format(UploadFilePath.scene_result_data_path, num).concat("extras");
+                if(CollUtil.isNotEmpty(fYunFileService.listRemoteFiles(extras))){
+                    fYunFileService.deleteFolder(extras);
+                }
+            }
+
+            //用户相机重新全量上传,需要解冻结
+            sceneColdStorageService.unfreeze(num, "用户相机重新全量上传", message.getPath());
+
+            //根据相机类型,组装资源路径
+            //下载资源到本地
+            this.downLoadSource(message, message.getPath());
+
+            message.getBuildContext().put("cameraType",message.getCameraType());
+
+            //发送mq,就进行计算
+            message.setResultReceiverMqName(queueModelingPost);
+            message.setBizType("intermit");
+
+            log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
+
+        }catch (Exception e){
+            log.error("场景计算前置处理出错,num"+num, e);
+            buildSceneDTService.handBaseFail("场景计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
+            throw e;
+        }
+    }
+
+    private String getOssPath(String path) {
+        String ossPath = ConstantFilePath.OSS_PREFIX
+                + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
+                .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "");
+        if (!ossPath.endsWith("/")) {
+            ossPath = ossPath.concat("/");
+        }
+        return ossPath;
+    }
+
+    @Override
+    public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path){
+        String ossPath = getOssPath(path);
+        fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
+    }
+
+    @Override
+    public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
+        String sceneCode = message.getBuildContext().get("sceneNum").toString();
+        String path = message.getPath();
+        try {
+            // 上传计算日志
+            //如果是重复计算,没有走到计算逻辑,不需要上传日志文件
+            log.info("开始上传计算日志");
+            String buildLogPath = String.format(UploadFilePath.BUILD_LOG_PATH, sceneCode);
+            fYunFileService.uploadFile(path + File.separator + "console.log", buildLogPath + "console.log");
+            log.info("计算日志上传完成");
+
+            JSONObject fdageData = getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
+
+            if (!message.getBuildSuccess()) {
+                log.error("建模失败,修改状态为失败状态");
+                scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
+                        .set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
+                        .eq(ScenePlus::getNum, sceneCode));
+
+                //推送到全景看看
+                intermitSceneService.sendMq(sceneCode, fdageData, CommonSuccessStatus.FAIL.code());
+
+                // 发送钉钉消息,计算失败
+                buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
+                return;
+            }
+
+            ScenePlus scenePlus = scenePlusService.getScenePlusByNum(sceneCode);
+
+            Integer cameraType = Integer.parseInt(message.getBuildContext().get("cameraType").toString());
+            Map<String, String> uploadFiles = getUploadFiles(scenePlus,path);
+
+            scenePlus.setPayStatus(PayStatus.PAY.code());
+            scenePlus.setUpdateTime(new Date());
+            scenePlus.setSceneStatus(SceneStatus.NO_DISPLAY.code());
+
+            Integer videoVersion = fdageData.getInteger("videoVersion");
+            //读取计算结果文件生成videosJson
+            JSONObject videosJson = commonService.getVideosJson(path, videoVersion, sceneCode, cameraType);
+
+            ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+
+            log.info("开始上传场景计算结果数据,num:{}", sceneCode);
+            //上传文件
+            fYunFileService.uploadMulFiles(uploadFiles);
+
+            //容量统计
+            Long space = commonService.getSpace(sceneCode);
+
+            //写入数据库
+            this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), message.getComputeTime(),false,scenePlusExt);
+
+            Object[] editInfoArr = commonService.updateEditInfo(scenePlus);
+
+            //统计原始资源大小
+            scenePlusExt.setOrigSpace(FileUtil.size(new File(path.concat(File.separator).concat("capture"))));
+
+            //删除计算目录
+            if(CollUtil.isEmpty(notDeleteNasNumList) || !notDeleteNasNumList.contains(sceneCode)){
+                CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/"));
+            }
+
+            //如果相机容量不足,需要把场景的paystatus改为容量不足状态
+            scenePlus.setPayStatus(commonService.getPayStatus(scenePlus.getCameraId(), space));
+
+            this.uploadStatusJson(scenePlus, scenePlusExt);
+
+            scenePlusService.updateById(scenePlus);
+            scenePlusExtService.updateById(scenePlusExt);
+
+            //推送到全景看看
+            intermitSceneService.sendMq(sceneCode, fdageData, CommonSuccessStatus.SUCCESS.code());
+
+            log.info("场景计算结果处理结束,场景码:{}", sceneCode);
+
+        }catch (Exception e){
+            log.error("场景计算结果处理出错,num"+sceneCode, e);
+            buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
+            throw e;
+        }
+    }
+
+    private Map<String, String> getUploadFiles(ScenePlus scenePlus,String path) throws Exception {
+        String projectNum = scenePlus.getNum();
+        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, projectNum);
+        String imagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, projectNum);
+        String videoPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, projectNum);
+        String resultsPath = path + File.separator + "results" + File.separator;
+
+        String uploadData = FileUtils.readFile(resultsPath + "upload.json");
+        JSONArray array = JSONObject.parseObject(uploadData).getJSONArray("upload");
+
+        JSONObject fileJson = null;
+        String fileName = "";
+
+        Map<String, String> map = new HashMap();
+
+        for (int i = 0; i < array.size(); ++i) {
+            fileJson = array.getJSONObject(i);
+            fileName = fileJson.getString("file");
+            String filePath = resultsPath + fileName;
+
+            if (!(new File(filePath)).exists()) {
+                throw new Exception(filePath + "文件不存在");
+            }
+
+            if(fileJson.getIntValue("clazz") == 1 || fileJson.getIntValue("clazz") == 22){
+                map.put(filePath, imagesPath + fileName);
+            }
+        }
+        return map;
+    }
+
+    private JSONObject getFdageData(String dataFdagePath) {
+        log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
+        String data = FileUtils.readFile(dataFdagePath);
+        //获取data.fdage的内容
+        JSONObject dataJson = new JSONObject();
+        if(data!=null){
+            dataJson = JSONObject.parseObject(data);
+        }
+        return dataJson;
+    }
+
+    private void uploadStatusJson(ScenePlus scenePlus, ScenePlusExt scenePlusExt){
+        String num = scenePlus.getNum();
+        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
+
+        Integer status = 1;
+        // 上传status JSON.
+        JSONObject statusJson = new JSONObject();
+        //临时将-2改成1,app还没完全更新
+        statusJson.put("status", status);
+        statusJson.put("webSite", scenePlusExt.getWebSite());
+        statusJson.put("sceneNum", num);
+        statusJson.put("thumb", scenePlusExt.getThumb());
+        statusJson.put("payStatus", scenePlus.getPayStatus());
+        statusJson.put("sceneScheme", scenePlusExt.getSceneScheme());
+        FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJson.toString());
+
+        fYunFileService.uploadFile(statusJson.toJSONString().getBytes(StandardCharsets.UTF_8), dataViewPath + "status.json");
+    }
+
+    private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
+
+        scenePlusExt.setSpace(space);
+        scenePlusExt.setComputeTime(computeTime.toString());
+        scenePlusExt.setAlgorithmTime(new Date());
+        scenePlusExt.setVideos(videosJson);
+        scenePlusExt.setIsObj(isObj ? 1 : 0);
+
+        if(ModelTypeEnums.TILE_CODE.equals(modelType)){
+            scenePlusExt.setSceneScheme(3);
+        }
+
+        switch (SceneSource.get(sceneSource)){
+            case BM:
+                scenePlusExt.setSceneResolution(SceneResolution.two_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.PRO.code());
+                break;
+            case SM:
+                scenePlusExt.setSceneResolution(SceneResolution.one_k.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LITE.code());
+                break;
+            case ZT:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.MINION.code());
+                break;
+            case JG:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
+                break;
+            case SG:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
+                break;
+        }
+
+        String sceneKind = scenePlusExt.getSceneScheme() == 3 ? SceneKind.FACE.code():SceneKind.TILES.code();
+        scenePlusExt.setSceneKind(sceneKind);
+//        scenePlusExt.setModelKind(modelKind);
+
+        //统计点位数量
+        scenePlusExt.setShootCount(this.getShootCount(scenePlusExt));
+
+        scenePlusExtService.updateById(scenePlusExt);
+    }
+
+    private Integer getShootCount(ScenePlusExt scenePlusExt){
+        Integer shootCount = null;
+        String homePath = SceneUtil.getHomePath(scenePlusExt.getDataSource());
+        JSONObject dataFdageObj = JSON.parseObject(fYunFileService.getFileContent(homePath.concat("data.fdage")));
+        if(Objects.nonNull(dataFdageObj)){
+            JSONArray points = dataFdageObj.getJSONArray("points");
+            if(CollUtil.isNotEmpty(points)){
+                shootCount = points.size();
+            }
+        }
+        if(Objects.nonNull(shootCount) && shootCount > 0){
+            return shootCount;
+        }
+
+        String slamDataStr = fYunFileService.getFileContent(homePath.concat("slam_data.json"));
+        JSONObject slamDataObj = JSON.parseObject(slamDataStr);
+        if(Objects.nonNull(slamDataObj)){
+            JSONArray viewsInfo = slamDataObj.getJSONArray("views_info");
+            if(CollUtil.isNotEmpty(viewsInfo)){
+                shootCount = viewsInfo.stream().mapToInt(info -> {
+                    return  ((JSONObject) info).getJSONArray("list_pose").size();
+                }).sum();
+            }
+        }
+
+        return shootCount;
+    }
+
+
+}

+ 591 - 0
src/main/java/com/fdkankan/contro/mq/service/impl/BuildLiguangServiceImpl.java

@@ -0,0 +1,591 @@
+package com.fdkankan.contro.mq.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.core.util.ZipUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import cn.hutool.extra.qrcode.QrConfig;
+import cn.hutool.http.ContentType;
+import cn.hutool.http.HttpUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.common.constant.*;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.bean.SyncLaserResultBean;
+import com.fdkankan.contro.constant.UserEditDataType;
+import com.fdkankan.contro.entity.*;
+import com.fdkankan.contro.mq.service.IBuildSceneService;
+import com.fdkankan.contro.service.*;
+import com.fdkankan.fyun.config.FYunFileConfig;
+import com.fdkankan.fyun.constant.FYunTypeEnum;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFileName;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.model.enums.ModelTypeEnums;
+import com.fdkankan.model.utils.CreateHouseJsonUtil;
+import com.fdkankan.model.utils.CreateObjUtil;
+import com.fdkankan.model.utils.SceneUtil;
+import com.fdkankan.push.config.PushMessageConfig;
+import com.fdkankan.push.utils.PushMsgUtil;
+import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
+import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+import com.fdkankan.redis.util.RedisUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.http.HttpHeaders;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+import java.util.Map.Entry;
+
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/4/20
+ **/
+@Slf4j
+@Service
+@RefreshScope
+public class BuildLiguangServiceImpl implements IBuildSceneService {
+
+    @Value("${queue.modeling.modeling-call}")
+    private String queueModelingCall;
+
+    @Value("${queue.modeling.single.modeling-call}")
+    private String singleModelingCall;
+
+    @Value("${model.type:#{null}}")
+    private String modelType;
+
+    @Value("${env:gn}")
+    private String env;
+
+    @Value("#{'${build.scene.post.not-delete-nas-nums:}'.split(',')}")
+    private List<String> notDeleteNasNumList;
+
+    @Value("4dkk.laserService.bucket")
+    private String laserBucket;
+
+    @Autowired
+    private RabbitMqProducer mqProducer;
+
+    @Resource
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private ICameraDetailService cameraDetailService;
+    @Autowired
+    private ISceneEditInfoService sceneEditInfoService;
+    @Autowired
+    private ISceneEditControlsService sceneEditControlsService;
+
+    @Autowired
+    private FYunFileConfig fYunFileConfig;
+
+    @Autowired
+    private RedisUtil redisUtil;
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private ISceneEditInfoExtService sceneEditInfoExtService;
+
+    @Autowired
+    private IUserIncrementService userIncrementService;
+
+    @Autowired
+    private IFdkkLaserService fdkkLaserService;
+
+
+    @Autowired
+    private IBuildSceneDTService buildSceneDTService;
+
+
+    @Autowired
+    private IIncrementTypeService incrementTypeService;
+
+    @Autowired
+    private ICompanyService companyService;
+    @Autowired
+    private ISceneAsynOperLogService sceneAsynOperLogService;
+    @Autowired
+    private ICommonService commonService;
+    @Autowired
+    private ISceneBuildProcessLogService sceneBuildProcessLogService;
+    @Autowired
+    private ISceneColdStorageService sceneColdStorageService;
+
+
+    @Override
+    public void buildScenePre(BuildSceneCallMessage message) throws Exception{
+        String num = message.getSceneNum();
+        try {
+            //重新计算时需要删除文件夹,否知使用缓存
+            if(new File(message.getPath() + File.separator + "results").exists()){
+                FileUtils.deleteDirectory(message.getPath() + File.separator + "results");
+            }
+            //由于刘强说caches会影响计算结果,所以这里删除caches
+            if(new File(message.getPath() + File.separator + "caches").exists()){
+                FileUtils.deleteDirectory(message.getPath() + File.separator + "caches");
+            }
+
+            //删除点位校准数据
+            if (Objects.nonNull(message.getExt())
+                    && message.getExt().containsKey("deleteExtras")
+                    && (Boolean) message.getExt().get("deleteExtras")) {
+                String extras = String.format(UploadFilePath.scene_result_data_path, num).concat("extras");
+                if(CollUtil.isNotEmpty(fYunFileService.listRemoteFiles(extras))){
+                    fYunFileService.deleteFolder(extras);
+                }
+            }
+
+            //根据相机类型,组装资源路径
+            //下载资源到本地
+            this.downLoadSource(message, message.getPath());
+
+
+            message.getBuildContext().put("cameraType",message.getCameraType());
+
+            message.setBizType("standard");
+
+            log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
+
+        }catch (Exception e){
+            log.error("场景计算前置处理出错,num"+num, e);
+            buildSceneDTService.handBaseFail("场景计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
+            throw e;
+        }
+    }
+
+    private String getOssPath(String path) {
+        String ossPath = ConstantFilePath.OSS_PREFIX
+                + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
+                .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "");
+        if (!ossPath.endsWith("/")) {
+            ossPath = ossPath.concat("/");
+        }
+        return ossPath;
+    }
+
+    @Override
+    public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path){
+        String ossPath = (String) buildSceneMqMessage.getExt().get("ossPath");
+        fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
+    }
+
+    @Override
+    public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
+        String sceneCode = message.getBuildContext().get("sceneNum").toString();
+        String path = message.getPath();
+        try {
+            // 上传计算日志
+            //如果是重复计算,没有走到计算逻辑,不需要上传日志文件
+            log.info("开始上传计算日志");
+            String buildLogPath = String.format(UploadFilePath.BUILD_LOG_PATH, sceneCode);
+            fYunFileService.uploadFile(path + File.separator + "console.log", buildLogPath + "console.log");
+            log.info("计算日志上传完成");
+
+            if (!message.getBuildSuccess()) {
+                log.error("建模失败,修改状态为失败状态");
+                scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
+                        .set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
+                        .eq(ScenePlus::getNum, sceneCode));
+
+                // 发送钉钉消息,计算失败
+                buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
+                return;
+            }
+            JSONObject fdageData = commonService.getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
+
+            ScenePlus scenePlus = scenePlusService.getScenePlusByNum(sceneCode);
+
+            Integer cameraType = Integer.parseInt(message.getBuildContext().get("cameraType").toString());
+            Map<String, String> uploadFiles = commonService.getUploadFiles(scenePlus,path,cameraType,fdageData);
+
+            scenePlus.setPayStatus(PayStatus.PAY.code());
+            scenePlus.setUpdateTime(new Date());
+            scenePlus.setSceneStatus(SceneStatus.NO_DISPLAY.code());
+
+            Integer videoVersion = fdageData.getInteger("videoVersion");
+            //读取计算结果文件生成videosJson
+            JSONObject videosJson = commonService.getVideosJson(path, videoVersion, sceneCode, cameraType);
+
+            ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+            boolean isObj = fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1;
+
+            //上传全景图俯视图
+            this.uploadFloorCad(path, sceneCode, uploadFiles);
+
+            log.info("开始上传场景计算结果数据,num:{}", sceneCode);
+            //由于3dtiles算法mesh文件发生变化,所以这里需要先清除一下oss的mesh目录,避免存在旧算法obj文件
+            fYunFileService.deleteFolder(String.format(UploadFilePath.DATA_VIEW_PATH, sceneCode) + "mesh");
+            fYunFileService.deleteFolder(String.format(UploadFilePath.IMG_VIEW_PATH,  sceneCode) + ModelKind.THREE_D_TILE.code());
+            //上传文件
+            fYunFileService.uploadMulFiles(uploadFiles);
+
+            //修改oss上dam的内容编码
+            Map<String,String> damFileHeaders = new HashMap<>();
+            damFileHeaders.put("Content-Encoding","gzip");
+            String damPath = path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam";
+            fYunFileService.uploadFile(damPath,  String.format(UploadFilePath.IMG_VIEW_PATH, sceneCode) + ConstantFileName.modelUUID + "_50k.dam", damFileHeaders);
+
+            //拷贝部分文件到编辑目录,用于用户编辑
+            this.copyToEditDir(sceneCode);
+
+            //计算完毕后,同步全景图到缓存目录
+//            this.cachePanorama(path, sceneCode);
+
+            //生成houseTypejson并上传
+            boolean existHouseType = this.uploadHouseTypeJson(sceneCode, path);
+            scenePlus.setHouseType(existHouseType ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code().intValue());
+
+            //生成floorpan.json
+            commonService.uploadFloorplanJson(sceneCode, path);
+
+            //重置异步操作记录
+            commonService.removeSceneAsynOperLog(sceneCode);
+
+            //清除用户编辑业务数据
+            Set<String> bizs = new HashSet<>();
+            bizs.add(UserEditDataType.BOX_MODEL.message());
+            bizs.add(UserEditDataType.FLOORPLAN.message());
+            bizs.add(UserEditDataType.FILTERS.message());
+            commonService.initUserEditData(sceneCode, bizs, null);
+
+            //上传计算结果文件
+            commonService.uploadBuildResultData(sceneCode, path, SceneVersionType.V4.code());
+
+            //容量统计
+            Long space = commonService.getSpace(sceneCode);
+
+            //写入数据库
+            this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), message.getComputeTime(),isObj,scenePlusExt);
+
+            Object[] editInfoArr = commonService.updateEditInfo(scenePlus);
+            SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
+            SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
+            SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
+
+            //更新场景主表
+            //如果相机容量不足,需要把场景的paystatus改为容量不足状态
+            scenePlus.setPayStatus(commonService.getPayStatus(scenePlus.getCameraId(), space));
+            //统计原始资源大小
+            scenePlusExt.setOrigSpace(FileUtil.size(new File(path.concat(File.separator).concat("capture"))));
+
+            if (new File(path + "/results/laserData/vision_edit.txt").exists()) {
+                fdkkLaserService.cloudPointBuild(sceneCode,path);
+            }
+
+            log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
+            CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
+            Company company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
+            //写scene.json
+            commonService.writeSceneJson(sceneCode,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
+
+            String qrLogo = !ObjectUtils.isEmpty(company) && !ObjectUtils.isEmpty(company.getQrLogo()) ? company.getQrLogo() : null;
+
+            qrLogo = ObjectUtils.isEmpty(qrLogo) && !ObjectUtils.isEmpty(sceneEditInfoExt.getShareLogoImg()) ? fYunFileConfig.getHost().concat(sceneEditInfoExt.getShareLogoImg()) : null;
+
+            createQrCode(sceneCode, scenePlusExt, qrLogo);
+
+//            //删除计算目录
+            if(CollUtil.isEmpty(notDeleteNasNumList) || !notDeleteNasNumList.contains(sceneCode)){
+                CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/"));
+            }
+
+            this.uploadStatusJson(scenePlus, scenePlusExt);
+
+            scenePlusService.updateById(scenePlus);
+            scenePlusExtService.updateById(scenePlusExt);
+
+            log.info("场景计算结果处理结束,场景码:{}", sceneCode);
+
+        }catch (Exception e){
+            log.error("场景计算结果处理出错,num"+sceneCode, e);
+            buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
+            throw e;
+        }
+    }
+
+//    private void cachePanorama(String dataSource, String num){
+//        String cachedImagesPath = String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
+//        //将全景图缓存到缓存目录
+//        List<String> imagesList = FileUtil.listFileNames(dataSource + "/caches/images");
+//        //先清除旧的全景图
+//        cn.hutool.core.io.FileUtil.del(cachedImagesPath);
+//        String visionPath = dataSource + "/results/vision.txt";
+//        List<String> panoramaImageList = SceneUtil.getPanoramaImageList(visionPath);
+//        imagesList.stream().forEach(fileName -> {
+//            if (panoramaImageList.contains(fileName)) {
+//                String srcPath = dataSource + "/caches/images/" + fileName;
+//                String targetPath = cachedImagesPath + fileName;
+//                log.info("源文件:{}, 目标文件:{}", srcPath, targetPath);
+//                cn.hutool.core.io.FileUtil.copy(srcPath, targetPath, true);
+//            }
+//        });
+//    }
+
+
+
+    private void uploadFloorCad(String path, String num, Map<String, String> uploadFiles){
+
+        //户型图上传
+        String  dataViewPath = UploadFilePath.DATA_VIEW_PATH + "floor-cad-%s.%s";
+        String floorCadPath = path + "/results/floorplan_cad";
+        List<String> floorCadList = FileUtils.getFileList(floorCadPath);
+        if(CollUtil.isNotEmpty(floorCadList)){
+            floorCadList.stream().forEach(str->{
+                String substring = str.substring(str.lastIndexOf(File.separator) + 1);
+                String[] arr = substring.split("floor");
+                String[] arr2 = arr[1].split("\\.");
+                uploadFiles.put(str, String.format(dataViewPath, num, arr2[0], arr2[1]));
+            });
+        }
+
+    }
+
+    private void uploadStatusJson(ScenePlus scenePlus, ScenePlusExt scenePlusExt){
+        String num = scenePlus.getNum();
+        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
+
+        Integer status = 1;
+        if(scenePlus.getSceneSource() == 4 || scenePlus.getSceneSource() == 5){//如果是激光场景,需要激光系统那边完全处理好之后再发mq通知更新状态
+            status = 0;
+        }
+
+        // 上传status JSON.
+        JSONObject statusJson = new JSONObject();
+        //临时将-2改成1,app还没完全更新
+        statusJson.put("status", status);
+        statusJson.put("webSite", scenePlusExt.getWebSite());
+        statusJson.put("sceneNum", num);
+        statusJson.put("thumb", scenePlusExt.getThumb());
+        statusJson.put("payStatus", scenePlus.getPayStatus());
+        statusJson.put("sceneScheme", scenePlusExt.getSceneScheme());
+        FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJson.toString());
+
+        Map<String,String> headers = new HashMap<>();
+        headers.put(HttpHeaders.CONTENT_TYPE, ContentType.JSON.getValue());
+        fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", dataViewPath + "status.json", headers);
+    }
+
+    private void createQrCode(String num, ScenePlusExt scenePlusExt, String qrLogo) {
+        String localLogoPath = null;
+        if (!ObjectUtils.isEmpty(qrLogo)) {
+            try {
+                localLogoPath = ConstantFilePath.AGENT_PATH + qrLogo.substring(qrLogo.lastIndexOf("//") + 1);
+                HttpUtil.downloadFile(qrLogo, localLogoPath);
+            } catch (Exception e) {
+                log.error("公司logo下载失败:{}", qrLogo);
+                localLogoPath = null;
+            }
+        }
+        //生成二维码
+        String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +".png";
+        String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +"_en.png";
+        QrConfig qrConfig = QrConfig.create();
+        qrConfig.setWidth(1024);
+        qrConfig.setHeight(1024);
+        if(StrUtil.isNotEmpty(localLogoPath)){
+            qrConfig.setImg(localLogoPath);
+        }
+        QrCodeUtil.generate(scenePlusExt.getWebSite(), qrConfig, FileUtil.file(outPathZh));
+        QrCodeUtil.generate(scenePlusExt.getWebSite() + "&lang=en", qrConfig, FileUtil.file(outPathEn));
+        //上传二维码
+        fYunFileService.uploadFile(outPathZh, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + ".png");
+        fYunFileService.uploadFile(outPathEn, String.format(UploadFilePath.DOWNLOADS_QRCODE, num) + num + "_en.png");
+
+        if(!ObjectUtils.isEmpty(localLogoPath)){
+            FileUtils.deleteFile(localLogoPath);
+        }
+    }
+
+    private void pushMsgToApp(Integer pushChannel, String pushToken, int cameraType, String sceneName, String webSite){
+        log.info("推送消息,渠道是 {}, 手机token是 {}", pushChannel, pushToken);
+        if(Objects.isNull(pushChannel) || StrUtil.isBlank(pushToken)){
+            return;
+        }
+
+        String title = sceneName + "计算完成";
+        String body = "您上传的" + sceneName + "计算完成,点击查看";
+
+        try{
+            if(FYunTypeEnum.AWS.code().equals(fYunFileService.getFyunType())){
+                PushMsgUtil.googlePushMsg(ConstantFilePath.BASE_PATH + "/refreshToken.json", pushToken,
+                        title, body , webSite);
+                return;
+            }
+
+            PushMessageConfig pushConfig = null;
+            if(pushChannel == 0){
+                if(cameraType == 10 || cameraType == 13){
+                    //ios
+                    pushConfig = new PushMessageConfig(PushMessageConfig.IOS_KEY_Z, PushMessageConfig.IOS_SECRET_Z);
+                    pushConfig.sendIOSUnicast(pushToken,  "四维看看Minion",title, body, webSite);
+                }else {
+                    //ios
+                    pushConfig = new PushMessageConfig(PushMessageConfig.IOS_KEY, PushMessageConfig.IOS_SECRET);
+                    pushConfig.sendIOSUnicast(pushToken, "四维看看Pro",title, body, webSite);
+                }
+            }else {
+                if(cameraType == 10 || cameraType == 13){
+                    //ios
+                    //安卓
+                    pushConfig = new PushMessageConfig(PushMessageConfig.ANDROID_KEY_Z, PushMessageConfig.ANDROID_SECRET_Z);
+                    pushConfig.sendAndroidUnicast2(pushToken, "四维看看Minion",title, body, webSite);
+                }else {
+                    //安卓
+                    pushConfig = new PushMessageConfig(PushMessageConfig.ANDROID_KEY, PushMessageConfig.ANDROID_SECRET);
+                    pushConfig.sendAndroidUnicast(pushToken, "四维看看Pro",title, body, webSite);
+                }
+            }
+            log.info("消息推送结束!");
+        }catch (Exception e){
+            log.error("推送消息失败:", e);
+        }
+    }
+
+    private void copyToEditDir(String num) throws IOException {
+
+        String editImagesPath = String.format(UploadFilePath.IMG_EDIT_PATH, num);
+        String viewImagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
+
+        String editDataPath = String.format(UploadFilePath.DATA_EDIT_PATH, num);
+        String viewDataPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
+
+        Map<String, String> map = new HashMap<>();
+        map.put(editImagesPath + "vision.modeldata", viewImagesPath + "vision.modeldata");
+        map.put(editImagesPath + "vision2.modeldata", viewImagesPath + "vision2.modeldata");
+        map.put(editDataPath + "floorplan_cad.json", viewDataPath + "floorplan_cad.json");
+
+        for (Entry<String, String> entry : map.entrySet()) {
+                fYunFileService.copyFileInBucket(entry.getValue(), entry.getKey());
+        }
+    }
+
+    private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
+
+        scenePlusExt.setSpace(space);
+        scenePlusExt.setComputeTime(computeTime.toString());
+        scenePlusExt.setAlgorithmTime(new Date());
+        scenePlusExt.setVideos(videosJson);
+        scenePlusExt.setIsObj(isObj ? 1 : 0);
+
+        if(ModelTypeEnums.TILE_CODE.equals(modelType)){
+            scenePlusExt.setSceneScheme(3);
+        }
+
+        switch (SceneSource.get(sceneSource)){
+            case BM:
+                scenePlusExt.setSceneResolution(SceneResolution.two_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.PRO.code());
+                break;
+            case SM:
+                scenePlusExt.setSceneResolution(SceneResolution.one_k.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LITE.code());
+                break;
+            case ZT:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.MINION.code());
+                break;
+            case JG:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
+                break;
+            case SG:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
+                break;
+        }
+
+        String sceneKind = scenePlusExt.getSceneScheme() == 3 ? SceneKind.FACE.code():SceneKind.TILES.code();
+        scenePlusExt.setSceneKind(sceneKind);
+//        scenePlusExt.setModelKind(modelKind);
+
+        //统计点位数量
+        Map<String, Integer> result = this.getShootCount(scenePlusExt);
+        Integer shootCount = result.get("shootCount");
+        Integer mixture = result.get("mixture");
+        scenePlusExt.setShootCount(shootCount);
+        scenePlusExt.setMixture(mixture);
+
+        scenePlusExtService.updateById(scenePlusExt);
+    }
+
+    private Map<String, Integer> getShootCount(ScenePlusExt scenePlusExt){
+
+        Map<String, Integer> result = new HashMap<>();
+
+        Integer shootCount = 0;
+        Integer mixture = Objects.isNull(scenePlusExt.getMixture()) ? 0 : scenePlusExt.getMixture();
+        String homePath = SceneUtil.getHomePath(scenePlusExt.getDataSource());
+        JSONObject dataFdageObj = JSON.parseObject(fYunFileService.getFileContent(homePath.concat("data.fdage")));
+        if(Objects.nonNull(dataFdageObj)){
+            JSONArray points = dataFdageObj.getJSONArray("points");
+            if(CollUtil.isNotEmpty(points)){
+                shootCount = points.size();
+            }
+        }
+        if(Objects.nonNull(shootCount) && shootCount > 0){
+            if(Objects.nonNull(scenePlusExt.getLocation()) && scenePlusExt.getLocation() == 6){
+                mixture = CommonStatus.YES.code().intValue();
+            }
+        }else{
+            String slamDataStr = fYunFileService.getFileContent(homePath.concat("slam_data.json"));
+            JSONObject slamDataObj = JSON.parseObject(slamDataStr);
+            if(Objects.nonNull(slamDataObj)){
+                JSONArray viewsInfo = slamDataObj.getJSONArray("views_info");
+                if(CollUtil.isNotEmpty(viewsInfo)){
+                    shootCount = viewsInfo.stream().mapToInt(info -> {
+                        return  ((JSONObject) info).getJSONArray("list_pose").size();
+                    }).sum();
+                }
+            }
+            mixture = CommonStatus.NO.code().intValue();
+        }
+
+        result.put("shootCount", shootCount);
+        result.put("mixture", mixture);
+
+        return result;
+    }
+
+    public static void main(String[] args) {
+        JSONObject dataFdageObj = JSON.parseObject(null);
+        System.out.println(dataFdageObj);
+    }
+
+
+    public boolean uploadHouseTypeJson(String num, String dataSource) {
+        String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
+        if (!new File(floorPlanCardFilePath).exists()) {
+            log.warn("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
+            return false;
+        }
+        JSONObject json = CreateHouseJsonUtil.createHouseTypeJsonByCad(floorPlanCardFilePath);
+        if(Objects.isNull(json)){
+            return false;
+        }
+        String hourseTypeJsonPath = String.format(UploadFilePath.USER_VIEW_PATH, num) + "houseType.json";
+        fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
+        hourseTypeJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "houseType.json";
+        fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
+
+        return true;
+    }
+}

+ 69 - 59
src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java

@@ -1,25 +1,22 @@
 package com.fdkankan.contro.mq.service.impl;
 
-import cn.hutool.core.exceptions.ExceptionUtil;
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.common.constant.*;
 import com.fdkankan.common.util.FileUtils;
-import com.fdkankan.contro.entity.ScenePlus;
-import com.fdkankan.contro.entity.ScenePlusExt;
-import com.fdkankan.contro.entity.ScenePro;
-import com.fdkankan.contro.entity.SceneProEdit;
+import com.fdkankan.contro.constant.UserEditDataType;
+import com.fdkankan.contro.entity.*;
 import com.fdkankan.contro.mq.service.IBuildSceneService;
-import com.fdkankan.contro.mq.service.ICommonService;
+import com.fdkankan.contro.service.ICommonService;
 import com.fdkankan.contro.service.*;
 import com.fdkankan.contro.service.impl.FdkkV4Service;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.model.constants.ConstantFileName;
 import com.fdkankan.model.constants.ConstantFilePath;
-import com.fdkankan.model.constants.SceneBuildProcessType;
 import com.fdkankan.model.constants.UploadFilePath;
 import com.fdkankan.model.utils.CreateObjUtil;
 import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
@@ -30,12 +27,13 @@ import com.fdkankan.redis.util.RedisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 
+import javax.annotation.Resource;
 import java.io.File;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
 
 /**
  * <p>
@@ -47,6 +45,7 @@ import java.util.Objects;
  **/
 @Slf4j
 @Service
+@RefreshScope
 public class BuildObjServiceImpl implements IBuildSceneService {
 
     @Value("${queue.modeling.modeling-call}")
@@ -70,7 +69,7 @@ public class BuildObjServiceImpl implements IBuildSceneService {
     @Autowired
     private RabbitMqProducer mqProducer;
 
-    @Autowired
+    @Resource
     private FYunFileServiceInterface fYunFileService;
 
     @Autowired
@@ -101,14 +100,18 @@ public class BuildObjServiceImpl implements IBuildSceneService {
     private IScenePlusExtService scenePlusExtService;
     @Autowired
     private RedisUtil redisUtil;
+    @Autowired
+    private ICameraDetailService cameraDetailService;
+    @Autowired
+    private ICompanyService companyService;
 
     @Override
     public void buildScenePre(BuildSceneCallMessage message) throws Exception{
         boolean success = false;
         String num = message.getSceneNum();
+        String path = message.getPath();
+        String laserObjFilePath = path + "_laser_obj";
         try {
-            String path = message.getPath();
-            String laserObjFilePath = path + "_laser_obj";
             //根据相机类型,组装资源路径
             log.info("开始准备生成OBJ场景资源,路径:{}", laserObjFilePath);
 
@@ -122,9 +125,13 @@ public class BuildObjServiceImpl implements IBuildSceneService {
                 log.error("data.fdage文件不存在");
                 return ;
             }
+            //下载资源到本地
+            this.downLoadSource(message, laserObjFilePath);
+
             if (!jsonObject.containsKey("exportMeshObj") || jsonObject.getIntValue("exportMeshObj") != 1) {
                 // 写入data.fdage 防止重算
                 jsonObject.put("exportMeshObj", 1);
+                FileUtil.writeUtf8String(jsonObject.toJSONString(), laserObjFilePath + File.separator + "capture" + File.separator + "data.fdage");
                 fYunFileService.uploadFile(laserObjFilePath + File.separator + "capture" + File.separator + "data.fdage",
                         ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage");
             }
@@ -137,12 +144,7 @@ public class BuildObjServiceImpl implements IBuildSceneService {
             message.setResolution(jsonObject.getString("resolution"));
             message.setPath(laserObjFilePath);
             message.setResultReceiverMqName(queueObjModelingPost);
-
-            //下载资源到本地
-            this.downLoadSource(message, laserObjFilePath);
-
-            //发送mq,就进行计算
-            mqProducer.sendByWorkQueue(queueModelingCall, message);
+            message.setBizType("obj");
 
             success = true;
 
@@ -152,41 +154,24 @@ public class BuildObjServiceImpl implements IBuildSceneService {
             log.error("生成OBJ场景资源准备异常,num=" + num, e);
             buildSceneDTService.handBaseFail("生成OBJ场景资源准备异常", message.getPath(), message.getSceneNum(), "计算控制服务器");
             throw e;
+        }finally {
+            fdkkLaserService.pushBuildStatusToLaserSystem(num, laserObjFilePath + "/laserData/mesh", success ? CommonOperStatus.SUCCESS.code() : CommonOperStatus.FAILD.code());
         }
     }
 
     @Override
     public void downLoadSource(BuildSceneCallMessage message,String path) throws Exception{
 
-        ScenePro scenePro = sceneProService.getByNum(message.getSceneNum());
-        String version = "V4";
-        if(Objects.nonNull(scenePro) && scenePro.getIsUpgrade() != CommonStatus.YES.code().intValue()){
-            version = "V3";
-        }
+        //下载原始资源文件
+        String ossPath = commonService.getOssOrignPath(message.getPath());
+        fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
 
-        if(SceneVersionType.V4.code().equals(version)){
-            String ossResultPath = String.format(UploadFilePath.scene_result_data_path, message.getSceneNum());
-            fYunFileService.downloadFile(ossResultPath + "caches/reconstruction/final.bin", path + "/caches/reconstruction/final.bin");
-            fYunFileService.downloadFile(ossResultPath + "caches/reconstruction/chunk.json", path + "/caches/reconstruction/chunk.json");
-            fYunFileService.downloadFile(ossResultPath + "caches/floor_group_fix.json", path + "/caches/floor_group_fix.json");
-            fYunFileService.downloadFileByCommand(path + "/caches/images/", ossResultPath + "caches/images/");
-            fYunFileService.downloadFileByCommand( path + "/caches/depthmap_csc/" , ossResultPath + "caches/depthmap_csc/");
-            fYunFileService.downloadFileByCommand( path + "/caches/depthmap_vis/", ossResultPath + "caches/depthmap_vis/");
-            fYunFileService.downloadFileByCommand( path + "/caches/depthmap/", ossResultPath + "caches/depthmap/");
-            fYunFileService.downloadFile(ossResultPath + "caches/panorama.json", path + "/caches/panorama.json");
-            fYunFileService.downloadFile(ossResultPath + "results/laserData/laser.ply", path + "/results/laserData/laser.ply");
-        }else{
-            String prevoisPath = message.getBuildContext().get("previousPath").toString();
-            FileUtils.copyFile(prevoisPath + "/caches/reconstruction/final.bin", path + "/caches/reconstruction/final.bin", true);
-            FileUtils.copyFile(prevoisPath + "/caches/reconstruction/chunk.json", path + "/caches/reconstruction/chunk.json", true);
-            FileUtils.copyFile(prevoisPath + "/caches/floor_group_fix.json", path + "/caches/floor_group_fix.json", true);
-            FileUtils.copyDirectiory(prevoisPath + "/caches/images", path + "/caches/images");
-            FileUtils.copyDirectiory(prevoisPath + "/caches/depthmap_csc", path + "/caches/depthmap_csc");
-            FileUtils.copyDirectiory(prevoisPath + "/caches/depthmap_vis", path + "/caches/depthmap_vis");
-            FileUtils.copyDirectiory(prevoisPath + "/caches/depthmap", path + "/caches/depthmap");
-            FileUtils.copyFile(prevoisPath + "/caches/panorama.json", path + "/caches/panorama.json", true);
-            FileUtils.copyFile(prevoisPath + "/results/laserData/laser.ply", path + "/results/laserData/laser.ply", true);
-        }
+        //下载caches/image,算法会执行快一些
+        String ossResultPath = String.format(UploadFilePath.scene_result_data_path, message.getSceneNum());
+        fYunFileService.downloadFileByCommand(path + "/caches/images/", ossResultPath + "caches/images/");
+
+        //下载点位校准文件
+        fYunFileService.downloadFileByCommand(path + "/extras/", ossResultPath + "extras/");
     }
 
     @Override
@@ -240,6 +225,8 @@ public class BuildObjServiceImpl implements IBuildSceneService {
                     log.error("3dtiles目录异常,3dtiles地址:{}", new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
                     throw new Exception("3dtiles目录异常");
                 }
+                //先删除
+                fYunFileService.deleteFolder(oss3dtilesPath);
                 //上传3dtiles文件
                 fYunFileService.uploadFileByCommand(threedtilesPath, oss3dtilesPath);
             }
@@ -263,9 +250,15 @@ public class BuildObjServiceImpl implements IBuildSceneService {
             log.info("开始拷贝obj文件");
             FileUtils.copyFolderAllFiles(laserObjFilePath + "/results/mesh", laserObjFilePath + "/laserData/mesh/", true);
 
+            //先删除
+            fYunFileService.deleteFolder(String.format(UploadFilePath.DATA_VIEW_PATH,  projectNum) + "mesh");
             //上传mesh文件
             fYunFileService.uploadFileByCommand(laserObjFilePath + "/results/mesh", String.format(UploadFilePath.DATA_VIEW_PATH,  projectNum) + "mesh");
 
+            CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision.txt", resultsPath + "vision.modeldata");
+            fYunFileService.uploadFile(resultsPath + "vision.txt", ossImagePath.concat("vision.txt"));
+            fYunFileService.uploadFile(resultsPath + "vision.modeldata", ossImagePath.concat("vision.modeldata"));
+
             if(!ObjectUtils.isEmpty(scenePro)){
                 LambdaUpdateWrapper<ScenePro> updateWrapper = new LambdaUpdateWrapper<ScenePro>()
                         .set(ScenePro::getStatus, -2).eq(ScenePro::getNum, projectNum);
@@ -275,29 +268,46 @@ public class BuildObjServiceImpl implements IBuildSceneService {
             }
 
             ScenePlus scenePlus = scenePlusService.getScenePlusByNum(projectNum);
-            if(!ObjectUtils.isEmpty(scenePlus)){
+            if(Objects.nonNull(scenePlus)){
+
+//                //清除用户编辑业务数据
+//                Set<String> bizs = new HashSet<>();
+//                bizs.add(UserEditDataType.BOX_MODEL.message());
+//                bizs.add(UserEditDataType.FLOORPLAN.message());
+//                commonService.initUserEditData(projectNum, bizs, null);
+
                 LambdaUpdateWrapper<ScenePlus> plusUpdateWrapper = new LambdaUpdateWrapper<ScenePlus>()
                         .set(ScenePlus::getSceneStatus, -2).eq(ScenePlus::getNum, projectNum);
                 scenePlusService.update(plusUpdateWrapper);
+                ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+                scenePlusExt.setAlgorithmTime(Calendar.getInstance().getTime());
+
+                //计算容量
+                Long space = commonService.getSpace(projectNum);
+                scenePlusExt.setSpace(space);
+
+                Object[] editInfoArr = commonService.updateEditInfo(scenePlus);
+                SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
+                SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
+                SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
 
                 if(this.modelKind.equals(ModelKind.THREE_D_TILE.code())
                         && CollUtil.isNotEmpty(sdTilesSceneSourceList)
-                        && sdTilesSceneSourceList.contains(SceneSource.JG.code())){
-                    ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+                        && sdTilesSceneSourceList.contains(scenePlus.getSceneSource())){
                     scenePlusExt.setModelKind(ModelKind.THREE_D_TILE.code());
                     scenePlusExtService.updateById(scenePlusExt);
-
-                    String sceneJsonStr = fYunFileService.getFileContent(String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "scene.json");
-                    if(StrUtil.isNotEmpty(sceneJsonStr)){
-                        JSONObject sceneJson = JSON.parseObject(sceneJsonStr);
-                        sceneJson.put("modelKind", ModelKind.THREE_D_TILE.code());
-                        fYunFileService.uploadFile(sceneJson.toJSONString().getBytes(), String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "scene.json");
-                        redisUtil.del(String.format(RedisKey.SCENE_JSON, projectNum));
-                    }
-
                 }
+
+                log.info("生成scene.json上传oss并设置缓存,num:{}", projectNum);
+                CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
+                Company company = !org.apache.commons.lang3.ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
+                //写scene.json
+                commonService.writeSceneJson(projectNum,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
             }
 
+            //重置异步操作记录
+            commonService.removeSceneAsynOperLog(projectNum);
+
             // 如果未升级V4,则升级V4
             if("v3".equals(version)){
                 fdkkV4Service.upgradeToV4(projectNum);
@@ -307,7 +317,7 @@ public class BuildObjServiceImpl implements IBuildSceneService {
 
             //国际环境需要发邮件通知
             if("eur".equals(env)){
-                commonService.sendEmail(projectNum);
+                commonService.sendEmail(projectNum, "obj");
             }
 
         }catch (Exception e){

+ 169 - 430
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java

@@ -1,14 +1,13 @@
 package com.fdkankan.contro.mq.service.impl;
 
-import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.exceptions.ExceptionUtil;
 import cn.hutool.core.io.FileUtil;
-import cn.hutool.core.io.file.FileNameUtil;
+import cn.hutool.core.thread.ThreadUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.ZipUtil;
 import cn.hutool.extra.qrcode.QrCodeUtil;
 import cn.hutool.extra.qrcode.QrConfig;
+import cn.hutool.http.ContentType;
 import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -17,42 +16,40 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.common.constant.*;
 import com.fdkankan.common.util.FileUtils;
-import com.fdkankan.contro.bean.SceneJsonBean;
+import com.fdkankan.contro.bean.SyncLaserResultBean;
 import com.fdkankan.contro.constant.UserEditDataType;
 import com.fdkankan.contro.entity.*;
 import com.fdkankan.contro.mq.service.IBuildSceneService;
-import com.fdkankan.contro.mq.service.ICommonService;
 import com.fdkankan.contro.service.*;
-import com.fdkankan.contro.vo.SceneEditControlsVO;
 import com.fdkankan.fyun.config.FYunFileConfig;
 import com.fdkankan.fyun.constant.FYunTypeEnum;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.model.constants.ConstantFileName;
 import com.fdkankan.model.constants.ConstantFilePath;
-import com.fdkankan.model.constants.SceneBuildProcessType;
 import com.fdkankan.model.constants.UploadFilePath;
 import com.fdkankan.model.enums.ModelTypeEnums;
 import com.fdkankan.model.utils.CreateHouseJsonUtil;
 import com.fdkankan.model.utils.CreateObjUtil;
-import com.fdkankan.model.utils.FloorPlanUserUtil;
 import com.fdkankan.model.utils.SceneUtil;
 import com.fdkankan.push.config.PushMessageConfig;
 import com.fdkankan.push.utils.PushMsgUtil;
 import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
 import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
 import com.fdkankan.rabbitmq.util.RabbitMqProducer;
-import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.util.RedisUtil;
-import com.sun.org.apache.xpath.internal.operations.Plus;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpHeaders;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.io.File;
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.util.*;
 import java.util.Map.Entry;
 import java.util.stream.Collectors;
@@ -68,6 +65,7 @@ import java.util.stream.Collectors;
  **/
 @Slf4j
 @Service
+@RefreshScope
 public class BuildSceneServiceImpl implements IBuildSceneService {
 
     @Value("${queue.modeling.modeling-call}")
@@ -79,19 +77,19 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     @Value("${model.type:#{null}}")
     private String modelType;
 
-    @Value("${model.modelKind:3dtiles}")
-    private String modelKind;
-
-    @Value("#{'${model.3dtiles.sceneSource:}'.split(',')}")
-    private List<Integer> sdTilesSceneSourceList;
-
     @Value("${env:gn}")
     private String env;
 
+    @Value("#{'${build.scene.post.not-delete-nas-nums:}'.split(',')}")
+    private List<String> notDeleteNasNumList;
+
+    @Value("4dkk.laserService.bucket")
+    private String laserBucket;
+
     @Autowired
     private RabbitMqProducer mqProducer;
 
-    @Autowired
+    @Resource
     private FYunFileServiceInterface fYunFileService;
     @Autowired
     private ICameraDetailService cameraDetailService;
@@ -134,16 +132,41 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     private ICommonService commonService;
     @Autowired
     private ISceneBuildProcessLogService sceneBuildProcessLogService;
+    @Autowired
+    private ISceneColdStorageService sceneColdStorageService;
+    @Autowired
+    private IWbService wbService;
+
 
     @Override
     public void buildScenePre(BuildSceneCallMessage message) throws Exception{
-        boolean success = false;
         String num = message.getSceneNum();
         try {
+            Map<String, Object> sceneStatusParam = new HashMap<>();
+            sceneStatusParam.put("num", num);
+            sceneStatusParam.put("status", 0);
+            commonService.sendUpdateSceneStatusMqToQueues(sceneStatusParam);
             //重新计算时需要删除文件夹,否知使用缓存
             if(new File(message.getPath() + File.separator + "results").exists()){
                 FileUtils.deleteDirectory(message.getPath() + File.separator + "results");
             }
+            //由于刘强说caches会影响计算结果,所以这里删除caches
+            if(new File(message.getPath() + File.separator + "caches").exists()){
+                FileUtils.deleteDirectory(message.getPath() + File.separator + "caches");
+            }
+
+            //删除点位校准数据
+            if (Objects.nonNull(message.getExt())
+                    && message.getExt().containsKey("deleteExtras")
+                    && (Boolean) message.getExt().get("deleteExtras")) {
+                String extras = String.format(UploadFilePath.scene_result_data_path, num).concat("extras");
+                if(CollUtil.isNotEmpty(fYunFileService.listRemoteFiles(extras))){
+                    fYunFileService.deleteFolder(extras);
+                }
+            }
+
+            //用户相机重新全量上传,需要解冻结
+            sceneColdStorageService.unfreeze(num, "用户相机重新全量上传", message.getPath());
 
             //根据相机类型,组装资源路径
             //下载资源到本地
@@ -174,16 +197,18 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
             message.getBuildContext().put("cameraType",message.getCameraType());
 
-            // 判断企业是否配置了弹性伸缩
-            if (message.getFlexibility() == 0) {
-                //发送mq,就进行计算
-                mqProducer.sendByWorkQueue(queueModelingCall, message);
-            } else {
-                //发送mq,就进行计算
-                mqProducer.sendByWorkQueue(singleModelingCall, message);
+            //查询是否超过比例50%,如果超过,则启动128G服务器弹性伸缩
+            Float maxRate = fdageJson.getFloat("maxRate");
+            if(env.equals("gn") && Objects.nonNull(maxRate) && maxRate > 50){
+                Map<String, Object> ext = message.getExt();
+                if(Objects.isNull(ext)){
+                    ext = new HashMap<>();
+                    message.setExt(ext);
+                }
+                ext.put("128G", 1);
             }
 
-            success = true;
+            message.setBizType("standard");
 
             log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
 
@@ -210,7 +235,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
     }
 
-
     @Override
     public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
         String sceneCode = message.getBuildContext().get("sceneNum").toString();
@@ -229,37 +253,29 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
                         .set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
                         .eq(ScenePlus::getNum, sceneCode));
 
+                wbService.sendMq(sceneCode, CommonSuccessStatus.FAIL.code());
+
                 // 发送钉钉消息,计算失败
                 buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
                 return;
             }
-            JSONObject fdageData = getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
+            JSONObject fdageData = commonService.getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
 
             ScenePlus scenePlus = scenePlusService.getScenePlusByNum(sceneCode);
 
             Integer cameraType = Integer.parseInt(message.getBuildContext().get("cameraType").toString());
-            Map<String, String> uploadFiles = getUploadFiles(scenePlus,path,cameraType,fdageData);
-
-            //计算场景消耗磁盘空间
-            long space = this.calUseSpace(uploadFiles);
-
+            Map<String, String> uploadFiles = commonService.getUploadFiles(scenePlus,path,cameraType,fdageData);
 
             scenePlus.setPayStatus(PayStatus.PAY.code());
-            //如果相机容量不足,需要把场景的paystatus改为容量不足状态
-            if (cameraType != 14) {
-                scenePlus.setPayStatus(this.getPayStatus(scenePlus.getCameraId(), space));
-            }
             scenePlus.setUpdateTime(new Date());
             scenePlus.setSceneStatus(SceneStatus.NO_DISPLAY.code());
 
             Integer videoVersion = fdageData.getInteger("videoVersion");
             //读取计算结果文件生成videosJson
-            JSONObject videosJson = this.getVideosJson(path, videoVersion, sceneCode, cameraType);
+            JSONObject videosJson = commonService.getVideosJson(path, videoVersion, sceneCode, cameraType);
 
             ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
             boolean isObj = fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1;
-            //写入数据库
-            this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), message.getComputeTime(),isObj,scenePlusExt);
 
             //上传全景图俯视图
             this.uploadFloorCad(path, sceneCode, uploadFiles);
@@ -267,24 +283,15 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             log.info("开始上传场景计算结果数据,num:{}", sceneCode);
             //由于3dtiles算法mesh文件发生变化,所以这里需要先清除一下oss的mesh目录,避免存在旧算法obj文件
             fYunFileService.deleteFolder(String.format(UploadFilePath.DATA_VIEW_PATH, sceneCode) + "mesh");
+            fYunFileService.deleteFolder(String.format(UploadFilePath.IMG_VIEW_PATH,  sceneCode) + ModelKind.THREE_D_TILE.code());
             //上传文件
             fYunFileService.uploadMulFiles(uploadFiles);
 
+            //修改oss上dam的内容编码
             Map<String,String> damFileHeaders = new HashMap<>();
             damFileHeaders.put("Content-Encoding","gzip");
-            // dam 文件设置请求头
-            uploadFiles.entrySet().stream().filter(entry -> FileNameUtil.extName(entry.getKey()).equals("dam"))
-                .forEach(entry -> {
-                    if (!new File(entry.getKey()).exists()) {
-                        log.error("文件不存在,不予gzip压缩,文件路径:{}", entry.getKey());
-                        return;
-                    }
-                    // gzip压缩
-                    FileUtil.writeBytes(ZipUtil.gzip(new File(entry.getKey())), entry.getKey() + ".gzip");
-                    // 重命名
-                    FileUtil.rename(new File(entry.getKey() + ".gzip"), entry.getKey(), true);
-                    fYunFileService.uploadFile(entry.getKey(), entry.getValue(), damFileHeaders);
-                });
+            String damPath = path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam";
+            fYunFileService.uploadFile(damPath,  String.format(UploadFilePath.IMG_VIEW_PATH, sceneCode) + ConstantFileName.modelUUID + "_50k.dam", damFileHeaders);
 
             //拷贝部分文件到编辑目录,用于用户编辑
             this.copyToEditDir(sceneCode);
@@ -293,31 +300,53 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 //            this.cachePanorama(path, sceneCode);
 
             //生成houseTypejson并上传
-            boolean existHouseType = this.uploadHouseTypeJson(sceneCode, scenePlusExt.getDataSource());
+            boolean existHouseType = this.uploadHouseTypeJson(sceneCode, path);
             scenePlus.setHouseType(existHouseType ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code().intValue());
 
             //生成floorpan.json
-            commonService.uploadFloorplanJson(sceneCode, scenePlusExt.getDataSource());
+            commonService.uploadFloorplanJson(sceneCode, path);
 
             //重置异步操作记录
-            this.removeSceneAsynOperLog(sceneCode);
+            commonService.removeSceneAsynOperLog(sceneCode);
 
             //清除用户编辑业务数据
             Set<String> bizs = new HashSet<>();
             bizs.add(UserEditDataType.BOX_MODEL.message());
+            bizs.add(UserEditDataType.FLOORPLAN.message());
+            bizs.add(UserEditDataType.FILTERS.message());
             commonService.initUserEditData(sceneCode, bizs, null);
 
             //上传计算结果文件
             commonService.uploadBuildResultData(sceneCode, path, SceneVersionType.V4.code());
 
-            Object[] editInfoArr = this.updateEditInfo(scenePlus);
+            //容量统计
+            Long space = commonService.getSpace(sceneCode);
+
+            //写入数据库
+            this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), message.getComputeTime(),isObj,scenePlusExt);
+
+            Object[] editInfoArr = commonService.updateEditInfo(scenePlus);
             SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
             SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
             SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
 
+            //更新场景主表
+            //如果相机容量不足,需要把场景的paystatus改为容量不足状态
+            scenePlus.setPayStatus(commonService.getPayStatus(scenePlus.getCameraId(), space));
+            //统计原始资源大小
+            scenePlusExt.setOrigSpace(FileUtil.size(new File(path.concat(File.separator).concat("capture"))));
+
             if (cameraType == 14) {
                 //计算成功  激光转台相机 同步 请求
-                fdkkLaserService.syncBuildResult(scenePlus.getNum(), scenePlusExt.getDataSource(),scenePlus.getCreateTime());
+                fdkkLaserService.syncBuildResult(
+                        SyncLaserResultBean.builder()
+                        .num(sceneCode).dataSource(path)
+                        .sceneStatus(2)
+                        .createTime(scenePlus.getCreateTime())
+                        .shootCount(scenePlusExt.getShootCount())
+                        .payStatus(scenePlus.getPayStatus())
+                        .mixture(scenePlusExt.getMixture())
+                        .version(SceneVersionType.V4.code()).build());
                 sceneEditControlsService.update(new LambdaUpdateWrapper<SceneEditControls>().set(SceneEditControls::getShowMap,0)
                         .eq(SceneEditControls::getEditInfoId,sceneEditInfo.getId()));
                 sceneEditControls.setShowMap(0);
@@ -325,11 +354,12 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
                 fdkkLaserService.cloudPointBuild(sceneCode,path);
             }
 
+
             log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
             CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
             Company company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
             //写scene.json
-            this.writeSceneJson(sceneCode, videosJson,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
+            commonService.writeSceneJson(sceneCode,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
 
             String qrLogo = !ObjectUtils.isEmpty(company) && !ObjectUtils.isEmpty(company.getQrLogo()) ? company.getQrLogo() : null;
 
@@ -342,46 +372,40 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             String pushToken = fdageData.getString("pushToken");
             this.pushMsgToApp(pushChannel,pushToken, cameraType, scenePlus.getTitle(), scenePlusExt.getWebSite());
 
-            //更新场景主表
-            scenePlusService.updateById(scenePlus);
+//            //删除计算目录
+            if(CollUtil.isEmpty(notDeleteNasNumList) || !notDeleteNasNumList.contains(sceneCode)){
+                CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/"));
+            }
+
 
-            //删除计算目录
-            CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/"));
+            this.uploadStatusJson(scenePlus, scenePlusExt);
+
+            scenePlusService.updateById(scenePlus);
+            scenePlusExtService.updateById(scenePlusExt);
 
             //国际环境需要发邮件通知
-            if("eur".equals(env)){
-                commonService.sendEmail(sceneCode);
+            if("eur".equals(env) &&
+                    !scenePlus.getSceneSource().equals(SceneSource.JG.code()) &&
+                    !scenePlus.getSceneSource().equals(SceneSource.SG.code())){
+                commonService.sendEmail(sceneCode, "standar");
             }
 
+            wbService.sendMq(sceneCode, CommonSuccessStatus.SUCCESS.code());
+
             log.info("场景计算结果处理结束,场景码:{}", sceneCode);
 
         }catch (Exception e){
             log.error("场景计算结果处理出错,num"+sceneCode, e);
             buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
             throw e;
+        } finally {
+            Map<String, Object> sceneStatusParam = new HashMap<>();
+            sceneStatusParam.put("num", sceneCode);
+            sceneStatusParam.put("status", message.getBuildSuccess() ? 1 : -1);
+            commonService.sendUpdateSceneStatusMqToQueues(sceneStatusParam);
         }
     }
 
-    private void removeSceneAsynOperLog(String num){
-        List<SceneAsynOperLog> list = sceneAsynOperLogService.list(new LambdaQueryWrapper<SceneAsynOperLog>().eq(SceneAsynOperLog::getNum, num));
-        if(CollUtil.isEmpty(list)){
-            return;
-        }
-        //删除数据库记录
-        List<Long> deleteIdList = list.parallelStream().map(item -> item.getId()).collect(Collectors.toList());
-        sceneAsynOperLogService.removeByIds(deleteIdList);
-
-        list.parallelStream().forEach(item -> {
-            if(StrUtil.isNotEmpty(item.getUrl())){
-                try {
-                    fYunFileService.deleteFile(item.getUrl());
-                } catch (IOException e) {
-                    log.warn("删除oss全景图下载压缩包失败,key:{}", item.getUrl());
-                }
-            }
-        });
-    }
-
 //    private void cachePanorama(String dataSource, String num){
 //        String cachedImagesPath = String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
 //        //将全景图缓存到缓存目录
@@ -400,136 +424,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 //        });
 //    }
 
-    private Map<String, String> getUploadFiles(ScenePlus scenePlus,String path,Integer cameraType,JSONObject fdageData) throws Exception {
-        if (ObjectUtils.isEmpty(scenePlus)) {
-            throw new Exception("未找到场景信息:" + path);
-        }
-
-        String projectNum = scenePlus.getNum();
-
-        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, projectNum);
-        String imagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, projectNum);
-        String videoPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, projectNum);
-        String resultsPath = path + File.separator + "results" + File.separator;
-
-        String uploadData = FileUtils.readFile(resultsPath + "upload.json");
-        JSONArray array = JSONObject.parseObject(uploadData).getJSONArray("upload");
-
-        JSONObject fileJson = null;
-        String fileName = "";
-
-        Map<String, String> map = new HashMap();
-
-        for (int i = 0; i < array.size(); ++i) {
-            fileJson = array.getJSONObject(i);
-            fileName = fileJson.getString("file");
-            String filePath = resultsPath + fileName;
-
-            if (!(new File(filePath)).exists()) {
-                throw new Exception(filePath + "文件不存在");
-            }
-
-            if ("vision2.txt".equals(fileName)) {
-                CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision2.txt", resultsPath + "vision2.modeldata");
-                map.put(resultsPath + "vision2.modeldata", imagesPath + "vision2.modeldata");
-                map.put(resultsPath + "vision2.txt", imagesPath + "vision2.txt");
-            }
-
-            if (fileJson.getIntValue("clazz") == 2) {
-                map.put(filePath, imagesPath + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/" + fileName.replace("tex/", ""));
-            } else if (fileJson.getIntValue("clazz") == 3) {
-                map.put(filePath, imagesPath + "pan/high/" + fileName.replace("high/", ""));
-            } else if (fileJson.getIntValue("clazz") == 4) {
-                map.put(filePath, imagesPath + "pan/low/" + fileName.replace("low/", ""));
-            } else if (fileJson.getIntValue("clazz") == 5) {
-                map.put(filePath, imagesPath + fileName);
-            } else if (fileJson.getIntValue("clazz") == 7) {
-                map.put(filePath, imagesPath + fileName);
-            } else if (fileJson.getIntValue("clazz") == 10) {
-                String updown = FileUtils.readFile(filePath);
-                JSONObject updownJson = JSONObject.parseObject(updown);
-                String mappingOssPath = String.format("scene_edit_data/%s/data/", projectNum) + fileName.replace("updown", "mapping");
-                map.put(filePath, mappingOssPath);
-            } else {
-                if (fileJson.getIntValue("clazz") == 11 || fileJson.getIntValue("clazz") == 12) {
-                    map.put(filePath, videoPath + fileName.replace("videos/", ""));
-                    if (fileName.contains(".mp4")) {
-                        map.put(resultsPath + fileName.replace("mp4", "flv"), videoPath + fileName.replace("videos/", "").replace("mp4", "flv"));
-                    }
-                }
-
-                if (fileJson.getIntValue("clazz") == 16) {
-                    map.put(filePath, dataViewPath + fileName);
-                }
-
-                if (fileJson.getIntValue("clazz") == 18) {
-                    map.put(filePath, imagesPath + fileName);
-                }
-            }
-        }
-
-        //exportMeshObj这个是字段由app写入的
-        boolean genModel = true;//是否生成模型 默认生成,深时场景要根据 exportMeshObj判断是否生成
-        if(!ObjectUtils.isEmpty(cameraType)
-                && cameraType == 14
-                && (!fdageData.containsKey("exportMeshObj") || fdageData.getIntValue("exportMeshObj") != 1)){
-            genModel = false;
-        }
-        boolean gen3dTiles = true;//是否生成3dtiles模型 默认生成
-        if(!ModelKind.THREE_D_TILE.code().equals(modelKind)
-                || CollUtil.isEmpty(sdTilesSceneSourceList)
-                || !sdTilesSceneSourceList.contains(scenePlus.getSceneSource())){
-            gen3dTiles = false;
-        }
-
-        if(genModel){
-            if (!gen3dTiles) {
-                CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
-                CreateObjUtil.convertDamToLzma(path + File.separator + "results/");
-                CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
-                map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", imagesPath + ConstantFileName.modelUUID + "_50k.dam.lzma");
-                map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", imagesPath + ConstantFileName.modelUUID + "_50k.dam");
-            }else{
-                List<String> list = FileUtils.list(new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
-                if(CollUtil.isEmpty(list)){
-                    log.error("3dtiles目录异常,3dtiles地址:{}", new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
-                    throw new Exception("3dtiles目录异常");
-                }
-                list.stream().forEach(str->{
-                    map.put(str, str.replace(path + File.separator + "results" + File.separator, imagesPath));
-                });
-            }
-        }
-
-        CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision.txt", resultsPath + "vision.modeldata");
-        map.put(resultsPath + "vision.txt", imagesPath + "vision.txt");
-        map.put(resultsPath + "vision.modeldata", imagesPath + "vision.modeldata");
-
-        log.info("数据转换完成:" + projectNum);
-        if(!new File("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum).exists()){
-            FileUtil.mkdir("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum);
-        }
-//        map.put(resultsPath + "floorplan.json", dataViewPath + "floor.json");
-        map.put(resultsPath + "floorplan_cad.json", dataViewPath + "floorplan_cad.json");
-        map.put(path + File.separator + "capture/stitch_params.txt", dataViewPath + "stitch_params.txt");
-        map.put(path + File.separator + "capture/Up.xml", dataViewPath + "Up.xml");
-        map.put(path + File.separator + "capture/Up2.xml", dataViewPath + "Up2.xml");
-        map.put(path + File.separator + "capture/Up.txt", dataViewPath + "Up.txt");
-        map.put(path + File.separator + "capture/Up2.txt", dataViewPath + "Up2.txt");
-        return map;
-
-    }
 
-    private JSONObject getFdageData(String dataFdagePath) {
-        log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
-        String data = FileUtils.readFile(dataFdagePath);
-        //获取data.fdage的内容
-        JSONObject dataJson = new JSONObject();
-        if(data!=null){
-            dataJson = JSONObject.parseObject(data);
-        }
-        return dataJson;
-    }
 
     private void uploadFloorCad(String path, String num, Map<String, String> uploadFiles){
 
@@ -548,66 +443,19 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
     }
 
-    private void writeSceneJson(String num, JSONObject videosJson, SceneEditInfo sceneEditInfo, SceneEditInfoExt sceneEditInfoExt,
-                                SceneEditControls sceneEditControls, ScenePlus scenePlus, ScenePlusExt scenePlusExt,Company company){
+    private void uploadStatusJson(ScenePlus scenePlus, ScenePlusExt scenePlusExt){
+        String num = scenePlus.getNum();
         String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
 
-        SceneJsonBean sceneJson = new SceneJsonBean();
-        BeanUtil.copyProperties(sceneEditInfoExt, sceneJson);
-        BeanUtil.copyProperties(sceneEditInfo, sceneJson);
-        SceneEditControlsVO sceneEditControlsVO = BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class);
-        sceneJson.setControls(sceneEditControlsVO);
-        sceneJson.setNum(num);
-        sceneJson.setCreateTime(scenePlus.getCreateTime());
-        sceneJson.setSceneResolution(scenePlusExt.getSceneResolution());
-        sceneJson.setVersion(sceneEditInfo.getVersion());
-        sceneJson.setImgVersion(sceneEditInfo.getImgVersion());
-        sceneJson.setSceneFrom(scenePlusExt.getSceneFrom());
-        sceneJson.setSceneKind(scenePlusExt.getSceneKind());
-        sceneJson.setModelKind(scenePlusExt.getModelKind());
-        sceneJson.setVideos(JSON.toJSONString(videosJson));
-        sceneJson.setPayStatus(scenePlus.getPayStatus());
-
-        if(!ObjectUtils.isEmpty(company)){
-            String userViewPath = String.format(UploadFilePath.USER_VIEW_PATH, num);
-            String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
-            String localLogoPath = null;
-            if (StrUtil.isNotEmpty(company.getTopLogo())) {
-                localLogoPath = ConstantFilePath.AGENT_PATH + company.getTopLogo().substring(company.getTopLogo().lastIndexOf("//") + 1);
-                HttpUtil.downloadFile(company.getTopLogo(), localLogoPath);
-                fYunFileService.uploadFile(localLogoPath, userViewPath + "loadingLogo-user.png");
-                fYunFileService.uploadFile(localLogoPath, userEditPath + "loadingLogo-user.png");
-                sceneJson.setLoadingLogo("user");
-                sceneJson.setLoadingLogoFile("loadingLogo-user.png");
-                sceneEditInfo.setLoadingLogo("user");
-                sceneEditInfo.setLoadingLogoFile("loadingLogo-user.png");
-            }
-            if (StrUtil.isNotEmpty(company.getFloorLogo())) {
-                localLogoPath = ConstantFilePath.AGENT_PATH + company.getFloorLogo().substring(company.getFloorLogo().lastIndexOf("//") + 1);
-                HttpUtil.downloadFile(company.getFloorLogo(), localLogoPath);
-                fYunFileService.uploadFile(localLogoPath, userViewPath + "floorLogo-user.png");
-                fYunFileService.uploadFile(localLogoPath, userEditPath + "floorLogo-user.png");
-                sceneJson.setFloorLogo("user");
-                sceneJson.setFloorLogoFile("floorLogo-user.png");
-
-                sceneEditInfo.setFloorLogo("user");
-                sceneEditInfo.setFloorLogoFile("floorLogo-user.png");
-            }
-            if(!ObjectUtils.isEmpty(localLogoPath)){
-                sceneEditInfoService.updateById(sceneEditInfo);
-                FileUtils.deleteFile(localLogoPath);
-            }
+        Integer status = 1;
+        if(scenePlus.getSceneSource() == 4 || scenePlus.getSceneSource() == 5){//如果是激光场景,需要激光系统那边完全处理好之后再发mq通知更新状态
+            status = 0;
         }
-        String sceneJsonStr = JSON.toJSONString(sceneJson);
-        //上传sceneJson文件
-        fYunFileService.uploadFile(sceneJsonStr.getBytes(), dataViewPath + "scene.json");
-        //scenejson写入缓存
-        redisUtil.set(String.format(RedisKey.SCENE_JSON, num), sceneJsonStr);
 
         // 上传status JSON.
         JSONObject statusJson = new JSONObject();
         //临时将-2改成1,app还没完全更新
-        statusJson.put("status", 1);
+        statusJson.put("status", status);
         statusJson.put("webSite", scenePlusExt.getWebSite());
         statusJson.put("sceneNum", num);
         statusJson.put("thumb", scenePlusExt.getThumb());
@@ -615,9 +463,9 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         statusJson.put("sceneScheme", scenePlusExt.getSceneScheme());
         FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJson.toString());
 
-        fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json",
-                dataViewPath + "status.json");
-
+        Map<String,String> headers = new HashMap<>();
+        headers.put(HttpHeaders.CONTENT_TYPE, ContentType.JSON.getValue());
+        fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", dataViewPath + "status.json", headers);
     }
 
     private void createQrCode(String num, ScenePlusExt scenePlusExt, String qrLogo) {
@@ -635,9 +483,9 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +".png";
         String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +"_en.png";
         QrConfig qrConfig = QrConfig.create();
-        qrConfig.setWidth(512);
-        qrConfig.setHeight(512);
-        if(!ObjectUtils.isEmpty(localLogoPath)){
+        qrConfig.setWidth(1024);
+        qrConfig.setHeight(1024);
+        if(StrUtil.isNotEmpty(localLogoPath)){
             qrConfig.setImg(localLogoPath);
         }
         QrCodeUtil.generate(scenePlusExt.getWebSite(), qrConfig, FileUtil.file(outPathZh));
@@ -653,7 +501,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
     private void pushMsgToApp(Integer pushChannel, String pushToken, int cameraType, String sceneName, String webSite){
         log.info("推送消息,渠道是 {}, 手机token是 {}", pushChannel, pushToken);
-        if(Objects.isNull(pushChannel) && StrUtil.isBlank(pushToken)){
+        if(Objects.isNull(pushChannel) || StrUtil.isBlank(pushToken)){
             return;
         }
 
@@ -714,93 +562,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         }
     }
 
-    private JSONObject getVideosJson(String path, Integer videoVersion, String projectNum, int cameraType) throws Exception {
-        //读取videos_hdr_param.json, 保存点位视频的value
-        Map<String, Object> videoMap = new HashMap<>();
-        String videosHdr = FileUtils.readFile(path + File.separator + "results/videos/videos_hdr_param.json");
-        JSONArray videoArray = null;
-        if(StringUtils.isNotEmpty(videosHdr)){
-            videoArray = JSONObject.parseObject(videosHdr).getJSONArray("hdr_param");
-        }
-        if(videoArray != null){
-            for(int i = 0, len = videoArray.size(); i < len; i++) {
-                videoMap.put(videoArray.getJSONObject(i).getString("name"), videoArray.getJSONObject(i).getString("value"));
-                if(videoArray.getJSONObject(i).containsKey("fov")){
-                    videoMap.put(videoArray.getJSONObject(i).getString("name") + "_fov", videoArray.getJSONObject(i).getString("fov"));
-                }
-            }
-        }
-
-        //获取upload中的video视频名称
-        String uploadData = FileUtils.readFile(path + File.separator + "results" +File.separator+"upload.json");
-        JSONObject uploadJson = null;
-        JSONArray array = null;
-        if(uploadData!=null) {
-            uploadJson = JSONObject.parseObject(uploadData);
-            array = uploadJson.getJSONArray("upload");
-        }
-        JSONObject fileJson = null;
-        String fileName = "";
-
-        //计算ts文件的大小,并拼接成json格式
-        JSONArray jsonArray = new JSONArray();
-        JSONObject videoJson = null;
-        JSONObject videosJson = new JSONObject();
-        long videoSize = 0L;
-        for(int i = 0, len = array.size(); i < len; i++) {
-            fileJson = array.getJSONObject(i);
-            fileName = fileJson.getString("file");
-            if(fileJson.getIntValue("clazz") == 11 && fileName.contains(".mp4") && !fileName.contains("-ios.mp4")){
-                videoJson = new JSONObject();
-                videoJson.put("id", fileName.substring(
-                    0, fileName.lastIndexOf(".")).replace("videos/", ""));
-
-                //如果ts文件存在,就计算ts大小
-                if(new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).exists()){
-                    videoSize = new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).length();
-                    videoJson.put("tsSize", videoSize);
-                }
-                if(videoMap.containsKey(videoJson.get("id"))){
-                    videoJson.put("value", videoMap.get(videoJson.get("id")));
-                }
-                if(videoMap.containsKey(videoJson.get("id") + "_fov")){
-                    videoJson.put("blend_fov", videoMap.get(videoJson.get("id") + "_fov"));
-                }else {
-                    videoJson.put("blend_fov", 7);
-                }
-                jsonArray.add(videoJson);
-            }
-        }
-
-        videosJson.put("data", jsonArray);
-        if(Objects.nonNull(videoVersion) && videoVersion >= 4){
-            videosJson.put("version", 3);
-            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "Up.xml");
-            if(cameraType == 13){
-                //转台相机
-                videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
-            }
-        }else {
-            videosJson.put("version", 1);
-            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "Up2.xml");
-            if(cameraType == 13){
-                //转台相机
-                videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
-            }
-        }
-
-        if(cameraType == 5 || cameraType == 6){
-            videosJson.put("version", 1);
-            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "stitch_params.txt");
-        }
-
-        return videosJson;
-    }
-
-    private Long calUseSpace(Map<String, String> uploadFile) {
-        return uploadFile.keySet().stream().map(File::new).filter(File::exists).mapToLong(File::length).sum();
-    }
-
     private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
 
         scenePlusExt.setSpace(space);
@@ -830,92 +591,70 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
                 scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
                 scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
                 break;
+            case SG:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
+                break;
         }
 
         String sceneKind = scenePlusExt.getSceneScheme() == 3 ? SceneKind.FACE.code():SceneKind.TILES.code();
         scenePlusExt.setSceneKind(sceneKind);
 //        scenePlusExt.setModelKind(modelKind);
 
-        scenePlusExtService.updateById(scenePlusExt);
-    }
-
-    private int getPayStatus(Long cameraId, Long space){
-        //更新相机使用用量
-        CameraDetail cameraDetail = cameraDetailService.updateCameraDetailByCameraIdAndSpace(cameraId, space);
-        Long totalSpace = cameraDetail.getTotalSpace();
-
-        UserIncrement userIncrement = userIncrementService.getByCameraId(cameraId);
-        if(!ObjectUtils.isEmpty(userIncrement) && userIncrement.getIsExpired().equals(ExpiredStatus.NOT_EXPIRED.code())){
-            IncrementType type = incrementTypeService.getById(userIncrement.getIncrementTypeId());
-            if(type != null){
-                Integer cameraCapacity = type.getCameraCapacity();
-                if(cameraCapacity == -1){           //无限容量权益
-                    return PayStatus.PAY.code();
-                }else {
-                    totalSpace = cameraCapacity *1024 * 1024 * 1024L;     //权益设置容量
-                }
-            }
-        }
+        //统计点位数量
+        Map<String, Integer> result = this.getShootCount(scenePlusExt);
+        Integer shootCount = result.get("shootCount");
+        Integer mixture = result.get("mixture");
+        scenePlusExt.setShootCount(shootCount);
+        scenePlusExt.setMixture(mixture);
 
-        return totalSpace.compareTo(cameraDetail.getUsedSpace()) == -1 ? PayStatus.NO_CAPACITY.code() : PayStatus.PAY.code();
+        scenePlusExtService.updateById(scenePlusExt);
     }
 
-    private Object[] updateEditInfo(ScenePlus scenePlus){
-        SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
-        SceneEditControls sceneEditControls = null;
-        SceneEditInfoExt sceneEditInfoExt = null;
-        if(sceneEditInfo == null){
-            sceneEditInfo = new SceneEditInfo();
-            sceneEditInfo.setScenePlusId(scenePlus.getId());
-            sceneEditInfo.setDescription(scenePlus.getDescription());
-            sceneEditInfo.setTitle(scenePlus.getTitle());
-            sceneEditInfoService.save(sceneEditInfo);
-        }else{
+    private Map<String, Integer> getShootCount(ScenePlusExt scenePlusExt){
 
-            int version = 0;
-            int imgVersion = 0;
-            int linkVersion = 0;
-            //获取展示页的版本号
-            String sceneJsonStr = fYunFileService.getFileContent(String.format(UploadFilePath.DATA_VIEW_PATH, scenePlus.getNum()) + "scene.json");
-            if(StrUtil.isNotEmpty(sceneJsonStr)){
-                JSONObject sceneJson = JSON.parseObject(sceneJsonStr);
-                version = sceneJson.getIntValue("version");
-                imgVersion = sceneJson.getIntValue("imgVersion");
-                linkVersion =  sceneJson.getIntValue("linkVersion");
-            }
+        Map<String, Integer> result = new HashMap<>();
 
-            if(version < sceneEditInfo.getVersion()){
-                version = sceneEditInfo.getVersion();
+        Integer shootCount = 0;
+        Integer mixture = Objects.isNull(scenePlusExt.getMixture()) ? 0 : scenePlusExt.getMixture();
+        String homePath = SceneUtil.getHomePath(scenePlusExt.getDataSource());
+        JSONObject dataFdageObj = JSON.parseObject(fYunFileService.getFileContent(homePath.concat("data.fdage")));
+        if(Objects.nonNull(dataFdageObj)){
+            JSONArray points = dataFdageObj.getJSONArray("points");
+            if(CollUtil.isNotEmpty(points)){
+                shootCount = points.size();
             }
-            if(imgVersion < sceneEditInfo.getImgVersion()){
-                imgVersion = sceneEditInfo.getImgVersion();
+        }
+        if(Objects.nonNull(shootCount) && shootCount > 0){
+            if(Objects.nonNull(scenePlusExt.getLocation()) && scenePlusExt.getLocation() == 6){
+                mixture = CommonStatus.YES.code().intValue();
             }
-            if(linkVersion < sceneEditInfo.getLinkVersion()){
-                linkVersion = sceneEditInfo.getLinkVersion();
+        }else{
+            String slamDataStr = fYunFileService.getFileContent(homePath.concat("slam_data.json"));
+            JSONObject slamDataObj = JSON.parseObject(slamDataStr);
+            if(Objects.nonNull(slamDataObj)){
+                JSONArray viewsInfo = slamDataObj.getJSONArray("views_info");
+                if(CollUtil.isNotEmpty(viewsInfo)){
+                    shootCount = viewsInfo.stream().mapToInt(info -> {
+                        return  ((JSONObject) info).getJSONArray("list_pose").size();
+                    }).sum();
+                }
             }
-
-            sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
-            sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
-            sceneEditInfo.setVersion(version + 1);
-            sceneEditInfo.setImgVersion(imgVersion + 1);
-            sceneEditInfo.setLinkVersion(linkVersion + 1);
-            sceneEditInfo.setIsUploadObj(CommonStatus.NO.code());
-            sceneEditInfoService.updateById(sceneEditInfo);
-        }
-        if(sceneEditControls == null){
-            sceneEditControls = new SceneEditControls();
-            sceneEditControls.setEditInfoId(sceneEditInfo.getId());
-            sceneEditControlsService.save(sceneEditControls);
+            mixture = CommonStatus.NO.code().intValue();
         }
-        if(sceneEditInfoExt == null){
-            sceneEditInfoExt = new SceneEditInfoExt();
-            sceneEditInfoExt.setScenePlusId(scenePlus.getId());
-            sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
-            sceneEditInfoExtService.save(sceneEditInfoExt);
-        }
-        return new Object[]{sceneEditInfo, sceneEditInfoExt, sceneEditControls};
+
+        result.put("shootCount", shootCount);
+        result.put("mixture", mixture);
+
+        return result;
+    }
+
+    public static void main(String[] args) {
+        JSONObject dataFdageObj = JSON.parseObject(null);
+        System.out.println(dataFdageObj);
     }
 
+
     public boolean uploadHouseTypeJson(String num, String dataSource) {
         String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
         if (!new File(floorPlanCardFilePath).exists()) {

+ 74 - 52
src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java

@@ -1,25 +1,24 @@
 package com.fdkankan.contro.mq.service.impl;
 
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.exceptions.ExceptionUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.file.FileNameUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.ZipUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import cn.hutool.extra.qrcode.QrConfig;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.fdkankan.common.constant.CommonOperStatus;
-import com.fdkankan.common.constant.ExpiredStatus;
-import com.fdkankan.common.constant.ModelKind;
 import com.fdkankan.common.constant.PayStatus;
+import com.fdkankan.common.constant.SceneScheme;
 import com.fdkankan.common.constant.SceneStatus;
+import com.fdkankan.common.constant.SceneVersionType;
 import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.bean.SyncLaserResultBean;
 import com.fdkankan.contro.entity.*;
 import com.fdkankan.contro.mq.service.IBuildSceneService;
-import com.fdkankan.contro.mq.service.ICommonService;
+import com.fdkankan.contro.service.ICommonService;
 import com.fdkankan.contro.service.*;
 import com.fdkankan.contro.service.impl.FdkkV4Service;
 import com.fdkankan.fyun.config.FYunFileConfig;
@@ -27,8 +26,8 @@ import com.fdkankan.fyun.constant.FYunTypeEnum;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.model.constants.ConstantFileName;
 import com.fdkankan.model.constants.ConstantFilePath;
-import com.fdkankan.model.constants.SceneBuildProcessType;
 import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.model.enums.ModelTypeEnums;
 import com.fdkankan.model.utils.CreateHouseJsonUtil;
 import com.fdkankan.model.utils.CreateObjUtil;
 import com.fdkankan.push.config.PushMessageConfig;
@@ -41,13 +40,11 @@ import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
 import org.springframework.stereotype.Service;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.*;
-import java.util.Map.Entry;
-import java.util.stream.Collectors;
 
 
 /**
@@ -60,6 +57,7 @@ import java.util.stream.Collectors;
  **/
 @Slf4j
 @Service
+@RefreshScope
 public class BuildV3SceneServiceImpl implements IBuildSceneService {
 
     @Value("${queue.modeling.modeling-call}")
@@ -112,9 +110,14 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
     @Autowired
     private ISceneProEditService sceneProEditService;
 
+    @Autowired
+    private ISceneColdStorageService sceneColdStorageService;
+
+    @Autowired
+    private ICompanyService companyService;
+
     @Override
     public void buildScenePre(BuildSceneCallMessage message) {
-        boolean success = false;
         String num = message.getSceneNum();
         try {
 
@@ -122,6 +125,13 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
             if(new File(message.getPath() + File.separator + "results").exists()){
                 FileUtils.deleteDirectory(message.getPath() + File.separator + "results");
             }
+            //由于刘强说caches会影响计算结果,所以这里删除caches
+            if(new File(message.getPath() + File.separator + "caches").exists()){
+                FileUtils.deleteDirectory(message.getPath() + File.separator + "caches");
+            }
+
+            //用户相机重新全量上传,需要解冻结
+            sceneColdStorageService.unfreeze(num, "用户相机重新全量上传", message.getPath());
 
             //根据相机类型,组装资源路径
             //下载资源到本地
@@ -152,10 +162,7 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
 
             message.setResultReceiverMqName(queueV3ModelingPost);
 
-            //发送mq,就进行计算
-            mqProducer.sendByWorkQueue(queueModelingCall, message);
-
-            success = true;
+            message.setBizType("standard");
 
             log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
 
@@ -231,13 +238,11 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
 
             scenePro.setPayStatus(PayStatus.PAY.code());
             //如果相机容量不足,需要把场景的paystatus改为容量不足状态
-            if (cameraType != 14) {
-                scenePro.setPayStatus(this.getPayStatus(scenePro.getCameraId(), space));
-                sceneProService.update(
-                        new LambdaUpdateWrapper<ScenePro>()
-                                .set(ScenePro::getPayStatus, scenePro.getPayStatus())
-                                .eq(ScenePro::getId, scenePro.getId()));
-            }
+            scenePro.setPayStatus(commonService.getPayStatus(scenePro.getCameraId(), space));
+            sceneProService.update(
+                    new LambdaUpdateWrapper<ScenePro>()
+                            .set(ScenePro::getPayStatus, scenePro.getPayStatus())
+                            .eq(ScenePro::getId, scenePro.getId()));
 
             //上传文件
             log.info("开始上传场景计算结果数据,num:{}", sceneCode);
@@ -262,7 +267,8 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
             uploadFiles.entrySet().stream().filter(entry-> FileNameUtil.getName(entry.getKey()).equals("floorplan_cad.json"))
                     .forEach(entry-> uploadHouseTypeJson(sceneCode,entry.getKey()));
 
-
+            //生成二维码
+            this.createQrcode(sceneCode);
 
             //计算成功,通知APP
             Integer pushChannel = fdageData.getInteger("pushChannel");
@@ -276,10 +282,16 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
             sceneProEdit.setFloorPublishVer(ObjectUtils.isEmpty(sceneProEdit.getFloorPublishVer()) ? 0 : sceneProEdit.getFloorPublishVer() + 1);
             if (cameraType == 14) {
                 //计算成功  激光转台相机 同步 请求
-                fdkkLaserService.syncBuildResult(scenePro.getNum(), scenePro.getDataSource(),scenePro.getCreateTime());
+                fdkkLaserService.syncBuildResult(
+                        SyncLaserResultBean.builder()
+                        .num(sceneCode).dataSource(path)
+                        .sceneStatus(2)
+                        .createTime(scenePro.getCreateTime())
+                        .shootCount(scenePro.getShootCount())
+                        .payStatus(scenePro.getPayStatus())
+                        .mixture(0)
+                        .version(SceneVersionType.V3.code()).build());
                 sceneProEdit.setMapVisi(0);
-            }else if (new File(path + "/results/laserData/vision_edit.txt").exists()) {
-                fdkkLaserService.cloudPointBuild(sceneCode,path);
             }
             sceneProEditService.updateById(sceneProEdit);
 
@@ -287,7 +299,7 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
             log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
             this.writeSceneJson(videosJson,scenePro,sceneProEdit);
 
-            CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/") + "/capture");
+//            CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/") + "/capture");
             log.info("场景计算结果处理结束,场景码:{}", sceneCode);
             // 判断是否升级V4
 //            if(fdageData.containsKey("updateV4") && fdageData.getIntValue("updateV4") == 1){
@@ -296,7 +308,7 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
 
             //国际环境需要发邮件通知
             if("eur".equals(env)){
-                commonService.sendEmail(sceneCode);
+                commonService.sendEmail(sceneCode, "standar");
             }
 
         }catch (Exception e){
@@ -306,6 +318,32 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
         }
     }
 
+    private void createQrcode(String num){
+        ScenePro scenePro = sceneProService.getByNum(num);
+        String logoPath = null;
+        if(Objects.nonNull(scenePro.getCameraId())){
+            CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePro.getId());
+            if(Objects.nonNull(cameraDetail) && Objects.nonNull(cameraDetail.getCompanyId())){
+                Company company = companyService.getById(cameraDetail.getCompanyId());
+                if(Objects.nonNull(company) && StrUtil.isNotEmpty(company.getQrLogo())){
+                    logoPath =  ConstantFilePath.BASE_PATH + File.separator + company.getQrLogo();
+                }
+            }
+        }
+
+        //生成二维码
+        String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +".png";
+        String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+ num +"_en.png";
+        QrConfig qrConfig = QrConfig.create();
+        qrConfig.setWidth(1024);
+        qrConfig.setHeight(1024);
+        if(StrUtil.isNotEmpty(logoPath)){
+            qrConfig.setImg(logoPath);
+        }
+        QrCodeUtil.generate(scenePro.getWebSite(), qrConfig, FileUtil.file(outPathZh));
+        QrCodeUtil.generate(scenePro.getWebSite() + "&lang=en", qrConfig, FileUtil.file(outPathEn));
+    }
+
     private void copyFiles(String path, String num) {
         if (new File(path + File.separator + "results" + File.separator + "floor.json").exists()) {
             FileUtils.copyFile(path + File.separator + "results" + File.separator + "floor.json", ConstantFilePath.SCENE_PATH + "data" + File.separator + "data" + num + File.separator + "floor.json", true);
@@ -448,7 +486,7 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
 
     private void pushMsgToApp(Integer pushChannel, String pushToken, int cameraType, String sceneName, String webSite){
         log.info("推送消息,渠道是 {}, 手机token是 {}", pushChannel, pushToken);
-        if(Objects.isNull(pushChannel) && StrUtil.isBlank(pushToken)){
+        if(Objects.isNull(pushChannel) || StrUtil.isBlank(pushToken)){
             return;
         }
 
@@ -579,7 +617,7 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
     }
 
     private ScenePro updateDbPlus(String num, Long space, String videosJson, Long computeTime,boolean isObj){
-        sceneProService.update(new LambdaUpdateWrapper<ScenePro>()
+        LambdaUpdateWrapper<ScenePro> wrapper = new LambdaUpdateWrapper<ScenePro>()
                 .eq(ScenePro::getNum, num)
                 .set(ScenePro::getStatus, SceneStatus.NO_DISPLAY.code())
                 .set(ScenePro::getUpdateTime, new Date())
@@ -588,29 +626,13 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
                 .set(ScenePro::getComputeTime, computeTime)
                 .set(ScenePro::getVideos, videosJson)
                 .set(ScenePro::getIsObj, isObj ? 1 : 0)
-                .set(ScenePro::getPayStatus, PayStatus.PAY.code()));
-       return sceneProService.getByNum(num);
-    }
+                .set(ScenePro::getPayStatus, PayStatus.PAY.code());
 
-    private int getPayStatus(Long cameraId, Long space) throws Exception{
-        //更新相机使用用量
-        CameraDetail cameraDetail = cameraDetailService.updateCameraDetailByCameraIdAndSpace(cameraId, space);
-        Long totalSpace = cameraDetail.getTotalSpace();
-
-        UserIncrement userIncrement = userIncrementService.getByCameraId(cameraId);
-        if(!ObjectUtils.isEmpty(userIncrement) && userIncrement.getIsExpired().equals(ExpiredStatus.NOT_EXPIRED.code())){
-            IncrementType type = incrementTypeService.getById(userIncrement.getIncrementTypeId());
-            if(type != null){
-                Integer cameraCapacity = type.getCameraCapacity();
-                if(cameraCapacity == -1){           //无限容量权益
-                    return PayStatus.PAY.code();
-                }else {
-                    totalSpace = cameraCapacity *1024 * 1024 * 1024L;     //权益设置容量
-                }
-            }
+        if(ModelTypeEnums.TILE_CODE.equals(modelSceneKind)){
+            wrapper.set(ScenePro::getSceneScheme, SceneScheme.LM.code());
         }
-
-        return totalSpace.compareTo(cameraDetail.getUsedSpace()) == -1 ? PayStatus.NO_CAPACITY.code() : PayStatus.PAY.code();
+        sceneProService.update(wrapper);
+       return sceneProService.getByNum(num);
     }
 
     public void uploadHouseTypeJson(String num, String floorPlanCardFilePath) {

+ 0 - 228
src/main/java/com/fdkankan/contro/mq/service/impl/CommonServiceImpl.java

@@ -1,228 +0,0 @@
-package com.fdkankan.contro.mq.service.impl;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.io.FileUtil;
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.fdkankan.common.util.FileUtils;
-import com.fdkankan.contro.entity.*;
-import com.fdkankan.contro.factory.UserEditData.UserEditDataHandler;
-import com.fdkankan.contro.factory.UserEditData.UserEditDataHandlerFactory;
-import com.fdkankan.contro.mq.service.ICommonService;
-import com.fdkankan.contro.service.*;
-import com.fdkankan.fyun.face.FYunFileServiceInterface;
-import com.fdkankan.model.constants.UploadFilePath;
-import com.fdkankan.model.utils.FloorPlanUserUtil;
-import com.fdkankan.sms.SendMailAcceUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.cloud.context.config.annotation.RefreshScope;
-import org.springframework.stereotype.Service;
-
-import java.io.File;
-import java.util.*;
-
-@Slf4j
-@Service
-@RefreshScope
-public class CommonServiceImpl implements ICommonService {
-
-    @Value("${main.url}")
-    private String mainUrl;
-
-    @Value("${env:gn}")
-    private String env;
-
-    @Value("${helpLink.zh-cn:https://docs.4dkankan.com/#/product/4dkk/zh-cn/README}")
-    private String helpLinkZh;
-
-    @Value("${helpLink.en-us:https://docs.4dkankan.com/#/product/4dkk/en-us/README}")
-    private String helpLinkEn;
-
-
-    @Autowired
-    private FYunFileServiceInterface fYunFileServiceInterface;
-    @Autowired
-    private IScenePlusService scenePlusService;
-    @Autowired
-    private IScenePlusExtService scenePlusExtService;
-    @Autowired
-    private IMailTemplateService mailTemplateService;
-    @Autowired
-    private IUserService userService;
-    @Autowired
-    private ISceneProService sceneProService;
-
-
-    @Override
-    public void uploadBuildResultData(String num, String dataSource, String version) {
-
-        Map<String, String> uploadMap = new HashMap<>();
-
-        String ossResultPath = String.format(UploadFilePath.scene_result_data_path, num);
-
-        //删除旧的文件目录
-        fYunFileServiceInterface.deleteFolder(ossResultPath);
-
-        //上传caches/images
-        String localCachesImagePath = dataSource + "/caches/images/";
-        String ossCachesImagePath = ossResultPath + "caches/images/";
-        //先清除旧的全景图
-        if(FileUtil.exist(localCachesImagePath)){
-            fYunFileServiceInterface.uploadFileByCommand(localCachesImagePath, ossCachesImagePath);
-        }
-
-        //上传project.json
-        String localProjectJsonPath = dataSource + "/project.json";
-        String ossProjectJsonPath = ossResultPath + "project.json";
-        if(FileUtil.exist(localProjectJsonPath)){
-            uploadMap.put(localProjectJsonPath, ossProjectJsonPath);
-        }
-
-        //上传data.json
-        String localDataJsonPath = dataSource + "/data.json";
-        String ossDataJsonPath = ossResultPath + "data.json";
-        if(FileUtil.exist(localDataJsonPath)){
-            uploadMap.put(localDataJsonPath, ossDataJsonPath);
-        }
-
-        //户型图上传
-        String floorplanCadPath = ossResultPath + "floorplan_cad";
-        String cadPicPathFormat = floorplanCadPath + "/floor-cad-%s.%s";
-        String floorCadPath = dataSource + "/results/floorplan_cad";
-        //清除原有旧的cad图
-        fYunFileServiceInterface.deleteFolder(floorplanCadPath);
-        List<String> floorCadList = FileUtils.getFileList(floorCadPath);
-        if(CollUtil.isNotEmpty(floorCadList)){
-            floorCadList.stream().forEach(str->{
-                String substring = str.substring(str.lastIndexOf(File.separator) + 1);
-                String[] arr = substring.split("floor");
-                String[] arr2 = arr[1].split("\\.");
-                //上传到用户编辑目录
-                uploadMap.put(str, String.format(cadPicPathFormat, arr2[0], arr2[1]));
-            });
-        }
-
-        //上传深时场景生成obj需要的文件
-        String localReconstruction = dataSource + "/caches/reconstruction/";
-        String ossReconstruction = ossResultPath + "caches/reconstruction/";
-        if(FileUtil.exist(localReconstruction)){
-            fYunFileServiceInterface.uploadFileByCommand(localReconstruction, ossReconstruction);
-        }
-        String localDepthmap = dataSource + "/caches/depthmap/";
-        String ossDepthmap = ossResultPath + "caches/depthmap/";
-        if(FileUtil.exist(localDepthmap)){
-            fYunFileServiceInterface.uploadFileByCommand(localDepthmap, ossDepthmap);
-        }
-        String localDepthmapAsc = dataSource + "/caches/depthmap_csc/";
-        String ossDepthmapAsc = ossResultPath + "caches/depthmap_csc/";
-        if(FileUtil.exist(localDepthmapAsc)){
-            fYunFileServiceInterface.uploadFileByCommand(localDepthmapAsc, ossDepthmapAsc);
-        }
-        String localPanoramaJson =  dataSource + "/caches/panorama.json";
-        String ossPanoramaJson =  ossResultPath + "caches/panorama.json";
-        if(FileUtil.exist(localPanoramaJson)){
-            fYunFileServiceInterface.uploadFile(localPanoramaJson, ossPanoramaJson);
-        }
-        String localLaserPly = dataSource + "/results/laserData/laser.ply";
-        String ossLaserPly =  ossResultPath + "results/laserData/laser.ply";
-        if(FileUtil.exist(localLaserPly)){
-            fYunFileServiceInterface.uploadFile(localLaserPly, ossLaserPly);
-        }
-        String localFloorGroupFixJson = dataSource + "/caches/floor_group_fix.json";
-        String ossFloorGroupFixJson = ossResultPath + "caches/floor_group_fix.json";
-        if(FileUtil.exist(localFloorGroupFixJson)){
-            fYunFileServiceInterface.uploadFile(localFloorGroupFixJson, ossFloorGroupFixJson);
-        }
-
-        String localDepthmapVis = dataSource + "/caches/depthmap_vis";
-        String ossDepthmapVis = ossResultPath + "caches/depthmap_vis";
-        if(FileUtil.exist(localDepthmapVis)){
-            fYunFileServiceInterface.uploadFileByCommand(localDepthmapVis, ossDepthmapVis);
-        }
-
-        String localIntensity = dataSource + "/caches/intensity";
-        String ossIntensity = ossResultPath + "caches/intensity";
-        if(FileUtil.exist(localIntensity)){
-            fYunFileServiceInterface.uploadFileByCommand(localIntensity, ossIntensity);
-        }
-
-        //开始上传
-        fYunFileServiceInterface.uploadMulFiles(uploadMap);
-    }
-
-    @Override
-    public void initUserEditData(String num, Set<String> bizs, Map<String, Map<String ,Object>> params) {
-        if(StrUtil.isEmpty(num) || CollUtil.isEmpty(bizs)){
-            return;
-        }
-        for (String biz : bizs) {
-            UserEditDataHandler handler = UserEditDataHandlerFactory.getHandler(biz);
-            handler.init(num, CollUtil.isEmpty(params) ? null : params.get(biz));
-        }
-    }
-
-    @Override
-    public void uploadFloorplanJson(String num, String dataSource) throws Exception{
-        String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
-        if (!new File(floorPlanCardFilePath).exists()) {
-            log.warn("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
-            return;
-        }
-        JSONObject json = FloorPlanUserUtil.createFloorPlanUserJson(floorPlanCardFilePath);
-        if(Objects.isNull(json)){
-            log.error("生成floorplan.json失败,cadPath:", floorPlanCardFilePath);
-            throw new Exception("生成floorplan.json失败,cadPath:" + floorPlanCardFilePath);
-        }
-        String hourseTypeJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "floorplan.json";
-        fYunFileServiceInterface.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
-    }
-
-    @Override
-    public void sendEmail(String num) {
-        try {
-            Long userId = null;
-            String websize = "";
-            String title = "";
-            ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
-            if(Objects.isNull(scenePlus)){
-                ScenePro scenePro = sceneProService.getByNum(num);
-                if(Objects.isNull(scenePro)){
-                    return;
-                }
-                userId = scenePro.getUserId();
-                websize = scenePro.getWebSite();
-                title = scenePro.getSceneName();
-            }else{
-                userId = scenePlus.getUserId();
-                ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
-                websize = scenePlusExt.getWebSite();
-                title = scenePlus.getTitle();
-            }
-
-            if(Objects.isNull(userId)){
-                return;
-            }
-            User user = userService.getById(userId);
-            if(Objects.isNull(user) || StrUtil.isEmpty(user.getUserName())){
-                return;
-            }
-            String toEmail = user.getUserName();
-            String helpLink = helpLinkEn;
-            String lang = "en";
-            if("gn".equals(env)){
-                lang = "zh";
-                helpLink = helpLinkZh;
-            }
-            websize += "&lang=" + lang;
-
-            MailTemplate mailTemplate = mailTemplateService.getOne(new LambdaQueryWrapper<MailTemplate>().eq(MailTemplate::getRemark, "计算完成").eq(MailTemplate::getLang, lang));
-            String content = mailTemplate.getMsg().replaceAll("scene_name", title).replaceAll("scene_link", websize).replaceAll("help_link", helpLink);
-            SendMailAcceUtils.sendMail(mailTemplate.getSendMail(), mailTemplate.getSendPassword(), mailTemplate.getSendHost(), toEmail, mailTemplate.getSubject(), content, null);
-        }catch (Exception e){
-            log.error("发送邮件失败,num:" + num, e);
-        }
-    }
-}

+ 0 - 27
src/main/java/com/fdkankan/contro/schedule/ScheduleJob.java

@@ -13,37 +13,10 @@ import org.springframework.stereotype.Component;
 @Component
 public class ScheduleJob {
 
-    @Value("${rocketmq.autoScaling.num.normal}")
-    private String baseNum;
-
-    @Autowired
-    private RabbitMqProducer rabbitMqProducer;
-
-    @Autowired
-    private ScalingService scalingService;
-
-    @Value("${queue.modeling.modeling-call}")
-    private String queueModelingCall;
     @Autowired
     private IScene3dNumService scene3dNumService;
 
 
-    @Scheduled(cron = "${rocketmq.autoScaling.corn:0 0/5 8-21 * * ?}")
-    public void job8() {
-        try {
-            //当mq排队数大于指定数量时使用弹性升缩
-            int mqNum = rabbitMqProducer.getMessageCount(queueModelingCall);
-            log.info("每5分钟查询一次排队队列,mqNum:" + mqNum);
-            if(mqNum - Integer.parseInt(baseNum) > 0){
-                log.info("使用弹性升缩开启一台ECS");
-                log.info(scalingService.createEcs());
-            }
-        } catch (Exception e) {
-            log.error("弹性升缩开启失败!", e);
-            log.error(e.getMessage());
-        }
-    }
-
     /**
      * 定时生成场景码,间隔1小时执行一次,项目启动一秒后执行一次
      */

+ 23 - 0
src/main/java/com/fdkankan/contro/service/IAppCameraFailLogService.java

@@ -0,0 +1,23 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.AppCameraFailLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.contro.vo.ReportFailLogVO;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import javax.validation.Valid;
+
+/**
+ * <p>
+ * app错误上报 服务类
+ * </p>
+ *
+ * @author
+ * @since 2024-05-20
+ */
+public interface IAppCameraFailLogService extends IService<AppCameraFailLog> {
+
+    void reportFailLog(ReportFailLogVO param);
+
+
+}

+ 2 - 0
src/main/java/com/fdkankan/contro/service/IBuildSceneDTService.java

@@ -12,6 +12,8 @@ public interface IBuildSceneDTService {
 
     void handModelFail(String reason, String serverPath, String num, String hostName);
 
+    void handModelFail(String reason, String serverPath, String num, String hostName, String logUrl);
+
     void handBaseFail(String reason, String serverPath, String num, String hostName);
 
 }

+ 1 - 1
src/main/java/com/fdkankan/contro/service/ICameraDetailService.java

@@ -17,6 +17,6 @@ public interface ICameraDetailService extends IService<CameraDetail> {
 
     CameraDetail getByCameraId(Long valueOf);
 
-    CameraDetail updateCameraDetailByCameraIdAndSpace(Long cameraId, Long space);
+    void updateCameraDetailByCameraIdAndSpace(Long cameraId, Long space);
 
 }

+ 2 - 0
src/main/java/com/fdkankan/contro/service/ICameraService.java

@@ -16,4 +16,6 @@ public interface ICameraService extends IService<Camera> {
     Camera getByChildName(String childName);
 
     Camera getBySnCode(String snCode);
+
+    Long getUsedSpace(Long cameraId, String spaceTypeStr);
 }

+ 18 - 0
src/main/java/com/fdkankan/contro/service/ICameraTypeService.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.CameraType;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2023-04-11
+ */
+public interface ICameraTypeService extends IService<CameraType> {
+
+    CameraType getByCamType(int camType);
+
+}

+ 61 - 0
src/main/java/com/fdkankan/contro/service/ICommonService.java

@@ -0,0 +1,61 @@
+package com.fdkankan.contro.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.contro.entity.*;
+import com.fdkankan.contro.vo.ScenePlusVO;
+import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
+
+import java.util.Map;
+import java.util.Set;
+
+public interface ICommonService {
+
+    /**
+     * 上传计算结果文件
+     * @param num
+     * @param dataSource
+     * @param version
+     */
+    public void uploadBuildResultData(String num, String dataSource, String version);
+
+    /**
+     * 删除用户编辑数据业务方法
+     * @param num 场景码
+     * @param bizs 业务集合
+     * @param params 业务处理所需参数
+     *               key : bizType
+     *               value: Map<String ,Object> 参数map
+     */
+    public void initUserEditData(String num, Set<String> bizs, Map<String, Map<String ,Object>> params) throws Exception;
+
+    public void uploadFloorplanJson(String num, String dataSource) throws Exception;
+
+    public void sendEmail(String num, String type);
+
+    String getOssOrignPath(String path);
+
+    int getPayStatus(Long cameraId, Long space);
+
+    void uploadStatusJson(String num, Integer sceneStatus, String webSite, String thumb, Integer payStatus, String uploadPath);
+
+    Long getSpaceLimit(CameraDetail cameraDetail);
+
+    Long getSpace(String num);
+
+    Object[] updateEditInfo(ScenePlus scenePlus);
+
+    void writeSceneJson(String num, SceneEditInfo sceneEditInfo, SceneEditInfoExt sceneEditInfoExt,
+                        SceneEditControls sceneEditControls, ScenePlus scenePlus, ScenePlusExt scenePlusExt, Company company);
+
+    void saveMqSendLog(String num, BuildSceneCallMessage message);
+
+    void sendUpdateSceneStatusMqToQueues(Map<String, Object> content);
+
+    void removeSceneAsynOperLog(String num);
+
+    JSONObject getVideosJson(String path, Integer videoVersion, String projectNum, int cameraType);
+
+    JSONObject getFdageData(String path);
+
+    Map<String, String> getUploadFiles(ScenePlus scenePlus,String path,Integer cameraType,JSONObject fdageData) throws Exception;
+}

+ 29 - 0
src/main/java/com/fdkankan/contro/service/IExceedSpaceSceneService.java

@@ -0,0 +1,29 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.CameraDetail;
+import com.fdkankan.contro.entity.ExceedSpaceScene;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.io.IOException;
+
+/**
+ * <p>
+ * 超出容量场景码表 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2023-06-29
+ */
+public interface IExceedSpaceSceneService extends IService<ExceedSpaceScene> {
+
+    boolean cehckExceedSpace(String num, CameraDetail cameraDetail, String snCode, String fileId, String unicode);
+
+    boolean isExceedSpace(String num, CameraDetail cameraDetail);
+
+    ExceedSpaceScene getByFileIdAndUnicode(long cameraId, String fileId, String unicode);
+
+    void repeal(long cameraId, String fileId, String unicode) throws IOException;
+
+
+
+}

+ 5 - 3
src/main/java/com/fdkankan/contro/service/IFdkkLaserService.java

@@ -1,5 +1,7 @@
 package com.fdkankan.contro.service;
 
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.contro.bean.SyncLaserResultBean;
 import com.fdkankan.contro.entity.Camera;
 import com.fdkankan.contro.entity.ScenePlus;
 import com.fdkankan.contro.entity.ScenePlusExt;
@@ -16,13 +18,13 @@ import java.util.Date;
  * @since 2022/1/14
  **/
 public interface IFdkkLaserService {
-    void syncBuildResult(String sceneNum, String dataSource, Date createTime);
+    void syncBuildResult(SyncLaserResultBean laserResultBean);
 
     void pushBuildStatusToLaserSystem(String projectNum, String laserObjFilePath, Integer buildObjStatus);
 
-    void saveScene(ScenePlus scenePlus, String scenePassword, Camera cameraEntity, String userName, boolean b);
+    void saveScene(ScenePlus scenePlus, JSONObject jsonObject, Camera cameraEntity, String userName, boolean b, Integer payStatus);
 
-    void saveScene(ScenePro scenePro, String scenePassword, Camera cameraEntity, String phone, boolean rebuild);
+    void saveScene(ScenePro scenePro, String scenePassword, Camera cameraEntity, String phone, boolean rebuild, Integer payStatus);
 
     void cloudPointBuild(String sceneCode, String visionEditFilePath);
 }

+ 7 - 0
src/main/java/com/fdkankan/contro/service/IInnerService.java

@@ -0,0 +1,7 @@
+package com.fdkankan.contro.service;
+
+public interface IInnerService {
+
+    void uploadArtificialResult(String num) throws Exception;
+
+}

+ 16 - 0
src/main/java/com/fdkankan/contro/service/IMqSendLogService.java

@@ -0,0 +1,16 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.MqSendLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-03-27
+ */
+public interface IMqSendLogService extends IService<MqSendLog> {
+
+}

+ 3 - 3
src/main/java/com/fdkankan/contro/service/ISceneBuildProcessLogService.java

@@ -8,13 +8,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * 场景计算流程状态表 服务类
  * </p>
  *
- * @author 
+ * @author
  * @since 2023-01-28
  */
 public interface ISceneBuildProcessLogService extends IService<SceneBuildProcessLog> {
 
-    public void clearSceneBuildProcessLog(String num, String process, String queueName);
+    public void clearSceneBuildProcessLog(String num, String process, String queueName, String bizType);
 
-    public void saveSceneBuildProcessLog(String num, String process, String queueName, int status, String reason);
+    public void saveSceneBuildProcessLog(String num, String process, String queueName, int status, String reason, String bizType);
 
 }

+ 21 - 0
src/main/java/com/fdkankan/contro/service/ISceneCleanOrigService.java

@@ -0,0 +1,21 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.SceneCleanOrig;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ * 删除oss原始资源记录 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2023-04-17
+ */
+public interface ISceneCleanOrigService extends IService<SceneCleanOrig> {
+
+    List<SceneCleanOrig> lisByNumAfterLastCall(String num, Date lastCallTime);
+
+}

+ 22 - 0
src/main/java/com/fdkankan/contro/service/ISceneColdStorageLogService.java

@@ -0,0 +1,22 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.SceneCleanOrig;
+import com.fdkankan.contro.entity.SceneColdStorageLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ * 场景冷归档日志表 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2023-07-14
+ */
+public interface ISceneColdStorageLogService extends IService<SceneColdStorageLog> {
+
+    List<SceneColdStorageLog> listFreezeByNumAfterLastCall(String num, Date lastCallTime);
+
+}

+ 20 - 0
src/main/java/com/fdkankan/contro/service/ISceneColdStorageService.java

@@ -0,0 +1,20 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.SceneColdStorage;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 场景封存状态表 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2023-07-25
+ */
+public interface ISceneColdStorageService extends IService<SceneColdStorage> {
+
+    void unfreeze(String num, String reason, String dataSource);
+
+    SceneColdStorage getByNum(String num);
+
+}

+ 22 - 0
src/main/java/com/fdkankan/contro/service/ISceneCopyLogService.java

@@ -0,0 +1,22 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.SceneCopyLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2023-04-17
+ */
+public interface ISceneCopyLogService extends IService<SceneCopyLog> {
+
+    List<SceneCopyLog> listByNewNum(String newNum);
+
+    void checkCanBuild(String num);
+
+}

+ 3 - 1
src/main/java/com/fdkankan/contro/service/ISceneFileBuildService.java

@@ -25,7 +25,9 @@ public interface ISceneFileBuildService extends IService<SceneFileBuild> {
 
     ResultData turntableUploadSuccess(String params) throws Exception;
 
-    ResultData rebuildScene(String num,Boolean force,Boolean deleteExtras) throws IOException;
+    ResultData rebuildScene(String num,Boolean force,Boolean deleteExtras, String from) throws IOException;
 
     ResultData copyDataAndBuild(String sourceBucet,String dataSource,String sceneVer) throws Exception;
+
+    ResultData uploadLiguang(String num, String snCode, String ossPath) throws Exception;
 }

+ 21 - 0
src/main/java/com/fdkankan/contro/service/ISceneInfoSyncMqConfigService.java

@@ -0,0 +1,21 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.SceneInfoSyncMqConfig;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 场景信息变更需要发送mq信息队列配置表 服务类
+ * </p>
+ *
+ * @author
+ * @since 2024-04-16
+ */
+public interface ISceneInfoSyncMqConfigService extends IService<SceneInfoSyncMqConfig> {
+
+    List<SceneInfoSyncMqConfig> listByInfoType(String infoType);
+
+
+}

+ 3 - 0
src/main/java/com/fdkankan/contro/service/IScenePlusExtService.java

@@ -3,6 +3,8 @@ package com.fdkankan.contro.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fdkankan.contro.entity.ScenePlusExt;
 
+import java.util.List;
+
 /**
  * <p>
  *  服务类
@@ -16,4 +18,5 @@ public interface IScenePlusExtService extends IService<ScenePlusExt> {
     ScenePlusExt getScenePlusExtByPlusId(long plusId);
 
     ScenePlusExt getScenePlusExtByPath(String path);
+
 }

+ 1 - 0
src/main/java/com/fdkankan/contro/service/IScenePlusService.java

@@ -23,4 +23,5 @@ public interface IScenePlusService extends IService<ScenePlus> {
 
     ScenePlus getByFileId(String fileId);
 
+    Long sumUsedSpaceByCameraId(Long cameraId, String spaceTypeStr);
 }

+ 4 - 0
src/main/java/com/fdkankan/contro/service/ISceneProService.java

@@ -15,4 +15,8 @@ public interface ISceneProService extends IService<ScenePro> {
 
     ScenePro getByNum(String num);
 
+    Long sumUsedSpaceByCameraId(Long cameraId, String spaceTypeStr);
+
+
+
 }

+ 16 - 0
src/main/java/com/fdkankan/contro/service/ISceneRebuildLogService.java

@@ -0,0 +1,16 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.SceneRebuildLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 场景重算接口调用日志表 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-05-17
+ */
+public interface ISceneRebuildLogService extends IService<SceneRebuildLog> {
+
+}

+ 27 - 0
src/main/java/com/fdkankan/contro/service/ISceneUploadCountService.java

@@ -0,0 +1,27 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.SceneUploadCount;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.contro.vo.SceneUploadCountParamVO;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import javax.validation.Valid;
+
+/**
+ * <p>
+ * app触发场景上传统计表 服务类
+ * </p>
+ *
+ * @author
+ * @since 2024-05-20
+ */
+public interface ISceneUploadCountService extends IService<SceneUploadCount> {
+
+    void increSceneUploadCount(SceneUploadCountParamVO param);
+
+    void resetCountByUuid(String uuid);
+
+    SceneUploadCount getByUUid(String uuid);
+
+
+}

+ 7 - 0
src/main/java/com/fdkankan/contro/service/IWbService.java

@@ -0,0 +1,7 @@
+package com.fdkankan.contro.service;
+
+public interface IWbService {
+
+    void sendMq(String num, Integer status);
+
+}

+ 9 - 0
src/main/java/com/fdkankan/contro/service/IntermitSceneService.java

@@ -0,0 +1,9 @@
+package com.fdkankan.contro.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+public interface IntermitSceneService {
+
+    void sendMq(String num, JSONObject fdageData, int status);
+
+}

+ 27 - 0
src/main/java/com/fdkankan/contro/service/impl/AppCameraFailLogServiceImpl.java

@@ -0,0 +1,27 @@
+package com.fdkankan.contro.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.fdkankan.contro.entity.AppCameraFailLog;
+import com.fdkankan.contro.mapper.IAppCameraFailLogMapper;
+import com.fdkankan.contro.service.IAppCameraFailLogService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.contro.vo.ReportFailLogVO;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * app错误上报 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2024-05-20
+ */
+@Service
+public class AppCameraFailLogServiceImpl extends ServiceImpl<IAppCameraFailLogMapper, AppCameraFailLog> implements IAppCameraFailLogService {
+
+    @Override
+    public void reportFailLog(ReportFailLogVO param) {
+        AppCameraFailLog bean = BeanUtil.toBean(param, AppCameraFailLog.class);
+        this.save(bean);
+    }
+}

+ 21 - 21
src/main/java/com/fdkankan/contro/service/impl/BuildSceneDTServiceImpl.java

@@ -46,30 +46,30 @@ public class BuildSceneDTServiceImpl implements IBuildSceneDTService {
 
     @Override
     public void handModelFail(String reason, String serverPath, String num, String hostName) {
-        CompletableFuture.runAsync(() -> {
-            try {
-                log.info("开始发送钉钉消息");
-                String logPath = String.format(contentExt,fYunFileConfig.getHost(),num,fYunFileConfig.getHost(),num);
-                log.info("发送钉钉消息,content:{}", logPath);
-                String content = String.format(this.DINGTALK_MSG_PATTERN, this.mainUrl, hostName, reason, num, serverPath) + logPath;
-                log.info("发送钉钉消息,content:{}", content);
-                dingTalkSendUtils.sendActioncardMsgToDingRobot(content,"场景计算失败");
-            } catch (ApiException | UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException apiException) {
-                log.error("发送钉钉消息失败", apiException);
-            }
-        });
+        String logPath = String.format(contentExt,fYunFileConfig.getHost(),num,fYunFileConfig.getHost(),num);
+        this.handModelFail(reason, serverPath, num, hostName, logPath);
+    }
+
+    @Override
+    public void handModelFail(String reason, String serverPath, String num, String hostName, String logPath) {
+        try {
+            log.info("发送钉钉消息,content:{}", logPath);
+            String content = String.format(this.DINGTALK_MSG_PATTERN, this.mainUrl, hostName, reason, num, serverPath) + logPath;
+            log.info("发送钉钉消息,content:{}", content);
+            dingTalkSendUtils.sendActioncardMsgToDingRobot(content,"场景计算失败");
+        } catch (ApiException | UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException apiException) {
+            log.error("发送钉钉消息失败", apiException);
+        }
     }
 
     @Override
     public void handBaseFail(String reason, String serverPath, String num, String hostName) {
-        CompletableFuture.runAsync(() -> {
-            try {
-                String content = String.format(this.DINGTALK_MSG_PATTERN, this.mainUrl, hostName, reason, num, serverPath);
-                log.info("发送钉钉消息,content:{}", content);
-                dingTalkSendUtils.sendActioncardMsgToDingRobot(content,"场景计算失败");
-            } catch (ApiException | UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException apiException) {
-                log.error("发送钉钉消息失败", apiException);
-            }
-        });
+        try {
+            String content = String.format(this.DINGTALK_MSG_PATTERN, this.mainUrl, hostName, reason, num, serverPath);
+            log.info("发送钉钉消息,content:{}", content);
+            dingTalkSendUtils.sendActioncardMsgToDingRobot(content,"场景计算失败");
+        } catch (ApiException | UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException apiException) {
+            log.error("发送钉钉消息失败", apiException);
+        }
     }
 }

+ 7 - 10
src/main/java/com/fdkankan/contro/service/impl/CameraDetailServiceImpl.java

@@ -2,6 +2,7 @@ package com.fdkankan.contro.service.impl;
 
 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.constant.TbStatus;
@@ -32,19 +33,15 @@ public class CameraDetailServiceImpl extends ServiceImpl<ICameraDetailMapper, Ca
 
 
     @Override
-    public CameraDetail updateCameraDetailByCameraIdAndSpace(Long cameraId, Long space) {
+    public void updateCameraDetailByCameraIdAndSpace(Long cameraId, Long space) {
         CameraDetail cameraDetail = this.getByCameraId(cameraId);
         if(Objects.isNull(cameraDetail)){
-            return null;
+            return;
         }
-        cameraDetail.setUsedSpace(cameraDetail.getUsedSpace() + space);
-        if(cameraDetail.getUsedSpace() < 0){
-            cameraDetail.setUsedSpace(0L);
-        }
-        if(!this.updateById(cameraDetail)){
-            throw new BusinessException(ErrorCode.ERROR_MSG);
-        }
-        return cameraDetail;
+        this.update(new LambdaUpdateWrapper<CameraDetail>()
+                .setSql("used_space = used_space + " + space)
+                .eq(CameraDetail::getId, cameraDetail.getId()));
+
     }
 
 }

+ 14 - 0
src/main/java/com/fdkankan/contro/service/impl/CameraServiceImpl.java

@@ -2,9 +2,13 @@ package com.fdkankan.contro.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.common.constant.SpaceType;
 import com.fdkankan.contro.entity.Camera;
 import com.fdkankan.contro.mapper.ICameraMapper;
 import com.fdkankan.contro.service.ICameraService;
+import com.fdkankan.contro.service.IScenePlusService;
+import com.fdkankan.contro.service.ISceneProService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -18,6 +22,11 @@ import org.springframework.stereotype.Service;
 @Service
 public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implements ICameraService {
 
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private ISceneProService sceneProService;
+
     @Override
     public Camera getByChildName(String childName){
         return this.getOne(new LambdaQueryWrapper<Camera>().eq(Camera::getChildName,childName));
@@ -29,4 +38,9 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
         return this.getOne(new LambdaQueryWrapper<Camera>().eq(Camera::getSnCode,snCode));
     }
 
+    @Override
+    public Long getUsedSpace(Long cameraId, String spaceTypeStr) {
+        return sceneProService.sumUsedSpaceByCameraId(cameraId, spaceTypeStr)
+                + scenePlusService.sumUsedSpaceByCameraId(cameraId, spaceTypeStr);
+    }
 }

+ 24 - 0
src/main/java/com/fdkankan/contro/service/impl/CameraTypeServiceImpl.java

@@ -0,0 +1,24 @@
+package com.fdkankan.contro.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.contro.entity.CameraType;
+import com.fdkankan.contro.mapper.ICameraTypeMapper;
+import com.fdkankan.contro.service.ICameraTypeService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2023-04-11
+ */
+@Service
+public class CameraTypeServiceImpl extends ServiceImpl<ICameraTypeMapper, CameraType> implements ICameraTypeService {
+    @Override
+    public CameraType getByCamType(int camType) {
+        return this.getOne(new LambdaQueryWrapper<CameraType>().eq(CameraType::getCameraType, camType));
+    }
+}

+ 790 - 0
src/main/java/com/fdkankan/contro/service/impl/CommonServiceImpl.java

@@ -0,0 +1,790 @@
+package com.fdkankan.contro.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.ZipUtil;
+import cn.hutool.http.HttpUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.constant.*;
+import com.fdkankan.common.util.FileUtils;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.bean.SceneJsonBean;
+import com.fdkankan.contro.entity.*;
+import com.fdkankan.contro.factory.UserEditData.UserEditDataHandler;
+import com.fdkankan.contro.factory.UserEditData.UserEditDataHandlerFactory;
+import com.fdkankan.contro.service.ICommonService;
+import com.fdkankan.contro.service.*;
+import com.fdkankan.contro.vo.SceneEditControlsVO;
+import com.fdkankan.contro.vo.ScenePlusVO;
+import com.fdkankan.fyun.config.FYunFileConfig;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFileName;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.model.utils.CreateObjUtil;
+import com.fdkankan.model.utils.FloorPlanUserUtil;
+import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+import com.fdkankan.redis.constant.RedisKey;
+import com.fdkankan.redis.util.RedisUtil;
+import com.fdkankan.sms.SendMailAcceUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.Objects;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Service
+@RefreshScope
+public class CommonServiceImpl implements ICommonService {
+
+    @Value("${main.laserUrl:#{null}}")
+    private String laserUrl;
+
+    @Value("${env:gn}")
+    private String env;
+
+    @Value("${helpLink.zh-cn:https://docs.4dkankan.com/#/product/4dkk/zh-cn/README}")
+    private String helpLinkZh;
+
+    @Value("${helpLink.en-us:https://docs.4dkankan.com/#/product/4dkk/en-us/README}")
+    private String helpLinkEn;
+
+    @Value("#{'${camType.laser:}'.split(',')}")
+    private List<Integer> laserCamTypeList;
+
+    @Value("${model.modelKind:3dtiles}")
+    private String modelKind;
+
+    @Value("#{'${model.3dtiles.sceneSource:}'.split(',')}")
+    private List<Integer> sdTilesSceneSourceList;
+
+    @Autowired
+    private ISceneAsynOperLogService sceneAsynOperLogService;
+    @Resource
+    private FYunFileServiceInterface fYunFileServiceInterface;
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private IMailTemplateService mailTemplateService;
+    @Autowired
+    private IUserService userService;
+    @Autowired
+    private ISceneProService sceneProService;
+    @Autowired
+    private ICameraDetailService cameraDetailService;
+    @Autowired
+    private IUserIncrementService userIncrementService;
+    @Autowired
+    private IIncrementTypeService incrementTypeService;
+    @Autowired
+    private ICameraService cameraService;
+    @Autowired
+    private FYunFileConfig fYunFileConfig;
+    @Autowired
+    private ISceneEditInfoService sceneEditInfoService;
+    @Autowired
+    private ISceneEditControlsService sceneEditControlsService;
+    @Autowired
+    private ISceneEditInfoExtService sceneEditInfoExtService;
+    @Autowired
+    private RedisUtil redisUtil;
+    @Autowired
+    private IMqSendLogService mqSendLogService;
+    @Autowired
+    private RabbitMqProducer rabbitMqProducer;
+    @Autowired
+    private ISceneInfoSyncMqConfigService sceneInfoSyncMqConfigService;
+
+    @Override
+    public void uploadBuildResultData(String num, String dataSource, String version) {
+
+        Map<String, String> uploadMap = new HashMap<>();
+
+        String ossResultPath = String.format(UploadFilePath.scene_result_data_path, num);
+
+        //删除旧的文件目录
+        fYunFileServiceInterface.deleteFolder(ossResultPath);
+
+        //上传caches/images
+        String localCachesImagePath = dataSource + "/caches/images/";
+        String ossCachesImagePath = ossResultPath + "caches/images/";
+        //先清除旧的全景图
+        if(FileUtil.exist(localCachesImagePath)){
+            fYunFileServiceInterface.uploadFileByCommand(localCachesImagePath, ossCachesImagePath);
+        }
+
+        //上传project.json
+        String localProjectJsonPath = dataSource + "/project.json";
+        String ossProjectJsonPath = ossResultPath + "project.json";
+        if(FileUtil.exist(localProjectJsonPath)){
+            uploadMap.put(localProjectJsonPath, ossProjectJsonPath);
+        }
+
+        //上传data.json
+        String localDataJsonPath = dataSource + "/data.json";
+        String ossDataJsonPath = ossResultPath + "data.json";
+        if(FileUtil.exist(localDataJsonPath)){
+            uploadMap.put(localDataJsonPath, ossDataJsonPath);
+        }
+
+        //户型图上传
+        String floorplanCadPath = ossResultPath + "floorplan_cad";
+        String cadPicPathFormat = floorplanCadPath + "/floor-cad-%s.%s";
+        String floorCadPath = dataSource + "/results/floorplan_cad";
+        //清除原有旧的cad图
+        fYunFileServiceInterface.deleteFolder(floorplanCadPath);
+        List<String> floorCadList = FileUtils.getFileList(floorCadPath);
+        if(CollUtil.isNotEmpty(floorCadList)){
+            floorCadList.stream().forEach(str->{
+                String substring = str.substring(str.lastIndexOf(File.separator) + 1);
+                String[] arr = substring.split("floor");
+                String[] arr2 = arr[1].split("\\.");
+                //上传到用户编辑目录
+                uploadMap.put(str, String.format(cadPicPathFormat, arr2[0], arr2[1]));
+            });
+        }
+
+        //上传深时场景生成obj需要的文件
+        String localReconstruction = dataSource + "/caches/reconstruction/";
+        String ossReconstruction = ossResultPath + "caches/reconstruction/";
+        if(FileUtil.exist(localReconstruction)){
+            fYunFileServiceInterface.uploadFileByCommand(localReconstruction, ossReconstruction);
+        }
+        String localDepthmap = dataSource + "/caches/depthmap/";
+        String ossDepthmap = ossResultPath + "caches/depthmap/";
+        if(FileUtil.exist(localDepthmap)){
+            fYunFileServiceInterface.uploadFileByCommand(localDepthmap, ossDepthmap);
+        }
+        String localDepthmapAsc = dataSource + "/caches/depthmap_csc/";
+        String ossDepthmapAsc = ossResultPath + "caches/depthmap_csc/";
+        if(FileUtil.exist(localDepthmapAsc)){
+            fYunFileServiceInterface.uploadFileByCommand(localDepthmapAsc, ossDepthmapAsc);
+        }
+        String localPanoramaJson =  dataSource + "/caches/panorama.json";
+        String ossPanoramaJson =  ossResultPath + "caches/panorama.json";
+        if(FileUtil.exist(localPanoramaJson)){
+            fYunFileServiceInterface.uploadFile(localPanoramaJson, ossPanoramaJson);
+        }
+//        String localLaserPly = dataSource + "/results/laserData/laser.ply";
+//        String ossLaserPly =  ossResultPath + "results/laserData/laser.ply";
+//        if(FileUtil.exist(localLaserPly)){
+//            fYunFileServiceInterface.uploadFile(localLaserPly, ossLaserPly);
+//        }
+        String localFloorGroupFixJson = dataSource + "/caches/floor_group_fix.json";
+        String ossFloorGroupFixJson = ossResultPath + "caches/floor_group_fix.json";
+        if(FileUtil.exist(localFloorGroupFixJson)){
+            fYunFileServiceInterface.uploadFile(localFloorGroupFixJson, ossFloorGroupFixJson);
+        }
+
+        String localDepthmapVis = dataSource + "/caches/depthmap_vis";
+        String ossDepthmapVis = ossResultPath + "caches/depthmap_vis";
+        if(FileUtil.exist(localDepthmapVis)){
+            fYunFileServiceInterface.uploadFileByCommand(localDepthmapVis, ossDepthmapVis);
+        }
+
+        String localIntensity = dataSource + "/caches/intensity";
+        String ossIntensity = ossResultPath + "caches/intensity";
+        if(FileUtil.exist(localIntensity)){
+            fYunFileServiceInterface.uploadFileByCommand(localIntensity, ossIntensity);
+        }
+
+        //上传点位校准相关文件
+        String localExtras = dataSource + "/extras";
+        String ossExtras = ossResultPath + "extras";
+        if(FileUtil.exist(localExtras)){
+            fYunFileServiceInterface.uploadFileByCommand(localExtras, ossExtras);
+        }
+
+        //开始上传
+        fYunFileServiceInterface.uploadMulFiles(uploadMap);
+    }
+
+    @Override
+    public void uploadFloorplanJson(String num, String dataSource) throws Exception{
+        String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
+        if (!new File(floorPlanCardFilePath).exists()) {
+            log.warn("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
+            return;
+        }
+        JSONObject json = FloorPlanUserUtil.createFloorPlanUserJson(floorPlanCardFilePath);
+        if(Objects.isNull(json)){
+            log.warn("生成floorplan.json失败,cadPath:{}", floorPlanCardFilePath);
+            return;
+        }
+        String floorplanJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "floorplan.json";
+        fYunFileServiceInterface.uploadFile(json.toJSONString().getBytes(), floorplanJsonPath);
+    }
+
+    @Override
+    public void initUserEditData(String num, Set<String> bizs, Map<String, Map<String ,Object>> params) throws Exception {
+        if(StrUtil.isEmpty(num) || CollUtil.isEmpty(bizs)){
+            return;
+        }
+        for (String biz : bizs) {
+            UserEditDataHandler handler = UserEditDataHandlerFactory.getHandler(biz);
+            handler.init(num, CollUtil.isEmpty(params) ? null : params.get(biz));
+        }
+    }
+
+    @Override
+    public void sendEmail(String num, String type) {
+        try {
+            Long userId = null;
+            String websize = "";
+            String title = "";
+            Integer sceneSource = null;
+            ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+            if(Objects.isNull(scenePlus)){
+                ScenePro scenePro = sceneProService.getByNum(num);
+                if(Objects.isNull(scenePro)){
+                    return;
+                }
+                userId = scenePro.getUserId();
+                websize = scenePro.getWebSite();
+                title = scenePro.getSceneName();
+                sceneSource = scenePro.getSceneSource();
+            }else{
+                userId = scenePlus.getUserId();
+                ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+                websize = scenePlusExt.getWebSite();
+                title = scenePlus.getTitle();
+                sceneSource = scenePlus.getSceneSource();
+            }
+
+            if(Objects.isNull(userId)){
+                return;
+            }
+            User user = userService.getById(userId);
+            if(Objects.isNull(user) || StrUtil.isEmpty(user.getUserName())){
+                return;
+            }
+            String toEmail = user.getUserName();
+            String helpLink = helpLinkEn;
+            String lang = "en";
+            if("gn".equals(env)){
+                lang = "zh";
+                helpLink = helpLinkZh;
+            }
+            websize += "&lang=" + lang;
+            if(("standar".equals(type))
+                    && (sceneSource == SceneSource.JG.code() || sceneSource == SceneSource.SG.code())){
+                websize = String.format(laserUrl, num, lang);
+            }
+
+            MailTemplate mailTemplate = mailTemplateService.getOne(new LambdaQueryWrapper<MailTemplate>().eq(MailTemplate::getRemark, "计算完成").eq(MailTemplate::getLang, lang));
+            String content = mailTemplate.getMsg().replaceAll("scene_name", title).replaceAll("scene_link", websize).replaceAll("help_link", helpLink);
+            SendMailAcceUtils.sendMail(mailTemplate.getSendMail(), mailTemplate.getSendPassword(), mailTemplate.getSendHost(), toEmail, mailTemplate.getSubject(), content, null);
+        }catch (Exception e){
+            log.error("发送邮件失败,num:" + num, e);
+        }
+    }
+
+    public static void main(String[] args) throws GeneralSecurityException {
+        String content  = "<p>Dear Valued Customer,&nbsp;</p>\n" +
+                "<p>&nbsp;</p>\n" +
+                "<p>The scene \"scene_name\" has been successfully calculated, please review the following:&nbsp;<a href=\"scene_link\" target=\"_blank\" rel=\"noopener\">scene_link</a>&nbsp;</p>\n" +
+                "<p>&nbsp;</p>\n" +
+                "<p>If you need to edit the scene, the User Manual can provide instructions: <a href=\"help_link\" target=\"_blank\" rel=\"noopener\">help_link</a>&nbsp;</p>\n" +
+                "<p>&nbsp;</p>\n" +
+                "<p>Sincerely,&nbsp;</p>\n" +
+                "<p>4Dage Support Team</p>\n" +
+                "<p>&nbsp;</p>\n" +
+                "<p>------------------</p>\n" +
+                "<p><img src=\"http://4dkk.4dage.com/ucenter/image/4dkankan_en.png\" /></p>\n" +
+                "<p><br /><strong><em>Web:</em></strong><a href=\"http://eur.4dkankan.com/\" target=\"_blank\" rel=\"noopener\">eur.4dkankan.com</a></p>";
+        SendMailAcceUtils.sendMail("4Dkankan@4dage.com", "6996790AAaa", "smtp.exmail.qq.com", "qinyongcheng@cgaii.com", "The Scene Calculation is Now Complete.", content, null);
+    }
+
+    public String getOssOrignPath(String path) {
+        String ossPath = ConstantFilePath.OSS_PREFIX
+                + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
+                .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "");
+        if (!ossPath.endsWith("/")) {
+            ossPath = ossPath.concat("/");
+        }
+        return ossPath;
+    }
+
+    @Override
+    public int getPayStatus(Long cameraId, Long space){
+        //查询权益统计容量的方式
+        String unit = SpaceType.GB.code();
+        CameraDetail cameraDetail = cameraDetailService.getByCameraId(cameraId);
+        if(StrUtil.isNotEmpty(cameraDetail.getUnit())){
+            unit = cameraDetail.getUnit();
+        }
+        Long limit = this.getSpaceLimit(cameraDetail);
+
+        if(SpaceType.SP.code().equals(unit)){//如果按空间方式统计,则space置为1
+            space = 1L;
+        }
+
+        //更新相机使用用量,非激光相机或者是空间个数计算方式的,需要叠加相机容量
+        cameraDetailService.updateCameraDetailByCameraIdAndSpace(cameraId, space);
+
+        //无限容量或者激光相机,直接返回已支付
+        if(limit == -1 || ("gn".equals(env) && CollUtil.isNotEmpty(laserCamTypeList) && laserCamTypeList.contains(cameraDetail.getType()))){
+            return PayStatus.PAY.code();
+        }
+
+        Long usedSpace = cameraService.getUsedSpace(cameraId, unit);
+        if(usedSpace + space > limit){
+            return PayStatus.NO_CAPACITY.code();
+        }
+
+        return PayStatus.PAY.code();
+    }
+
+    @Override
+    public void uploadStatusJson(String num, Integer sceneStatus, String webSite, String thumb, Integer payStatus, String uploadPath) {
+        String localDataPath = String.format(ConstantFilePath.DATABUFFER_FORMAT, num);
+        JSONObject statusJson = new JSONObject();
+        statusJson.put("status", sceneStatus);
+        statusJson.put("webSite", webSite);
+        statusJson.put("sceneNum", num);
+        statusJson.put("thumb", thumb);
+        statusJson.put("payStatus", PayStatus.NOT_PAY.code());
+        statusJson.put("recStatus", 'A');
+        FileUtils.writeFile(localDataPath + "status.json", statusJson.toString());
+        fYunFileServiceInterface.uploadFile(localDataPath + "status.json", uploadPath + "status.json");
+    }
+
+    @Override
+    public Long getSpaceLimit(CameraDetail cameraDetail){
+        Long limit = cameraDetail.getTotalSpace();
+        UserIncrement userIncrement = userIncrementService.getByCameraId(cameraDetail.getCameraId());
+        if(Objects.nonNull(userIncrement) && userIncrement.getIsExpired() == CommonStatus.NO.code().intValue()){
+            IncrementType incrementType = incrementTypeService.getById(userIncrement.getIncrementTypeId());
+            switch (SpaceType.get(cameraDetail.getUnit())){
+                case GB:
+                    limit = incrementType.getCameraCapacity();
+                    if(limit != -1){
+                        limit = limit * 1024 * 1024 * 1024;
+                    }
+                    break;
+                case SP:
+                    limit = incrementType.getCameraSpace();
+                    break;
+            }
+        }
+        return limit;
+    }
+
+    @Override
+    public Long getSpace(String num){
+        Long space = fYunFileServiceInterface.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.DATA_VIEW_PATH, num));
+        space += fYunFileServiceInterface.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.IMG_VIEW_PATH, num));
+        space += fYunFileServiceInterface.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.VIDEOS_VIEW_PATH, num));
+        space += fYunFileServiceInterface.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.VOICE_VIEW_PATH, num));
+        space += fYunFileServiceInterface.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.scene_result_data_path, num).concat("caches"));
+        return  space;
+    }
+
+    public Object[] updateEditInfo(ScenePlus scenePlus){
+        SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
+        SceneEditControls sceneEditControls = null;
+        SceneEditInfoExt sceneEditInfoExt = null;
+        if(sceneEditInfo == null){
+            sceneEditInfo = new SceneEditInfo();
+            sceneEditInfo.setScenePlusId(scenePlus.getId());
+            sceneEditInfo.setDescription(scenePlus.getDescription());
+            sceneEditInfo.setTitle(scenePlus.getTitle());
+            sceneEditInfoService.save(sceneEditInfo);
+        }else{
+
+            int version = 0;
+            int imgVersion = 0;
+            int linkVersion = 0;
+            //获取展示页的版本号
+            String sceneJsonStr = fYunFileServiceInterface.getFileContent(String.format(UploadFilePath.DATA_VIEW_PATH, scenePlus.getNum()) + "scene.json");
+            if(StrUtil.isNotEmpty(sceneJsonStr)){
+                JSONObject sceneJson = JSON.parseObject(sceneJsonStr);
+                version = sceneJson.getIntValue("version");
+                imgVersion = sceneJson.getIntValue("imgVersion");
+                linkVersion =  sceneJson.getIntValue("linkVersion");
+            }
+
+            if(version < sceneEditInfo.getVersion()){
+                version = sceneEditInfo.getVersion();
+            }
+            if(imgVersion < sceneEditInfo.getImgVersion()){
+                imgVersion = sceneEditInfo.getImgVersion();
+            }
+            if(linkVersion < sceneEditInfo.getLinkVersion()){
+                linkVersion = sceneEditInfo.getLinkVersion();
+            }
+
+            sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
+            sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
+            sceneEditInfo.setVersion(version + 1);
+            sceneEditInfo.setImgVersion(imgVersion + 1);
+            sceneEditInfo.setLinkVersion(linkVersion + 1);
+            sceneEditInfo.setIsUploadObj(CommonStatus.NO.code());
+            sceneEditInfoService.updateById(sceneEditInfo);
+        }
+        if(sceneEditControls == null){
+            sceneEditControls = new SceneEditControls();
+            sceneEditControls.setEditInfoId(sceneEditInfo.getId());
+            sceneEditControlsService.save(sceneEditControls);
+        }
+        if(sceneEditInfoExt == null){
+            sceneEditInfoExt = new SceneEditInfoExt();
+            sceneEditInfoExt.setScenePlusId(scenePlus.getId());
+            sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
+            sceneEditInfoExtService.save(sceneEditInfoExt);
+        }
+        return new Object[]{sceneEditInfo, sceneEditInfoExt, sceneEditControls};
+    }
+
+    public void writeSceneJson(String num, SceneEditInfo sceneEditInfo, SceneEditInfoExt sceneEditInfoExt,
+                                SceneEditControls sceneEditControls, ScenePlus scenePlus, ScenePlusExt scenePlusExt,Company company){
+        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
+
+        String oldSceneJson = fYunFileServiceInterface.getFileContent(dataViewPath + "scene.json");
+
+        SceneJsonBean sceneJson = new SceneJsonBean();
+        BeanUtil.copyProperties(sceneEditInfoExt, sceneJson, "started");
+        BeanUtil.copyProperties(sceneEditInfo, sceneJson);
+        SceneEditControlsVO sceneEditControlsVO = BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class);
+        sceneJson.setControls(sceneEditControlsVO);
+        sceneJson.setNum(num);
+        sceneJson.setCreateTime(scenePlus.getCreateTime());
+        sceneJson.setSceneResolution(scenePlusExt.getSceneResolution());
+        sceneJson.setVersion(sceneEditInfo.getVersion());
+        sceneJson.setImgVersion(sceneEditInfo.getImgVersion());
+        sceneJson.setSceneFrom(scenePlusExt.getSceneFrom());
+        sceneJson.setSceneKind(scenePlusExt.getSceneKind());
+        sceneJson.setModelKind(scenePlusExt.getModelKind());
+        sceneJson.setVideos(scenePlusExt.getVideos());
+        sceneJson.setPayStatus(scenePlus.getPayStatus());
+        if(StrUtil.isNotEmpty(oldSceneJson)){
+            SceneJsonBean oldSceneJsonBean = JSON.parseObject(oldSceneJson, SceneJsonBean.class);
+            List<JSONObject> mosaicList = JSON.parseObject(oldSceneJson, SceneJsonBean.class).getMosaicList();
+            sceneJson.setMosaicList(mosaicList);
+            sceneJson.setFloorLogo(oldSceneJsonBean.getFloorLogo());
+            sceneJson.setFloorLogoFile(oldSceneJsonBean.getFloorLogoFile());
+            sceneJson.setBoxModels(oldSceneJsonBean.getBoxModels());
+            sceneJson.setBoxVideos(oldSceneJsonBean.getBoxVideos());
+            sceneJson.setBoxPhotos(oldSceneJsonBean.getBoxPhotos());
+        }
+        if(StrUtil.isNotEmpty(sceneEditInfoExt.getStarted())){
+            sceneJson.setStarted(JSON.parseObject(sceneEditInfoExt.getStarted()));
+        }
+
+        if(!ObjectUtils.isEmpty(company)){
+            String userViewPath = String.format(UploadFilePath.USER_VIEW_PATH, num);
+            String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
+            String localLogoPath = null;
+            if (StrUtil.isNotEmpty(company.getTopLogo())) {
+                localLogoPath = ConstantFilePath.AGENT_PATH + company.getTopLogo().substring(company.getTopLogo().lastIndexOf("//") + 1);
+                HttpUtil.downloadFile(company.getTopLogo(), localLogoPath);
+                fYunFileServiceInterface.uploadFile(localLogoPath, userViewPath + "loadingLogo-user.png");
+                fYunFileServiceInterface.uploadFile(localLogoPath, userEditPath + "loadingLogo-user.png");
+                sceneJson.setLoadingLogo("user");
+                sceneJson.setLoadingLogoFile("loadingLogo-user.png");
+                sceneEditInfo.setLoadingLogo("user");
+                sceneEditInfo.setLoadingLogoFile("loadingLogo-user.png");
+            }
+            if (StrUtil.isNotEmpty(company.getFloorLogo())) {
+                localLogoPath = ConstantFilePath.AGENT_PATH + company.getFloorLogo().substring(company.getFloorLogo().lastIndexOf("//") + 1);
+                HttpUtil.downloadFile(company.getFloorLogo(), localLogoPath);
+                fYunFileServiceInterface.uploadFile(localLogoPath, userViewPath + "floorLogo-user.png");
+                fYunFileServiceInterface.uploadFile(localLogoPath, userEditPath + "floorLogo-user.png");
+                sceneJson.setFloorLogo("user");
+                sceneJson.setFloorLogoFile("floorLogo-user.png");
+
+                sceneEditInfo.setFloorLogo("user");
+                sceneEditInfo.setFloorLogoFile("floorLogo-user.png");
+            }
+            if(!ObjectUtils.isEmpty(localLogoPath)){
+                sceneEditInfoService.updateById(sceneEditInfo);
+                FileUtils.deleteFile(localLogoPath);
+            }
+        }
+        String sceneJsonStr = JSON.toJSONString(sceneJson);
+        //上传sceneJson文件
+        fYunFileServiceInterface.uploadFile(sceneJsonStr.getBytes(), dataViewPath + "scene.json");
+        //scenejson写入缓存
+        redisUtil.set(String.format(RedisKey.SCENE_JSON, num), sceneJsonStr);
+    }
+
+    @Override
+    public void saveMqSendLog(String num, BuildSceneCallMessage message) {
+        MqSendLog mqSendLog = new MqSendLog();
+        mqSendLog.setNum(num);
+        mqSendLog.setContent(JSON.toJSONString(message));
+        mqSendLogService.save(mqSendLog);
+    }
+
+    @Override
+    public void sendUpdateSceneStatusMqToQueues(Map<String, Object> content) {
+        List<SceneInfoSyncMqConfig> configs = sceneInfoSyncMqConfigService.listByInfoType("update_scene_status");
+        if(CollUtil.isEmpty(configs)){
+            return;
+        }
+        for (SceneInfoSyncMqConfig config : configs) {
+            rabbitMqProducer.sendByWorkQueue(config.getQueueName(), content);
+        }
+    }
+
+    @Override
+    public void removeSceneAsynOperLog(String num) {
+        List<SceneAsynOperLog> list = sceneAsynOperLogService.list(new LambdaQueryWrapper<SceneAsynOperLog>().eq(SceneAsynOperLog::getNum, num));
+        if(CollUtil.isEmpty(list)){
+            return;
+        }
+        //删除数据库记录
+        List<Long> deleteIdList = list.parallelStream().map(item -> item.getId()).collect(Collectors.toList());
+        sceneAsynOperLogService.removeByIds(deleteIdList);
+
+        list.parallelStream().forEach(item -> {
+            if(StrUtil.isNotEmpty(item.getUrl())){
+                try {
+                    fYunFileServiceInterface.deleteFile(item.getUrl());
+                } catch (IOException e) {
+                    log.warn("删除oss全景图下载压缩包失败,key:{}", item.getUrl());
+                }
+            }
+        });
+    }
+
+    public JSONObject getVideosJson(String path, Integer videoVersion, String projectNum, int cameraType){
+        //读取videos_hdr_param.json, 保存点位视频的value
+        Map<String, Object> videoMap = new HashMap<>();
+        String videosHdr = FileUtils.readFile(path + File.separator + "results/videos/videos_hdr_param.json");
+        JSONArray videoArray = null;
+        if(StringUtils.isNotEmpty(videosHdr)){
+            videoArray = JSONObject.parseObject(videosHdr).getJSONArray("hdr_param");
+        }
+        if(videoArray != null){
+            for(int i = 0, len = videoArray.size(); i < len; i++) {
+                videoMap.put(videoArray.getJSONObject(i).getString("name"), videoArray.getJSONObject(i).getString("value"));
+                if(videoArray.getJSONObject(i).containsKey("fov")){
+                    videoMap.put(videoArray.getJSONObject(i).getString("name") + "_fov", videoArray.getJSONObject(i).getString("fov"));
+                }
+            }
+        }
+
+        //获取upload中的video视频名称
+        String uploadData = FileUtils.readFile(path + File.separator + "results" +File.separator+"upload.json");
+        JSONObject uploadJson = null;
+        JSONArray array = null;
+        if(uploadData!=null) {
+            uploadJson = JSONObject.parseObject(uploadData);
+            array = uploadJson.getJSONArray("upload");
+        }
+        JSONObject fileJson = null;
+        String fileName = "";
+
+        //计算ts文件的大小,并拼接成json格式
+        JSONArray jsonArray = new JSONArray();
+        JSONObject videoJson = null;
+        JSONObject videosJson = new JSONObject();
+        long videoSize = 0L;
+        for(int i = 0, len = array.size(); i < len; i++) {
+            fileJson = array.getJSONObject(i);
+            fileName = fileJson.getString("file");
+            if(fileJson.getIntValue("clazz") == 11 && fileName.contains(".mp4") && !fileName.contains("-ios.mp4")){
+                videoJson = new JSONObject();
+                videoJson.put("id", fileName.substring(
+                        0, fileName.lastIndexOf(".")).replace("videos/", ""));
+
+                //如果ts文件存在,就计算ts大小
+                if(new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).exists()){
+                    videoSize = new File(path + File.separator + "results" +File.separator+ fileName.replace(".mp4", ".ts")).length();
+                    videoJson.put("tsSize", videoSize);
+                }
+                if(videoMap.containsKey(videoJson.get("id"))){
+                    videoJson.put("value", videoMap.get(videoJson.get("id")));
+                }
+                if(videoMap.containsKey(videoJson.get("id") + "_fov")){
+                    videoJson.put("blend_fov", videoMap.get(videoJson.get("id") + "_fov"));
+                }else {
+                    videoJson.put("blend_fov", 7);
+                }
+                jsonArray.add(videoJson);
+            }
+        }
+
+        videosJson.put("data", jsonArray);
+        if(Objects.nonNull(videoVersion) && videoVersion >= 4){
+            videosJson.put("version", 3);
+            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "Up.xml");
+            if(cameraType == 13 || cameraType == 14){
+                //转台相机
+                videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
+            }
+        }else {
+            videosJson.put("version", 1);
+            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "Up2.xml");
+            if(cameraType == 13 || cameraType == 14){
+                //转台相机
+                videosJson.put("upPath", videosJson.getString("upPath").replace(".xml", ".txt"));
+            }
+        }
+
+        if(cameraType == 5 || cameraType == 6){
+            videosJson.put("version", 1);
+            videosJson.put("upPath", fYunFileConfig.getHost() + String.format(UploadFilePath.DATA_VIEW_PATH, projectNum) + "stitch_params.txt");
+        }
+
+        return videosJson;
+    }
+
+    @Override
+    public JSONObject getFdageData(String dataFdagePath) {
+        log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
+        String data = FileUtils.readFile(dataFdagePath);
+        //获取data.fdage的内容
+        JSONObject dataJson = new JSONObject();
+        if(data!=null){
+            dataJson = JSONObject.parseObject(data);
+        }
+        return dataJson;
+    }
+
+    @Override
+    public Map<String, String> getUploadFiles(ScenePlus scenePlus,String path,Integer cameraType,JSONObject fdageData) throws Exception {
+        if (ObjectUtils.isEmpty(scenePlus)) {
+            throw new Exception("未找到场景信息:" + path);
+        }
+
+        String projectNum = scenePlus.getNum();
+
+        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, projectNum);
+        String imagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, projectNum);
+        String videoPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, projectNum);
+        String resultsPath = path + File.separator + "results" + File.separator;
+
+        String uploadData = FileUtils.readFile(resultsPath + "upload.json");
+        JSONArray array = JSONObject.parseObject(uploadData).getJSONArray("upload");
+
+        JSONObject fileJson = null;
+        String fileName = "";
+
+        Map<String, String> map = new HashMap();
+
+        for (int i = 0; i < array.size(); ++i) {
+            fileJson = array.getJSONObject(i);
+            fileName = fileJson.getString("file");
+            String filePath = resultsPath + fileName;
+
+            if (!(new File(filePath)).exists()) {
+                throw new Exception(filePath + "文件不存在");
+            }
+
+            if ("vision2.txt".equals(fileName)) {
+                CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision2.txt", resultsPath + "vision2.modeldata");
+                map.put(resultsPath + "vision2.modeldata", imagesPath + "vision2.modeldata");
+                map.put(resultsPath + "vision2.txt", imagesPath + "vision2.txt");
+            }
+
+            if (fileJson.getIntValue("clazz") == 2) {
+                map.put(filePath, imagesPath + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/" + fileName.replace("tex/", ""));
+            } else if (fileJson.getIntValue("clazz") == 3) {
+                map.put(filePath, imagesPath + "pan/high/" + fileName.replace("high/", ""));
+            } else if (fileJson.getIntValue("clazz") == 4) {
+                map.put(filePath, imagesPath + "pan/low/" + fileName.replace("low/", ""));
+            } else if (fileJson.getIntValue("clazz") == 5) {
+                map.put(filePath, imagesPath + fileName);
+            } else if (fileJson.getIntValue("clazz") == 7) {
+                map.put(filePath, imagesPath + fileName);
+            } else if (fileJson.getIntValue("clazz") == 10) {
+                String updown = FileUtils.readFile(filePath);
+                JSONObject updownJson = JSONObject.parseObject(updown);
+                String mappingOssPath = String.format("scene_edit_data/%s/data/", projectNum) + fileName.replace("updown", "mapping");
+                map.put(filePath, mappingOssPath);
+            } else {
+                if (fileJson.getIntValue("clazz") == 11 || fileJson.getIntValue("clazz") == 12) {
+                    map.put(filePath, videoPath + fileName.replace("videos/", ""));
+                    if (fileName.contains(".mp4")) {
+                        map.put(resultsPath + fileName.replace("mp4", "flv"), videoPath + fileName.replace("videos/", "").replace("mp4", "flv"));
+                    }
+                }
+
+                if (fileJson.getIntValue("clazz") == 16) {
+                    map.put(filePath, dataViewPath + fileName);
+                }
+
+                if (fileJson.getIntValue("clazz") == 18) {
+                    map.put(filePath, imagesPath + fileName);
+                }
+            }
+        }
+
+        //exportMeshObj这个是字段由app写入的
+        boolean genModel = true;//是否生成模型 默认生成,深时场景要根据 exportMeshObj判断是否生成
+        if(!ObjectUtils.isEmpty(cameraType)
+                && cameraType == 14
+                && (!fdageData.containsKey("exportMeshObj") || fdageData.getIntValue("exportMeshObj") != 1)){
+            genModel = false;
+        }
+        boolean gen3dTiles = true;//是否生成3dtiles模型 默认生成
+        if(!ModelKind.THREE_D_TILE.code().equals(modelKind)
+                || CollUtil.isEmpty(sdTilesSceneSourceList)
+                || !sdTilesSceneSourceList.contains(scenePlus.getSceneSource())){
+            gen3dTiles = false;
+        }
+
+        if(genModel){
+            if (!gen3dTiles) {
+                String damPath = path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam";
+                CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", damPath);
+                FileUtil.writeBytes(ZipUtil.gzip(new File(damPath)), damPath);
+                map.put(damPath, imagesPath + ConstantFileName.modelUUID + "_50k.dam");
+            }else{
+                List<String> list = FileUtils.list(new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
+                if(CollUtil.isEmpty(list)){
+                    log.error("3dtiles目录异常,3dtiles地址:{}", new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
+                    throw new Exception("3dtiles目录异常");
+                }
+                list.stream().forEach(str->{
+                    map.put(str, str.replace(path + File.separator + "results" + File.separator, imagesPath));
+                });
+            }
+        }
+
+        CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision.txt", resultsPath + "vision.modeldata");
+        map.put(resultsPath + "vision.txt", imagesPath + "vision.txt");
+        map.put(resultsPath + "vision.modeldata", imagesPath + "vision.modeldata");
+
+        log.info("数据转换完成:" + projectNum);
+        if(!new File("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum).exists()){
+            FileUtil.mkdir("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum);
+        }
+//        map.put(resultsPath + "floorplan.json", dataViewPath + "floor.json");
+        map.put(resultsPath + "floorplan_cad.json", dataViewPath + "floorplan_cad.json");
+        map.put(path + File.separator + "capture/stitch_params.txt", dataViewPath + "stitch_params.txt");
+        map.put(path + File.separator + "capture/Up.xml", dataViewPath + "Up.xml");
+        map.put(path + File.separator + "capture/Up2.xml", dataViewPath + "Up2.xml");
+        map.put(path + File.separator + "capture/Up.txt", dataViewPath + "Up.txt");
+        map.put(path + File.separator + "capture/Up2.txt", dataViewPath + "Up2.txt");
+        return map;
+
+    }
+}

+ 134 - 0
src/main/java/com/fdkankan/contro/service/impl/ExceedSpaceSceneServiceImpl.java

@@ -0,0 +1,134 @@
+package com.fdkankan.contro.service.impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.common.constant.*;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.contro.entity.*;
+import com.fdkankan.contro.mapper.IExceedSpaceSceneMapper;
+import com.fdkankan.contro.service.*;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.constants.UploadFilePath;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.Objects;
+
+/**
+ * <p>
+ * 超出容量场景码表 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2023-06-29
+ */
+@Service
+public class ExceedSpaceSceneServiceImpl extends ServiceImpl<IExceedSpaceSceneMapper, ExceedSpaceScene> implements IExceedSpaceSceneService {
+
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private ISceneProService sceneProService;
+    @Autowired
+    private IUserIncrementService userIncrementService;
+    @Autowired
+    private IIncrementTypeService incrementTypeService;
+    @Autowired
+    private ICommonService commonService;
+    @Autowired
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private ISceneCleanOrigService sceneCleanOrigService;
+
+
+    @Override
+    public boolean cehckExceedSpace(String num, CameraDetail cameraDetail, String snCode, String fileId, String unicode) {
+        if(!cameraDetail.getUnit().equals(SpaceType.SP.code())){
+            return false;
+        }
+        boolean exceedSpace = this.isExceedSpace(num, cameraDetail);
+        if(exceedSpace){
+            //写入超出容量场景表
+            ExceedSpaceScene scene = new ExceedSpaceScene();
+            scene.setNum(num);
+            scene.setUserId(cameraDetail.getUserId());
+            scene.setCameraId(cameraDetail.getCameraId());
+            scene.setFileId(fileId);
+            scene.setUnicode(unicode);
+            this.save(scene);
+
+            // TODO: 2023/7/11 由于八目相机有bug,第一次请求返回成功后,还是会请求第二次,第二次请求检测data.fdage不存在会导致请求失败,所以这个版本先不删除原始资源
+            //删除原始资源
+//            if(fileId.length() > 1 && unicode.length() > 1){
+//                String homePath = ConstantFilePath.OSS_PREFIX.concat(snCode).concat("/").concat(fileId).concat("/").concat(unicode);
+//                fYunFileService.deleteFolder(homePath);
+//            }
+
+            //记录删除原始资源记录
+//            SceneCleanOrig sceneCleanOrig = new SceneCleanOrig();
+//            sceneCleanOrig.setNum(num);
+//            sceneCleanOrig.setType(4);
+//            sceneCleanOrig.setState(CommonSuccessStatus.SUCCESS.code());
+//            sceneCleanOrigService.save(sceneCleanOrig);
+
+            //上传计算失败状态文件
+            //上传app状态文件
+            commonService.uploadStatusJson(num,SceneStatus.FAILD.code(),
+                    null, null, PayStatus.NOT_PAY.code(),
+                    String.format(UploadFilePath.DATA_VIEW_PATH, num));
+        }
+
+        return exceedSpace;
+    }
+
+    @Override
+    public boolean isExceedSpace(String num, CameraDetail cameraDetail) {
+        //查询权益统计容量的方式
+        Long limit = commonService.getSpaceLimit(cameraDetail);
+
+        if(limit == -1){
+            return false;
+        }
+
+        // TODO: 2023/6/30 现阶段只有按个数统计容量的方式再需要做上传拦截,所以这里暂时只做了统计个数统计
+        //统计场景个数
+        long v4Count = scenePlusService.count(
+                new LambdaQueryWrapper<ScenePlus>()
+                        .eq(ScenePlus::getCameraId, cameraDetail.getCameraId())
+                        .in(ScenePlus::getSceneStatus, SceneStatus.wait.code(), SceneStatus.SUCCESS.code(), SceneStatus.NO_DISPLAY.code()));
+        long V3count = sceneProService.count(new LambdaQueryWrapper<ScenePro>()
+                .eq(ScenePro::getCameraId, cameraDetail.getCameraId())
+                .in(ScenePro::getStatus, SceneStatus.wait.code(), SceneStatus.SUCCESS.code(), SceneStatus.NO_DISPLAY.code())
+                .eq(ScenePro::getIsUpgrade, CommonStatus.NO.code()));
+
+        if(v4Count + V3count < limit){
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public ExceedSpaceScene getByFileIdAndUnicode(long cameraId, String fileId, String unicode) {
+        return this.getOne(new LambdaQueryWrapper<ExceedSpaceScene>()
+                        .eq(ExceedSpaceScene::getCameraId, cameraId)
+                        .eq(ExceedSpaceScene::getFileId, fileId)
+                        .eq(ExceedSpaceScene::getUnicode, unicode));
+    }
+
+    @Override
+    public void repeal(long cameraId, String fileId, String unicode) throws IOException {
+        ExceedSpaceScene scene = this.getByFileIdAndUnicode(cameraId, fileId, unicode);
+        if(Objects.isNull(scene)){
+            return;
+        }
+        this.removeById(scene);
+
+        //删除status.json
+        String statusJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, scene.getNum()).concat("status.json");
+        fYunFileService.deleteFile(statusJsonPath);
+    }
+}

+ 57 - 23
src/main/java/com/fdkankan/contro/service/impl/IFdkkLaserServiceImpl.java

@@ -1,12 +1,18 @@
 package com.fdkankan.contro.service.impl;
 
+import cn.hutool.core.io.FileUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.constant.CommonStatus;
+import com.fdkankan.common.constant.SceneVersionType;
 import com.fdkankan.common.util.DateUtil;
 import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.bean.SyncLaserResultBean;
 import com.fdkankan.contro.entity.Camera;
 import com.fdkankan.contro.entity.ScenePlus;
+import com.fdkankan.contro.entity.ScenePlusExt;
 import com.fdkankan.contro.entity.ScenePro;
 import com.fdkankan.contro.service.IFdkkLaserService;
+import com.fdkankan.contro.service.IScenePlusExtService;
 import com.fdkankan.contro.service.IScenePlusService;
 import com.fdkankan.contro.service.ISceneProService;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
@@ -14,17 +20,18 @@ import com.fdkankan.rabbitmq.util.RabbitMqProducer;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 
+import javax.annotation.Resource;
 import java.io.File;
 import java.io.IOException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
 
 @Service
 @Slf4j
+@RefreshScope
 public class IFdkkLaserServiceImpl implements IFdkkLaserService {
 
     @Autowired
@@ -32,6 +39,8 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
 
     @Autowired
     private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
 
     @Autowired
     private RabbitMqProducer rabbitMqProducer;
@@ -39,6 +48,9 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
     @Value("${queue.application.laser.update-scene}")
     private String updateScene;
 
+    @Value("${queue.application.laser.init-scene:laser-init-scene}")
+    private String initScene;
+
     @Value("${queue.application.laser.update-build-status}")
     private String updateBuildStatus;
 
@@ -51,25 +63,22 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
     @Value("${4dkk.laserService.cloud-point-fyun-path}")
     private String cloudPointFyunPath;
 
-    @Autowired
+    @Resource
     private FYunFileServiceInterface fYunFileService;
 
 
-    public void updateSceneStatus(String sceneCode, int sceneStatus, String path, Date createTime) {
-        Map<String, Object> params = new HashMap<>();
-        params.put("sceneCode", sceneCode);
-        params.put("status", sceneStatus);
-        params.put("version",getSceneVersion(sceneCode));
-        params.put("createTime", DateUtil.date2String(createTime, null));
-        if (!ObjectUtils.isEmpty(path)) {
-            params.put("path", path);
-        }
-        rabbitMqProducer.sendByWorkQueue(updateScene, params);
-    }
-
-    public void syncBuildResult(String sceneNum, String dataSource,Date createTime) {
+    public void syncBuildResult(SyncLaserResultBean laserResultBean) {
         log.info("激光转台相机构建结果 同步 请求 ");
         try {
+            String num = laserResultBean.getNum();
+            String dataSource = laserResultBean.getDataSource();
+            Integer sceneStatus = laserResultBean.getSceneStatus();
+            Date createTime = laserResultBean.getCreateTime();
+            Integer shootCount = laserResultBean.getShootCount();
+            Integer payStatus = laserResultBean.getPayStatus();
+            Boolean mixture = laserResultBean.getMixture() == CommonStatus.NO.code().intValue() ? false : true;
+            String version = SceneVersionType.V4.code();
+
             String jgPath = dataSource;
             //创建目录
             if (dataSource.lastIndexOf("/") != -1) {
@@ -93,9 +102,25 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
             FileUtils.copyDirectiory(dataSource + "/results/mesh", jgPath + "/laserData/mesh");
 
             FileUtils.copyDirectiory(dataSource + "/results/laserData/cover", jgPath + "/extras");
+            //删除旧的深度图
+            if(FileUtil.exist( jgPath+"/laserData/depthmap/")){
+                FileUtil.del(jgPath+"/laserData/depthmap/");
+            }
             FileUtils.copyFile(dataSource + "/results/laserData", jgPath, true);
 
-            updateSceneStatus(sceneNum, 2, jgPath + File.separator + "laserData",createTime);
+//            updateSceneStatus(scenePlus, scenePlusExt, jgPath + File.separator + "laserData",createTime, algorithmTime, scenePlusExt);
+
+            Map<String, Object> params = new HashMap<>();
+            params.put("sceneCode", num);
+            params.put("status", sceneStatus);
+            params.put("version",version);
+            params.put("createTime", DateUtil.date2String(createTime, null));
+            params.put("algorithmTime", DateUtil.date2String(Calendar.getInstance().getTime(), null));
+            params.put("path", jgPath + File.separator + "laserData");
+            params.put("shootCount", shootCount);
+            params.put("payStatus", payStatus);
+            params.put("mixture", mixture);
+            rabbitMqProducer.sendByWorkQueue(updateScene, params);
         } catch (Exception e) {
             log.error("激光转台相机同步失败", e);
         }
@@ -111,7 +136,7 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
     }
 
 
-    public void saveScene(ScenePlus scenePlus, String scenePassword, Camera cameraEntity, String phone, boolean rebuild) {
+    public void saveScene(ScenePlus scenePlus, JSONObject fdageJson, Camera cameraEntity, String phone, boolean rebuild, Integer payStatus) {
         Map<String, Object> params = new HashMap<>();
         params.put("childName", cameraEntity.getChildName());
         params.put("createTime", DateUtil.date2String(scenePlus.getCreateTime(), null));
@@ -120,17 +145,24 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
         params.put("snCode", cameraEntity.getSnCode());
         params.put("status", scenePlus.getSceneStatus());
         if (!rebuild) {
-            params.put("password", scenePassword);
+            if(Objects.nonNull(fdageJson)){
+                params.put("password", fdageJson.getString("pwd"));
+            }
         } else {
             params.put("status", 4);
         }
         params.put("version",getSceneVersion(scenePlus.getNum()));
         params.put("title", scenePlus.getTitle());
         params.put("userId", scenePlus.getUserId());
-        rabbitMqProducer.sendByWorkQueue(updateScene, params);
+        params.put("sceneSource", scenePlus.getSceneSource());
+        if(Objects.nonNull(fdageJson)){
+            params.put("location", fdageJson.getInteger("location"));
+        }
+        params.put("payStatus", payStatus);
+        rabbitMqProducer.sendByWorkQueue(initScene, params);
     }
 
-    public void saveScene(ScenePro scenePro, String scenePassword, Camera cameraEntity, String phone, boolean rebuild) {
+    public void saveScene(ScenePro scenePro, String scenePassword, Camera cameraEntity, String phone, boolean rebuild, Integer payStatus) {
         Map<String, Object> params = new HashMap<>();
         params.put("childName", cameraEntity.getChildName());
         if(ObjectUtils.isEmpty(scenePro.getCreateTime())){
@@ -149,7 +181,8 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
         params.put("version",getSceneVersion(scenePro.getNum()));
         params.put("title", scenePro.getSceneName());
         params.put("userId", scenePro.getUserId());
-        rabbitMqProducer.sendByWorkQueue(updateScene, params);
+        params.put("payStatus", payStatus);
+        rabbitMqProducer.sendByWorkQueue(initScene, params);
     }
 
     private String getSceneVersion(String num) {
@@ -177,6 +210,7 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
         }
 
         // 上传点云编辑文件,并通知激光系统
+        log.info("开始上传点云文件,bucket:{}", bucket);
         fYunFileService.uploadFile(bucket,path + "/results/laserData/vision_edit.txt", String.format(cloudPointFyunPath,sceneCode,sceneCode) + "vision_edit.txt");
         fYunFileService.uploadFileByCommand(bucket,path + "/results/laserData/uuidcloud", String.format(cloudPointFyunPath,sceneCode,sceneCode) + "uuidcloud");
 

+ 339 - 0
src/main/java/com/fdkankan/contro/service/impl/InnerServiceImpl.java

@@ -0,0 +1,339 @@
+package com.fdkankan.contro.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.http.ContentType;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.constant.*;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.bean.SyncLaserResultBean;
+import com.fdkankan.contro.constant.UserEditDataType;
+import com.fdkankan.contro.entity.*;
+import com.fdkankan.contro.service.*;
+import com.fdkankan.fyun.config.FYunFileConfig;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFileName;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.model.enums.ModelTypeEnums;
+import com.fdkankan.model.utils.CreateHouseJsonUtil;
+import com.fdkankan.model.utils.SceneUtil;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.http.HttpHeaders;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+
+@Service
+public class InnerServiceImpl implements IInnerService {
+
+    @Value("${model.type:#{null}}")
+    private String modelType;
+
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private ICommonService commonService;
+    @Resource
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private IFdkkLaserService fdkkLaserService;
+    @Autowired
+    private ICameraDetailService cameraDetailService;
+    @Autowired
+    private ICompanyService companyService;
+    @Resource
+    private FYunFileConfig fYunFileConfig;
+
+    @Override
+    public void uploadArtificialResult(String num) throws Exception {
+
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+        if(Objects.isNull(scenePlus)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+
+        String path = scenePlusExt.getDataSource();
+
+        JSONObject fdageData = commonService.getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
+
+        Integer cameraType = 10;
+        if(scenePlus.getSceneSource() == SceneSource.ZT.code()){
+            cameraType = 13;
+        }else{
+            cameraType = 14;
+        }
+
+        Map<String, String> uploadFiles = commonService.getUploadFiles(scenePlus,path,cameraType,fdageData);
+
+        scenePlus.setPayStatus(PayStatus.PAY.code());
+        scenePlus.setUpdateTime(new Date());
+        scenePlus.setSceneStatus(SceneStatus.NO_DISPLAY.code());
+
+        Integer videoVersion = fdageData.getInteger("videoVersion");
+        //读取计算结果文件生成videosJson
+        JSONObject videosJson = commonService.getVideosJson(path, videoVersion, num, cameraType);
+
+        boolean isObj = fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1;
+
+        //上传全景图俯视图
+        this.uploadFloorCad(path, num, uploadFiles);
+
+        //由于3dtiles算法mesh文件发生变化,所以这里需要先清除一下oss的mesh目录,避免存在旧算法obj文件
+        fYunFileService.deleteFolder(String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh");
+        fYunFileService.deleteFolder(String.format(UploadFilePath.IMG_VIEW_PATH,  num) + ModelKind.THREE_D_TILE.code());
+        //上传文件
+        fYunFileService.uploadMulFiles(uploadFiles);
+
+        //修改oss上dam的内容编码
+        Map<String,String> damFileHeaders = new HashMap<>();
+        damFileHeaders.put("Content-Encoding","gzip");
+        String damPath = path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam";
+        fYunFileService.uploadFile(damPath,  String.format(UploadFilePath.IMG_VIEW_PATH, num) + ConstantFileName.modelUUID + "_50k.dam", damFileHeaders);
+
+        //拷贝部分文件到编辑目录,用于用户编辑
+        this.copyToEditDir(num);
+
+        //计算完毕后,同步全景图到缓存目录
+//            this.cachePanorama(path, sceneCode);
+
+        //生成houseTypejson并上传
+        boolean existHouseType = this.uploadHouseTypeJson(num, path);
+        scenePlus.setHouseType(existHouseType ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code().intValue());
+
+        //生成floorpan.json
+        commonService.uploadFloorplanJson(num, path);
+
+        //重置异步操作记录
+        commonService.removeSceneAsynOperLog(num);
+
+        //清除用户编辑业务数据
+        Set<String> bizs = new HashSet<>();
+        bizs.add(UserEditDataType.BOX_MODEL.message());
+        bizs.add(UserEditDataType.FLOORPLAN.message());
+        bizs.add(UserEditDataType.FILTERS.message());
+        commonService.initUserEditData(num, bizs, null);
+
+        //上传计算结果文件
+        commonService.uploadBuildResultData(num, path, SceneVersionType.V4.code());
+
+        //容量统计
+        Long space = commonService.getSpace(num);
+
+        //写入数据库
+        this.updateDbPlus(scenePlus.getSceneSource(), space, videosJson.toJSONString(), 0L,isObj,scenePlusExt);
+
+        Object[] editInfoArr = commonService.updateEditInfo(scenePlus);
+        SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
+        SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
+        SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
+
+        //更新场景主表
+        //如果相机容量不足,需要把场景的paystatus改为容量不足状态
+        scenePlus.setPayStatus(commonService.getPayStatus(scenePlus.getCameraId(), space));
+        //统计原始资源大小
+        scenePlusExt.setOrigSpace(FileUtil.size(new File(path.concat(File.separator).concat("capture"))));
+
+        if (cameraType == 14) {
+            //计算成功  激光转台相机 同步 请求
+            fdkkLaserService.syncBuildResult(
+                    SyncLaserResultBean.builder()
+                            .num(num).dataSource(path)
+                            .sceneStatus(2)
+                            .createTime(scenePlus.getCreateTime())
+                            .shootCount(scenePlusExt.getShootCount())
+                            .payStatus(scenePlus.getPayStatus())
+                            .mixture(scenePlusExt.getMixture())
+                            .version(SceneVersionType.V4.code()).build());
+            sceneEditControls.setShowMap(0);
+        } else if (new File(path + "/results/laserData/vision_edit.txt").exists()) {
+            fdkkLaserService.cloudPointBuild(num,path);
+        }
+
+
+        CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
+        Company company = !ObjectUtils.isEmpty(cameraDetail.getCompanyId()) ? companyService.getById(cameraDetail.getCompanyId()) : null;
+        //写scene.json
+        commonService.writeSceneJson(num,sceneEditInfo, sceneEditInfoExt, sceneEditControls, scenePlus,scenePlusExt,company);
+
+        this.uploadStatusJson(scenePlus, scenePlusExt);
+
+        scenePlusService.updateById(scenePlus);
+        scenePlusExtService.updateById(scenePlusExt);
+    }
+
+    private void uploadStatusJson(ScenePlus scenePlus, ScenePlusExt scenePlusExt){
+        String num = scenePlus.getNum();
+        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
+
+        Integer status = 1;
+        if(scenePlus.getSceneSource() == 4 || scenePlus.getSceneSource() == 5){//如果是激光场景,需要激光系统那边完全处理好之后再发mq通知更新状态
+            status = 0;
+        }
+
+        // 上传status JSON.
+        JSONObject statusJson = new JSONObject();
+        //临时将-2改成1,app还没完全更新
+        statusJson.put("status", status);
+        statusJson.put("webSite", scenePlusExt.getWebSite());
+        statusJson.put("sceneNum", num);
+        statusJson.put("thumb", scenePlusExt.getThumb());
+        statusJson.put("payStatus", scenePlus.getPayStatus());
+        statusJson.put("sceneScheme", scenePlusExt.getSceneScheme());
+        FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJson.toString());
+
+        Map<String,String> headers = new HashMap<>();
+        headers.put(HttpHeaders.CONTENT_TYPE, ContentType.JSON.getValue());
+        fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", dataViewPath + "status.json", headers);
+    }
+
+    private void uploadFloorCad(String path, String num, Map<String, String> uploadFiles){
+
+        //户型图上传
+        String  dataViewPath = UploadFilePath.DATA_VIEW_PATH + "floor-cad-%s.%s";
+        String floorCadPath = path + "/results/floorplan_cad";
+        List<String> floorCadList = FileUtils.getFileList(floorCadPath);
+        if(CollUtil.isNotEmpty(floorCadList)){
+            floorCadList.stream().forEach(str->{
+                String substring = str.substring(str.lastIndexOf(File.separator) + 1);
+                String[] arr = substring.split("floor");
+                String[] arr2 = arr[1].split("\\.");
+                uploadFiles.put(str, String.format(dataViewPath, num, arr2[0], arr2[1]));
+            });
+        }
+
+    }
+
+    private void copyToEditDir(String num) throws IOException {
+
+        String editImagesPath = String.format(UploadFilePath.IMG_EDIT_PATH, num);
+        String viewImagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
+
+        String editDataPath = String.format(UploadFilePath.DATA_EDIT_PATH, num);
+        String viewDataPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
+
+        Map<String, String> map = new HashMap<>();
+        map.put(editImagesPath + "vision.modeldata", viewImagesPath + "vision.modeldata");
+        map.put(editImagesPath + "vision2.modeldata", viewImagesPath + "vision2.modeldata");
+        map.put(editDataPath + "floorplan_cad.json", viewDataPath + "floorplan_cad.json");
+
+        for (Map.Entry<String, String> entry : map.entrySet()) {
+            fYunFileService.copyFileInBucket(entry.getValue(), entry.getKey());
+        }
+    }
+
+    public boolean uploadHouseTypeJson(String num, String dataSource) {
+        String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
+        if (!new File(floorPlanCardFilePath).exists()) {
+            return false;
+        }
+        JSONObject json = CreateHouseJsonUtil.createHouseTypeJsonByCad(floorPlanCardFilePath);
+        if(Objects.isNull(json)){
+            return false;
+        }
+        String hourseTypeJsonPath = String.format(UploadFilePath.USER_VIEW_PATH, num) + "houseType.json";
+        fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
+        hourseTypeJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "houseType.json";
+        fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
+
+        return true;
+    }
+
+    private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
+
+        scenePlusExt.setSpace(space);
+        scenePlusExt.setComputeTime(computeTime.toString());
+        scenePlusExt.setAlgorithmTime(new Date());
+        scenePlusExt.setVideos(videosJson);
+        scenePlusExt.setIsObj(isObj ? 1 : 0);
+
+        if(ModelTypeEnums.TILE_CODE.equals(modelType)){
+            scenePlusExt.setSceneScheme(3);
+        }
+
+        switch (SceneSource.get(sceneSource)){
+            case BM:
+                scenePlusExt.setSceneResolution(SceneResolution.two_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.PRO.code());
+                break;
+            case SM:
+                scenePlusExt.setSceneResolution(SceneResolution.one_k.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LITE.code());
+                break;
+            case ZT:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.MINION.code());
+                break;
+            case JG:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
+                break;
+            case SG:
+                scenePlusExt.setSceneResolution(SceneResolution.four_K.code());
+                scenePlusExt.setSceneFrom(SceneFrom.LASER.code());
+                break;
+        }
+
+        String sceneKind = scenePlusExt.getSceneScheme() == 3 ? SceneKind.FACE.code():SceneKind.TILES.code();
+        scenePlusExt.setSceneKind(sceneKind);
+//        scenePlusExt.setModelKind(modelKind);
+
+        //统计点位数量
+        Map<String, Integer> result = this.getShootCount(scenePlusExt);
+        Integer shootCount = result.get("shootCount");
+        Integer mixture = result.get("mixture");
+        scenePlusExt.setShootCount(shootCount);
+        scenePlusExt.setMixture(mixture);
+
+        scenePlusExtService.updateById(scenePlusExt);
+    }
+
+    private Map<String, Integer> getShootCount(ScenePlusExt scenePlusExt){
+
+        Map<String, Integer> result = new HashMap<>();
+
+        Integer shootCount = 0;
+        Integer mixture = Objects.isNull(scenePlusExt.getMixture()) ? 0 : scenePlusExt.getMixture();
+        String homePath = SceneUtil.getHomePath(scenePlusExt.getDataSource());
+        JSONObject dataFdageObj = JSON.parseObject(fYunFileService.getFileContent(homePath.concat("data.fdage")));
+        if(Objects.nonNull(dataFdageObj)){
+            JSONArray points = dataFdageObj.getJSONArray("points");
+            if(CollUtil.isNotEmpty(points)){
+                shootCount = points.size();
+            }
+        }
+        if(Objects.nonNull(shootCount) && shootCount > 0){
+            if(Objects.nonNull(scenePlusExt.getLocation()) && scenePlusExt.getLocation() == 6){
+                mixture = CommonStatus.YES.code().intValue();
+            }
+        }else{
+            String slamDataStr = fYunFileService.getFileContent(homePath.concat("slam_data.json"));
+            JSONObject slamDataObj = JSON.parseObject(slamDataStr);
+            if(Objects.nonNull(slamDataObj)){
+                JSONArray viewsInfo = slamDataObj.getJSONArray("views_info");
+                if(CollUtil.isNotEmpty(viewsInfo)){
+                    shootCount = viewsInfo.stream().mapToInt(info -> {
+                        return  ((JSONObject) info).getJSONArray("list_pose").size();
+                    }).sum();
+                }
+            }
+            mixture = CommonStatus.NO.code().intValue();
+        }
+
+        result.put("shootCount", shootCount);
+        result.put("mixture", mixture);
+
+        return result;
+    }
+}

+ 60 - 0
src/main/java/com/fdkankan/contro/service/impl/IntermitSceneServiceImpl.java

@@ -0,0 +1,60 @@
+package com.fdkankan.contro.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.constant.CommonSuccessStatus;
+import com.fdkankan.contro.entity.Camera;
+import com.fdkankan.contro.entity.SSOUser;
+import com.fdkankan.contro.entity.ScenePlus;
+import com.fdkankan.contro.entity.ScenePlusExt;
+import com.fdkankan.contro.service.*;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+@Service
+public class IntermitSceneServiceImpl implements IntermitSceneService {
+
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private IUserService userService;
+    @Autowired
+    private ICameraService cameraService;
+    @Autowired
+    private RabbitMqProducer mqProducer;
+
+    @Override
+    public void sendMq(String num, JSONObject fdageData, int status) {
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+
+        String phoneNum = null;
+        if(Objects.nonNull(scenePlus.getUserId())){
+            SSOUser user = userService.getSSOUserByUserId(scenePlus.getUserId());
+            phoneNum = user.getUserName();
+        }
+        Camera camera = cameraService.getById(scenePlus.getCameraId());
+        Map<String, Object> params = new HashMap<>();
+        params.put("sceneCode", num);
+        params.put("location", fdageData.getInteger("location"));
+        params.put("algorithmTime", scenePlusExt.getAlgorithmTime());
+        params.put("snCode", camera.getSnCode());
+        params.put("userId", scenePlus.getUserId());
+        params.put("phoneNum", phoneNum);
+        params.put("status", status);
+        params.put("sceneName", scenePlus.getTitle());
+        params.put("pwd", fdageData.getString("pwd"));
+        params.put("shootCount", fdageData.getJSONArray("points").size());
+        params.put("gps", fdageData.getJSONObject("gps"));
+        params.put("createTime", scenePlus.getCreateTime());
+        params.put("sceneSource", 6);//代表断续拍摄场景(全景看看系统用)
+        params.put("payStatus", scenePlus.getPayStatus());
+        mqProducer.sendByWorkQueue("queue-pano-scene", params);
+    }
+}

+ 20 - 0
src/main/java/com/fdkankan/contro/service/impl/MqSendLogServiceImpl.java

@@ -0,0 +1,20 @@
+package com.fdkankan.contro.service.impl;
+
+import com.fdkankan.contro.entity.MqSendLog;
+import com.fdkankan.contro.mapper.IMqSendLogMapper;
+import com.fdkankan.contro.service.IMqSendLogService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2024-03-27
+ */
+@Service
+public class MqSendLogServiceImpl extends ServiceImpl<IMqSendLogMapper, MqSendLog> implements IMqSendLogService {
+
+}

+ 11 - 3
src/main/java/com/fdkankan/contro/service/impl/Scene3dNumServiceImpl.java

@@ -8,9 +8,11 @@ import com.fdkankan.common.constant.CommonStatus;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.util.RandomUtil;
+import com.fdkankan.contro.entity.CameraType;
 import com.fdkankan.contro.entity.Scene3dNum;
 import com.fdkankan.contro.enums.CameraTypeEnum;
 import com.fdkankan.contro.mapper.IScene3dNumMapper;
+import com.fdkankan.contro.service.ICameraTypeService;
 import com.fdkankan.contro.service.IScene3dNumService;
 import com.fdkankan.dingtalk.DingTalkSendUtils;
 import com.fdkankan.redis.constant.RedisKey;
@@ -67,6 +69,8 @@ public class Scene3dNumServiceImpl extends ServiceImpl<IScene3dNumMapper, Scene3
 
     @Autowired
     private DingTalkSendUtils dingTalkSendUtils;
+    @Autowired
+    private ICameraTypeService cameraTypeService;
 
     @Override
     public String generateSceneNum(Integer cameraType) throws Exception {
@@ -123,11 +127,15 @@ public class Scene3dNumServiceImpl extends ServiceImpl<IScene3dNumMapper, Scene3
         }
     }
 
-    private  static  String addPrefix( String num,Integer cameraType){
-        if(cameraType == null){
+    private  String addPrefix(String num,Integer camType){
+        if(camType == null){
+            return num;
+        }
+        CameraType cameraType = cameraTypeService.getByCamType(camType);
+        if(Objects.isNull(cameraType)){
             return num;
         }
-        return CameraTypeEnum.getSceneNumPrefixByType(cameraType) + num;
+        return cameraType.getScenePrefix() + num;
     }
 
     @Override

+ 43 - 21
src/main/java/com/fdkankan/contro/service/impl/SceneBuildProcessLogServiceImpl.java

@@ -1,12 +1,15 @@
 package com.fdkankan.contro.service.impl;
 
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fdkankan.contro.entity.SceneBuildProcessLog;
 import com.fdkankan.contro.mapper.ISceneBuildProcessLogMapper;
 import com.fdkankan.contro.service.ISceneBuildProcessLogService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
 import java.util.Objects;
 
 /**
@@ -14,37 +17,56 @@ import java.util.Objects;
  * 场景计算流程状态表 服务实现类
  * </p>
  *
- * @author 
+ * @author
  * @since 2023-01-28
  */
+@Slf4j
 @Service
 public class SceneBuildProcessLogServiceImpl extends ServiceImpl<ISceneBuildProcessLogMapper, SceneBuildProcessLog> implements ISceneBuildProcessLogService {
 
 
     @Override
-    public void clearSceneBuildProcessLog(String num, String process, String queueName) {
-        this.remove(new LambdaQueryWrapper<SceneBuildProcessLog>()
-                .eq(SceneBuildProcessLog::getNum, num)
-                .eq(SceneBuildProcessLog::getProcess, process)
-                .eq(SceneBuildProcessLog::getQueueName, queueName));
+    public void clearSceneBuildProcessLog(String num, String process, String queueName, String bizType) {
+        try {
+            LambdaQueryWrapper<SceneBuildProcessLog> wrapper = new LambdaQueryWrapper<SceneBuildProcessLog>()
+                    .eq(SceneBuildProcessLog::getNum, num)
+                    .eq(SceneBuildProcessLog::getProcess, process);
+            if(StrUtil.isNotEmpty(bizType)){
+                wrapper.eq(SceneBuildProcessLog::getBizType, bizType);
+            }
+            this.remove(wrapper);
+        }catch (Exception e){
+            log.error("清楚计算流程日志报错", e);
+        }
     }
 
     @Override
-    public void saveSceneBuildProcessLog(String num, String process, String queueName, int status, String reason) {
-
-        SceneBuildProcessLog log = this.getOne(new LambdaQueryWrapper<SceneBuildProcessLog>()
-                .eq(SceneBuildProcessLog::getNum, num)
-                .eq(SceneBuildProcessLog::getProcess,process)
-                .eq(SceneBuildProcessLog::getQueueName, queueName));
-        if(Objects.isNull(log)){
-            log = new SceneBuildProcessLog();
+    public void saveSceneBuildProcessLog(String num, String process, String queueName, int status, String reason, String bizType) {
+        try {
+            LambdaQueryWrapper<SceneBuildProcessLog> wrapper = new LambdaQueryWrapper<SceneBuildProcessLog>()
+                    .eq(SceneBuildProcessLog::getNum, num)
+                    .eq(SceneBuildProcessLog::getProcess, process)
+                    .eq(SceneBuildProcessLog::getQueueName, queueName);
+            if(StrUtil.isNotEmpty(bizType)){
+                wrapper.eq(SceneBuildProcessLog::getBizType, bizType);
+            }
+
+            SceneBuildProcessLog log = this.getOne(wrapper);
+            if(Objects.isNull(log)){
+                log = new SceneBuildProcessLog();
+            }
+            log.setNum(num);
+            log.setProcess(process);
+            log.setProcess(process);
+            log.setQueueName(queueName);
+            log.setState(status);
+            log.setReason(reason);
+            log.setUpdateTime(new Date());
+            log.setBizType(bizType);
+            this.saveOrUpdate(log);
+        }catch (Exception e){
+            log.error("保存计算流程日志报错", e);
         }
-        log.setNum(num);
-        log.setProcess(process);
-        log.setProcess(process);
-        log.setQueueName(queueName);
-        log.setState(status);
-        log.setReason(reason);
-        this.saveOrUpdate(log);
+
     }
 }

+ 29 - 0
src/main/java/com/fdkankan/contro/service/impl/SceneCleanOrigServiceImpl.java

@@ -0,0 +1,29 @@
+package com.fdkankan.contro.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.contro.entity.SceneCleanOrig;
+import com.fdkankan.contro.mapper.ISceneCleanOrigMapper;
+import com.fdkankan.contro.service.ISceneCleanOrigService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ * 删除oss原始资源记录 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2023-04-17
+ */
+@Service
+public class SceneCleanOrigServiceImpl extends ServiceImpl<ISceneCleanOrigMapper, SceneCleanOrig> implements ISceneCleanOrigService {
+
+    @Override
+    public List<SceneCleanOrig> lisByNumAfterLastCall(String num, Date lastCallTime) {
+        return this.list(new LambdaQueryWrapper<SceneCleanOrig>().eq(SceneCleanOrig::getNum, num).gt(SceneCleanOrig::getCreateTime, lastCallTime));
+    }
+
+}

+ 32 - 0
src/main/java/com/fdkankan/contro/service/impl/SceneColdStorageLogServiceImpl.java

@@ -0,0 +1,32 @@
+package com.fdkankan.contro.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.contro.entity.SceneCleanOrig;
+import com.fdkankan.contro.entity.SceneColdStorageLog;
+import com.fdkankan.contro.mapper.ISceneColdStorageLogMapper;
+import com.fdkankan.contro.service.ISceneColdStorageLogService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ * 场景冷归档日志表 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2023-07-14
+ */
+@Service
+public class SceneColdStorageLogServiceImpl extends ServiceImpl<ISceneColdStorageLogMapper, SceneColdStorageLog> implements ISceneColdStorageLogService {
+
+    @Override
+    public List<SceneColdStorageLog> listFreezeByNumAfterLastCall(String num, Date lastCallTime) {
+        return this.list(new LambdaQueryWrapper<SceneColdStorageLog>()
+                .eq(SceneColdStorageLog::getNum, num)
+                .eq(SceneColdStorageLog::getType, 1)
+                .gt(SceneColdStorageLog::getCreateTime, lastCallTime));
+    }
+}

+ 63 - 0
src/main/java/com/fdkankan/contro/service/impl/SceneColdStorageServiceImpl.java

@@ -0,0 +1,63 @@
+package com.fdkankan.contro.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.common.constant.CommonStatus;
+import com.fdkankan.common.constant.CommonSuccessStatus;
+import com.fdkankan.contro.entity.SceneColdStorage;
+import com.fdkankan.contro.entity.SceneColdStorageLog;
+import com.fdkankan.contro.mapper.ISceneColdStorageMapper;
+import com.fdkankan.contro.service.ISceneColdStorageLogService;
+import com.fdkankan.contro.service.ISceneColdStorageService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.model.utils.SceneUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Objects;
+
+/**
+ * <p>
+ * 场景封存状态表 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2023-07-25
+ */
+@Service
+public class SceneColdStorageServiceImpl extends ServiceImpl<ISceneColdStorageMapper, SceneColdStorage> implements ISceneColdStorageService {
+
+    @Autowired
+    private ISceneColdStorageLogService sceneColdStorageLogService;
+
+    @Override
+    public void unfreeze(String num, String reason, String dataSource) {
+
+        //修改封存状态
+        SceneColdStorage sceneColdStorage = this.getByNum(num);
+        if(Objects.isNull(sceneColdStorage) || sceneColdStorage.getState() == 2){//如果是解冻状态就无需再记录解冻日志
+            return;
+        }
+        if(Objects.isNull(sceneColdStorage)){
+            sceneColdStorage = new SceneColdStorage();
+        }
+        sceneColdStorage.setState(2);
+        this.saveOrUpdate(sceneColdStorage);
+
+        //插入日志表
+        SceneColdStorageLog sceneColdStorageLog = new SceneColdStorageLog();
+        sceneColdStorageLog.setNum(num);
+        sceneColdStorageLog.setPath(SceneUtil.getHomePath(dataSource));
+        sceneColdStorageLog.setState(CommonSuccessStatus.SUCCESS.code());
+        sceneColdStorageLog.setReason(reason);
+        sceneColdStorageLog.setType(2);
+        sceneColdStorageLogService.save(sceneColdStorageLog);
+
+
+    }
+
+    @Override
+    public SceneColdStorage getByNum(String num) {
+        return this.getOne(new LambdaQueryWrapper<SceneColdStorage>().eq(SceneColdStorage::getNum, num));
+    }
+}

+ 0 - 0
src/main/java/com/fdkankan/contro/service/impl/SceneCopyLogServiceImpl.java


Some files were not shown because too many files changed in this diff