Prechádzať zdrojové kódy

Merge branch 'release' into project-jp

# Conflicts:
#	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/service/ICommonService.java
#	src/main/java/com/fdkankan/contro/service/impl/CommonServiceImpl.java
#	src/main/java/com/fdkankan/contro/service/impl/IFdkkLaserServiceImpl.java
dsx 2 rokov pred
rodič
commit
aeba752bc8
55 zmenil súbory, kde vykonal 1489 pridanie a 168 odobranie
  1. 5 0
      src/main/java/com/fdkankan/contro/bean/SceneJsonBean.java
  2. 1 0
      src/main/java/com/fdkankan/contro/constant/UserEditDataType.java
  3. 21 0
      src/main/java/com/fdkankan/contro/controller/SceneCleanOrigController.java
  4. 21 0
      src/main/java/com/fdkankan/contro/controller/SceneCopyLogController.java
  5. 1 1
      src/main/java/com/fdkankan/contro/controller/TestController.java
  6. 3 0
      src/main/java/com/fdkankan/contro/entity/CameraDetail.java
  7. 75 0
      src/main/java/com/fdkankan/contro/entity/ExceedSpaceScene.java
  8. 7 1
      src/main/java/com/fdkankan/contro/entity/IncrementType.java
  9. 69 0
      src/main/java/com/fdkankan/contro/entity/SceneCleanOrig.java
  10. 72 0
      src/main/java/com/fdkankan/contro/entity/SceneColdStorage.java
  11. 81 0
      src/main/java/com/fdkankan/contro/entity/SceneColdStorageLog.java
  12. 51 0
      src/main/java/com/fdkankan/contro/entity/SceneCopyLog.java
  13. 24 0
      src/main/java/com/fdkankan/contro/entity/SceneEditControls.java
  14. 6 0
      src/main/java/com/fdkankan/contro/entity/SceneEditInfoExt.java
  15. 60 0
      src/main/java/com/fdkankan/contro/factory/UserEditData/FloorplanHandler.java
  16. 1 1
      src/main/java/com/fdkankan/contro/generate/AutoGenerate.java
  17. 18 0
      src/main/java/com/fdkankan/contro/mapper/IExceedSpaceSceneMapper.java
  18. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneCleanOrigMapper.java
  19. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneColdStorageLogMapper.java
  20. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneColdStorageMapper.java
  21. 18 0
      src/main/java/com/fdkankan/contro/mapper/ISceneCopyLogMapper.java
  22. 13 1
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java
  23. 48 47
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java
  24. 9 15
      src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java
  25. 1 1
      src/main/java/com/fdkankan/contro/service/ICameraDetailService.java
  26. 2 0
      src/main/java/com/fdkankan/contro/service/ICameraService.java
  27. 12 1
      src/main/java/com/fdkankan/contro/mq/service/ICommonService.java
  28. 29 0
      src/main/java/com/fdkankan/contro/service/IExceedSpaceSceneService.java
  29. 1 1
      src/main/java/com/fdkankan/contro/service/IFdkkLaserService.java
  30. 21 0
      src/main/java/com/fdkankan/contro/service/ISceneCleanOrigService.java
  31. 22 0
      src/main/java/com/fdkankan/contro/service/ISceneColdStorageLogService.java
  32. 20 0
      src/main/java/com/fdkankan/contro/service/ISceneColdStorageService.java
  33. 22 0
      src/main/java/com/fdkankan/contro/service/ISceneCopyLogService.java
  34. 3 0
      src/main/java/com/fdkankan/contro/service/IScenePlusExtService.java
  35. 1 0
      src/main/java/com/fdkankan/contro/service/IScenePlusService.java
  36. 4 0
      src/main/java/com/fdkankan/contro/service/ISceneProService.java
  37. 7 10
      src/main/java/com/fdkankan/contro/service/impl/CameraDetailServiceImpl.java
  38. 14 0
      src/main/java/com/fdkankan/contro/service/impl/CameraServiceImpl.java
  39. 106 8
      src/main/java/com/fdkankan/contro/mq/service/impl/CommonServiceImpl.java
  40. 134 0
      src/main/java/com/fdkankan/contro/service/impl/ExceedSpaceSceneServiceImpl.java
  41. 5 4
      src/main/java/com/fdkankan/contro/service/impl/IFdkkLaserServiceImpl.java
  42. 29 0
      src/main/java/com/fdkankan/contro/service/impl/SceneCleanOrigServiceImpl.java
  43. 32 0
      src/main/java/com/fdkankan/contro/service/impl/SceneColdStorageLogServiceImpl.java
  44. 63 0
      src/main/java/com/fdkankan/contro/service/impl/SceneColdStorageServiceImpl.java
  45. 37 0
      src/main/java/com/fdkankan/contro/service/impl/SceneCopyLogServiceImpl.java
  46. 145 61
      src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java
  47. 2 0
      src/main/java/com/fdkankan/contro/service/impl/ScenePlusExtServiceImpl.java
  48. 52 16
      src/main/java/com/fdkankan/contro/service/impl/ScenePlusServiceImpl.java
  49. 34 0
      src/main/java/com/fdkankan/contro/service/impl/SceneProServiceImpl.java
  50. 8 0
      src/main/java/com/fdkankan/contro/vo/SceneEditControlsVO.java
  51. 5 0
      src/main/resources/mapper/contro/ExceedSpaceSceneMapper.xml
  52. 5 0
      src/main/resources/mapper/contro/SceneCleanOrigMapper.xml
  53. 5 0
      src/main/resources/mapper/contro/SceneColdStorageLogMapper.xml
  54. 5 0
      src/main/resources/mapper/contro/SceneColdStorageMapper.xml
  55. 5 0
      src/main/resources/mapper/contro/SceneCopyLogMapper.xml

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

@@ -204,5 +204,10 @@ public class SceneJsonBean {
      */
     private Integer surveillances;
 
+    /**
+     * 是否有指示牌
+     */
+    private Integer billboards;
+
 
 }

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

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

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

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

@@ -1,6 +1,6 @@
 package com.fdkankan.contro.controller;
 
-import com.fdkankan.contro.mq.service.ICommonService;
+import com.fdkankan.contro.service.ICommonService;
 import com.fdkankan.contro.service.IScene3dNumService;
 import com.fdkankan.web.response.ResultData;
 import org.springframework.beans.factory.annotation.Autowired;

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 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")

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

@@ -91,6 +91,12 @@ public class SceneEditInfoExt {
     private String shareLogoImg;
 
     /**
+     * 是否有指示牌
+     */
+    @TableField("billboards")
+    private Integer billboards;
+
+    /**
      * 创建时间
      */
     @TableField("create_time")

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

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

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

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

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

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

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

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

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

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

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

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

+ 13 - 1
src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java

@@ -13,7 +13,7 @@ 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.mq.service.ICommonService;
+import com.fdkankan.contro.service.ICommonService;
 import com.fdkankan.contro.service.*;
 import com.fdkankan.contro.service.impl.FdkkV4Service;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
@@ -168,6 +168,9 @@ public class BuildObjServiceImpl implements IBuildSceneService {
         //下载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
@@ -247,6 +250,10 @@ public class BuildObjServiceImpl implements IBuildSceneService {
             //上传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);
@@ -263,6 +270,11 @@ public class BuildObjServiceImpl implements IBuildSceneService {
                 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())){

+ 48 - 47
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java

@@ -2,7 +2,6 @@ package com.fdkankan.contro.mq.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.exceptions.ExceptionUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.file.FileNameUtil;
 import cn.hutool.core.util.StrUtil;
@@ -21,7 +20,6 @@ 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.mq.service.ICommonService;
 import com.fdkankan.contro.service.*;
 import com.fdkankan.contro.vo.SceneEditControlsVO;
 import com.fdkankan.fyun.config.FYunFileConfig;
@@ -29,13 +27,10 @@ import com.fdkankan.fyun.constant.FYunTypeEnum;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.model.constants.ConstantFileName;
 import com.fdkankan.model.constants.ConstantFilePath;
-import com.fdkankan.model.constants.SceneBuildProcessType;
 import com.fdkankan.model.constants.UploadFilePath;
 import com.fdkankan.model.enums.ModelTypeEnums;
 import com.fdkankan.model.utils.CreateHouseJsonUtil;
 import com.fdkankan.model.utils.CreateObjUtil;
-import com.fdkankan.model.utils.FloorPlanUserUtil;
-import com.fdkankan.model.utils.SceneUtil;
 import com.fdkankan.push.config.PushMessageConfig;
 import com.fdkankan.push.utils.PushMsgUtil;
 import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
@@ -43,7 +38,6 @@ import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
 import com.fdkankan.rabbitmq.util.RabbitMqProducer;
 import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.util.RedisUtil;
-import com.sun.org.apache.xpath.internal.operations.Plus;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -88,6 +82,9 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     @Value("${env:gn}")
     private String env;
 
+    @Value("#{'${build.scene.post.not-delete-nas-nums:}'.split(',')}")
+    private List<String> notDeleteNasNumList;
+
     @Autowired
     private RabbitMqProducer mqProducer;
 
@@ -134,6 +131,8 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
     private ICommonService commonService;
     @Autowired
     private ISceneBuildProcessLogService sceneBuildProcessLogService;
+    @Autowired
+    private ISceneColdStorageService sceneColdStorageService;
 
     @Override
     public void buildScenePre(BuildSceneCallMessage message) throws Exception{
@@ -145,6 +144,19 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
                 FileUtils.deleteDirectory(message.getPath() + File.separator + "results");
             }
 
+            //删除点位校准数据
+            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());
@@ -210,7 +222,6 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
     }
 
-
     @Override
     public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
         String sceneCode = message.getBuildContext().get("sceneNum").toString();
@@ -240,15 +251,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             Integer cameraType = Integer.parseInt(message.getBuildContext().get("cameraType").toString());
             Map<String, String> uploadFiles = getUploadFiles(scenePlus,path,cameraType,fdageData);
 
-            //计算场景消耗磁盘空间
-            long space = this.calUseSpace(uploadFiles);
-
-
             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());
 
@@ -258,8 +261,6 @@ 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);
 
             //上传全景图俯视图
             this.uploadFloorCad(path, sceneCode, uploadFiles);
@@ -270,21 +271,11 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             //上传文件
             fYunFileService.uploadMulFiles(uploadFiles);
 
+            //修改oss上dam的内容编码
             Map<String,String> damFileHeaders = new HashMap<>();
             damFileHeaders.put("Content-Encoding","gzip");
-            // dam 文件设置请求头
-            uploadFiles.entrySet().stream().filter(entry -> FileNameUtil.extName(entry.getKey()).equals("dam"))
-                .forEach(entry -> {
-                    if (!new File(entry.getKey()).exists()) {
-                        log.error("文件不存在,不予gzip压缩,文件路径:{}", entry.getKey());
-                        return;
-                    }
-                    // gzip压缩
-                    FileUtil.writeBytes(ZipUtil.gzip(new File(entry.getKey())), entry.getKey() + ".gzip");
-                    // 重命名
-                    FileUtil.rename(new File(entry.getKey() + ".gzip"), entry.getKey(), true);
-                    fYunFileService.uploadFile(entry.getKey(), entry.getValue(), damFileHeaders);
-                });
+            String damPath = path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam";
+            fYunFileService.uploadFile(damPath,  String.format(UploadFilePath.IMG_VIEW_PATH, sceneCode) + ConstantFileName.modelUUID + "_50k.dam", damFileHeaders);
 
             //拷贝部分文件到编辑目录,用于用户编辑
             this.copyToEditDir(sceneCode);
@@ -293,11 +284,11 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 //            this.cachePanorama(path, sceneCode);
 
             //生成houseTypejson并上传
-            boolean existHouseType = this.uploadHouseTypeJson(sceneCode, scenePlusExt.getDataSource());
+            boolean existHouseType = this.uploadHouseTypeJson(sceneCode, path);
             scenePlus.setHouseType(existHouseType ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code().intValue());
 
             //生成floorpan.json
-            commonService.uploadFloorplanJson(sceneCode, scenePlusExt.getDataSource());
+            commonService.uploadFloorplanJson(sceneCode, path);
 
             //重置异步操作记录
             this.removeSceneAsynOperLog(sceneCode);
@@ -305,11 +296,18 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             //清除用户编辑业务数据
             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];
@@ -317,7 +315,7 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
             if (cameraType == 14) {
                 //计算成功  激光转台相机 同步 请求
-                fdkkLaserService.syncBuildResult(scenePlus.getNum(), scenePlusExt.getDataSource(),scenePlus.getCreateTime());
+                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);
@@ -342,6 +340,8 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             String pushToken = fdageData.getString("pushToken");
             this.pushMsgToApp(pushChannel,pushToken, cameraType, scenePlus.getTitle(), scenePlusExt.getWebSite());
 
+            this.uploadStatusJson(scenePlus, scenePlusExt);
+
             //更新场景主表
             scenePlusService.updateById(scenePlus);
 
@@ -481,11 +481,10 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
 
         if(genModel){
             if (!gen3dTiles) {
-                CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
-                CreateObjUtil.convertDamToLzma(path + File.separator + "results/");
-                CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
-                map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", imagesPath + ConstantFileName.modelUUID + "_50k.dam.lzma");
-                map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", imagesPath + ConstantFileName.modelUUID + "_50k.dam");
+                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)){
@@ -600,7 +599,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还没完全更新
@@ -614,7 +617,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) {
@@ -632,8 +634,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(512);
-        qrConfig.setHeight(512);
+        qrConfig.setWidth(1024);
+        qrConfig.setHeight(1024);
         if(!ObjectUtils.isEmpty(localLogoPath)){
             qrConfig.setImg(localLogoPath);
         }
@@ -833,13 +835,12 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         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){
-        //更新相机使用用量
-        CameraDetail cameraDetail = cameraDetailService.updateCameraDetailByCameraIdAndSpace(cameraId, space);
-        return PayStatus.PAY.code();
+        scenePlusExtService.updateById(scenePlusExt);
     }
 
     private Object[] updateEditInfo(ScenePlus scenePlus){

+ 9 - 15
src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java

@@ -1,7 +1,5 @@
 package com.fdkankan.contro.mq.service.impl;
 
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.exceptions.ExceptionUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.file.FileNameUtil;
 import cn.hutool.core.util.StrUtil;
@@ -9,18 +7,14 @@ 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.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.fdkankan.common.constant.CommonOperStatus;
-import com.fdkankan.common.constant.ExpiredStatus;
-import com.fdkankan.common.constant.ModelKind;
 import com.fdkankan.common.constant.PayStatus;
 import com.fdkankan.common.constant.SceneStatus;
 import com.fdkankan.common.util.DateExtUtil;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.contro.entity.*;
 import com.fdkankan.contro.mq.service.IBuildSceneService;
-import com.fdkankan.contro.mq.service.ICommonService;
+import com.fdkankan.contro.service.ICommonService;
 import com.fdkankan.contro.service.*;
 import com.fdkankan.contro.service.impl.FdkkV4Service;
 import com.fdkankan.fyun.config.FYunFileConfig;
@@ -28,7 +22,6 @@ import com.fdkankan.fyun.constant.FYunTypeEnum;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.model.constants.ConstantFileName;
 import com.fdkankan.model.constants.ConstantFilePath;
-import com.fdkankan.model.constants.SceneBuildProcessType;
 import com.fdkankan.model.constants.UploadFilePath;
 import com.fdkankan.model.utils.CreateHouseJsonUtil;
 import com.fdkankan.model.utils.CreateObjUtil;
@@ -45,10 +38,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.*;
-import java.util.Map.Entry;
-import java.util.stream.Collectors;
 
 
 /**
@@ -113,6 +103,9 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
     @Autowired
     private ISceneProEditService sceneProEditService;
 
+    @Autowired
+    private ISceneColdStorageService sceneColdStorageService;
+
     @Override
     public void buildScenePre(BuildSceneCallMessage message) {
         boolean success = false;
@@ -124,6 +117,9 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
                 FileUtils.deleteDirectory(message.getPath() + File.separator + "results");
             }
 
+            //用户相机重新全量上传,需要解冻结
+            sceneColdStorageService.unfreeze(num, "用户相机重新全量上传", message.getPath());
+
             //根据相机类型,组装资源路径
             //下载资源到本地
             this.downLoadSource(message, message.getPath());
@@ -233,7 +229,7 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
             scenePro.setPayStatus(PayStatus.PAY.code());
             //如果相机容量不足,需要把场景的paystatus改为容量不足状态
             if (cameraType != 14) {
-                scenePro.setPayStatus(this.getPayStatus(scenePro.getCameraId(), space));
+                scenePro.setPayStatus(commonService.getPayStatus(scenePro.getCameraId(), space));
                 sceneProService.update(
                         new LambdaUpdateWrapper<ScenePro>()
                                 .set(ScenePro::getPayStatus, scenePro.getPayStatus())
@@ -280,10 +276,8 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
             sceneProEdit.setFloorPublishVer(ver);
             if (cameraType == 14) {
                 //计算成功  激光转台相机 同步 请求
-                fdkkLaserService.syncBuildResult(scenePro.getNum(), scenePro.getDataSource(),scenePro.getCreateTime());
+                fdkkLaserService.syncBuildResult(scenePro.getNum(), scenePro.getDataSource(),scenePro.getCreateTime(), Calendar.getInstance().getTime());
                 sceneProEdit.setMapVisi(0);
-            }else if (new File(path + "/results/laserData/vision_edit.txt").exists()) {
-                fdkkLaserService.cloudPointBuild(sceneCode,path);
             }
             sceneProEditService.updateById(sceneProEdit);
 

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

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

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

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

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

@@ -1,4 +1,7 @@
-package com.fdkankan.contro.mq.service;
+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;
@@ -28,4 +31,12 @@ public interface ICommonService {
     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;
+
+
+
+}

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

@@ -16,7 +16,7 @@ import java.util.Date;
  * @since 2022/1/14
  **/
 public interface IFdkkLaserService {
-    void syncBuildResult(String sceneNum, String dataSource, Date createTime);
+    void syncBuildResult(String sceneNum, String dataSource, Date createTime, Date algorithmTime);
 
     void pushBuildStatusToLaserSystem(String projectNum, String laserObjFilePath, Integer buildObjStatus);
 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 106 - 8
src/main/java/com/fdkankan/contro/mq/service/impl/CommonServiceImpl.java

@@ -1,16 +1,22 @@
-package com.fdkankan.contro.mq.service.impl;
+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.mq.service.ICommonService;
+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;
@@ -55,7 +61,18 @@ public class CommonServiceImpl implements ICommonService {
     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) {
@@ -127,11 +144,11 @@ public class CommonServiceImpl implements ICommonService {
         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 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)){
@@ -150,6 +167,13 @@ public class CommonServiceImpl implements ICommonService {
             fYunFileServiceInterface.uploadFileByCommand(localIntensity, ossIntensity);
         }
 
+        //上传点位校准相关文件
+        String localExtras = dataSource + "/extras";
+        String ossExtras = ossResultPath + "extras";
+        if(FileUtil.exist(localExtras)){
+            fYunFileServiceInterface.uploadFileByCommand(localExtras, ossExtras);
+        }
+
         //开始上传
         fYunFileServiceInterface.uploadMulFiles(uploadMap);
     }
@@ -236,4 +260,78 @@ public class CommonServiceImpl implements ICommonService {
         }
         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);
+    }
+}

+ 5 - 4
src/main/java/com/fdkankan/contro/service/impl/IFdkkLaserServiceImpl.java

@@ -55,19 +55,20 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
     private FYunFileServiceInterface fYunFileService;
 
 
-    public void updateSceneStatus(String sceneCode, int sceneStatus, String path, Date createTime) {
+    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", createTime);
+        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) {
+    public void syncBuildResult(String sceneNum, String dataSource,Date createTime, Date algorithmTime) {
         log.info("激光转台相机构建结果 同步 请求 ");
         try {
             String jgPath = dataSource;
@@ -95,7 +96,7 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
             FileUtils.copyDirectiory(dataSource + "/results/laserData/cover", jgPath + "/extras");
             FileUtils.copyFile(dataSource + "/results/laserData", jgPath, true);
 
-            updateSceneStatus(sceneNum, 2, jgPath + File.separator + "laserData",createTime);
+            updateSceneStatus(sceneNum, 2, jgPath + File.separator + "laserData",createTime, algorithmTime);
         } catch (Exception e) {
             log.error("激光转台相机同步失败", e);
         }

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

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

+ 145 - 61
src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java

@@ -23,6 +23,7 @@ import com.fdkankan.common.util.SnowflakeIdGenerator;
 import com.fdkankan.contro.constant.RedisConstants;
 import com.fdkankan.contro.entity.*;
 import com.fdkankan.contro.mapper.ISceneFileBuildMapper;
+import com.fdkankan.contro.service.ICommonService;
 import com.fdkankan.contro.service.*;
 import com.fdkankan.contro.vo.ResponseSceneFile;
 import com.fdkankan.contro.vo.ScenePlusVO;
@@ -82,6 +83,9 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
     @Value("${scene.pro.new.url}")
     private String sceneProNewUrl;
 
+    @Value("${scene.pro.v3.url}")
+    private String sceneProV3Url;
+
     @Value("${queue.modeling.modeling-pre}")
     private String queueModelingPre;
 
@@ -97,14 +101,15 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
     @Value("#{'${model.3dtiles.sceneSource:}'.split(',')}")
     private List<Integer> sdTilesSceneSourceList;
 
+    @Value("#{'${camType.laser:}'.split(',')}")
+    private List<Integer> laserCamTypeList;
+
     @Value("${build.notSupport.beforeTime:202203}")
     private String jgNotSupportBuildTime;
 
     @Autowired
     private RedisUtil redisUtil;
 
-
-
     @Autowired
     private IScenePlusExtService scenePlusExtService;
 
@@ -165,6 +170,24 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
     @Autowired
     private ISceneCopyDistinctEnvService sceneCopyDistinctEnvService;
 
+    @Autowired
+    private ISceneCopyLogService sceneCopyLogService;
+
+    @Autowired
+    private ISceneCleanOrigService sceneCleanOrigService;
+
+    @Autowired
+    private ICommonService commonService;
+
+    @Autowired
+    private IExceedSpaceSceneService exceedSpaceSceneService;
+
+    @Autowired
+    private ISceneColdStorageLogService sceneColdStorageLogService;
+
+    @Autowired
+    private ISceneColdStorageService sceneColdStorageService;
+
     @Override
     public SceneFileBuild findByFileId(String fileId) {
 
@@ -217,14 +240,23 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
 
         // 检测是否有生成
         String fileId = redisUtil.get(String.format(RedisConstants.FOLDER_FILEID_BUILD, folderName));
-        if (!ObjectUtils.isEmpty(fileId)) {
-            responseSceneFile.setFileId(fileId);
-            return responseSceneFile;
+        if (StrUtil.isEmpty(fileId)) {
+            SceneFileBuild sceneFileBuild = this.findByUnicode(folderName);
+            if (sceneFileBuild != null) {
+                fileId = sceneFileBuild.getFileId();
+            }
         }
+        if(StrUtil.isNotEmpty(fileId)){
+
+            //校验目录是否被上锁,如果上锁,抛出错误(避免删除原始资源定时任务执行过程中,有场景补拍重新上传)
+            String homePath = redisUtil.get(String.format(RedisKey.SCENE_OSS_HOME_DIR_DELETE, folderName));
+            if(StrUtil.isNotEmpty(homePath)){
+                throw new BusinessException(ErrorCode.FAILURE_CODE_5073);
+            }
+            //如果原始资源目录不是正在被定时任务删除中,就加上上传锁,并正常返回
+            homePath = ConstantFilePath.OSS_PREFIX.concat(mac).concat("/").concat(fileId).concat("/").concat(folderName);
+            redisUtil.set(String.format(RedisKey.SCENE_OSS_HOME_DIR_UPLOAD, folderName), homePath, RedisKey.CAMERA_EXPIRE_7_TIME);
 
-        SceneFileBuild sceneFileBuild = this.findByUnicode(folderName);
-        if (sceneFileBuild != null) {
-            fileId = sceneFileBuild.getFileId();
             responseSceneFile.setFileId(fileId);
             redisUtil.set(String.format(RedisConstants.FOLDER_FILEID_BUILD, folderName), fileId, 2 * 24 * 60 * 60);
             return responseSceneFile;
@@ -238,7 +270,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
 
         // 查找场景表
         LambdaQueryWrapper<ScenePro> proWrapper = new LambdaQueryWrapper<>();
-        proWrapper.like(ScenePro::getDataSource, "/" + folderName).eq(ScenePro::getRecStatus, 'A');
+        proWrapper.like(ScenePro::getDataSource, "/" + folderName);
         ScenePro pro = sceneProService.getOne(proWrapper);
 
         String dataSource = null;
@@ -249,7 +281,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             dataSource = scenePlusService.getDataSourceLikeUnicode("/" + folderName);
         }
 
-        if (!ObjectUtils.isEmpty(dataSource)) {
+        if (StrUtil.isNotEmpty(dataSource)) {
             log.info("从数据库中查到与 fileId:{} 匹配的路径为:{}", fileId, dataSource);
             int n = dataSource.split("/").length;
             if (n > 1) {
@@ -257,11 +289,12 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             }
         }
 
-        if (ObjectUtils.isEmpty(fileId)) {
+        if (StrUtil.isEmpty(fileId)) {
             fileId = new SnowflakeIdGenerator(0, 0).nextId() + "";
             log.info("新生成build数据,{}", fileId);
         }
-        sceneFileBuild = new SceneFileBuild();
+
+        SceneFileBuild sceneFileBuild = new SceneFileBuild();
         sceneFileBuild.setChildName(mac);
         sceneFileBuild.setFileId(fileId);
         sceneFileBuild.setRecStatus("A");
@@ -308,12 +341,19 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
 
         //查看场景中的文件目录是否有改文件id,有则重新计算改场景,无则新建场景
         ScenePlus scenePlus = scenePlusService.getByFileId("/" + fileId + "/");
-        int rebuild = 1;
+        int rebuild = CommonStatus.YES.code();
         if (ObjectUtils.isEmpty(scenePlus)) {
+
+
+            //清除超容量场景记录
+            exceedSpaceSceneService.repeal(camera.getId(), fileId, unicode);
+
             sceneNum = scene3dNumService.generateSceneNum(cameraDetail.getType());
-            rebuild = 0;
+
+            rebuild = CommonStatus.NO.code();
         } else {
             sceneNum = scenePlus.getNum();
+            sceneCopyLogService.checkCanBuild(sceneNum);
             if (scenePlus.getSceneStatus().equals(SceneStatus.wait.code())) {
                 log.info(scenePlus.getNum() + ":场景处于计算中,不能再计算");
                 return null;
@@ -323,6 +363,18 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             log.error("大场景序号为空:" + sceneNum);
             throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
         }
+
+        //如果是相机计算容量的模式是场景个数模式,则需要拦截计算
+        if(rebuild == CommonStatus.NO.code() && cameraType != 14){//新场景需要校验容量是否超出限制
+            boolean exceedSpace = exceedSpaceSceneService.cehckExceedSpace(sceneNum, cameraDetail, cameraName, fileId, unicode);
+            if(exceedSpace){
+                ScenePlusVO scenePlusVO = new ScenePlusVO();
+                scenePlusVO.setNum(sceneNum);
+                scenePlusVO.setSceneStatus(SceneStatus.EXCEED_SPACE.code());
+                return scenePlusVO;
+            }
+        }
+
         String dataSource = cameraName.replace("4DKKPRO_", "").replace("-fdage", "").toLowerCase() + File.separator +
                 fileId + File.separator + unicode;
         if (cameraType == 14) {
@@ -345,9 +397,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
 
     private ScenePlusVO buildScenePost(String dataSource, JSONObject jsonObject, String buildType, long cameraType,
                                        String sceneNum, CameraDetail cameraDetail, int rebuild,String icon) throws Exception {
-        String localDataPath = String.format(ConstantFilePath.DATABUFFER_FORMAT, sceneNum);
         String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, sceneNum);
-        String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, sceneNum);
 
         String userName = null;
         if (!ObjectUtils.isEmpty(cameraDetail.getUserId())) {
@@ -368,9 +418,9 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
 
         //重算的场景,先移除该场景对应的容量
         if (rebuild == 1) {
-            scenePlusService.resetSpace(sceneNum);
-            //删除oss的houst_floor.json(国际版可能会卡住)
-            fYunFileService.deleteFile(dataViewPath + "houst_floor.json");
+            if(CollUtil.isEmpty(laserCamTypeList) || !laserCamTypeList.contains(cameraDetail.getType())){
+                scenePlusService.resetSpace(sceneNum);
+            }
         } else {
             //上传log-main.png
             fYunFileService.uploadFile(ConstantFilePath.LOGO_PATH + "logo-main.png", imgViewPath + "logo-main.png");
@@ -384,18 +434,10 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
                 jsonObject.getInteger("scenetype"), jsonObject.getString("gps"), rebuild,
                 jsonObject.getInteger("resolution"), firmwareVersion.toString(), sceneUrl, buildType, cameraDetail.getCooperationUser());
 
-        if (Objects.nonNull(scenePlusVO)) {
-            JSONObject statusJson = new JSONObject();
-            //临时将-2改成1,app还没完全更新
-            statusJson.put("status", scenePlusVO.getSceneStatus() == -2 ? 1 : scenePlusVO.getSceneStatus());
-            statusJson.put("webSite", scenePlusVO.getWebSite());
-            statusJson.put("sceneNum", scenePlusVO.getNum());
-            statusJson.put("thumb", scenePlusVO.getThumb());
-            statusJson.put("payStatus", 0);
-            statusJson.put("recStatus", 'A');
-            FileUtils.writeFile(localDataPath + "status.json", statusJson.toString());
-            fYunFileService.uploadFile(localDataPath + "status.json", dataViewPath + "status.json");
-        }
+        //上传app状态文件
+        commonService.uploadStatusJson(sceneNum, scenePlusVO.getSceneStatus(),
+                scenePlusVO.getWebSite(),scenePlusVO.getThumb(),PayStatus.NOT_PAY.code(),
+                String.format(UploadFilePath.DATA_VIEW_PATH, sceneNum));
 
         BuildSceneCallMessage mqMessage = getBuildSceneMqMessage(sceneNum, cameraType, algorithm, jsonObject.getInteger("resolution"), buildType,
                 scenePlusVO.getDataSource());
@@ -413,8 +455,10 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
     }
 
     public ScenePlusVO buildV3Scene(ScenePro scenePro,String fileId, String prefix,JSONObject jsonObject,String buildType,long cameraType) throws Exception{
-        //调用createScene方法生成scene数据和加入算法队列
 
+        sceneCopyLogService.checkCanBuild(scenePro.getNum());
+
+        //调用createScene方法生成scene数据和加入算法队列
         String cameraName = jsonObject.getJSONObject("cam").getString("uuid");
         String unicode = jsonObject.getString("creator") + "_" + jsonObject.getString("uuidtime");
 
@@ -473,18 +517,11 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
                 jsonObject.getInteger("scenetype"), jsonObject.getString("gps"),
                 jsonObject.getInteger("resolution"), firmwareVersion.toString(), buildType);
 
-        if (Objects.nonNull(scenePlusVO)) {
-            JSONObject statusJson = new JSONObject();
-            //临时将-2改成1,app还没完全更新
-            statusJson.put("status", scenePlusVO.getSceneStatus() == -2 ? 1 : scenePlusVO.getSceneStatus());
-            statusJson.put("webSite", scenePlusVO.getWebSite());
-            statusJson.put("sceneNum", scenePlusVO.getNum());
-            statusJson.put("thumb", scenePlusVO.getThumb());
-            statusJson.put("payStatus", 0);
-            statusJson.put("recStatus", 'A');
-            FileUtils.writeFile(localDataPath + "status.json", statusJson.toString());
-            fYunFileService.uploadFile(localDataPath + "status.json", dataViewPath + "status.json");
-        }
+        //上传场景状态文件
+        commonService.uploadStatusJson(sceneNum, scenePlusVO.getSceneStatus(),
+                scenePlusVO.getWebSite(),scenePlusVO.getThumb(),PayStatus.NOT_PAY.code(),
+                String.format(ConstantFilePath.DATA_PATH_FORMAT, sceneNum));
+
         BuildSceneCallMessage mqMessage = getBuildSceneMqMessage(sceneNum, cameraType, algorithm, jsonObject.getInteger("resolution"), buildType,
                 scenePlusVO.getDataSource());
         if (cameraDetail.getCompanyId() != null) {
@@ -599,6 +636,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             }
         }
 
+        this.removeUpdateV4(ConstantFilePath.OSS_PREFIX + prefixBuffer + "data.fdage", fdageJson);
+
         // 判断是否是V3的场景
         ScenePro scenePro = sceneProService.getOne(
             new LambdaQueryWrapper<ScenePro>().like(ScenePro::getDataSource, fileId));
@@ -615,7 +654,22 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         return ResultData.ok();
     }
 
+    private void removeUpdateV4(String dataFdagePath, JSONObject fdageJson){
+        Integer updateV4 = fdageJson.getInteger("updateV4");
+        if(Objects.isNull(updateV4) || updateV4 == 0){
+            return;
+        }
+        fdageJson.put("updateV4", CommonStatus.NO.code());
+        fYunFileService.uploadFile(fdageJson.toJSONString().getBytes(StandardCharsets.UTF_8), dataFdagePath);
+    }
+
     private boolean callV3(ScenePro scenePro, String preParams, JSONObject fdageJson,String api) throws Exception {
+
+        //复制出来的场景不支持补拍上传
+        if(Objects.nonNull(scenePro)){
+            sceneCopyLogService.checkCanBuild(scenePro.getNum());
+        }
+
         String cameraName = fdageJson.getJSONObject("cam").getString("uuid");
 
         Camera camera = cameraService.getByChildName(cameraName);
@@ -637,6 +691,11 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
                 throw new BusinessException(CameraConstant.FAILURE_6003);
             }
             if (!ObjectUtils.isEmpty(company.getSceneVersion()) && company.getSceneVersion().equals("V3")) {
+                //如果是app重新上传,需要解冻结
+                if(Objects.nonNull(scenePro)){
+                    sceneColdStorageService.unfreeze(scenePro.getNum(), "用户相机重新全量上传", scenePro.getDataSource());
+                }
+
                 callV3Service(preParams, api);
                 return Boolean.TRUE;
             }
@@ -716,6 +775,9 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             log.info("data.fdage文件为空");
             throw new BusinessException(CameraConstant.FAILURE_6009);
         }
+
+        this.removeUpdateV4(ConstantFilePath.OSS_PREFIX + prefixBuffer + "data.fdage", fdageJson);
+
         String buildType = "V3";
         //13表示转台
         Long cameraType = 13L;
@@ -745,7 +807,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         }
 
 
-        if(ObjectUtils.isEmpty(scenePlusVO)){
+        if(ObjectUtils.isEmpty(scenePlusVO) || scenePlusVO.getSceneStatus() == SceneStatus.EXCEED_SPACE.code()){
             return ResultData.ok();
         }
         // 通知激光场景系统开始构建场景
@@ -893,9 +955,9 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         }else {
             ScenePlus oldScene = scenePlusService.getScenePlusByNum(projectNum);
             scenePlus.setId(oldScene.getId());
-            scenePlus.setSceneStatus(0);
+            scenePlus.setSceneStatus(SceneStatus.wait.code());
             scenePlus.setRecStatus(RecStatus.VALID.code());
-            scenePlus.setPayStatus(0);
+            scenePlus.setPayStatus(PayStatus.NOT_PAY.code());
             scenePlus.setCreateTime(Calendar.getInstance().getTime());
 
             ScenePlusExt oldSceneExt = scenePlusExtService.getScenePlusExtByPlusId(oldScene.getId());
@@ -1101,35 +1163,54 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
     public ResultData rebuildScene(String num,Boolean force,Boolean deleteExtras) throws IOException {
 
         ScenePro scenePro = sceneProService.getByNum(num);
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
 
-        // TODO: 2023/1/12 3dtiles临时上激光场景
-//        if(Objects.nonNull(scenePro) && (Objects.isNull(scenePro.getIsUpgrade())
-//            || scenePro.getIsUpgrade() != CommonStatus.YES.code().intValue())){
-//            if(scenePro.getSceneSource() == SceneSource.JG.code().intValue()){
-//                return rebuildV3Scene(scenePro,num,force);
-//            }else{
-//                return rebuildV3SceneToMini(scenePro);
-//            }
-//        }
+        //复制出来的场景不支持重算
+        List<SceneCopyLog> sceneCopyLogs = sceneCopyLogService. listByNewNum(num);
+        if(CollUtil.isNotEmpty(sceneCopyLogs)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5071);
+        }
+
+        //已删除原始资源的场景不支持重算
+        Long cameraId = null;
+        Date laseCallTime = null;
+        ScenePlusExt scenePlusExt = null;
+        if(Objects.nonNull(scenePlus)){
+            scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+            laseCallTime = scenePlusExt.getAlgorithmTime();
+            cameraId = scenePlus.getCameraId();
+        }else{
+            laseCallTime = scenePro.getCreateTime();
+            cameraId = scenePro.getCameraId();
+        }
+
+        //查询场景是否处于冻结状态,如果已冻结,不允许重算
+        SceneColdStorage sceneColdStorage = sceneColdStorageService.getOne(new LambdaQueryWrapper<SceneColdStorage>().eq(SceneColdStorage::getNum, num).eq(SceneColdStorage::getState, 1));
+        if(Objects.nonNull(sceneColdStorage)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5074);
+        }
+
+        //查询最后一次计算时间后是否有删除过目录,如果有,则不支持重算
+        List<SceneCleanOrig> sceneCleanOrigs = sceneCleanOrigService.lisByNumAfterLastCall(num, laseCallTime);
+        if(CollUtil.isNotEmpty(sceneCleanOrigs)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5072);
+        }
 
 
         //激光场景校验是否能够计算
         this.checkJgCanBuild(scenePro);
 
-        //如果是v3场景,不允许重算,需要升级v4后再调此接口进行重算
         if(Objects.nonNull(scenePro) && (Objects.isNull(scenePro.getIsUpgrade())
                 || scenePro.getIsUpgrade() != CommonStatus.YES.code().intValue())){
             return rebuildV3Scene(scenePro,num,force);
         }
 
-        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
         if(Objects.isNull(scenePlus)){
             throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
         }
         if (scenePlus.getSceneStatus() == 0 && (ObjectUtils.isEmpty(force) || !force)) {
             throw new BusinessException(ErrorCode.FAILURE_CODE_5033);
         }
-        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
         String path = scenePlusExt.getDataSource();
         Integer sceneSource = scenePlus.getSceneSource();
         String buildType = scenePlusExt.getBuildType();
@@ -1145,7 +1226,10 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
         }
 
         //重算的场景,先移除该场景对应的容量
-        scenePlusService.resetSpace(num);
+        CameraDetail cameraDetail = cameraDetailService.getByCameraId(cameraId);
+        if(CollUtil.isEmpty(laserCamTypeList) || !laserCamTypeList.contains(cameraDetail.getType())){
+            scenePlusService.resetSpace(num);
+        }
         String statusJsonOssPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "status.json";
         JSONObject statusJson = JSONObject.parseObject(fYunFileService.getFileContent(String.format(UploadFilePath.DATA_VIEW_PATH, num) + "status.json"));
         if(ObjectUtils.isEmpty(statusJson)){
@@ -1453,7 +1537,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
 
 
         String buildType = "V3";
-        String sceneUrl = mainUrl + "/" + sceneProNewUrl;
+        String sceneUrl = mainUrl + "/" + sceneProV3Url;
 
         boolean isObj = jsonObject.containsKey("exportMeshObj") && jsonObject.getIntValue("exportMeshObj") == 1;
 

+ 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>
  *  服务实现类

+ 52 - 16
src/main/java/com/fdkankan/contro/service/impl/ScenePlusServiceImpl.java

@@ -1,10 +1,17 @@
 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.entity.ScenePro;
 import com.fdkankan.contro.mapper.IScenePlusMapper;
 import com.fdkankan.contro.service.ICameraDetailService;
 import com.fdkankan.contro.service.IScenePlusExtService;
@@ -12,11 +19,13 @@ import com.fdkankan.contro.service.IScenePlusService;
 import com.fdkankan.web.response.ResultData;
 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.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -48,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"));
@@ -65,23 +79,19 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
     @Override
     public String getDataSourceLikeUnicode(String unicode) {
         // 防止plus表删除,ext表未删除
-        List<ScenePlusExt> scenePlusExts = scenePlusExtService.list(
-            new LambdaQueryWrapper<ScenePlusExt>().like(ScenePlusExt::getDataSource, unicode)
-                    .eq(ScenePlusExt::getRecStatus,"A"));
+        ScenePlusExt scenePlusExt = scenePlusExtService.getOne(
+            new LambdaQueryWrapper<ScenePlusExt>().select(ScenePlusExt::getPlusId, ScenePlusExt::getDataSource).like(ScenePlusExt::getDataSource, unicode));
 
-        if (ObjectUtils.isEmpty(scenePlusExts)) {
+        if (Objects.isNull(scenePlusExt)) {
             return null;
         }
 
-        if (scenePlusExts.size() > 1) {
-            for (ScenePlusExt scenePlusExt : scenePlusExts) {
-                ScenePlus plus = getById(scenePlusExt.getPlusId());
-                if (!ObjectUtils.isEmpty(plus) && plus.getRecStatus().equals("A")) {
-                    return scenePlusExt.getDataSource();
-                }
-            }
+        ScenePlus plus = getById(scenePlusExt.getPlusId());
+        if (Objects.nonNull(plus)) {
+            return scenePlusExt.getDataSource();
         }
-        return scenePlusExts.get(0).getDataSource();
+        scenePlusExtService.removeById(scenePlusExt);
+        return null;
     }
 
     @Override
@@ -103,4 +113,30 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
         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;
+    }
 }

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

@@ -1,13 +1,21 @@
 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场景表 服务实现类
@@ -24,4 +32,30 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
     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;
+    }
 }

+ 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 - 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/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/SceneCopyLogMapper.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.ISceneCopyLogMapper">
+
+</mapper>