浏览代码

Merge branch 'release' into project-jmga-test

# Conflicts:
#	src/main/java/com/fdkankan/contro/controller/SceneFileController.java
#	src/main/java/com/fdkankan/contro/entity/IncrementType.java
#	src/main/java/com/fdkankan/contro/entity/UserIncrement.java
#	src/main/java/com/fdkankan/contro/generate/AutoGenerate.java
#	src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java
#	src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java
#	src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java
#	src/main/java/com/fdkankan/contro/schedule/ScheduleJob.java
#	src/main/java/com/fdkankan/contro/service/IFdkkLaserService.java
#	src/main/java/com/fdkankan/contro/service/ISceneFileBuildService.java
#	src/main/java/com/fdkankan/contro/service/IScenePlusService.java
#	src/main/java/com/fdkankan/contro/service/ISceneProService.java
#	src/main/java/com/fdkankan/contro/service/impl/BuildSceneDTServiceImpl.java
#	src/main/java/com/fdkankan/contro/service/impl/FdkkV4Service.java
#	src/main/java/com/fdkankan/contro/service/impl/IFdkkLaserServiceImpl.java
#	src/main/java/com/fdkankan/contro/service/impl/Scene3dNumServiceImpl.java
#	src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java
#	src/main/java/com/fdkankan/contro/service/impl/ScenePlusServiceImpl.java
#	src/main/java/com/fdkankan/contro/service/impl/SceneProServiceImpl.java
#	src/main/java/com/fdkankan/contro/service/impl/UserIncrementServiceImpl.java
dsx 2 年之前
父节点
当前提交
de449371ca
共有 100 个文件被更改,包括 6054 次插入586 次删除
  1. 36 0
      pom.xml
  2. 57 31
      src/main/java/com/fdkankan/contro/bean/SceneJsonBean.java
  3. 2 0
      src/main/java/com/fdkankan/contro/constant/RedisConstants.java
  4. 40 0
      src/main/java/com/fdkankan/contro/constant/UserEditDataType.java
  5. 21 0
      src/main/java/com/fdkankan/contro/controller/SceneCleanOrigController.java
  6. 21 0
      src/main/java/com/fdkankan/contro/controller/SceneCopyLogController.java
  7. 65 2
      src/main/java/com/fdkankan/contro/controller/SceneFileController.java
  8. 34 0
      src/main/java/com/fdkankan/contro/controller/TestController.java
  9. 3 0
      src/main/java/com/fdkankan/contro/entity/CameraDetail.java
  10. 4 0
      src/main/java/com/fdkankan/contro/entity/Company.java
  11. 75 0
      src/main/java/com/fdkankan/contro/entity/ExceedSpaceScene.java
  12. 99 0
      src/main/java/com/fdkankan/contro/entity/IncrementType.java
  13. 90 0
      src/main/java/com/fdkankan/contro/entity/MailTemplate.java
  14. 1 1
      src/main/java/com/fdkankan/contro/entity/Scene3dNum.java
  15. 105 0
      src/main/java/com/fdkankan/contro/entity/SceneAsynOperLog.java
  16. 81 0
      src/main/java/com/fdkankan/contro/entity/SceneBuildProcessLog.java
  17. 69 0
      src/main/java/com/fdkankan/contro/entity/SceneCleanOrig.java
  18. 72 0
      src/main/java/com/fdkankan/contro/entity/SceneColdStorage.java
  19. 81 0
      src/main/java/com/fdkankan/contro/entity/SceneColdStorageLog.java
  20. 69 0
      src/main/java/com/fdkankan/contro/entity/SceneCopyDistinctEnv.java
  21. 51 0
      src/main/java/com/fdkankan/contro/entity/SceneCopyLog.java
  22. 24 0
      src/main/java/com/fdkankan/contro/entity/SceneEditControls.java
  23. 18 0
      src/main/java/com/fdkankan/contro/entity/SceneEditInfo.java
  24. 30 1
      src/main/java/com/fdkankan/contro/entity/SceneEditInfoExt.java
  25. 6 0
      src/main/java/com/fdkankan/contro/entity/ScenePlus.java
  26. 8 2
      src/main/java/com/fdkankan/contro/entity/ScenePlusExt.java
  27. 81 0
      src/main/java/com/fdkankan/contro/entity/UserIncrement.java
  28. 4 0
      src/main/java/com/fdkankan/contro/factory/DemoFactory.java
  29. 65 0
      src/main/java/com/fdkankan/contro/factory/UserEditData/BoxModelHandler.java
  30. 60 0
      src/main/java/com/fdkankan/contro/factory/UserEditData/FloorplanHandler.java
  31. 9 0
      src/main/java/com/fdkankan/contro/factory/UserEditData/UserEditDataHandler.java
  32. 9 0
      src/main/java/com/fdkankan/contro/factory/UserEditData/UserEditDataHandlerFactory.java
  33. 18 0
      src/main/java/com/fdkankan/contro/mapper/IExceedSpaceSceneMapper.java
  34. 18 0
      src/main/java/com/fdkankan/contro/mapper/IMailTemplateMapper.java
  35. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneAsynOperLogMapper.java
  36. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneBuildProcessLogMapper.java
  37. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneCleanOrigMapper.java
  38. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneColdStorageLogMapper.java
  39. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneColdStorageMapper.java
  40. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneCopyDistinctEnvMapper.java
  41. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneCopyLogMapper.java
  42. 63 9
      src/main/java/com/fdkankan/contro/mq/listener/AbstrackBuildSceneListener.java
  43. 67 0
      src/main/java/com/fdkankan/contro/mq/listener/BuildSceneProcessLogListener.java
  44. 1 1
      src/main/java/com/fdkankan/contro/mq/service/IBuildSceneService.java
  45. 316 0
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java
  46. 275 130
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java
  47. 600 0
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java
  48. 1 1
      src/main/java/com/fdkankan/contro/service/ICameraDetailService.java
  49. 2 0
      src/main/java/com/fdkankan/contro/service/ICameraService.java
  50. 42 0
      src/main/java/com/fdkankan/contro/service/ICommonService.java
  51. 29 0
      src/main/java/com/fdkankan/contro/service/IExceedSpaceSceneService.java
  52. 28 0
      src/main/java/com/fdkankan/contro/service/IFdkkLaserService.java
  53. 16 0
      src/main/java/com/fdkankan/contro/service/IMailTemplateService.java
  54. 3 1
      src/main/java/com/fdkankan/contro/service/IScene3dNumService.java
  55. 16 0
      src/main/java/com/fdkankan/contro/service/ISceneAsynOperLogService.java
  56. 20 0
      src/main/java/com/fdkankan/contro/service/ISceneBuildProcessLogService.java
  57. 21 0
      src/main/java/com/fdkankan/contro/service/ISceneCleanOrigService.java
  58. 22 0
      src/main/java/com/fdkankan/contro/service/ISceneColdStorageLogService.java
  59. 20 0
      src/main/java/com/fdkankan/contro/service/ISceneColdStorageService.java
  60. 16 0
      src/main/java/com/fdkankan/contro/service/ISceneCopyDistinctEnvService.java
  61. 22 0
      src/main/java/com/fdkankan/contro/service/ISceneCopyLogService.java
  62. 1 1
      src/main/java/com/fdkankan/contro/service/ISceneFileBuildService.java
  63. 3 0
      src/main/java/com/fdkankan/contro/service/IScenePlusExtService.java
  64. 1 2
      src/main/java/com/fdkankan/contro/service/IScenePlusService.java
  65. 22 0
      src/main/java/com/fdkankan/contro/service/ISceneProService.java
  66. 75 0
      src/main/java/com/fdkankan/contro/service/impl/BuildSceneDTServiceImpl.java
  67. 7 10
      src/main/java/com/fdkankan/contro/service/impl/CameraDetailServiceImpl.java
  68. 14 0
      src/main/java/com/fdkankan/contro/service/impl/CameraServiceImpl.java
  69. 337 0
      src/main/java/com/fdkankan/contro/service/impl/CommonServiceImpl.java
  70. 134 0
      src/main/java/com/fdkankan/contro/service/impl/ExceedSpaceSceneServiceImpl.java
  71. 66 0
      src/main/java/com/fdkankan/contro/service/impl/FdkkV4Service.java
  72. 189 0
      src/main/java/com/fdkankan/contro/service/impl/IFdkkLaserServiceImpl.java
  73. 20 0
      src/main/java/com/fdkankan/contro/service/impl/MailTemplateServiceImpl.java
  74. 61 37
      src/main/java/com/fdkankan/contro/service/impl/Scene3dNumServiceImpl.java
  75. 20 0
      src/main/java/com/fdkankan/contro/service/impl/SceneAsynOperLogServiceImpl.java
  76. 50 0
      src/main/java/com/fdkankan/contro/service/impl/SceneBuildProcessLogServiceImpl.java
  77. 29 0
      src/main/java/com/fdkankan/contro/service/impl/SceneCleanOrigServiceImpl.java
  78. 32 0
      src/main/java/com/fdkankan/contro/service/impl/SceneColdStorageLogServiceImpl.java
  79. 63 0
      src/main/java/com/fdkankan/contro/service/impl/SceneColdStorageServiceImpl.java
  80. 20 0
      src/main/java/com/fdkankan/contro/service/impl/SceneCopyDistinctEnvServiceImpl.java
  81. 37 0
      src/main/java/com/fdkankan/contro/service/impl/SceneCopyLogServiceImpl.java
  82. 1258 330
      src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java
  83. 2 0
      src/main/java/com/fdkankan/contro/service/impl/ScenePlusExtServiceImpl.java
  84. 66 15
      src/main/java/com/fdkankan/contro/service/impl/ScenePlusServiceImpl.java
  85. 61 0
      src/main/java/com/fdkankan/contro/service/impl/SceneProServiceImpl.java
  86. 44 0
      src/main/java/com/fdkankan/contro/service/impl/UserIncrementServiceImpl.java
  87. 8 0
      src/main/java/com/fdkankan/contro/vo/SceneEditControlsVO.java
  88. 5 5
      src/main/resources/bootstrap-dev.yml
  89. 9 6
      src/main/resources/bootstrap-pro.yml
  90. 9 1
      src/main/resources/bootstrap-test.yml
  91. 239 0
      src/main/resources/logback-nacos.xml
  92. 5 0
      src/main/resources/mapper/contro/ExceedSpaceSceneMapper.xml
  93. 5 0
      src/main/resources/mapper/contro/MailTemplateMapper.xml
  94. 5 0
      src/main/resources/mapper/contro/SceneAsynOperLogMapper.xml
  95. 5 0
      src/main/resources/mapper/contro/SceneBuildProcessLogMapper.xml
  96. 5 0
      src/main/resources/mapper/contro/SceneCleanOrigMapper.xml
  97. 5 0
      src/main/resources/mapper/contro/SceneColdStorageLogMapper.xml
  98. 5 0
      src/main/resources/mapper/contro/SceneColdStorageMapper.xml
  99. 5 0
      src/main/resources/mapper/contro/SceneCopyDistinctEnvMapper.xml
  100. 0 0
      src/main/resources/mapper/contro/SceneCopyLogMapper.xml

+ 36 - 0
pom.xml

@@ -96,6 +96,12 @@
     </dependency>
 
     <dependency>
+      <groupId>com.fdkankan</groupId>
+      <artifactId>4dkankan-utils-sms</artifactId>
+      <version>3.0.0-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
       <groupId>org.projectlombok</groupId>
       <artifactId>lombok</artifactId>
     </dependency>
@@ -146,6 +152,36 @@
       <version>1.3.2</version>
     </dependency>
 
+    <dependency>
+      <groupId>com.yomahub</groupId>
+      <artifactId>tlog-web-spring-boot-starter</artifactId>
+      <version>1.3.6</version>
+    </dependency>
+
+    <dependency>
+      <groupId>net.logstash.logback</groupId>
+      <artifactId>logstash-logback-encoder</artifactId>
+      <version>5.0</version>
+    </dependency>
+
+    <dependency>
+      <groupId>com.yomahub</groupId>
+      <artifactId>tlog-logstash-logback</artifactId>
+      <version>1.5.0</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-to-slf4j</artifactId>
+      <version>2.17.0</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <version>2.17.0</version>
+    </dependency>
+
   </dependencies>
   <build>
     <finalName>${artifactId}</finalName>

+ 57 - 31
src/main/java/com/fdkankan/contro/bean/SceneJsonBean.java

@@ -1,6 +1,9 @@
 package com.fdkankan.contro.bean;
 
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fdkankan.contro.vo.SceneEditControlsVO;
+import java.util.List;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
@@ -74,48 +77,26 @@ public class SceneJsonBean {
      */
     private Date createTime;
 
-//    /**
-//     * 点位数量
-//     */
-//    private Integer panoCount;
-//
-//    /**
-//     * 球幕视频数量
-//     */
-//    private Integer videoCount;
-
     /**
      * 版本
      */
     private Integer version;
 
-//    /**
-//     * 户型图文件路径集合
-//     */
-//    private String[] floorPlanPaths;
+    /**
+     * 图片版本
+     */
+    private Integer imgVersion;
+
+    /**
+     * 场景关联版本
+     */
+    private Integer linkVersion;
 
     /**
      * 是否上传了户型图(0-否,1-是)
      */
     private Byte floorPlanUser;
 
-//    private String cadInfo;
-
-//    /**
-//     * 是否上传模型
-//     */
-//    private Byte isUploadObj;
-//
-//    /**
-//     * 重新建模的版本
-//     */
-//    private Integer floorEditVer;
-//
-//    /**
-//     * 正式发布重新建模的版本
-//     */
-//    private Integer floorPublishVer;
-
     /**
      * 初始点信息
      */
@@ -132,6 +113,16 @@ public class SceneJsonBean {
     private String sceneFrom;
 
     /**
+     * 切图方式(tiles:瓦片图,face:切片图,pan:全景图 ,local:本地切片,cube:立体图)
+     */
+    private String sceneKind;
+
+    /**
+     * dam,3dtiles
+     */
+    private String modelKind;
+
+    /**
      * 空间视频数据
      */
     private String boxVideos;
@@ -142,6 +133,11 @@ public class SceneJsonBean {
     private String boxPhotos;
 
     /**
+     * 空间模型数据
+     */
+    private String boxModels;
+
+    /**
      *点位视频
      */
     private String videos;
@@ -183,5 +179,35 @@ public class SceneJsonBean {
      */
     private Integer links;
 
+    /**
+     * 是否有马赛克
+     */
+    private Integer mosaic;
+
+    /**
+     * 马赛克列表
+     */
+    private List<JSONObject> mosaicList;
+
+    /**
+     * 水印文件名
+     */
+    private String waterMark;
+
+    /**
+     * 是否有滤镜(0-否,1-是)
+     */
+    private Integer filters;
+
+    /**
+     * 是否有监控摄像头数据
+     */
+    private Integer surveillances;
+
+    /**
+     * 是否有指示牌
+     */
+    private Integer billboards;
+
 
 }

+ 2 - 0
src/main/java/com/fdkankan/contro/constant/RedisConstants.java

@@ -4,4 +4,6 @@ public class RedisConstants {
     public static final String FOLDER_FILEID_BUILD = "model-controls:folder:%s";
     public static final String FILEID_FOLDER_BUILD = "model-controls:fileId:%s";
     public static final String FOLDER_LOCK_BUILD = "model-controls:lock:%s";
+    public static final String SCENE_PREPARE_BUILDING = "model-controls:scene:building:prepare:message:";
+    public static final String SCENE_POST_BUILDING = "model-controls:scene:building:post:message:";
 }

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

@@ -0,0 +1,40 @@
+package com.fdkankan.contro.constant;
+
+/**
+ * 文件业务类型
+ */
+public enum UserEditDataType {
+
+    BOX_MODEL("boxModel", "boxModelHandler"),
+    FLOORPLAN("floorplan", "floorplanHandler"),
+    ;
+
+    private String code;
+    private String message;
+
+    private UserEditDataType(String code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public String code() {
+        return code;
+    }
+
+    public String message() {
+        return message;
+    }
+
+    public static UserEditDataType get(Integer code){
+        UserEditDataType[] values = UserEditDataType.values();
+        String enumValue = null;
+        for(UserEditDataType eachValue : values){
+            enumValue = eachValue.code();
+            if(enumValue.equals(code)){
+                return eachValue;
+            }
+        }
+        return null;
+    }
+
+}

+ 21 - 0
src/main/java/com/fdkankan/contro/controller/SceneCleanOrigController.java

@@ -0,0 +1,21 @@
+package com.fdkankan.contro.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 删除oss原始资源记录 前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2023-04-17
+ */
+@RestController
+@RequestMapping("/contro/sceneCleanOrig")
+public class SceneCleanOrigController {
+
+}
+

+ 21 - 0
src/main/java/com/fdkankan/contro/controller/SceneCopyLogController.java

@@ -0,0 +1,21 @@
+package com.fdkankan.contro.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2023-04-17
+ */
+@RestController
+@RequestMapping("/contro/sceneCopyLog")
+public class SceneCopyLogController {
+
+}
+

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

@@ -7,24 +7,36 @@ import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.contro.entity.User;
+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.exception.BusinessException;
 import com.fdkankan.contro.service.ISceneFileBuildService;
 import com.fdkankan.contro.vo.ResponseSceneFile;
 import com.fdkankan.contro.vo.SendCallAlgorithmParam;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.web.response.ResultData;
 import lombok.extern.log4j.Log4j2;
 import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.bind.annotation.*;
 
 import java.io.File;
 import java.io.IOException;
 import java.util.Date;
 import java.util.Map;
 import java.util.concurrent.CompletableFuture;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 场景文件上传模块
@@ -40,6 +52,10 @@ public class SceneFileController{
     @Autowired
     private ISceneFileBuildService sceneFileBuildService;
 
+    @Autowired
+    private FYunFileServiceInterface fYunFileService;
+
+
     /**
      * 场景文件上传之前先获取fileId
      * @param params
@@ -74,8 +90,55 @@ public class SceneFileController{
     }
 
     @GetMapping("rebuildScene")
-    public ResultData rebuildScene(@RequestParam(value = "num") String num,@RequestParam(value = "force",defaultValue = "false") Boolean force ) throws IOException {
-        return sceneFileBuildService.rebuildScene(num,force);
+    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);
+    }
+
+
+    /**
+     * 国际八目相机调用
+     * @param params
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("getS3UploadUrl")
+    public ResultData getS3UploadUrl(String params) throws Exception {
+        log.info("getS3UploadUrl 参数:{}",params);
+        if (StringUtils.isEmpty(params)) {
+            throw new BusinessException(ErrorCode.PARAM_ERROR,"params为空。");
+        }
+        JSONObject jsonObject = JSON.parseObject(params);
+        if(jsonObject == null){
+            throw new BusinessException(ErrorCode.PARAM_ERROR,"params为空。");
+        }
+        JSONArray files = jsonObject.getJSONArray("Files");
+        if(files == null){
+            throw new BusinessException(ErrorCode.PARAM_ERROR,"params为空。");
+        }
+        List<String> urls = new ArrayList<>();
+        for(int i = 0, len = files.size(); i < len; i++){
+            urls.add(files.getJSONObject(i).getString("filename"));
+        }
+        Map<String, String> uploadS3Url = getUploadS3Url(urls);
+        return ResultData.ok(uploadS3Url);
+    }
+
+    private Map<String, String> getUploadS3Url(List<String> urls) {
+        if(urls == null || urls.size() <= 0){
+            return null;
+        }
+        Map<String, String> map = new HashMap();
+        for(String path : urls){
+            map.put(path, fYunFileService.getPresignedUrl(path).toString());
+        }
+        return map;
+    }
+
+
+    @GetMapping("copyDataAndBuild")
+    public ResultData copyDataAndBuild(@RequestParam(value = "dataSource") String dataSource,@RequestParam(value = "sceneVer") String sceneVer,
+                                       @RequestParam(value = "sourceBucket") String sourceBucket) throws Exception {
+        return sceneFileBuildService.copyDataAndBuild(sourceBucket,dataSource ,sceneVer);
     }
 
     /**

+ 34 - 0
src/main/java/com/fdkankan/contro/controller/TestController.java

@@ -0,0 +1,34 @@
+package com.fdkankan.contro.controller;
+
+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.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/12/12
+ **/
+@RestController
+@RequestMapping("/test")
+public class TestController {
+
+    @Autowired
+    private IScene3dNumService scene3dNumService;
+    @Autowired
+    private ICommonService commonService;
+
+    @GetMapping("/test")
+    public ResultData test(String num) throws Exception {
+        commonService.sendEmail(num);
+        return ResultData.ok();
+    }
+
+}

+ 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;
+
 
 }

+ 4 - 0
src/main/java/com/fdkankan/contro/entity/Company.java

@@ -96,6 +96,10 @@ public class Company implements Serializable {
     @TableField("update_time")
     private Date updateTime;
 
+
+    @TableField("scene_version")
+    private String sceneVersion;
+
     /**
      * A正常,I删除
      */

+ 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;
+
+
+}

+ 99 - 0
src/main/java/com/fdkankan/contro/entity/IncrementType.java

@@ -0,0 +1,99 @@
+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.math.BigDecimal;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 会员权益类型
+ * </p>
+ *
+ * @author 
+ * @since 2022-08-01
+ */
+@Getter
+@Setter
+@TableName("t_increment_type")
+public class IncrementType implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 权益类型名称
+     */
+    @TableField("name")
+    private String name;
+
+    @TableField("type")
+    private String type;
+
+    /**
+     * 下载次数,-1代表无限次
+     */
+    @TableField("download_num")
+    private Integer downloadNum;
+    /**
+     * 下载次数,-1代表无限次
+     */
+    @TableField("download_price")
+    private BigDecimal downloadPrice;
+
+    /**
+     * 相机容量 单位 G
+     */
+    @TableField("camera_capacity")
+    private Long cameraCapacity;
+
+    /**
+     * 相机容量 单位 G
+     */
+    @TableField("camera_space")
+    private Long cameraSpace;
+
+    /**
+     * 购买之后,有效期天数,-1代表无限制
+     */
+    @TableField("valid_time")
+    private Integer validTime;
+
+    /**
+     * 0:年;1:月:2:日
+     */
+    @TableField("valid_time_type")
+    private Integer validTimeType;
+
+    /**
+     * 权益价格
+     */
+    @TableField("price")
+    private BigDecimal price;
+
+    /**
+     * 价格符号
+     */
+    @TableField("symbol")
+    private String symbol;
+
+    @TableField("create_time")
+    private String createTime;
+
+    @TableField("update_time")
+    private String updateTime;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+
+}

+ 90 - 0
src/main/java/com/fdkankan/contro/entity/MailTemplate.java

@@ -0,0 +1,90 @@
+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-03-01
+ */
+@Getter
+@Setter
+@TableName("t_mail_template")
+public class MailTemplate implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 发件人邮箱
+     */
+    @TableField("send_mail")
+    private String sendMail;
+
+    /**
+     * 发件人邮箱密码
+     */
+    @TableField("send_password")
+    private String sendPassword;
+
+    /**
+     * 发件人主机
+     */
+    @TableField("send_host")
+    private String sendHost;
+
+    /**
+     * 收件主题
+     */
+    @TableField("subject")
+    private String subject;
+
+    /**
+     * 邮件内容
+     */
+    @TableField("msg")
+    private String msg;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A", delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * 备注
+     */
+    @TableField("remark")
+    private String remark;
+
+    /**
+     * 0订单发票,1深时演示场景,2验证码,3权益会员过期
+     */
+    @TableField("type")
+    private Integer type;
+
+    /**
+     * zh 中文,en英文
+     */
+    @TableField("lang")
+    private String lang;
+
+
+}

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

@@ -59,7 +59,7 @@ public class Scene3dNum implements Serializable {
      * A正常,I删除
      */
     @TableField("rec_status")
-    @TableLogic("A")
+    @TableLogic(value = "A", delval = "I")
     private String recStatus;
 
 

+ 105 - 0
src/main/java/com/fdkankan/contro/entity/SceneAsynOperLog.java

@@ -0,0 +1,105 @@
+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 2022-12-16
+ */
+@Getter
+@Setter
+@TableName("t_scene_asyn_oper_log")
+public class SceneAsynOperLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 场景码
+     */
+    @TableField("num")
+    private String num;
+
+    /**
+     * 操作类型(upload-上传,download-下载)
+     */
+    @TableField("oper_type")
+    private String operType;
+
+    /**
+     * 模块名称
+     */
+    @TableField("module")
+    private String module;
+
+    /**
+     * 功能
+     */
+    @TableField("func")
+    private String func;
+
+    /**
+     * 版本号
+     */
+    @TableField("version")
+    private Integer version;
+
+    /**
+     * 状态(0-处理中,1-处理完成,2-处理失败)
+     */
+    @TableField("state")
+    private Integer state;
+
+    /**
+     * 下载链接
+     */
+    @TableField("url")
+    private String url;
+
+    /**
+     * 是否需要弹窗(0-否,1-是)
+     */
+    @TableField("pop")
+    private Boolean pop;
+
+    /**
+     * 扩展信息
+     */
+    @TableField("ext_data")
+    private String extData;
+
+    /**
+     * 创建时间
+     */
+    @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;
+
+
+}

+ 81 - 0
src/main/java/com/fdkankan/contro/entity/SceneBuildProcessLog.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-01-28
+ */
+@Getter
+@Setter
+@TableName("t_scene_build_process_log")
+public class SceneBuildProcessLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 场景码
+     */
+    @TableField("num")
+    private String num;
+
+    /**
+     * 计算流程(pre-前置处理,call-计算,post-后置处理)
+     */
+    @TableField("process")
+    private String process;
+
+    /**
+     * mq消息队列名称
+     */
+    @TableField("queue_name")
+    private String queueName;
+
+    /**
+     * 处理状态(0-处理中,1-成功,2-失败)
+     */
+    @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;
+
+
+}

+ 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;
+
+
+}

+ 69 - 0
src/main/java/com/fdkankan/contro/entity/SceneCopyDistinctEnv.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>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2023-03-21
+ */
+@Getter
+@Setter
+@TableName("t_scene_copy_distinct_env")
+public class SceneCopyDistinctEnv implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 场景码
+     */
+    @TableField("num")
+    private String num;
+
+    /**
+     * 原资源路径
+     */
+    @TableField("src_data_source")
+    private String srcDataSource;
+
+    /**
+     * 目标资源路径
+     */
+    @TableField("target_data_source")
+    private String targetDataSource;
+
+    /**
+     * 创建时间
+     */
+    @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;
+
+
+}

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

@@ -89,6 +89,30 @@ 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("create_time")

+ 18 - 0
src/main/java/com/fdkankan/contro/entity/SceneEditInfo.java

@@ -107,6 +107,18 @@ public class SceneEditInfo implements Serializable {
     private Integer version;
 
     /**
+     * 图片版本
+     */
+    @TableField("img_version")
+    private Integer imgVersion;
+
+    /**
+     * 场景关联版本
+     */
+    @TableField("link_version")
+    private Integer linkVersion;
+
+    /**
      * 是否上传模型
      */
     @TableField("is_upload_obj")
@@ -137,6 +149,12 @@ public class SceneEditInfo implements Serializable {
     private String boxPhotos;
 
     /**
+     * 空间模型数据
+     */
+    @TableField("box_models")
+    private String boxModels;
+
+    /**
      * 是否需要处理球幕视频
      */
     @TableField("build_video_status")

+ 30 - 1
src/main/java/com/fdkankan/contro/entity/SceneEditInfoExt.java

@@ -5,7 +5,6 @@ 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 com.fdkankan.db.base.BaseEntity;
 import java.util.Date;
 import lombok.Getter;
 import lombok.Setter;
@@ -62,12 +61,42 @@ public class SceneEditInfoExt {
     private String mosaics;
 
     /**
+     * 水印文件名
+     */
+    @TableField("water_mark")
+    private String waterMark;
+
+    /**
      * 是否有场景关联(0-否,1-是)
      */
     @TableField("links")
     private Integer links;
 
     /**
+     * 是否有滤镜(0-否,1-是)
+     */
+    @TableField("filters")
+    private Integer filters;
+
+    /**
+     * 是否有监控摄像头(0-否,1-是)
+     */
+    @TableField("surveillances")
+    private Integer surveillances;
+
+    /**
+     * mosaics数据
+     */
+    @TableField("share_logo_img")
+    private String shareLogoImg;
+
+    /**
+     * 是否有指示牌
+     */
+    @TableField("billboards")
+    private Integer billboards;
+
+    /**
      * 创建时间
      */
     @TableField("create_time")

+ 6 - 0
src/main/java/com/fdkankan/contro/entity/ScenePlus.java

@@ -92,6 +92,12 @@ public class ScenePlus implements Serializable {
     private Integer recommend;
 
     /**
+     * 是否有housetype文件(0-否,1-是)
+     */
+    @TableField("house_type")
+    private Integer houseType;
+
+    /**
      * 创建时间
      */
     @TableField("create_time")

+ 8 - 2
src/main/java/com/fdkankan/contro/entity/ScenePlusExt.java

@@ -107,7 +107,7 @@ public class ScenePlusExt implements Serializable {
     private String buildType;
 
     /**
-     * 全景图加载方式,tiles/1k:1k瓦片图,tiles/2:2k瓦片图,tiles/4k:4k瓦片图,pan:全景图 ,local:本地切片,cube:立体图
+     * 分辨率(2k,4k)
      */
     @TableField("scene_resolution")
     private String sceneResolution;
@@ -125,6 +125,12 @@ public class ScenePlusExt implements Serializable {
     private String sceneKind;
 
     /**
+     * 算法模型类型(dam,3dtiles)
+     */
+    @TableField("model_kind")
+    private String modelKind;
+
+    /**
      * 计算耗时
      */
     @TableField("compute_time")
@@ -155,7 +161,7 @@ public class ScenePlusExt implements Serializable {
      * A正常,I删除
      */
     @TableField("rec_status")
-    @TableLogic("A")
+    @TableLogic(value = "A",delval = "I")
     private String recStatus;
 
     /**

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

@@ -0,0 +1,81 @@
+package com.fdkankan.contro.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 用户增值权益表
+ * </p>
+ *
+ * @author 
+ * @since 2021-12-24
+ */
+@Getter
+@Setter
+@ToString
+@TableName("t_user_increment")
+public class UserIncrement implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+
+    /**
+     * 相机主表t_camera的id
+     */
+    @TableField("camera_id")
+    private Long cameraId;
+
+    /**
+     * 会员权益类型Id
+     */
+    @TableField("increment_type_id")
+    private Integer incrementTypeId;
+
+    /**
+     * 结束时间
+     */
+    @TableField("increment_end_time")
+    private Date incrementEndTime;
+
+    /**
+     * 是否过期(1过期,0未过期)
+     */
+    @TableField("is_expired")
+    private Integer isExpired;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * 生效时间
+     */
+    @TableField("increment_start_time")
+    private Date incrementStartTime;
+
+
+    /**
+     * 0正常,1删除
+     */
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+}

+ 4 - 0
src/main/java/com/fdkankan/contro/factory/DemoFactory.java

@@ -0,0 +1,4 @@
+package com.fdkankan.contro.factory;
+
+public interface DemoFactory {
+}

+ 65 - 0
src/main/java/com/fdkankan/contro/factory/UserEditData/BoxModelHandler.java

@@ -0,0 +1,65 @@
+package com.fdkankan.contro.factory.UserEditData;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.contro.entity.SceneEditInfo;
+import com.fdkankan.contro.entity.ScenePlus;
+import com.fdkankan.contro.service.ISceneEditInfoService;
+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("boxModelHandler")
+public class BoxModelHandler implements UserEditDataHandler {
+
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private ISceneEditInfoService sceneEditInfoService;
+    @Autowired
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private RedisUtil redisUtil;
+
+    @Override
+    public void init(String num, Map<String, Object> params) {
+        String modelEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "boxModels";
+        String modelViewPath = String.format(UploadFilePath.USER_VIEW_PATH, num) + "boxModels";
+        String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json";
+
+        //修改数据库,将boxModels字段置为空
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+        SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
+        sceneEditInfoService.update(new LambdaUpdateWrapper<SceneEditInfo>().set(SceneEditInfo::getBoxModels, null).eq(SceneEditInfo::getId, sceneEditInfo.getId()));
+
+        //更新scene.json
+        if(fYunFileService.fileExist(sceneJsonPath)){
+            String sceneJsonStr = fYunFileService.getFileContent(sceneJsonPath);
+            JSONObject sceneJson = JSON.parseObject(sceneJsonStr);
+            sceneJson.remove("boxModels");
+            sceneJsonStr = sceneJson.toJSONString();
+            fYunFileService.uploadFile(sceneJsonStr.getBytes(StandardCharsets.UTF_8), sceneJsonPath);
+            //scenejson写入缓存
+            redisUtil.set(String.format(RedisKey.SCENE_JSON, num), sceneJsonStr);
+        }
+
+        //删除oss资源
+        if(fYunFileService.fileExist(modelEditPath)){
+            fYunFileService.deleteFolder(modelEditPath);
+        }
+        if(fYunFileService.fileExist(modelViewPath)){
+            fYunFileService.deleteFolder(modelViewPath);
+        }
+    }
+}

+ 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);
+    }
+}

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

@@ -0,0 +1,9 @@
+package com.fdkankan.contro.factory.UserEditData;
+
+import java.util.Map;
+
+public interface UserEditDataHandler {
+
+    void init(String num, Map<String, Object> params);
+
+}

+ 9 - 0
src/main/java/com/fdkankan/contro/factory/UserEditData/UserEditDataHandlerFactory.java

@@ -0,0 +1,9 @@
+package com.fdkankan.contro.factory.UserEditData;
+
+import cn.hutool.extra.spring.SpringUtil;
+
+public class UserEditDataHandlerFactory {
+    public static UserEditDataHandler getHandler(String name){
+        return SpringUtil.getBean(name);
+    }
+}

+ 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/IMailTemplateMapper.java

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

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

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.SceneAsynOperLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2022-12-16
+ */
+@Mapper
+public interface ISceneAsynOperLogMapper extends BaseMapper<SceneAsynOperLog> {
+
+}

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

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.SceneBuildProcessLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 场景计算流程状态表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2023-01-28
+ */
+@Mapper
+public interface ISceneBuildProcessLogMapper extends BaseMapper<SceneBuildProcessLog> {
+
+}

+ 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/ISceneCopyDistinctEnvMapper.java

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

+ 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> {
+
+}

+ 63 - 9
src/main/java/com/fdkankan/contro/mq/listener/AbstrackBuildSceneListener.java

@@ -1,12 +1,19 @@
 package com.fdkankan.contro.mq.listener;
 
+import cn.hutool.core.exceptions.ExceptionUtil;
 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.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.beans.factory.annotation.Autowired;
 import org.springframework.util.ObjectUtils;
 
 import java.io.IOException;
@@ -15,31 +22,78 @@ import java.util.HashMap;
 
 @Slf4j
 public class AbstrackBuildSceneListener implements IBuildSceneListener {
+
+    @Autowired
+    private RedisLockUtil redisLockUtil;
+    @Autowired
+    private ISceneBuildProcessLogService sceneBuildProcessLogService;
+
     @Override
     public void preHandle(Channel channel, String queueName, Message message, IBuildSceneService buildSceneService) throws IOException {
+        // 添加消息幂等处理
         String messageId = message.getMessageProperties().getMessageId();
+        if(!ObjectUtils.isEmpty(messageId)){
+            // 设置消息id幂等性,防止消息重复消费
+            boolean lock = redisLockUtil.lock(RedisConstants.SCENE_PREPARE_BUILDING + messageId, 24 * 3600);
+            if (!lock) {
+                log.error("服务:{},消息重复消费:{}", "常驻服务", messageId);
+                channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+                return;
+            }
+        }
+
         String msg = new String(message.getBody(), StandardCharsets.UTF_8);
         log.info("开始准备场景计算资源,队列名:{},id:{},消息体:{}", queueName, messageId, msg);
         BuildSceneCallMessage buildSceneMessage = JSONObject.parseObject(msg, BuildSceneCallMessage.class);
-        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
-        if(ObjectUtils.isEmpty(buildSceneMessage.getBuildContext())){
-            buildSceneMessage.setBuildContext(new HashMap<>());
-        }
-        if(!ObjectUtils.isEmpty(buildSceneMessage.getSceneNum())){
-            buildSceneMessage.getBuildContext().put("sceneNum",buildSceneMessage.getSceneNum());
+        String num = buildSceneMessage.getSceneNum();
+        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(), queueName);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, CommonOperStatus.WAITING.code(), null);
+            buildSceneService.buildScenePre(buildSceneMessage);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, CommonOperStatus.SUCCESS.code(), null);
+        }catch (Exception e){
+            log.error("场景计算前置处理出错,num=" + num, e);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.PRE.code(), queueName, CommonOperStatus.FAILD.code(), ExceptionUtil.stacktraceToString(e, 3000));
         }
-        buildSceneService.buildScenePre(buildSceneMessage);
         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 {
+        // 添加消息幂等处理
         String messageId = message.getMessageProperties().getMessageId();
+        if(!ObjectUtils.isEmpty(messageId)){
+            // 设置消息id幂等性,防止消息重复消费
+            boolean lock = redisLockUtil.lock(RedisConstants.SCENE_POST_BUILDING + messageId, 24 * 3600);
+            if (!lock) {
+                log.error("服务:{},消息重复消费:{}", "常驻服务", messageId);
+                channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+                return;
+            }
+        }
+
         String msg = new String(message.getBody(), StandardCharsets.UTF_8);
         log.info("场景计算完成,开始处理场景计算结果,队列名:{},id:{},消息体:{}", queueName, messageId, msg);
         BuildSceneResultMqMessage buildSceneMessage = JSONObject.parseObject(msg, BuildSceneResultMqMessage.class);
-        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
-        buildSceneService.buildScenePost(buildSceneMessage);
+        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);
+            buildSceneService.buildScenePost(buildSceneMessage);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, CommonOperStatus.SUCCESS.code(), null);
+        }catch (Exception e){
+            log.error("场景计算结果处理出错,num=" + num, e);
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.POST.code(), queueName, CommonOperStatus.FAILD.code(), ExceptionUtil.stacktraceToString(e, 3000));
+        }
         log.info("场景计算结果处理完成,队列名:{},id:{},消息体:{}", queueName, messageId, msg);
+        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
     }
 }

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

@@ -0,0 +1,67 @@
+package com.fdkankan.contro.mq.listener;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.constant.CommonOperStatus;
+import com.fdkankan.common.constant.ModelingBuildStatus;
+import com.fdkankan.contro.service.ISceneBuildProcessLogService;
+import com.fdkankan.model.constants.SceneBuildProcessType;
+import com.fdkankan.rabbitmq.bean.BuildSceneProcessLogMessage;
+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 java.nio.charset.StandardCharsets;
+
+@Slf4j
+@Component
+public class BuildSceneProcessLogListener{
+
+    @Value("${queue.modeling.modeling-process-log}")
+    private String queueModelingProcessLog;
+    @Value("${queue.modeling.modeling-call}")
+    private String queueModelingCall;
+
+    @Autowired
+    private ISceneBuildProcessLogService sceneBuildProcessLogService;
+
+    /**
+     * 场景计算状态日志记录
+     * @param channel
+     * @param message
+     * @throws Exception
+     */
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.modeling.modeling-process-log}")
+    )
+    public void buildScenePreHandler(Channel channel, Message message) throws Exception {
+        String msg = new String(message.getBody(), StandardCharsets.UTF_8);
+        BuildSceneProcessLogMessage buildSceneMessage = JSONObject.parseObject(msg, BuildSceneProcessLogMessage.class);
+        String num = buildSceneMessage.getNum();
+        try {
+            String reason = null;
+            int status = CommonOperStatus.SUCCESS.code();
+            int buildStatus = buildSceneMessage.getBuildStatus();
+            //新的计算开始,需要将之前的记录置为失效
+            if(buildStatus == ModelingBuildStatus.CALCULATING.code()){
+                sceneBuildProcessLogService.clearSceneBuildProcessLog(num, SceneBuildProcessType.CALL.code(),queueModelingCall);
+                status = CommonOperStatus.WAITING.code();
+            }else{
+                if(buildStatus != ModelingBuildStatus.SUCCESS.code()){
+                    status = CommonOperStatus.FAILD.code();
+                    reason = ModelingBuildStatus.get(buildStatus).message();
+                }
+            }
+            sceneBuildProcessLogService.saveSceneBuildProcessLog(num, SceneBuildProcessType.CALL.code(), queueModelingCall, status, reason);
+        }catch (Exception e){
+            log.error("场景计算流程状态日志记录出错, num="+num, e);
+        }finally {
+            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+        }
+    }
+
+}

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

@@ -13,7 +13,7 @@ import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
  **/
 public interface IBuildSceneService {
 
-    void buildScenePre(BuildSceneCallMessage message);
+    void buildScenePre(BuildSceneCallMessage message) throws Exception;
 
     void downLoadSource(BuildSceneCallMessage buildSceneMqMessage, String path) throws Exception;
 

+ 316 - 0
src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java

@@ -0,0 +1,316 @@
+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.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.mq.service.IBuildSceneService;
+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.UploadFilePath;
+import com.fdkankan.model.utils.CreateObjUtil;
+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 lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
+
+import java.io.File;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/3/1
+ **/
+@Slf4j
+@Service
+public class BuildObjServiceImpl implements IBuildSceneService {
+
+    @Value("${queue.modeling.modeling-call}")
+    private String queueModelingCall;
+
+    @Value("${queue.modeling.obj.modeling-post}")
+    private String queueObjModelingPost;
+
+    @Value("${queue.modeling.obj.modeling-pre}")
+    private String queueObjModelingPre;
+
+    @Value("${model.modelKind:3dtiles}")
+    private String modelKind;
+
+    @Value("#{'${model.3dtiles.sceneSource:}'.split(',')}")
+    private List<Integer> sdTilesSceneSourceList;
+
+    @Value("${env:gn}")
+    private String env;
+
+    @Autowired
+    private RabbitMqProducer mqProducer;
+
+    @Autowired
+    private FYunFileServiceInterface fYunFileService;
+
+    @Autowired
+    private ISceneProService sceneProService;
+
+    @Autowired
+    private IFdkkLaserService fdkkLaserService;
+
+    @Autowired
+    private FdkkV4Service fdkkV4Service;
+
+    @Autowired
+    private IBuildSceneDTService buildSceneDTService;
+
+    @Autowired
+    private ISceneProEditService sceneProEditService;
+
+    @Autowired
+    private IScenePlusService scenePlusService;
+
+    @Autowired
+    private ISceneBuildProcessLogService sceneBuildProcessLogService;
+
+    @Autowired
+    private ICommonService commonService;
+
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private RedisUtil redisUtil;
+
+    @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 {
+            //根据相机类型,组装资源路径
+            log.info("开始准备生成OBJ场景资源,路径:{}", laserObjFilePath);
+
+            FileUtils.delAllFile(laserObjFilePath);
+
+            //获取解压后的资源的data.fdage中的数据
+            File folderPath = new File(path);
+            fYunFileService.downloadFile(ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage", laserObjFilePath + "/capture/data.fdage");
+            JSONObject jsonObject = FileUtils.readJson(laserObjFilePath + File.separator + "capture" + File.separator + "data.fdage");
+            if(ObjectUtils.isEmpty(jsonObject)){
+                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");
+            }
+            // 重新构造datafdage文件,添加生成obt文件选项
+            jsonObject.put("OnlyExportMeshObj",true);
+            FileUtils.writeFile(laserObjFilePath + File.separator + "capture" + File.separator + "data.fdage", jsonObject.toJSONString());
+
+            message.getBuildContext().put("previousPath",path);
+            message.setCameraType("14");
+            message.setResolution(jsonObject.getString("resolution"));
+            message.setPath(laserObjFilePath);
+            message.setResultReceiverMqName(queueObjModelingPost);
+
+            //发送mq,就进行计算
+            mqProducer.sendByWorkQueue(queueModelingCall, message);
+
+            success = true;
+
+            log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
+
+        }catch (Exception e){
+            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{
+
+        //下载原始资源文件
+        String ossPath = commonService.getOssOrignPath(message.getPath());
+        fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
+
+        //下载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
+    public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
+
+        String path = message.getPath();
+        String projectNum = message.getBuildContext().get("sceneNum").toString();
+        String laserObjFilePath = path;
+        boolean success = false;
+        try {
+
+            //上传计算日志
+            String buildLogPath = String.format(UploadFilePath.BUILD_LOG_PATH, projectNum);
+            fYunFileService.uploadFile(path + File.separator + "console.log", buildLogPath + "console.log");
+
+            if (!message.getBuildSuccess()) {
+                log.error("生成OBJ场景计算失败!");
+                // 发送钉钉消息,计算失败
+                buildSceneDTService.handModelFail("生成OBJ场景计算失败!", message.getPath(), message.getBuildContext().get("sceneNum").toString(), message.getHostName());
+                return;
+            }
+
+            ScenePro scenePro = sceneProService.getByNum(projectNum);
+            String version = "v4";
+            String ossImagePath = String.format(UploadFilePath.IMG_VIEW_PATH,  projectNum);
+            //如果是微服务上线之前的存量场景且未生成过obj(未升级过),需要上传到v3的目录,在函数最后调用升级接口进行文件拷贝
+            if(Objects.nonNull(scenePro) && scenePro.getIsUpgrade() != CommonStatus.YES.code().intValue()){
+                ossImagePath = String.format(ConstantFilePath.IMAGE_PATH_FORMAT, projectNum);
+                version = "v3";
+            }
+            //上传obj
+            String resultsPath = path + File.separator + "results" + File.separator;
+            if(this.modelKind.equals(ModelKind.DAM.code())){
+                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");
+                File file = new File(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma");
+                while (!file.exists()) {
+                    Thread.sleep(60000);
+                }
+                fYunFileService.uploadFile(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", ossImagePath + ConstantFileName.modelUUID + "_50k.dam.lzma");
+                fYunFileService.uploadFile(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", ossImagePath + ConstantFileName.modelUUID + "_50k.dam");
+            }
+            if(this.modelKind.equals(ModelKind.THREE_D_TILE.code())
+                    && CollUtil.isNotEmpty(sdTilesSceneSourceList)
+                    && sdTilesSceneSourceList.contains(SceneSource.JG.code())){
+                String threedtilesPath = resultsPath + ModelKind.THREE_D_TILE.code();
+                String oss3dtilesPath = ossImagePath + ModelKind.THREE_D_TILE.code();
+                List<String> list = FileUtils.list(new File(threedtilesPath));
+                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目录异常");
+                }
+                //上传3dtiles文件
+                fYunFileService.uploadFileByCommand(threedtilesPath, oss3dtilesPath);
+            }
+
+            String texPath = laserObjFilePath + File.separator + "results" + File.separator + "tex";
+
+            File texFile = new File(texPath);
+            if(texFile.exists()){
+                for (File textureFile : texFile.listFiles()) {
+                    if(textureFile.getName().endsWith(".jpg")){
+                        fYunFileService.uploadFile(textureFile.getAbsolutePath(),
+                            ossImagePath + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/"+textureFile.getName());
+                    }
+                }
+            }
+
+            fYunFileService.uploadFile(laserObjFilePath + File.separator + "results" + File.separator + "tex/texture1.jpg",
+                    ossImagePath + ConstantFileName.modelUUID + "_50k_texture_jpg_high1/texture1.jpg");
+
+            // 拷贝结果
+            log.info("开始拷贝obj文件");
+            FileUtils.copyFolderAllFiles(laserObjFilePath + "/results/mesh", laserObjFilePath + "/laserData/mesh/", true);
+
+            //上传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);
+                sceneProService.update(updateWrapper);
+                sceneProEditService.update(new LambdaUpdateWrapper<SceneProEdit>().set(SceneProEdit::getMapVisi,0)
+                        .eq(SceneProEdit::getProId,scenePro.getId()));
+            }
+
+            ScenePlus scenePlus = scenePlusService.getScenePlusByNum(projectNum);
+            if(Objects.nonNull(scenePlus)){
+                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);
+
+
+                if(this.modelKind.equals(ModelKind.THREE_D_TILE.code())
+                        && CollUtil.isNotEmpty(sdTilesSceneSourceList)
+                        && sdTilesSceneSourceList.contains(SceneSource.JG.code())){
+                    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));
+                    }
+
+                }
+            }
+
+            // 如果未升级V4,则升级V4
+            if("v3".equals(version)){
+                fdkkV4Service.upgradeToV4(projectNum);
+            }
+
+            success = true;
+
+            //国际环境需要发邮件通知
+            if("eur".equals(env)){
+                commonService.sendEmail(projectNum);
+            }
+
+        }catch (Exception e){
+            log.error("生成OBJ场景计算结果处理异常,num=" + projectNum, e);
+            buildSceneDTService.handBaseFail("生成OBJ场景计算结果处理异常", message.getPath(), projectNum, "计算控制服务器");
+            throw e;
+        }finally {
+            fdkkLaserService.pushBuildStatusToLaserSystem(projectNum, laserObjFilePath + "/laserData/mesh", success ? CommonOperStatus.SUCCESS.code() : CommonOperStatus.FAILD.code());
+        }
+    }
+
+}

+ 275 - 130
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java

@@ -17,6 +17,7 @@ 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.constant.UserEditDataType;
 import com.fdkankan.contro.entity.*;
 import com.fdkankan.contro.mq.service.IBuildSceneService;
 import com.fdkankan.contro.service.*;
@@ -81,6 +82,18 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     public String buildProgressUrl;
 
 
+    @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;
+
     @Autowired
     private RabbitMqProducer mqProducer;
 
@@ -107,26 +120,69 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
     @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) {
+    public void buildScenePre(BuildSceneCallMessage message) throws Exception{
         boolean success = false;
+        String num = message.getSceneNum();
         try {
 
             //开始计算前发送mq消息,监听project.json文件的变化以更新进度条
             mqProducer.sendByWorkQueue(modelingProgressNotice, message);
 
+            //重新计算时需要删除文件夹,否知使用缓存
+            if(new File(message.getPath() + File.separator + "results").exists()){
+                FileUtils.deleteDirectory(message.getPath() + File.separator + "results");
+            }
+
+            //删除project.json文件
+            FileUtil.del(message.getPath().concat(File.separator).concat("project.json"));
+
+            //删除点位校准数据
+            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());
 
-            //删除project.json文件
-            FileUtil.del(message.getPath().concat(File.separator).concat("project.json"));
+            JSONObject fdageJson = JSONObject.parseObject(FileUtils.readFile(message.getPath().concat("/capture/data.fdage")));
+
+            boolean rewrite = false;
+            // 兼容旧的数据,防止OnlyExportMeshObj标志未删除掉
+            if (fdageJson.containsKey("OnlyExportMeshObj")) {
+                log.info("data.fdage 包含 OnlyExportMeshObj,进行去除!");
+                // 写入data.fdage 防止重算
+                fdageJson.remove("OnlyExportMeshObj");
+                String ossPath = getOssPath(message.getPath());
+                fYunFileService.uploadFile(fdageJson.toJSONString().getBytes(), ossPath + "data.fdage");
+                rewrite = true;
+            }
 
             if (!ObjectUtils.isEmpty(modelType)) {
                 // 修改dataFdage文件
-                JSONObject fdageJson = JSONObject.parseObject(FileUtils.readFile(message.getPath().concat("/capture/data.fdage")));
                 fdageJson.put("modelType", modelType);
+                rewrite = true;
+            }
+
+            if (rewrite) {
                 FileUtils.writeFile(message.getPath().concat("/capture/data.fdage"), fdageJson.toJSONString());
             }
 
@@ -146,27 +202,27 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             log.info("场景计算资源准备结束,场景码:{}", message.getSceneNum());
 
         }catch (Exception e){
-            log.error("场景计算前置处理出错", e);
-        }finally {
-            //如果前置处理失败,发送钉钉消息
-            if(!success){
-
-            }
-
+            log.error("场景计算前置处理出错,num"+num, e);
+//            buildSceneDTService.handBaseFail("场景计算资源准备异常!", message.getPath(), message.getSceneNum(), "计算控制服务器");
+            throw e;
         }
     }
 
-    @Override
-    public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path){
+    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("/");
         }
-        fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
+        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 {
@@ -190,23 +246,14 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             }
             JSONObject fdageData = getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
 
-            Integer cameraType = Integer.parseInt(message.getBuildContext().get("cameraType").toString());
-            Map<String, String> uploadFiles = getUploadFiles(path,cameraType,fdageData);
+            ScenePlus scenePlus = scenePlusService.getScenePlusByNum(sceneCode);
 
-            //计算场景消耗磁盘空间
-            long space = this.calUseSpace(uploadFiles);
+            Integer cameraType = Integer.parseInt(message.getBuildContext().get("cameraType").toString());
+            Map<String, String> uploadFiles = getUploadFiles(scenePlus,path,cameraType,fdageData);
 
-            ScenePlus scenePlus = scenePlusService.getScenePlusByNum(sceneCode);
             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());
-            scenePlusService.updateById(scenePlus);
-            cameraDetailService.updateCameraDetailByCameraIdAndSpace(scenePlus.getCameraId(), space);
-
 
             Integer videoVersion = fdageData.getInteger("videoVersion");
             //读取计算结果文件生成videosJson
@@ -214,68 +261,104 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
             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);
-
-            Object[] editInfoArr = this.updateEditInfo(scenePlus);
-            SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
-            SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
-            SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
 
             //上传全景图俯视图
             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.uploadMulFiles(uploadFiles);
 
+            //修改oss上dam的内容编码
             Map<String,String> damFileHeaders = new HashMap<>();
             damFileHeaders.put("Content-Encoding","gzip");
-
-            if (!fYunFileService.getFyunType().equals(FYunTypeEnum.LOCAL.code())) {
-                // dam 文件设置请求头
-                uploadFiles.entrySet().stream().filter(entry -> FileNameUtil.extName(entry.getKey()).equals("dam"))
-                        .filter(entry -> new File(entry.getKey()).exists())
-                        .forEach(entry -> {
-                            // 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);
 
+            //计算完毕后,同步全景图到缓存目录
+//            this.cachePanorama(path, sceneCode);
+
             //生成houseTypejson并上传
-            uploadFiles.entrySet().stream().filter(entry-> FileNameUtil.getName(entry.getKey()).equals("floorplan_cad.json"))
-                    .forEach(entry-> uploadHouseTypeJson(sceneCode,entry.getKey()));
+            boolean existHouseType = this.uploadHouseTypeJson(sceneCode, path);
+            scenePlus.setHouseType(existHouseType ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code().intValue());
+
+            //生成floorpan.json
+            commonService.uploadFloorplanJson(sceneCode, path);
+
+            //重置异步操作记录
+            this.removeSceneAsynOperLog(sceneCode);
+
+            //清除用户编辑业务数据
+            Set<String> bizs = new HashSet<>();
+            bizs.add(UserEditDataType.BOX_MODEL.message());
+            bizs.add(UserEditDataType.FLOORPLAN.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 = this.updateEditInfo(scenePlus);
+            SceneEditInfo sceneEditInfo = (SceneEditInfo)editInfoArr[0];
+            SceneEditInfoExt sceneEditInfoExt = (SceneEditInfoExt)editInfoArr[1];
+            SceneEditControls sceneEditControls = (SceneEditControls)editInfoArr[2];
+
+            if (cameraType == 14) {
+                //计算成功  激光转台相机 同步 请求
+                fdkkLaserService.syncBuildResult(scenePlus.getNum(), path, scenePlus.getCreateTime(), Calendar.getInstance().getTime());
+                sceneEditControlsService.update(new LambdaUpdateWrapper<SceneEditControls>().set(SceneEditControls::getShowMap,0)
+                        .eq(SceneEditControls::getEditInfoId,sceneEditInfo.getId()));
+                sceneEditControls.setShowMap(0);
+            } else if (new File(path + "/results/laserData/vision_edit.txt").exists()) {
+                fdkkLaserService.cloudPointBuild(sceneCode,path);
+            }
 
-            //写scene.json
             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);
 
-            createQrCode(sceneCode, scenePlusExt, ObjectUtils.isEmpty(company) ? null : company.getQrLogo());
+            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);
 
             //计算成功,通知APP
             Integer pushChannel = fdageData.getInteger("pushChannel");
             String pushToken = fdageData.getString("pushToken");
             this.pushMsgToApp(pushChannel,pushToken, cameraType, scenePlus.getTitle(), scenePlusExt.getWebSite());
 
-            if (cameraType == 14) {
-                // 如果是激光场景,上传全景文件到V3路径,激光系统上线后,可不用上传
-                String imagePath = String.format(UploadFilePath.IMG_VIEW_PATH, sceneCode);
-                String V3ImagePath = String.format(ConstantFilePath.IMAGE_PATH_FORMAT, sceneCode);
-                uploadFiles.entrySet().stream().filter(entry -> entry.getValue().contains(imagePath)).forEach(entry -> {
-                    fYunFileService.uploadFile(entry.getKey(), entry.getValue().replace(imagePath, V3ImagePath));
-                });
+            //删除计算目录
+//            if(CollUtil.isEmpty(notDeleteNasNumList) || !notDeleteNasNumList.contains(sceneCode)){
+//                CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/"));
+//            }
+
+            //更新场景主表
+            //如果相机容量不足,需要把场景的paystatus改为容量不足状态
+            if (cameraType != 14) {
+                scenePlus.setPayStatus(commonService.getPayStatus(scenePlus.getCameraId(), space));
             }
 
-            CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/") + "/capture");
+            this.uploadStatusJson(scenePlus, scenePlusExt);
+
+            scenePlusService.updateById(scenePlus);
+
+            //国际环境需要发邮件通知
+            if("eur".equals(env)){
+                commonService.sendEmail(sceneCode);
+            }
 
             redisUtil.set(String.format(RedisKey.SCENE_BUILD_FINISH_NUM, sceneCode), "1");
 
@@ -293,30 +376,65 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             log.info("场景计算结果处理结束,场景码:{}", sceneCode);
 
         }catch (Exception e){
-            log.error("场景计算结果处理异常, num=" + sceneCode, e);
+            log.error("场景计算结果处理出错,num"+sceneCode, e);
+//            buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
+            throw e;
         }
     }
 
-    private Map<String, String> getUploadFiles(String path,Integer cameraType,JSONObject fdageData) throws Exception {
-        ScenePlus scenePlus = scenePlusService.getByFileId(path);
+    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);
+//        //将全景图缓存到缓存目录
+//        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 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 uploadJsonPath = resultsPath + "upload.json";
-        String uploadData = FileUtils.readFile(uploadJsonPath);
-        log.info("upload.json 文件路径:{}, 内容:{}", uploadJsonPath, uploadData);
+        String uploadData = FileUtils.readFile(resultsPath + "upload.json");
         JSONArray array = JSONObject.parseObject(uploadData).getJSONArray("upload");
 
-
         JSONObject fileJson = null;
         String fileName = "";
 
@@ -370,14 +488,36 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             }
         }
 
+        //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 ((fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1)
-                || (!ObjectUtils.isEmpty(cameraType) && (!cameraType.equals(14)))) {
-            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");
+        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");
@@ -385,9 +525,10 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         map.put(resultsPath + "vision.modeldata", imagesPath + "vision.modeldata");
 
         log.info("数据转换完成:" + projectNum);
-
-        FileUtil.touch("/mnt/4Dkankan/scene/data" + File.separator + "data" + projectNum);
-        map.put(resultsPath + "floorplan.json", dataViewPath + "floor.json");
+        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");
@@ -412,8 +553,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     private void uploadFloorCad(String path, String num, Map<String, String> uploadFiles){
 
         //户型图上传
-        String  userEditPath = UploadFilePath.USER_EDIT_PATH + "floor-cad-%s.%s";
-        String  userViewPath = UploadFilePath.USER_VIEW_PATH + "floor-cad-%s.%s";
+        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)){
@@ -421,8 +561,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
                 String substring = str.substring(str.lastIndexOf(File.separator) + 1);
                 String[] arr = substring.split("floor");
                 String[] arr2 = arr[1].split("\\.");
-                uploadFiles.put(str, String.format(userEditPath, num, arr2[0], arr2[1]));
-                uploadFiles.put(str, String.format(userViewPath, num, arr2[0], arr2[1]));
+                uploadFiles.put(str, String.format(dataViewPath, num, arr2[0], arr2[1]));
             });
         }
 
@@ -440,7 +579,11 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         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());
 
@@ -479,7 +622,11 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         fYunFileService.uploadFile(sceneJsonStr.getBytes(), dataViewPath + "scene.json");
         //scenejson写入缓存
         redisUtil.set(String.format(RedisKey.SCENE_JSON, num), sceneJsonStr);
+    }
 
+    private void uploadStatusJson(ScenePlus scenePlus, ScenePlusExt scenePlusExt){
+        String num = scenePlus.getNum();
+        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
         // 上传status JSON.
         JSONObject statusJson = new JSONObject();
         //临时将-2改成1,app还没完全更新
@@ -493,7 +640,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
         fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json",
                 dataViewPath + "status.json");
-
     }
 
     private void createQrCode(String num, ScenePlusExt scenePlusExt, String qrLogo) {
@@ -511,6 +657,8 @@ 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(1024);
+        qrConfig.setHeight(1024);
         if(!ObjectUtils.isEmpty(localLogoPath)){
             qrConfig.setImg(localLogoPath);
         }
@@ -675,42 +823,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         return uploadFile.keySet().stream().map(File::new).filter(File::exists).mapToLong(File::length).sum();
     }
 
-    private void sealScene(Long scenePlusId){
-        scenePlusService.update(
-            new LambdaUpdateWrapper<ScenePlus>()
-                .set(ScenePlus::getPayStatus, PayStatus.NO_CAPACITY.code())
-                .eq(ScenePlus::getId, scenePlusId));
-    }
-
-    /**
-     * <p>
-     双目场景更新数据库
-     * </p>
-     * @author dengsixing
-     * @date 2022/3/21
-     * @param num
-     * @param space
-     **/
-    private void updateDb4Sm(String num, long space){
-        List<ScenePlus> ScenePlusList = scenePlusService.list(
-            new LambdaQueryWrapper<ScenePlus>().select(ScenePlus::getId).eq(ScenePlus::getNum, num));
-
-        if(CollUtil.isEmpty(ScenePlusList)){
-            return ;
-        }
-
-        List<Long> sceneIds = ScenePlusList.stream().map(ScenePlus::getId).collect(Collectors.toList());
-
-        //更新场景创建时间
-        scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>().in(ScenePlus::getId, sceneIds)
-            .set(ScenePlus::getSceneStatus, SceneStatus.NO_DISPLAY.code()));
-
-        //更新使用容量
-        scenePlusExtService.update(new LambdaUpdateWrapper<ScenePlusExt>().in(ScenePlusExt::getPlusId, sceneIds)
-                .set(ScenePlusExt::getSpace, space)
-                .set(ScenePlusExt::getAlgorithmTime, Calendar.getInstance().getTime()));
-    }
-
     private void updateDbPlus(int sceneSource,Long space,String videosJson, Long computeTime,boolean isObj,ScenePlusExt scenePlusExt){
 
         scenePlusExt.setSpace(space);
@@ -744,12 +856,14 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
         String sceneKind = scenePlusExt.getSceneScheme() == 3 ? SceneKind.FACE.code():SceneKind.TILES.code();
         scenePlusExt.setSceneKind(sceneKind);
+//        scenePlusExt.setModelKind(modelKind);
 
-        scenePlusExtService.updateById(scenePlusExt);
-    }
+        String dataFdage = FileUtil.readUtf8String(scenePlusExt.getDataSource().concat("/capture/").concat("data.fdage"));
+        JSONObject jsonObject = JSON.parseObject(dataFdage);
+        int points = jsonObject.getJSONArray("points").size();
+        scenePlusExt.setShootCount(points);
 
-    private int getPayStatus(Long cameraId, Long space){
-        return PayStatus.PAY.code();
+        scenePlusExtService.updateById(scenePlusExt);
     }
 
     private Object[] updateEditInfo(ScenePlus scenePlus){
@@ -762,11 +876,36 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             sceneEditInfo.setDescription(scenePlus.getDescription());
             sceneEditInfo.setTitle(scenePlus.getTitle());
             sceneEditInfoService.save(sceneEditInfo);
-
         }else{
+
+            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");
+            }
+
+            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(sceneEditInfo.getVersion() + 1);
+            sceneEditInfo.setVersion(version + 1);
+            sceneEditInfo.setImgVersion(imgVersion + 1);
+            sceneEditInfo.setLinkVersion(linkVersion + 1);
+            sceneEditInfo.setIsUploadObj(CommonStatus.NO.code());
             sceneEditInfoService.updateById(sceneEditInfo);
         }
         if(sceneEditControls == null){
@@ -783,15 +922,21 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         return new Object[]{sceneEditInfo, sceneEditInfoExt, sceneEditControls};
     }
 
-    public void uploadHouseTypeJson(String num, String floorPlanCardFilePath) {
+    public boolean uploadHouseTypeJson(String num, String dataSource) {
+        String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
         if (!new File(floorPlanCardFilePath).exists()) {
-            log.error("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
-            return;
+            log.warn("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
+            return false;
         }
         JSONObject json = CreateHouseJsonUtil.createHouseTypeJsonByCad(floorPlanCardFilePath);
-        String hourseTypeJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "houseType.json";
+        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.DATA_EDIT_PATH, num) + "houseType.json";
+        hourseTypeJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "houseType.json";
         fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
+
+        return true;
     }
 }

+ 600 - 0
src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java

@@ -0,0 +1,600 @@
+package com.fdkankan.contro.mq.service.impl;
+
+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 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.PayStatus;
+import com.fdkankan.common.constant.SceneStatus;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.entity.*;
+import com.fdkankan.contro.mq.service.IBuildSceneService;
+import com.fdkankan.contro.service.ICommonService;
+import com.fdkankan.contro.service.*;
+import com.fdkankan.contro.service.impl.FdkkV4Service;
+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.utils.CreateHouseJsonUtil;
+import com.fdkankan.model.utils.CreateObjUtil;
+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 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.stereotype.Service;
+
+import java.io.File;
+import java.util.*;
+
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/4/20
+ **/
+@Slf4j
+@Service
+public class BuildV3SceneServiceImpl implements IBuildSceneService {
+
+    @Value("${queue.modeling.modeling-call}")
+    private String queueModelingCall;
+
+    @Value("${queue.modeling.v3.modeling-post}")
+    private String queueV3ModelingPost;
+
+    @Value("${model.type:#{null}}")
+    private String modelSceneKind;
+
+    @Value("${model.modelKind:3dtiles}")
+    private String modelKind;
+
+    @Value("${env:gn}")
+    private String env;
+
+    @Autowired
+    private ICommonService commonService;
+
+    @Autowired
+    private RabbitMqProducer mqProducer;
+
+    @Autowired
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private ICameraDetailService cameraDetailService;
+
+    @Autowired
+    private FYunFileConfig fYunFileConfig;
+
+    @Autowired
+    private ISceneProService sceneProService;
+
+    @Autowired
+    private IUserIncrementService userIncrementService;
+
+    @Autowired
+    private IFdkkLaserService fdkkLaserService;
+
+    @Autowired
+    private FdkkV4Service fdkkV4Service;
+
+    @Autowired
+    private IIncrementTypeService incrementTypeService;
+
+    @Autowired
+    private IBuildSceneDTService buildSceneDTService;
+
+    @Autowired
+    private ISceneProEditService sceneProEditService;
+
+    @Autowired
+    private ISceneColdStorageService sceneColdStorageService;
+
+    @Override
+    public void buildScenePre(BuildSceneCallMessage message) {
+        boolean success = false;
+        String num = message.getSceneNum();
+        try {
+
+            //重新计算时需要删除文件夹,否知使用缓存
+            if(new File(message.getPath() + File.separator + "results").exists()){
+                FileUtils.deleteDirectory(message.getPath() + File.separator + "results");
+            }
+
+            //用户相机重新全量上传,需要解冻结
+            sceneColdStorageService.unfreeze(num, "用户相机重新全量上传", message.getPath());
+
+            //根据相机类型,组装资源路径
+            //下载资源到本地
+            this.downLoadSource(message, message.getPath());
+            JSONObject fdageJson = JSONObject.parseObject(FileUtils.readFile(message.getPath().concat("/capture/data.fdage")));
+            // 兼容旧的数据,防止OnlyExportMeshObj标志未删除掉
+            boolean rewrite = false;
+            if (fdageJson.containsKey("OnlyExportMeshObj")) {
+                log.info("data.fdage 包含 OnlyExportMeshObj,进行去除!");
+                // 写入data.fdage 防止重算
+                fdageJson.remove("OnlyExportMeshObj");
+                String ossPath = getOssPath(message.getPath());
+                fYunFileService.uploadFile(fdageJson.toJSONString().getBytes(), ossPath + "data.fdage");
+                rewrite = true;
+            }
+
+            if (!ObjectUtils.isEmpty(modelSceneKind)) {
+                // 修改dataFdage文件
+                fdageJson.put("modelType", modelSceneKind);
+                rewrite = true;
+            }
+
+            if (rewrite) {
+                FileUtils.writeFile(message.getPath().concat("/capture/data.fdage"), fdageJson.toJSONString());
+            }
+
+            message.getBuildContext().put("cameraType",message.getCameraType());
+
+            message.setResultReceiverMqName(queueV3ModelingPost);
+
+            //发送mq,就进行计算
+            mqProducer.sendByWorkQueue(queueModelingCall, message);
+
+            success = true;
+
+            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();
+        try {
+
+            Integer cameraType = Integer.parseInt(message.getBuildContext().get("cameraType").toString());
+            Long computeTime = message.getComputeTime();
+
+            String path = message.getPath();
+
+            Boolean buildSuccess = message.getBuildSuccess();
+            JSONObject fdageData = getFdageData(path + File.separator + "capture" +File.separator+"data.fdage");
+            Integer videoVersion = fdageData.getInteger("videoVersion");
+            // 上传计算日志
+            //如果是重复计算,没有走到计算逻辑,不需要上传日志文件
+            log.info("开始上传计算日志");
+            String buildLogPath = String.format(UploadFilePath.BUILD_LOG_PATH, sceneCode);
+            fYunFileService.uploadFile(path + File.separator + "console.log", buildLogPath + "console.log");
+            log.info("计算日志上传完成");
+
+            if (!buildSuccess) {
+                log.error("建模失败,修改状态为失败状态");
+                sceneProService.update(new LambdaUpdateWrapper<ScenePro>()
+                        .set(ScenePro::getStatus, SceneStatus.FAILD.code())
+                        .eq(ScenePro::getNum, sceneCode));
+                // 发送钉钉消息,计算失败
+                buildSceneDTService.handModelFail("计算失败", message.getPath(), sceneCode, message.getHostName());
+                return;
+            }
+
+            Map<String, String> uploadFiles = getUploadFiles(sceneCode,path,cameraType,fdageData);
+
+            copyFiles(path,sceneCode);
+
+            //建模成功走以下逻辑
+            log.info("cameraType:{}",cameraType);
+
+            //计算场景消耗磁盘空间
+            long space = this.calUseSpace(uploadFiles);
+
+            //读取计算结果文件生成videosJson
+            JSONObject videosJson = this.getVideosJson(path, videoVersion, sceneCode, cameraType);
+
+            //写入数据库
+            ScenePro scenePro = this.updateDbPlus(sceneCode, space, videosJson.toJSONString(), computeTime,fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1);
+
+            scenePro.setPayStatus(PayStatus.PAY.code());
+            //如果相机容量不足,需要把场景的paystatus改为容量不足状态
+            if (cameraType != 14) {
+                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);
+            fYunFileService.uploadMulFiles(uploadFiles);
+
+            Map<String,String> damFileHeaders = new HashMap<>();
+            damFileHeaders.put("Content-Encoding","gzip");
+
+            // dam 文件设置请求头
+            uploadFiles.entrySet().stream()
+                .filter(entry -> FileNameUtil.extName(entry.getKey()).equals("dam"))
+                .filter(entry -> new File(entry.getKey()).exists())
+                .forEach(entry -> {
+                    // 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);
+                });
+
+            //生成houseTypejson并上传
+            uploadFiles.entrySet().stream().filter(entry-> FileNameUtil.getName(entry.getKey()).equals("floorplan_cad.json"))
+                    .forEach(entry-> uploadHouseTypeJson(sceneCode,entry.getKey()));
+
+
+
+            //计算成功,通知APP
+            Integer pushChannel = fdageData.getInteger("pushChannel");
+            String pushToken = fdageData.getString("pushToken");
+            this.pushMsgToApp(pushChannel,pushToken, cameraType, scenePro.getSceneName(), scenePro.getWebSite());
+
+            SceneProEdit sceneProEdit = sceneProEditService.getByProId(scenePro.getId());
+            sceneProEdit.setVersion(ObjectUtils.isEmpty(sceneProEdit.getVersion()) ? 0 : sceneProEdit.getVersion() + 1);
+            sceneProEdit.setImagesVersion(ObjectUtils.isEmpty(sceneProEdit.getImagesVersion()) ? 0 : sceneProEdit.getImagesVersion() + 1);
+            sceneProEdit.setFloorEditVer(ObjectUtils.isEmpty(sceneProEdit.getFloorEditVer()) ? 0 : sceneProEdit.getFloorEditVer() + 1);
+            sceneProEdit.setFloorPublishVer(ObjectUtils.isEmpty(sceneProEdit.getFloorPublishVer()) ? 0 : sceneProEdit.getFloorPublishVer() + 1);
+            if (cameraType == 14) {
+                //计算成功  激光转台相机 同步 请求
+                fdkkLaserService.syncBuildResult(scenePro.getNum(), scenePro.getDataSource(),scenePro.getCreateTime(), Calendar.getInstance().getTime());
+                sceneProEdit.setMapVisi(0);
+            }
+            sceneProEditService.updateById(sceneProEdit);
+
+            //写scene.json
+            log.info("生成scene.json上传oss并设置缓存,num:{}", sceneCode);
+            this.writeSceneJson(videosJson,scenePro,sceneProEdit);
+
+            CreateObjUtil.deleteFile(path.replace(ConstantFilePath.BUILD_MODEL_PATH, "/") + "/capture");
+            log.info("场景计算结果处理结束,场景码:{}", sceneCode);
+            // 判断是否升级V4
+//            if(fdageData.containsKey("updateV4") && fdageData.getIntValue("updateV4") == 1){
+//                fdkkV4Service.upgradeToV4(sceneCode);
+//            }
+
+            //国际环境需要发邮件通知
+            if("eur".equals(env)){
+                commonService.sendEmail(sceneCode);
+            }
+
+        }catch (Exception e){
+            log.error("场景计算结果处理出错,num"+sceneCode, e);
+            buildSceneDTService.handBaseFail("场景计算结果处理出错!", message.getPath(), sceneCode, "计算控制服务器");
+            throw e;
+        }
+    }
+
+    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);
+        }
+        if (new File(path + File.separator + "results" + File.separator + "floorplan.json").exists()) {
+            FileUtils.copyFile(path + File.separator + "results" + File.separator + "floorplan.json", ConstantFilePath.SCENE_PATH + "data" + File.separator + "data" + num + File.separator + "floor.json", true);
+            FileUtils.copyFile(path + File.separator + "results" + File.separator + "floorplan.json", ConstantFilePath.SCENE_PATH + "data" + File.separator + "data" + num + File.separator + "floorplan.json", true);
+        }
+    }
+
+    private Map<String, String> getUploadFiles(String projectNum,String path,Integer cameraType,JSONObject fdageData) throws Exception {
+        String dataViewPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, projectNum);
+        String imagesPath = String.format(ConstantFilePath.IMAGE_PATH_FORMAT, projectNum);
+        String videoPath = String.format(ConstantFilePath.VIDEO_PATH_FORMAT, 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 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);
+                }
+            }
+        }
+
+
+        if ((fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1)
+                || (!ObjectUtils.isEmpty(cameraType) && cameraType != 14)) {
+            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");
+        }
+
+        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);
+
+        FileUtil.touch("/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 writeSceneJson(JSONObject videosJson, ScenePro scenePro,SceneProEdit sceneProEdit)  throws Exception{
+        String num = scenePro.getNum();
+        String dataViewPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, num);
+        //如果云端没有scene.json文件,生成一份
+
+        JSONObject sceneJson = JSONObject.parseObject(JSONObject.toJSONString(scenePro));
+        sceneJson.put("videos",videosJson.toJSONString());
+        sceneJson.put("version",sceneProEdit.getVersion());
+        sceneJson.put("imagesVersion",sceneProEdit.getImagesVersion());
+        sceneJson.put("floorEditVer",sceneProEdit.getFloorEditVer());
+        sceneJson.put("floorPublishVer",sceneProEdit.getFloorPublishVer());
+        String sceneJsonStr = JSON.toJSONString(sceneJson);
+
+        FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "scene.json", sceneJsonStr);
+        //上传sceneJson文件
+        fYunFileService.uploadFile(sceneJsonStr.getBytes(), dataViewPath + "scene.json");
+
+        // 上传status JSON.
+        JSONObject statusJson = new JSONObject();
+        //临时将-2改成1,app还没完全更新
+        statusJson.put("status", 1);
+        statusJson.put("webSite", scenePro.getWebSite());
+        statusJson.put("sceneNum", num);
+        statusJson.put("thumb", scenePro.getThumb());
+        statusJson.put("payStatus", scenePro.getPayStatus());
+        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");
+    }
+
+    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 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(ConstantFilePath.DATA_PATH_FORMAT, 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(ConstantFilePath.DATA_PATH_FORMAT, 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(ConstantFilePath.DATA_PATH_FORMAT, 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 ScenePro updateDbPlus(String num, Long space, String videosJson, Long computeTime,boolean isObj){
+        sceneProService.update(new LambdaUpdateWrapper<ScenePro>()
+                .eq(ScenePro::getNum, num)
+                .set(ScenePro::getStatus, SceneStatus.NO_DISPLAY.code())
+                .set(ScenePro::getUpdateTime, new Date())
+                .set(ScenePro::getCreateTime, new Date())
+                .set(ScenePro::getSpace, space)
+                .set(ScenePro::getComputeTime, computeTime)
+                .set(ScenePro::getVideos, videosJson)
+                .set(ScenePro::getIsObj, isObj ? 1 : 0)
+                .set(ScenePro::getPayStatus, PayStatus.PAY.code()));
+       return sceneProService.getByNum(num);
+    }
+
+    public void uploadHouseTypeJson(String num, String floorPlanCardFilePath) {
+        if (!new File(floorPlanCardFilePath).exists()) {
+            log.error("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
+            return;
+        }
+        JSONObject json = CreateHouseJsonUtil.createHouseTypeJsonByCad(floorPlanCardFilePath);
+        String hourseTypeJsonPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, num) + "houseType.json";
+        fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
+        hourseTypeJsonPath = String.format(UploadFilePath.DATA_EDIT_PATH, num) + "houseType.json";
+        fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
+    }
+}

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

@@ -15,6 +15,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);
 }

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

@@ -0,0 +1,42 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.CameraDetail;
+import com.fdkankan.contro.vo.ScenePlusVO;
+
+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);
+
+    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);
+}

+ 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;
+
+
+
+}

+ 28 - 0
src/main/java/com/fdkankan/contro/service/IFdkkLaserService.java

@@ -0,0 +1,28 @@
+package com.fdkankan.contro.service;
+
+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 java.util.Date;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/1/14
+ **/
+public interface IFdkkLaserService {
+    void syncBuildResult(String sceneNum, String dataSource, Date createTime, Date algorithmTime);
+
+    void pushBuildStatusToLaserSystem(String projectNum, String laserObjFilePath, Integer buildObjStatus);
+
+    void saveScene(ScenePlus scenePlus, String scenePassword, Camera cameraEntity, String userName, boolean b);
+
+    void saveScene(ScenePro scenePro, String scenePassword, Camera cameraEntity, String phone, boolean rebuild);
+
+    void cloudPointBuild(String sceneCode, String visionEditFilePath);
+}

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

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

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

@@ -23,7 +23,9 @@ public interface IScene3dNumService extends IService<Scene3dNum> {
      * 从码池中取出一个场景码
      * @return
      */
-    String generateSceneNum(Integer cameraType);
+    String generateSceneNum(Integer cameraType) throws Exception;
+
+    void generateSceneNumHandler();
 
     /**
      * 批量生成场景码并放入码池

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

@@ -0,0 +1,16 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.SceneAsynOperLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2022-12-16
+ */
+public interface ISceneAsynOperLogService extends IService<SceneAsynOperLog> {
+
+}

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

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

+ 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);
+
+}

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

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

+ 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);
+
+}

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

@@ -29,7 +29,7 @@ public interface ISceneFileBuildService extends IService<SceneFileBuild> {
 
     ResultData turntableUploadSuccess(String params) throws Exception;
 
-    ResultData rebuildScene(String num,Boolean force) throws IOException;
+    ResultData rebuildScene(String num,Boolean force,Boolean deleteExtras) throws IOException;
 
     ResultData uploadFile(MultipartFile file, String params) throws Exception;
 

+ 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 - 2
src/main/java/com/fdkankan/contro/service/IScenePlusService.java

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

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

@@ -0,0 +1,22 @@
+package com.fdkankan.contro.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.contro.entity.ScenePro;
+
+/**
+ * <p>
+ * pro场景表 服务类
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2021-12-23
+ */
+public interface ISceneProService extends IService<ScenePro> {
+
+    ScenePro getByNum(String num);
+
+    Long sumUsedSpaceByCameraId(Long cameraId, String spaceTypeStr);
+
+
+
+}

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

@@ -0,0 +1,75 @@
+package com.fdkankan.contro.service.impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.fdkankan.contro.service.IBuildSceneDTService;
+import com.fdkankan.dingtalk.DingTalkSendUtils;
+import com.fdkankan.fyun.config.FYunFileConfig;
+import com.taobao.api.ApiException;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.io.UnsupportedEncodingException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/4/20
+ **/
+@Slf4j
+@Service
+public class BuildSceneDTServiceImpl implements IBuildSceneDTService {
+
+    public static final String DINGTALK_MSG_PATTERN = "**环境**: %s\n\n" +
+        "**服务器名称**: %s\n\n" +
+        "**失败原因**: %s\n\n" +
+        "**num**: %s\n\n" +
+        "**server-path**: %s\n\n";
+
+    public static final String contentExt = "**algorithm-log**: [%sbuild_log/%s/console.log](%sbuild_log/%s/console.log)";
+
+    @Autowired
+    private DingTalkSendUtils dingTalkSendUtils;
+
+    @Autowired
+    private FYunFileConfig fYunFileConfig;
+
+    @Value("${main.url}")
+    private String mainUrl;
+
+    @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);
+            }
+        });
+    }
+
+    @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);
+            }
+        });
+    }
+}

+ 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);
+    }
 }

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

@@ -0,0 +1,337 @@
+package com.fdkankan.contro.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.constant.CommonStatus;
+import com.fdkankan.common.constant.PayStatus;
+import com.fdkankan.common.constant.SceneStatus;
+import com.fdkankan.common.constant.SpaceType;
+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.service.ICommonService;
+import com.fdkankan.contro.service.*;
+import com.fdkankan.contro.vo.ScenePlusVO;
+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.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;
+    @Autowired
+    private ICameraDetailService cameraDetailService;
+    @Autowired
+    private IUserIncrementService userIncrementService;
+    @Autowired
+    private IIncrementTypeService incrementTypeService;
+    @Autowired
+    private ICameraService cameraService;
+    @Autowired
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private FYunFileConfig fYunFileConfig;
+
+    @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 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);
+        }
+    }
+
+    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){
+            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 = fYunFileService.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.DATA_VIEW_PATH, num));
+        space += fYunFileService.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.IMG_VIEW_PATH, num));
+        space += fYunFileService.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.VIDEOS_VIEW_PATH, num));
+        space += fYunFileService.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.VOICE_VIEW_PATH, num));
+        space += fYunFileService.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.scene_result_data_path, num).concat("caches"));
+        return  space;
+    }
+}

+ 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);
+    }
+}

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

@@ -0,0 +1,66 @@
+package com.fdkankan.contro.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.contro.common.Result;
+import com.fdkankan.contro.entity.ScenePro;
+import com.fdkankan.contro.service.ISceneProService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.client.RestTemplate;
+
+@Service
+public class FdkkV4Service {
+    private static final Logger log = LoggerFactory.getLogger(FdkkV4Service.class);
+
+    private final String UPGRADE_TO_V4="/api/user/scene/upgradeToV4?num=%s";
+
+    @Value("${main.url}")
+    private String mainUrl;
+
+    private RestTemplate restTemplate = new RestTemplate();
+
+    @Autowired
+    private ISceneProService sceneProService;
+
+    /**
+     * 场景升级
+     * @param num  场景码
+     * @return
+     * @throws Exception
+     */
+    public void upgradeToV4(String num){
+        // 如果场景在旧表中存在,则需要升级,否则不需要升级
+        ScenePro scenePro = sceneProService.getByNum(num);
+        String url = mainUrl + String.format(UPGRADE_TO_V4,num);
+        log.info("v3场景升级v4,url:{}",url);
+        ResponseEntity<Result> responseEntity = restTemplate.getForEntity(url, Result.class);
+        log.info("v3场景升级v4,url:{},结果,{}",url, JSONObject.toJSONString(responseEntity.getBody()));
+        if(responseEntity.getStatusCode() != HttpStatus.OK){
+            log.error("场景升级失败,请稍后再试!");
+        }
+        Integer code = responseEntity.getBody().getCode();
+        if(code != 0){
+            String msg = "场景升级失败,请稍后再试!";
+            if(code == 7019){
+                msg = "场景升级中,请勿重复升级";
+            }else if(code == 7020){
+                msg = "场景已升级,不能重复升级";
+            }
+            log.error(msg);
+            return;
+        }
+
+        //修改场景状态为升级中
+        LambdaUpdateWrapper<ScenePro> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.set(ScenePro::getIsUpgrade,2).eq(ScenePro::getNum,num);
+        sceneProService.update(wrapper);
+    }
+
+}

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

@@ -0,0 +1,189 @@
+package com.fdkankan.contro.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.util.DateUtil;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.contro.entity.Camera;
+import com.fdkankan.contro.entity.ScenePlus;
+import com.fdkankan.contro.entity.ScenePro;
+import com.fdkankan.contro.service.IFdkkLaserService;
+import com.fdkankan.contro.service.IScenePlusService;
+import com.fdkankan.contro.service.ISceneProService;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+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.stereotype.Service;
+import org.springframework.util.ObjectUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+@Slf4j
+public class IFdkkLaserServiceImpl implements IFdkkLaserService {
+
+    @Autowired
+    private ISceneProService sceneProService;
+
+    @Autowired
+    private IScenePlusService scenePlusService;
+
+    @Autowired
+    private RabbitMqProducer rabbitMqProducer;
+
+    @Value("${queue.application.laser.update-scene}")
+    private String updateScene;
+
+    @Value("${queue.application.laser.update-build-status}")
+    private String updateBuildStatus;
+
+    @Value("${queue.application.laser.cloud-point-build}")
+    private String cloudPointBuild;
+
+    @Value("${4dkk.laserService.bucket}")
+    private String bucket;
+
+    @Value("${4dkk.laserService.cloud-point-fyun-path}")
+    private String cloudPointFyunPath;
+
+    @Autowired
+    private FYunFileServiceInterface fYunFileService;
+
+
+    public void updateSceneStatus(String sceneCode, int sceneStatus, String path, Date createTime, Date algorithmTime) {
+        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));
+        params.put("algorithmTime", DateUtil.date2String(algorithmTime, null));
+        if (!ObjectUtils.isEmpty(path)) {
+            params.put("path", path);
+        }
+        rabbitMqProducer.sendByWorkQueue(updateScene, params);
+    }
+
+    public void syncBuildResult(String sceneNum, String dataSource,Date createTime, Date algorithmTime) {
+        log.info("激光转台相机构建结果 同步 请求 ");
+        try {
+            String jgPath = dataSource;
+            //创建目录
+            if (dataSource.lastIndexOf("/") != -1) {
+                jgPath = jgPath + "_laserData";
+            } else {
+                jgPath = jgPath.substring(0, jgPath.length() - 1) + "_laserData";
+            }
+
+            FileUtils.createDir(jgPath + "/extras");
+
+            log.info("生成 激光相机目录 " + jgPath);
+            //生成data.json
+            JSONObject jgDataJson = new JSONObject();
+            jgDataJson.put("split_type", "SPLIT_V15");
+            jgDataJson.put("skybox_type", "SKYBOX_V5");
+            jgDataJson.put("extras", null);
+            FileUtils.writeFile(jgPath + File.separator + "data.json", jgDataJson.toString());
+
+            // result/mesh/mesh.obj  --> jgPath/laserData/laser.obj
+            log.info("开始拷贝obj文件");
+            FileUtils.copyDirectiory(dataSource + "/results/mesh", jgPath + "/laserData/mesh");
+
+            FileUtils.copyDirectiory(dataSource + "/results/laserData/cover", jgPath + "/extras");
+            FileUtils.copyFile(dataSource + "/results/laserData", jgPath, true);
+
+            updateSceneStatus(sceneNum, 2, jgPath + File.separator + "laserData",createTime, algorithmTime);
+        } catch (Exception e) {
+            log.error("激光转台相机同步失败", e);
+        }
+    }
+
+    @Override
+    public void pushBuildStatusToLaserSystem(String projectNum, String laserObjFilePath, Integer buildObjStatus) {
+        Map<String, Object> params = new HashMap<>();
+        params.put("sceneCode", projectNum);
+        params.put("objPath", laserObjFilePath);
+        params.put("buildObjStatus", buildObjStatus);
+        rabbitMqProducer.sendByWorkQueue(updateBuildStatus, params);
+    }
+
+
+    public void saveScene(ScenePlus scenePlus, String scenePassword, Camera cameraEntity, String phone, boolean rebuild) {
+        Map<String, Object> params = new HashMap<>();
+        params.put("childName", cameraEntity.getChildName());
+        params.put("createTime", DateUtil.date2String(scenePlus.getCreateTime(), null));
+        params.put("phone", phone);
+        params.put("sceneCode", scenePlus.getNum());
+        params.put("snCode", cameraEntity.getSnCode());
+        params.put("status", scenePlus.getSceneStatus());
+        if (!rebuild) {
+            params.put("password", scenePassword);
+        } 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);
+    }
+
+    public void saveScene(ScenePro scenePro, String scenePassword, Camera cameraEntity, String phone, boolean rebuild) {
+        Map<String, Object> params = new HashMap<>();
+        params.put("childName", cameraEntity.getChildName());
+        if(ObjectUtils.isEmpty(scenePro.getCreateTime())){
+            scenePro.setCreateTime(new Date());
+        }
+        params.put("createTime", DateUtil.date2String(scenePro.getCreateTime(), null));
+        params.put("phone", phone);
+        params.put("sceneCode", scenePro.getNum());
+        params.put("snCode", cameraEntity.getSnCode());
+        params.put("status", scenePro.getStatus());
+        if (!rebuild) {
+            params.put("password", scenePassword);
+        } else {
+            params.put("status", 4);
+        }
+        params.put("version",getSceneVersion(scenePro.getNum()));
+        params.put("title", scenePro.getSceneName());
+        params.put("userId", scenePro.getUserId());
+        rabbitMqProducer.sendByWorkQueue(updateScene, params);
+    }
+
+    private String getSceneVersion(String num) {
+        String version = "V3";
+        ScenePro scenepro = sceneProService.getByNum(num);
+        if (scenepro == null || scenepro.getIsUpgrade() == 1) {
+            ScenePlus plus = scenePlusService.getScenePlusByNum(num);
+            if (plus != null) {
+                version = "V4";
+            }
+        }
+        return version;
+    }
+
+    @Override
+    public void cloudPointBuild(String sceneCode, String path) {
+        log.info("开始同步点云编辑文件");
+        // 删除旧的文件及目录
+        try {
+            fYunFileService.deleteFile(cloudPointFyunPath + "vision_edit.txt");
+            fYunFileService.deleteFolder(cloudPointFyunPath + "uuidcloud");
+        } catch (IOException e) {
+            log.error("删除文件失败", e);
+            e.printStackTrace();
+        }
+
+        // 上传点云编辑文件,并通知激光系统
+        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");
+
+        Map<String, Object> params = new HashMap<>();
+        params.put("sceneNum", sceneCode);
+        params.put("businessType", 0);
+        rabbitMqProducer.sendByWorkQueue(cloudPointBuild, params);
+    }
+}

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

@@ -0,0 +1,20 @@
+package com.fdkankan.contro.service.impl;
+
+import com.fdkankan.contro.entity.MailTemplate;
+import com.fdkankan.contro.mapper.IMailTemplateMapper;
+import com.fdkankan.contro.service.IMailTemplateService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2023-03-01
+ */
+@Service
+public class MailTemplateServiceImpl extends ServiceImpl<IMailTemplateMapper, MailTemplate> implements IMailTemplateService {
+
+}

+ 61 - 37
src/main/java/com/fdkankan/contro/service/impl/Scene3dNumServiceImpl.java

@@ -1,8 +1,8 @@
 package com.fdkankan.contro.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.common.constant.CommonStatus;
 import com.fdkankan.common.constant.ErrorCode;
@@ -12,6 +12,7 @@ import com.fdkankan.contro.entity.Scene3dNum;
 import com.fdkankan.contro.enums.CameraTypeEnum;
 import com.fdkankan.contro.mapper.IScene3dNumMapper;
 import com.fdkankan.contro.service.IScene3dNumService;
+import com.fdkankan.dingtalk.DingTalkSendUtils;
 import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.constant.RedisLockKey;
 import com.fdkankan.redis.util.RedisLockUtil;
@@ -19,6 +20,7 @@ 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.CollectionUtils;
 
@@ -37,10 +39,16 @@ import java.util.stream.Collectors;
  * @author dengsixing
  * @since 2021-12-23
  */
+@RefreshScope
 @Slf4j
 @Service
 public class Scene3dNumServiceImpl extends ServiceImpl<IScene3dNumMapper, Scene3dNum> implements IScene3dNumService {
 
+    public static final String DINGTALK_MSG_PATTERN =
+        "**环境**: %s\n\n" +
+        "**标题**: %s\n\n" +
+        "**告警信息**: %s\n\n";
+
     @Autowired
     private RedisUtil redisUtil;
     @Autowired
@@ -48,55 +56,71 @@ public class Scene3dNumServiceImpl extends ServiceImpl<IScene3dNumMapper, Scene3
 
     @Value("${scene.num.cachePageSize:500}")
     private int cachePageSize;
-    @Value("${scene.num.threshold:10000}")
+    @Value("${scene.num.threshold:1000}")
     private int threshold;
-    @Value("${scene.num.prefix:V4-}")
+    @Value("${scene.num.prefix}")
     private String numPrefix;
     @Value("${scene.num.batchSize:100}")
     private int batchSize;
+    @Value("${main.url}")
+    private String mainUrl;
+
+    @Autowired
+    private DingTalkSendUtils dingTalkSendUtils;
 
     @Override
-    public String generateSceneNum(Integer cameraType){
+    public String generateSceneNum(Integer cameraType) throws Exception {
         // 从缓存中获取
         String sceneNum = redisUtil.lLeftPop(RedisKey.FDKANKAN_SCENE_NUMS);
         if(Objects.nonNull(sceneNum)){
             return addPrefix(sceneNum,cameraType);
         }
+        //为了防止场景量暴增导致定时任务来还不急处理,如果上面redis获取不到,需要调用一下生成场景码方法
+        log.warn("定时任务没有生成足够的场景码,此处实时调用批量生成场景码程序");
+        this.generateSceneNumHandler();
+        Thread.sleep(5000L);
+        // 从缓存中获取
+        sceneNum = redisUtil.lLeftPop(RedisKey.FDKANKAN_SCENE_NUMS);
+        if(Objects.isNull(sceneNum)){
+            String content = String.format(this.DINGTALK_MSG_PATTERN, mainUrl, "场景码穷尽告警", "场景计算获取场景码失败");
+            dingTalkSendUtils.sendActioncardMsgToDingRobot(content, "场景码穷尽告警");
+            throw new Exception("场景计算获取场景码失败");
+        }
+        return addPrefix(sceneNum,cameraType);
+    }
+
+    @Override
+    public void generateSceneNumHandler() {
+        boolean lock =  redisLockUtil.lock(RedisLockKey.LOCK_FDKANKAN_SCENE_NUMS, RedisKey.EXPIRE_TIME_30_MINUTE);
+        if(!lock){
+            return;
+        }
         // 分布式加锁
-        boolean lock =  redisLockUtil.lock(RedisLockKey.LOCK_FDKANKAN_SCENE_NUMS, RedisKey.EXPIRE_TIME_10_MINUTE);
-        if (lock) {
-            try {
-                log.info("开始加载场景码缓存");
-                List<String> nums = this.findSceneNum(cachePageSize);
-                if(CollectionUtils.isEmpty(nums)){
-                    batchCreateSceneNum(true);
-                    nums = this.findSceneNum(cachePageSize);
-                }else{
-                    CompletableFuture.runAsync(() -> batchCreateSceneNum(false));
-                }
-                redisUtil.lRightPushAll(RedisKey.FDKANKAN_SCENE_NUMS, nums);
-                this.update(new LambdaUpdateWrapper<Scene3dNum>().set(Scene3dNum::getUsed, CommonStatus.YES.code()).in(Scene3dNum::getCode, nums));
-//                this.updateUsedStatus(nums);
-                log.info("场景码加载缓存完成");
-            } catch (Exception e) {
-                log.error("场景码加载缓存失败", e);
-            } finally {
-                redisLockUtil.unlockLua(RedisLockKey.LOCK_FDKANKAN_SCENE_NUMS);
+        try {
+            //检查mysql码池中是否有足够的未使用场景,不够时,需要创建一批
+            batchCreateSceneNum(false);
+
+            //检查redis中场景码是否少于指定缓存数量,少于时,需要从码池中获取
+            long redisCnt = redisUtil.lGetSize(RedisKey.FDKANKAN_SCENE_NUMS);
+            if(redisCnt >= cachePageSize){
+                return;
             }
-        }else{
-            // 等待2秒加载缓存
-            try {
-                Thread.sleep(2000);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
+            log.info("开始加载场景码缓存");
+            List<String> nums = this.findSceneNum(cachePageSize);
+            if(CollUtil.isEmpty(nums) || nums.size() < cachePageSize){
+                String content = String.format(this.DINGTALK_MSG_PATTERN, mainUrl, "场景码穷尽告警", "场景码表中未使用状态少于" + cachePageSize);
+                dingTalkSendUtils.sendActioncardMsgToDingRobot(content, "场景码穷尽告警");
             }
+            if(CollUtil.isNotEmpty(nums)){
+                redisUtil.lRightPushAll(RedisKey.FDKANKAN_SCENE_NUMS, nums);
+                this.updateUsedStatus(nums);
+            }
+            log.info("场景码加载缓存完成");
+        } catch (Exception e) {
+            log.error("场景码加载缓存失败", e);
+        } finally {
+            redisLockUtil.unlockLua(RedisLockKey.LOCK_FDKANKAN_SCENE_NUMS);
         }
-        sceneNum = redisUtil.lLeftPop(RedisKey.FDKANKAN_SCENE_NUMS);
-        if(StrUtil.isEmpty(sceneNum)){
-            log.error("场景码加载失败");
-            throw new BusinessException(ErrorCode.FAILURE_CODE_5053);
-        }
-        return addPrefix(sceneNum,cameraType);
     }
 
     private  static  String addPrefix( String num,Integer cameraType){
@@ -114,8 +138,8 @@ public class Scene3dNumServiceImpl extends ServiceImpl<IScene3dNumMapper, Scene3
                 return;
             }
         }
-        int batchCnt = threshold / batchSize + (threshold % batchSize > 0 ? 1 : 0);
-        for (int i = 0; i < batchCnt; i++){
+        int batchCnt = threshold / batchSize + (threshold % batchSize > 0 ? 1 : 0);//批次数
+        for (int i = 0; i < batchCnt; i++){//分批生成,每批次batchSize个
             Set<String> numSet = this.turnCreateSceneNum(batchSize);
             List<Scene3dNum> scene3dNumList = numSet.parallelStream().map(num -> {
                 Scene3dNum scene3dNum = new Scene3dNum();

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

@@ -0,0 +1,20 @@
+package com.fdkankan.contro.service.impl;
+
+import com.fdkankan.contro.entity.SceneAsynOperLog;
+import com.fdkankan.contro.mapper.ISceneAsynOperLogMapper;
+import com.fdkankan.contro.service.ISceneAsynOperLogService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2022-12-16
+ */
+@Service
+public class SceneAsynOperLogServiceImpl extends ServiceImpl<ISceneAsynOperLogMapper, SceneAsynOperLog> implements ISceneAsynOperLogService {
+
+}

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

@@ -0,0 +1,50 @@
+package com.fdkankan.contro.service.impl;
+
+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 org.springframework.stereotype.Service;
+
+import java.util.Objects;
+
+/**
+ * <p>
+ * 场景计算流程状态表 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2023-01-28
+ */
+@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));
+    }
+
+    @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();
+        }
+        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));
+    }
+}

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

@@ -0,0 +1,20 @@
+package com.fdkankan.contro.service.impl;
+
+import com.fdkankan.contro.entity.SceneCopyDistinctEnv;
+import com.fdkankan.contro.mapper.ISceneCopyDistinctEnvMapper;
+import com.fdkankan.contro.service.ISceneCopyDistinctEnvService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2023-03-21
+ */
+@Service
+public class SceneCopyDistinctEnvServiceImpl extends ServiceImpl<ISceneCopyDistinctEnvMapper, SceneCopyDistinctEnv> implements ISceneCopyDistinctEnvService {
+
+}

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

@@ -0,0 +1,37 @@
+package com.fdkankan.contro.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.contro.entity.SceneCopyLog;
+import com.fdkankan.contro.mapper.ISceneCopyLogMapper;
+import com.fdkankan.contro.service.ISceneCopyLogService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2023-04-17
+ */
+@Service
+public class SceneCopyLogServiceImpl extends ServiceImpl<ISceneCopyLogMapper, SceneCopyLog> implements ISceneCopyLogService {
+    @Override
+    public List<SceneCopyLog> listByNewNum(String newNum) {
+        return this.list(new LambdaQueryWrapper<SceneCopyLog>().eq(SceneCopyLog::getNewNum, newNum));
+    }
+
+    @Override
+    public void checkCanBuild(String num) {
+        List<SceneCopyLog> sceneCopyLogs = this.listByNewNum(num);
+        if(CollUtil.isNotEmpty(sceneCopyLogs)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5071);
+        }
+    }
+}

文件差异内容过多而无法显示
+ 1258 - 330
src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java


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

@@ -7,6 +7,8 @@ import com.fdkankan.contro.mapper.IScenePlusExtMapper;
 import com.fdkankan.contro.service.IScenePlusExtService;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  *  服务实现类

+ 66 - 15
src/main/java/com/fdkankan/contro/service/impl/ScenePlusServiceImpl.java

@@ -1,8 +1,14 @@
 package com.fdkankan.contro.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.constant.PayStatus;
+import com.fdkankan.common.constant.SceneStatus;
+import com.fdkankan.common.constant.SpaceType;
+import com.fdkankan.contro.entity.CameraDetail;
 import com.fdkankan.contro.entity.ScenePlus;
 import com.fdkankan.contro.entity.ScenePlusExt;
 import com.fdkankan.contro.mapper.IScenePlusMapper;
@@ -17,6 +23,10 @@ import org.springframework.util.ObjectUtils;
 
 import java.util.Objects;
 
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
 /**
  * <p>
  * 场景主表 服务实现类
@@ -47,12 +57,17 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
             log.info("该场景不存在无法重置容量,场景码为:" + num);
             return ResultData.error(ErrorCode.FAILURE_CODE_5058);
         }
-        if (scenePlusExt.getSceneScheme() < 4){
-            log.info("该场景不属于八目相机无法重置容量,场景码为:" + num);
-            return ResultData.error(ErrorCode.FAILURE_CODE_5057);
+        if(scenePlus.getSceneStatus() == SceneStatus.EXCEED_SPACE.code()){//超出容量的场景不需要更新容量
+            return ResultData.ok();
         }
         if(!ObjectUtils.isEmpty(scenePlusExt) && !ObjectUtils.isEmpty(scenePlusExt.getSpace())){
-            cameraDetailService.updateCameraDetailByCameraIdAndSpace(scenePlus.getCameraId(), -scenePlusExt.getSpace());
+            Long space = -scenePlusExt.getSpace();
+            CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
+            String spaceType = cameraDetail.getUnit();
+            if(spaceType.equals(SpaceType.SP.code())){
+                space = -1L;
+            }
+            cameraDetailService.updateCameraDetailByCameraIdAndSpace(scenePlus.getCameraId(), space);
         }
 
         scenePlusExt.setSpace(Long.parseLong("0"));
@@ -63,29 +78,65 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
 
     @Override
     public String getDataSourceLikeUnicode(String unicode) {
-
+        // 防止plus表删除,ext表未删除
         ScenePlusExt scenePlusExt = scenePlusExtService.getOne(
-            new LambdaQueryWrapper<ScenePlusExt>().like(ScenePlusExt::getDataSource, unicode));
+            new LambdaQueryWrapper<ScenePlusExt>().select(ScenePlusExt::getPlusId, ScenePlusExt::getDataSource).like(ScenePlusExt::getDataSource, unicode));
 
-        if(Objects.isNull(scenePlusExt)){
+        if (Objects.isNull(scenePlusExt)) {
             return null;
         }
 
-        return scenePlusExt.getDataSource();
+        ScenePlus plus = getById(scenePlusExt.getPlusId());
+        if (Objects.nonNull(plus)) {
+            return scenePlusExt.getDataSource();
+        }
+        scenePlusExtService.removeById(scenePlusExt);
+        return null;
     }
 
     @Override
     public ScenePlus getByFileId(String fileId) {
+        // 防止plus表删除,ext表未删除
+        List<ScenePlusExt> scenePlusExts = scenePlusExtService.list(
+                new LambdaQueryWrapper<ScenePlusExt>().like(ScenePlusExt::getDataSource, fileId)
+                        .eq(ScenePlusExt::getRecStatus, "A"));
 
-        ScenePlusExt scenePlusExt = scenePlusExtService.getOne(
-            new LambdaQueryWrapper<ScenePlusExt>().like(ScenePlusExt::getDataSource, fileId));
-
-        if(Objects.isNull(scenePlusExt)){
+        if (ObjectUtils.isEmpty(scenePlusExts)) {
             return null;
         }
-        return this.getById(scenePlusExt.getPlusId());
+        for (ScenePlusExt scenePlusExt : scenePlusExts) {
+            ScenePlus plus = getById(scenePlusExt.getPlusId());
+            if (!ObjectUtils.isEmpty(plus) && plus.getRecStatus().equals("A")) {
+                return plus;
+            }
+        }
+        return null;
     }
 
-
-
+    @Override
+    public Long sumUsedSpaceByCameraId(Long cameraId, String spaceTypeStr) {
+
+        LambdaQueryWrapper<ScenePlus> wrapper = new LambdaQueryWrapper<ScenePlus>()
+                .eq(ScenePlus::getCameraId, cameraId)
+                .in(ScenePlus::getSceneStatus, SceneStatus.SUCCESS.code(), SceneStatus.NO_DISPLAY.code());
+
+        SpaceType spaceType = SpaceType.get(spaceTypeStr);
+        switch (spaceType){
+            case GB:
+                List<ScenePlus> list = this.list(wrapper);
+                if(CollUtil.isEmpty(list)){
+                    return 0L;
+                }
+                List<Long> plusIdList = list.stream().map(scenePlus -> scenePlus.getId()).collect(Collectors.toList());
+                List<ScenePlusExt> scenePlusExtList = scenePlusExtService.list(new LambdaQueryWrapper<ScenePlusExt>().in(ScenePlusExt::getPlusId, plusIdList));
+                return scenePlusExtList.stream().mapToLong(pro -> {
+                    Long space = pro.getSpace();
+                    return Objects.isNull(space) ? 0L : space;
+                }).sum();
+            case SP:
+                wrapper.eq(ScenePlus::getPayStatus, PayStatus.PAY.code());
+                return this.count(wrapper);
+        }
+        return null;
+    }
 }

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

@@ -0,0 +1,61 @@
+package com.fdkankan.contro.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.common.constant.CommonStatus;
+import com.fdkankan.common.constant.PayStatus;
+import com.fdkankan.common.constant.SceneStatus;
+import com.fdkankan.common.constant.SpaceType;
+import com.fdkankan.contro.entity.ScenePro;
+import com.fdkankan.contro.mapper.ISceneProMapper;
+import com.fdkankan.contro.service.ISceneProService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * <p>
+ * pro场景表 服务实现类
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2021-12-23
+ */
+@Slf4j
+@Service
+public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro> implements ISceneProService {
+
+    @Override
+    public ScenePro getByNum(String num) {
+        return this.getOne(new LambdaQueryWrapper<ScenePro>().eq(ScenePro::getNum, num));
+    }
+
+    @Override
+    public Long sumUsedSpaceByCameraId(Long cameraId, String spaceTypeStr) {
+        LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<ScenePro>()
+                .eq(ScenePro::getCameraId, cameraId)
+                .in(ScenePro::getStatus, SceneStatus.SUCCESS.code(), SceneStatus.NO_DISPLAY.code())
+                .eq(ScenePro::getIsUpgrade, CommonStatus.NO.code());
+
+        SpaceType spaceType = SpaceType.get(spaceTypeStr);
+        switch (spaceType){
+            case GB:
+                wrapper.select(ScenePro::getSpace);
+                List<ScenePro> list = this.list(wrapper);
+                if(CollUtil.isEmpty(list)){
+                    return 0L;
+                }
+                return list.stream().mapToLong(pro -> {
+                    Long space = pro.getSpace();
+                    return Objects.isNull(space) ? 0L : space;
+                }).sum();
+            case SP:
+                wrapper.eq(ScenePro::getPayStatus, PayStatus.PAY.code());
+                return this.count(wrapper);
+        }
+        return 0L;
+    }
+}

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

@@ -0,0 +1,44 @@
+package com.fdkankan.contro.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.common.constant.TbStatus;
+import com.fdkankan.contro.entity.UserIncrement;
+import com.fdkankan.contro.mapper.IUserIncrementMapper;
+import com.fdkankan.contro.service.IUserIncrementService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * <p>
+ * 用户增值权益表 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2021-12-24
+ */
+@Service
+public class UserIncrementServiceImpl extends ServiceImpl<IUserIncrementMapper, UserIncrement> implements IUserIncrementService {
+
+    @Resource
+    private IUserIncrementMapper userIncrementMapper;
+
+    @Override
+    public UserIncrement getByCameraId(Long cameraId) {
+        QueryWrapper<UserIncrement> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(UserIncrement::getCameraId,cameraId);
+        List<UserIncrement> list = this.list(queryWrapper);
+        if(list == null || list.size()<=0){
+            return null;
+        }
+        return list.get(0);
+    }
+
+    @Override
+    public List<UserIncrement> getByChildName(String childName) {
+        return userIncrementMapper.getByChildName(childName);
+    }
+
+}

+ 8 - 0
src/main/java/com/fdkankan/contro/vo/SceneEditControlsVO.java

@@ -66,5 +66,13 @@ public class SceneEditControlsVO implements Serializable {
      */
     private Integer showRule;
 
+    private Integer showCapture;
+
+    private Integer showScale;
+
+    private Integer showShare;
+
+    private Integer tagshare;
+
 
 }

+ 5 - 5
src/main/resources/bootstrap-dev.yml

@@ -22,17 +22,17 @@ spring:
             group: DEFAULT_GROUP
             refresh: true
 
-          - data-id: other-config.yaml
+          - data-id: common-config.yaml
             group: DEFAULT_GROUP
             refresh: true
 
-          - data-id: common-upload-config.yaml
+          - data-id: common-fyun-config.yaml
             group: DEFAULT_GROUP
             refresh: true
 
-          - data-id: common-mq-config.yaml
+          - data-id: common-scaling.yaml
             group: DEFAULT_GROUP
             refresh: true
       discovery:
-        server-addr: 120.24.144.164:8848
-        namespace: 4dkankan-dev
+        server-addr: ${spring.cloud.nacos.config.server-addr}
+        namespace: ${spring.cloud.nacos.config.namespace}

+ 9 - 6
src/main/resources/bootstrap-pro.yml

@@ -29,11 +29,14 @@ spring:
           - data-id: common-fyun-config.yaml
             group: DEFAULT_GROUP
             refresh: true
-      discovery:
-        server-addr: 172.20.1.63:8848
-        namespace: 4dkankan-v4-prod
-
-
-
 
+          - data-id: common-scaling.yaml
+            group: DEFAULT_GROUP
+            refresh: true
 
+          - data-id: common-logback-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+      discovery:
+        server-addr: ${spring.cloud.nacos.config.server-addr}
+        namespace: ${spring.cloud.nacos.config.namespace}

+ 9 - 1
src/main/resources/bootstrap-test.yml

@@ -2,7 +2,7 @@ spring:
   cloud:
     nacos:
       config:
-        server-addr: 172.20.1.63:8848
+        server-addr: 120.24.144.164:8848
         file-extension: yaml
         namespace: 4dkankan-v4-test
         extension-configs:
@@ -29,6 +29,14 @@ spring:
           - data-id: common-fyun-config.yaml
             group: DEFAULT_GROUP
             refresh: true
+
+          - data-id: common-scaling.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+
+          - data-id: common-logback-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
       discovery:
         server-addr: ${spring.cloud.nacos.config.server-addr}
         namespace: ${spring.cloud.nacos.config.namespace}

+ 239 - 0
src/main/resources/logback-nacos.xml

@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 -->
+<!-- scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true -->
+<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
+<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
+<configuration scan="true" scanPeriod="10 seconds">
+
+	<contextName>nacos</contextName>
+
+	<springProperty scope="context" name="LOG_PATH" source="logging.path"/>
+	<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->
+	<property name="log.path" value="${LOG_PATH}/modeling-control/logs" />
+
+	<!-- 彩色日志 -->
+	<!-- 彩色日志依赖的渲染类 -->
+	<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
+	<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
+	<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
+	<!-- 彩色日志格式 -->
+	<property name="CONSOLE_LOG_PATTERN"
+		value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" />
+
+	<!--输出到控制台 -->
+	<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+		<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息 -->
+		<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+			<level>info</level>
+		</filter>
+		<encoder>
+			<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
+			<!-- 设置字符集 -->
+			<charset>UTF-8</charset>
+		</encoder>
+	</appender>
+	<!--输出到文件 -->
+
+	<!-- 时间滚动输出 level为 DEBUG 日志 -->
+	<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<!-- 正在记录的日志文件的路径及文件名 -->
+		<file>${log.path}/log_debug.log</file>
+		<!--日志文件输出格式 -->
+		<encoder>
+			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+			<charset>UTF-8</charset> <!-- 设置字符集 -->
+		</encoder>
+		<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+			<!-- 日志归档 -->
+			<fileNamePattern>${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log
+			</fileNamePattern>
+			<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+				<maxFileSize>100MB</maxFileSize>
+			</timeBasedFileNamingAndTriggeringPolicy>
+			<!--日志文件保留天数 -->
+			<maxHistory>15</maxHistory>
+		</rollingPolicy>
+		<!-- 此日志文件只记录debug级别的 -->
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+			<level>debug</level>
+			<onMatch>ACCEPT</onMatch>
+			<onMismatch>DENY</onMismatch>
+		</filter>
+	</appender>
+
+	<appender name="ASYNC_DEBUG_FILE" class="com.yomahub.tlog.core.enhance.logback.async.AspectLogbackAsyncAppender">
+		<!--默认情况下,当BlockingQueue还有20%容量,他将丢弃TRACE、DEBUG和INFO级别的event,只保留WARN和ERROR级别的event。为了保持所有的events,设置该值为0。-->
+		<discardingThreshold>0</discardingThreshold>
+		<!--queue配置最大容量为256个events。如果队列被填满,应用程序线程被阻止记录新的events,直到工作线程有机会来转发一个或多个events。
+		因此队列深度需要根据业务场景进行相应的测试,做出相应的更改,以达到较好的性能。-->
+		<queueSize>2048</queueSize>
+		<includeCallerData>false</includeCallerData>
+		<appender-ref ref="DEBUG_FILE"/>
+	</appender>
+
+	<!-- 时间滚动输出 level为 INFO 日志 -->
+	<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<!-- 正在记录的日志文件的路径及文件名 -->
+		<file>${log.path}/log_info.log</file>
+		<!--日志文件输出格式 -->
+		<encoder>
+			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+			<charset>UTF-8</charset>
+		</encoder>
+		<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+			<!-- 每天日志归档路径以及格式 -->
+			<fileNamePattern>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log
+			</fileNamePattern>
+			<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+				<maxFileSize>100MB</maxFileSize>
+			</timeBasedFileNamingAndTriggeringPolicy>
+			<!--日志文件保留天数 -->
+			<maxHistory>15</maxHistory>
+		</rollingPolicy>
+		<!-- 此日志文件只记录info级别的 -->
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+			<level>info</level>
+			<onMatch>ACCEPT</onMatch>
+			<onMismatch>DENY</onMismatch>
+		</filter>
+	</appender>
+
+	<appender name="ASYNC_INFO_FILE" class="com.yomahub.tlog.core.enhance.logback.async.AspectLogbackAsyncAppender">
+		<!--默认情况下,当BlockingQueue还有20%容量,他将丢弃TRACE、DEBUG和INFO级别的event,只保留WARN和ERROR级别的event。为了保持所有的events,设置该值为0。-->
+		<discardingThreshold>0</discardingThreshold>
+		<!--queue配置最大容量为256个events。如果队列被填满,应用程序线程被阻止记录新的events,直到工作线程有机会来转发一个或多个events。
+		因此队列深度需要根据业务场景进行相应的测试,做出相应的更改,以达到较好的性能。-->
+		<queueSize>2048</queueSize>
+		<includeCallerData>false</includeCallerData>
+		<appender-ref ref="INFO_FILE"/>
+	</appender>
+
+	<!-- 时间滚动输出 level为 WARN 日志 -->
+	<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<!-- 正在记录的日志文件的路径及文件名 -->
+		<file>${log.path}/log_warn.log</file>
+		<!--日志文件输出格式 -->
+		<encoder>
+			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+			<charset>UTF-8</charset> <!-- 此处设置字符集 -->
+		</encoder>
+		<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+			<fileNamePattern>${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log
+			</fileNamePattern>
+			<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+				<maxFileSize>100MB</maxFileSize>
+			</timeBasedFileNamingAndTriggeringPolicy>
+			<!--日志文件保留天数 -->
+			<maxHistory>15</maxHistory>
+		</rollingPolicy>
+		<!-- 此日志文件只记录warn级别的 -->
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+			<level>warn</level>
+			<onMatch>ACCEPT</onMatch>
+			<onMismatch>DENY</onMismatch>
+		</filter>
+	</appender>
+
+	<appender name="ASYNC_WARN_FILE" class="com.yomahub.tlog.core.enhance.logback.async.AspectLogbackAsyncAppender">
+		<!--默认情况下,当BlockingQueue还有20%容量,他将丢弃TRACE、DEBUG和INFO级别的event,只保留WARN和ERROR级别的event。为了保持所有的events,设置该值为0。-->
+		<discardingThreshold>0</discardingThreshold>
+		<!--queue配置最大容量为256个events。如果队列被填满,应用程序线程被阻止记录新的events,直到工作线程有机会来转发一个或多个events。
+		因此队列深度需要根据业务场景进行相应的测试,做出相应的更改,以达到较好的性能。-->
+		<queueSize>2048</queueSize>
+		<includeCallerData>false</includeCallerData>
+		<appender-ref ref="WARN_FILE"/>
+	</appender>
+
+
+	<!-- 时间滚动输出 level为 ERROR 日志 -->
+	<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<!-- 正在记录的日志文件的路径及文件名 -->
+		<file>${log.path}/log_error.log</file>
+		<!--日志文件输出格式 -->
+		<encoder>
+			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+			<charset>UTF-8</charset> <!-- 此处设置字符集 -->
+		</encoder>
+		<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+			<fileNamePattern>${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log
+			</fileNamePattern>
+			<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+				<maxFileSize>100MB</maxFileSize>
+			</timeBasedFileNamingAndTriggeringPolicy>
+			<!--日志文件保留天数 -->
+			<maxHistory>15</maxHistory>
+		</rollingPolicy>
+		<!-- 此日志文件只记录ERROR级别的 -->
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+			<level>ERROR</level>
+			<onMatch>ACCEPT</onMatch>
+			<onMismatch>DENY</onMismatch>
+		</filter>
+	</appender>
+
+	<appender name="ASYNC_ERROR_FILE" class="com.yomahub.tlog.core.enhance.logback.async.AspectLogbackAsyncAppender">
+		<!--默认情况下,当BlockingQueue还有20%容量,他将丢弃TRACE、DEBUG和INFO级别的event,只保留WARN和ERROR级别的event。为了保持所有的events,设置该值为0。-->
+		<discardingThreshold>0</discardingThreshold>
+		<!--queue配置最大容量为256个events。如果队列被填满,应用程序线程被阻止记录新的events,直到工作线程有机会来转发一个或多个events。
+		因此队列深度需要根据业务场景进行相应的测试,做出相应的更改,以达到较好的性能。-->
+		<queueSize>2048</queueSize>
+		<includeCallerData>false</includeCallerData>
+		<appender-ref ref="ERROR_FILE"/>
+	</appender>
+
+	<springProperty scope="context" name="logstash_dest" source="logstash.ipAndPort"/>
+	<!--	<springProperty scope="context" name="preIvkApp" source="logstash.preIvkApp"/>-->
+	<springProperty scope="context" name="application_name" source="spring.application.name"/>
+	<springProperty scope="context" name="profiles_active" source="spring.profiles.active"/>
+	<appender name="LOGSTASH-ERROR_FILE" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
+		<destination>${logstash_dest}</destination>
+		<keepAliveDuration>5 minutes</keepAliveDuration>
+		<!-- 日志输出编码 -->
+		<encoder charset="UTF-8" class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
+			<providers>
+				<provider class="com.yomahub.tlog.logstash.logback.TLogLogstashLogbackProvider"/>
+				<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
+				<pattern>
+					<pattern>
+						{
+						"level": "%level",
+						"thread": "%thread",
+						"class": "%logger{40}",
+						"message": "%message",
+						"stack_trace": "%exception{10}",
+						"client_time": "%d{yyyy-MM-dd HH:mm:ss.SSS}",
+						"preIvkApp":"${application_name}-${profiles_active}"
+						}
+					</pattern>
+				</pattern>
+			</providers>
+		</encoder>
+		<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+			<level>ERROR</level>
+		</filter>
+	</appender>
+
+
+	<!-- <logger>用来设置某一个包或者具体的某一个类的日志打印级别、 以及指定<appender>。<logger>仅有一个name属性, 一个可选的level和一个可选的addtivity属性。 name:用来指定受此logger约束的某一个包或者具体的某一个类。 level:用来设置打印级别,大小写无关:TRACE,
+		DEBUG, INFO, WARN, ERROR, ALL 和 OFF, 还有一个特俗值INHERITED或者同义词NULL,代表强制执行上级的级别。 如果未设置此属性,那么当前logger将会继承上级的级别。 addtivity:是否向上级logger传递打印信息。默认是true。 -->
+	<!--<logger name="org.springframework.web" level="info"/> -->
+	<!--<logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/> -->
+	<!-- 使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作: 第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息 第二种就是单独给dao下目录配置debug模式,代码如下,这样配置sql语句会打印,其他还是正常info级别: -->
+	<!-- root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性 level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, 不能设置为INHERITED或者同义词NULL。默认是DEBUG 可以包含零个或多个元素,标识这个appender将会添加到这个logger。 -->
+
+	<root level="info">
+		<appender-ref ref="CONSOLE" />
+		<appender-ref ref="ASYNC_DEBUG_FILE" />
+		<appender-ref ref="ASYNC_INFO_FILE" />
+		<appender-ref ref="ASYNC_WARN_FILE" />
+		<appender-ref ref="ASYNC_ERROR_FILE" />
+		<appender-ref ref="LOGSTASH-ERROR_FILE" />
+	</root>
+
+</configuration>
+
+

+ 5 - 0
src/main/resources/mapper/contro/ExceedSpaceSceneMapper.xml

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

+ 5 - 0
src/main/resources/mapper/contro/MailTemplateMapper.xml

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

+ 5 - 0
src/main/resources/mapper/contro/SceneAsynOperLogMapper.xml

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

+ 5 - 0
src/main/resources/mapper/contro/SceneBuildProcessLogMapper.xml

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

+ 5 - 0
src/main/resources/mapper/contro/SceneCleanOrigMapper.xml

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

+ 5 - 0
src/main/resources/mapper/contro/SceneColdStorageLogMapper.xml

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

+ 5 - 0
src/main/resources/mapper/contro/SceneColdStorageMapper.xml

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

+ 5 - 0
src/main/resources/mapper/contro/SceneCopyDistinctEnvMapper.xml

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

+ 0 - 0
src/main/resources/mapper/contro/SceneCopyLogMapper.xml


部分文件因为文件数量过多而无法显示