瀏覽代碼

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

# Conflicts:
#	src/main/java/com/fdkankan/scene/controller/SceneController.java
#	src/main/java/com/fdkankan/scene/generate/AutoGenerate.java
#	src/main/java/com/fdkankan/scene/schedule/ScheduleJob.java
#	src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java
#	src/main/java/com/fdkankan/scene/service/impl/SceneEditServiceImpl.java
#	src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java
#	src/main/java/com/fdkankan/scene/service/impl/SceneUploadServiceImpl.java
dengsixing 1 年之前
父節點
當前提交
27831100f6
共有 44 個文件被更改,包括 1791 次插入278 次删除
  1. 18 0
      pom.xml
  2. 4 0
      src/main/java/com/fdkankan/scene/Interceptor/CheckPermitAspect.java
  3. 18 0
      src/main/java/com/fdkankan/scene/bean/SceneJsonBean.java
  4. 30 2
      src/main/java/com/fdkankan/scene/controller/SceneAsynOperLogController.java
  5. 15 0
      src/main/java/com/fdkankan/scene/controller/SceneController.java
  6. 53 0
      src/main/java/com/fdkankan/scene/controller/SceneDynamicPanelController.java
  7. 62 32
      src/main/java/com/fdkankan/scene/controller/SceneEditController.java
  8. 53 0
      src/main/java/com/fdkankan/scene/controller/SceneEditDrawController.java
  9. 66 0
      src/main/java/com/fdkankan/scene/entity/SceneDynamicPanel.java
  10. 15 2
      src/main/java/com/fdkankan/scene/entity/SceneEditControls.java
  11. 20 2
      src/main/java/com/fdkankan/scene/entity/SceneEditInfoExt.java
  12. 4 1
      src/main/java/com/fdkankan/scene/entity/SceneResource.java
  13. 20 0
      src/main/java/com/fdkankan/scene/entity/Surveillance.java
  14. 18 0
      src/main/java/com/fdkankan/scene/mapper/ISceneDynamicPanelMapper.java
  15. 9 0
      src/main/java/com/fdkankan/scene/service/ICommonService.java
  16. 27 0
      src/main/java/com/fdkankan/scene/service/ICutModelService.java
  17. 8 2
      src/main/java/com/fdkankan/scene/service/ISceneAsynOperLogService.java
  18. 20 0
      src/main/java/com/fdkankan/scene/service/ISceneDrawService.java
  19. 25 0
      src/main/java/com/fdkankan/scene/service/ISceneDynamicPanelService.java
  20. 5 1
      src/main/java/com/fdkankan/scene/service/ISceneEditInfoService.java
  21. 2 2
      src/main/java/com/fdkankan/scene/service/ISceneProService.java
  22. 2 0
      src/main/java/com/fdkankan/scene/service/ISceneResourceService.java
  23. 5 3
      src/main/java/com/fdkankan/scene/service/ISurveillanceService.java
  24. 47 0
      src/main/java/com/fdkankan/scene/service/impl/CommonServiceImpl.java
  25. 283 0
      src/main/java/com/fdkankan/scene/service/impl/CutModelServiceImpl.java
  26. 44 12
      src/main/java/com/fdkankan/scene/service/impl/SceneAsynOperLogServiceImpl.java
  27. 9 1
      src/main/java/com/fdkankan/scene/service/impl/SceneCleanOrigServiceImpl.java
  28. 244 0
      src/main/java/com/fdkankan/scene/service/impl/SceneDrawServiceImpl.java
  29. 101 0
      src/main/java/com/fdkankan/scene/service/impl/SceneDynamicPanelServiceImpl.java
  30. 152 73
      src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java
  31. 194 116
      src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java
  32. 15 8
      src/main/java/com/fdkankan/scene/service/impl/SceneResourceServiceImpl.java
  33. 9 5
      src/main/java/com/fdkankan/scene/service/impl/SceneUploadServiceImpl.java
  34. 61 13
      src/main/java/com/fdkankan/scene/service/impl/SurveillanceServiceImpl.java
  35. 29 0
      src/main/java/com/fdkankan/scene/vo/SceneDynamicPanelParamVO.java
  36. 27 0
      src/main/java/com/fdkankan/scene/vo/SceneDynamicPanelVO.java
  37. 10 0
      src/main/java/com/fdkankan/scene/vo/SceneEditControlsParamVO.java
  38. 11 0
      src/main/java/com/fdkankan/scene/vo/SceneEditControlsVO.java
  39. 4 1
      src/main/java/com/fdkankan/scene/vo/SceneEditInfoParamVO.java
  40. 20 0
      src/main/java/com/fdkankan/scene/vo/SceneInfoVO.java
  41. 9 1
      src/main/java/com/fdkankan/scene/vo/SurveillanceParamVO.java
  42. 8 0
      src/main/java/com/fdkankan/scene/vo/SurveillanceVO.java
  43. 10 1
      src/main/resources/bootstrap-dev.yml
  44. 5 0
      src/main/resources/mapper/scene/SceneDynamicPanelMapper.xml

+ 18 - 0
pom.xml

@@ -54,6 +54,18 @@
             <groupId>com.fdkankan</groupId>
             <artifactId>4dkankan-common-web</artifactId>
             <version>3.0.0-SNAPSHOT</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring-web</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+            <version>5.2.16.RELEASE</version>
         </dependency>
 
         <dependency>
@@ -152,6 +164,12 @@
             <version>1.0.5</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.fdkankan</groupId>
+            <artifactId>4dkankan-utils-dxf</artifactId>
+            <version>3.0.0-SNAPSHOT</version>
+        </dependency>
+
     </dependencies>
 
     <dependencyManagement>

+ 4 - 0
src/main/java/com/fdkankan/scene/Interceptor/CheckPermitAspect.java

@@ -6,6 +6,7 @@ import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSON;
 import com.fdkankan.common.constant.CommonStatus;
 import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.constant.PayStatus;
 import com.fdkankan.common.constant.SceneStatus;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.redis.constant.RedisKey;
@@ -99,6 +100,9 @@ public class CheckPermitAspect {
 			|| SceneStatus.FAILD.code().equals(scenePlus.getSceneStatus())){
 			throw new BusinessException(ErrorCode.FAILURE_CODE_5033);
 		}
+		if(!PayStatus.PAY.code().equals(scenePlus.getPayStatus())){
+			throw new BusinessException(ErrorCode.FAILURE_CODE_5034);
+		}
 
 		//判断是否相机登录,是否场景的相机id和相机登录的相机id是否相等,如果都满足,则放行,否则判定为用户登录
 		if(Objects.nonNull(user.getCameraLogin())

+ 18 - 0
src/main/java/com/fdkankan/scene/bean/SceneJsonBean.java

@@ -218,5 +218,23 @@ public class SceneJsonBean {
      */
     private Integer billboards;
 
+    /**
+     * 是否有模型裁剪(0-否,1-是)
+     */
+    private Integer cutModel;
+
+    /**
+     * 启动页信息
+     */
+    private JSONObject started;
+
+    /**
+     * 空间绘制
+     */
+    private Integer sceneDraw;
+
+    //动态面板
+    private int dynamicPanel;
+
 
 }

+ 30 - 2
src/main/java/com/fdkankan/scene/controller/SceneAsynOperLogController.java

@@ -1,6 +1,14 @@
 package com.fdkankan.scene.controller;
 
 
+import com.fdkankan.scene.annotation.CheckPermit;
+import com.fdkankan.scene.service.ISceneAsynOperLogService;
+import com.fdkankan.scene.vo.SceneAsynOperLogParamVO;
+import com.fdkankan.web.response.ResultData;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
@@ -10,12 +18,32 @@ import org.springframework.web.bind.annotation.RestController;
  *  前端控制器
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-12-07
  */
 @RestController
-@RequestMapping("/scene/sceneAsynOperLog")
+@RequestMapping("/service/scene/edit")
 public class SceneAsynOperLogController {
 
+    @Autowired
+    private ISceneAsynOperLogService sceneAsynOperLogService;
+
+
+    /**
+     * <p>
+     查询异步操作
+     * </p>
+     * @author dengsixing
+     * @date 2022/10/19
+     * @param param
+     * @return com.fdkankan.common.response.ResultData
+     **/
+    @CheckPermit
+    @PostMapping("/getAsynOperLog")
+    public ResultData getAsynOperLog(@RequestBody @Validated SceneAsynOperLogParamVO param){
+        return sceneAsynOperLogService.getAsynOperLog(param);
+    }
+
+
 }
 

+ 15 - 0
src/main/java/com/fdkankan/scene/controller/SceneController.java

@@ -5,6 +5,8 @@ import com.fdkankan.common.constant.SceneInfoReqType;
 import com.fdkankan.scene.annotation.CheckViewBizAuth;
 import com.fdkankan.scene.annotation.SaveLog;
 import com.fdkankan.scene.service.IRepairDataService;
+import com.fdkankan.scene.annotation.CheckPermit;
+import com.fdkankan.scene.service.ISceneDynamicPanelService;
 import com.fdkankan.scene.service.ISceneService;
 import com.fdkankan.web.response.ResultData;
 import com.fdkankan.scene.service.ISceneEditInfoService;
@@ -38,6 +40,8 @@ public class SceneController extends BaseController {
     private ISceneService sceneService;
     @Autowired
     private IRepairDataService repairDataService;
+    @Autowired
+    private ISceneDynamicPanelService sceneDynamicPanelService;
 
     /**
      * <p>
@@ -116,5 +120,16 @@ public class SceneController extends BaseController {
         return repairDataService.repairSceneResultData(num);
     }
 
+    /**
+     * 查询是否有动态面板数据
+     * @param num
+     * @return
+     */
+    @GetMapping("/checkDynamicPanel")
+    public ResultData checkDynamicPanel(@RequestParam("num") String num){
+       return ResultData.ok(sceneDynamicPanelService.checkDynamicPanel(num));
+    }
+
+
 }
 

+ 53 - 0
src/main/java/com/fdkankan/scene/controller/SceneDynamicPanelController.java

@@ -0,0 +1,53 @@
+package com.fdkankan.scene.controller;
+
+
+import com.fdkankan.scene.annotation.CheckPermit;
+import com.fdkankan.scene.service.ISceneDynamicPanelService;
+import com.fdkankan.scene.vo.BaseJsonDataParamVO;
+import com.fdkankan.web.response.ResultData;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ * <p>
+ * 场景动态面板 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2024-05-21
+ */
+@RestController
+@RequestMapping("/service/scene/edit/dynamicPanel")
+public class SceneDynamicPanelController {
+
+    @Autowired
+    private ISceneDynamicPanelService sceneDynamicPanelService;
+
+    /**
+     * 获取动态面板列表
+     * @param num
+     * @return
+     */
+    @CheckPermit
+    @GetMapping("/list")
+    public ResultData list(@RequestParam("num") String num){
+        return ResultData.ok(sceneDynamicPanelService.list(num));
+    }
+
+    /**
+     * 修改动态面板
+     * @param param
+     * @return
+     */
+    @CheckPermit
+    @PostMapping("/update")
+    public ResultData update(@RequestBody @Valid BaseJsonDataParamVO param){
+        sceneDynamicPanelService.update(param);
+        return ResultData.ok();
+    }
+
+
+}
+

+ 62 - 32
src/main/java/com/fdkankan/scene/controller/SceneEditController.java

@@ -9,20 +9,15 @@ import com.fdkankan.scene.service.*;
 import com.fdkankan.scene.vo.*;
 import com.fdkankan.web.controller.BaseController;
 import com.fdkankan.web.response.ResultData;
-import java.io.IOException;
 import lombok.extern.log4j.Log4j2;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
+
 /**
  * 场景编辑管理
  */
@@ -54,6 +49,8 @@ public class SceneEditController extends JmgaBaseController {
     private ISceneAsynOperLogService sceneAsynOperLogService;
     @Autowired
     private ISceneEditInfoExtService sceneEditInfoExtService;
+    @Autowired
+    private ICutModelService cutModelService;
 
     /**
      * <p>
@@ -209,8 +206,8 @@ public class SceneEditController extends JmgaBaseController {
      **/
     @CheckPermit
     @PostMapping(value = "/downloadModel")
-    public ResultData downloadTexData(@RequestParam("num") String num) throws Exception {
-        return sceneProService.downloadTexData(num);
+    public ResultData downloadModel(@RequestParam("num") String num) throws Exception {
+        return sceneProService.downloadModel(num);
     }
 
     /**
@@ -226,20 +223,20 @@ public class SceneEditController extends JmgaBaseController {
     @SaveLog
     @CheckPermit
     @PostMapping(value = "/uploadModel")
-    public ResultData uploadObjAndImg(@RequestParam("num") String num, @RequestParam("file") MultipartFile file) throws Exception {
-        return sceneProService.uploadObjAndImg(num, file);
+    public ResultData uploadModel(@RequestParam("num") String num, @RequestParam("file") MultipartFile file) throws Exception {
+        return sceneProService.uploadModel(num, file);
     }
 
     /**
      * <p>
      保存关联全景图
-     * </p>      
+     * </p>
      * @author dengsixing
-     * @date 2022/8/1 
+     * @date 2022/8/1
      * @param num
      * @param sid
      * @param fileName
-     * @param file 
+     * @param file
      * @return com.fdkankan.web.response.ResultData
      **/
     @SaveLog
@@ -334,6 +331,36 @@ public class SceneEditController extends JmgaBaseController {
 
     /**
      * <p>
+     保存户型图
+     * </p>
+     * @author dengsixing
+     * @date 2022/1/20
+     * @param param
+     * @return com.fdkankan.web.response.ResultData
+     **/
+    @CheckPermit
+    @GetMapping(value = "/cad/dxf/download")
+    public ResultData saveCadDxf(@RequestParam String num) throws Exception{
+        return sceneEditInfoService.downloadDxf(num);
+    }
+
+    /**
+     * <p>
+     保存户型图
+     * </p>
+     * @author dengsixing
+     * @date 2022/1/20
+     * @param param
+     * @return com.fdkankan.web.response.ResultData
+     **/
+    @CheckPermit
+    @PostMapping(value = "/cad/dxf/upload")
+    public ResultData uploadDxf(@RequestParam MultipartFile file, @RequestParam String num) throws Exception{
+        return sceneEditInfoService.uploadDxf(file, num);
+    }
+
+    /**
+     * <p>
      重置户型图
      * </p>
      * @author dengsixing
@@ -792,14 +819,14 @@ public class SceneEditController extends JmgaBaseController {
     @SaveLog
     @CheckPermit
     @PostMapping("/surveillance/save")
-    ResultData saveSurveillance(@RequestBody @Validated SurveillanceParamVO param){
+    ResultData saveSurveillance(@RequestBody @Validated SurveillanceParamVO param) throws Exception {
         return surveillanceService.saveSurveillance(param);
     }
 
     @SaveLog
     @CheckPermit
     @PostMapping("/surveillance/delete")
-    public ResultData deleteSurveillance(@RequestBody @Validated BaseSidParamVO param){
+    public ResultData deleteSurveillance(@RequestBody @Validated BaseSidParamVO param) throws IOException {
         return surveillanceService.deleteSurveillance(param);
     }
 
@@ -874,21 +901,6 @@ public class SceneEditController extends JmgaBaseController {
     }
 
     /**
-     * <p>
-     删除空间模型
-     * </p>
-     * @author dengsixing
-     * @date 2022/10/19
-     * @param param
-     * @return com.fdkankan.common.response.ResultData
-     **/
-    @CheckPermit
-    @PostMapping("/getAsynOperLog")
-    public ResultData getAsynOperLog(@RequestBody @Validated SceneAsynOperLogParamVO param){
-        return sceneAsynOperLogService.getAsynOperLog(param);
-    }
-
-    /**
      * 获取编辑器版本信息
      * @return
      */
@@ -948,6 +960,24 @@ public class SceneEditController extends JmgaBaseController {
         return ResultData.ok(sceneEditInfoExtService.deleteBillboardsStyles(param));
     }
 
+    @CheckPermit
+    @PostMapping(value = "/cutModel/save")
+    public ResultData saveCutModel(@RequestBody @Validated BaseJsonArrayParamVO param) throws Exception {
+        return cutModelService.saveCutModel(param);
+    }
+
+    @CheckPermit
+    @PostMapping(value = "/cutModel/list")
+    public ResultData listCutModel(@RequestBody @Validated BaseSceneParamVO param) throws Exception {
+        return ResultData.ok(cutModelService.listCutModel(param));
+    }
+
+    @CheckPermit
+    @PostMapping(value = "/cutModel/delete")
+    public ResultData deleteCutModel(@RequestBody @Validated DeleteSidListParamVO param) throws Exception {
+        return cutModelService.deleteCutModel(param);
+    }
+
 
 
 }

+ 53 - 0
src/main/java/com/fdkankan/scene/controller/SceneEditDrawController.java

@@ -0,0 +1,53 @@
+package com.fdkankan.scene.controller;
+
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.constant.SceneInfoReqType;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.scene.annotation.CheckPermit;
+import com.fdkankan.scene.service.*;
+import com.fdkankan.scene.vo.*;
+import com.fdkankan.web.controller.BaseController;
+import com.fdkankan.web.response.ResultData;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+
+/**
+ * 场景编辑管理
+ */
+@Log4j2
+@RestController
+@RequestMapping("/service/scene/edit/sceneDraw")
+public class SceneEditDrawController extends BaseController {
+
+    @Autowired
+    private ISceneDrawService sceneDrawService;
+
+    @CheckPermit
+    @GetMapping(value = "/list")
+    public ResultData listSceneDraw(@RequestParam("num") String num) throws Exception {
+        return ResultData.ok(sceneDrawService.listSceneDraw(num));
+    }
+
+    @CheckPermit
+    @PostMapping(value = "/save")
+    public ResultData saveSceneDraw(@RequestBody @Validated BaseJsonArrayParamVO param) throws Exception {
+        sceneDrawService.saveSceneDraw(param);
+        return ResultData.ok();
+    }
+
+    @CheckPermit
+    @PostMapping(value = "/delete")
+    public ResultData deleteSceneDraw(@RequestBody @Validated DeleteSidListParamVO param) throws Exception {
+        sceneDrawService.deleteSceneDraw(param);
+        return ResultData.ok();
+    }
+
+
+
+}

+ 66 - 0
src/main/java/com/fdkankan/scene/entity/SceneDynamicPanel.java

@@ -0,0 +1,66 @@
+package com.fdkankan.scene.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.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 2024-05-21
+ */
+@Getter
+@Setter
+@TableName("t_scene_dynamic_panel")
+public class SceneDynamicPanel implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 场景码
+     */
+    @TableField("num")
+    private String num;
+
+    /**
+     * sid
+     */
+    @TableField("sid")
+    private String sid;
+
+    /**
+     * 创建时间
+     */
+    @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;
+
+
+}

+ 15 - 2
src/main/java/com/fdkankan/scene/entity/SceneEditControls.java

@@ -9,10 +9,10 @@ import java.util.Date;
 
 /**
  * <p>
- * 
+ *
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-01-20
  */
 @Getter
@@ -137,6 +137,19 @@ public class SceneEditControls implements Serializable {
     @TableField("show_link_title")
     private Integer showLinkTitle;
 
+    /**
+     * 是否显示空间绘制标题
+     */
+    @TableField("show_draw_title")
+    private Integer showDrawTitle;
+
+    /**
+     * 是否显示全部模型
+     */
+    @TableField("show_all_model")
+    private Integer showAllModel;
+
+
 
     /**
      * 创建时间

+ 20 - 2
src/main/java/com/fdkankan/scene/entity/SceneEditInfoExt.java

@@ -11,10 +11,10 @@ import lombok.Setter;
 
 /**
  * <p>
- * 
+ *
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-03-07
  */
 @Getter
@@ -97,12 +97,30 @@ public class SceneEditInfoExt {
     private Integer billboards;
 
     /**
+     * 是否有指示牌(0-否,1-是)
+     */
+    @TableField("cut_model")
+    private Integer cutModel;
+
+    /**
+     * 是否有指示牌(0-否,1-是)
+     */
+    @TableField("scene_draw")
+    private Integer sceneDraw;
+
+    /**
      * 分享配置信息
      */
     @TableField("sns_info")
     private String snsInfo;
 
     /**
+     * 启动页信息
+     */
+    @TableField("started")
+    private String started;
+
+    /**
      * 创建时间
      */
     @TableField("create_time")

+ 4 - 1
src/main/java/com/fdkankan/scene/entity/SceneResource.java

@@ -12,7 +12,7 @@ import java.util.Date;
  * 场景资源表
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-01-20
  */
 @Getter
@@ -55,6 +55,9 @@ public class SceneResource implements Serializable {
     @TableField("description")
     private String description;
 
+    @TableField("version")
+    private String version;
+
     /**
      * 创建时间
      */

+ 20 - 0
src/main/java/com/fdkankan/scene/entity/Surveillance.java

@@ -65,6 +65,26 @@ public class Surveillance implements Serializable {
     private String playUrl;
 
     /**
+     * 类型
+     */
+    @TableField("url_type")
+    private Integer urlType;
+
+
+    /**
+     * 播放地址
+     */
+    @TableField("file_name")
+    private String  fileName;
+
+    /**
+     * 封面图
+     */
+    @TableField("poster")
+    private String  poster;
+
+
+    /**
      * 创建时间
      */
     @TableField("create_time")

+ 18 - 0
src/main/java/com/fdkankan/scene/mapper/ISceneDynamicPanelMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.scene.mapper;
+
+import com.fdkankan.scene.entity.SceneDynamicPanel;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 场景动态面板 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-05-21
+ */
+@Mapper
+public interface ISceneDynamicPanelMapper extends BaseMapper<SceneDynamicPanel> {
+
+}

+ 9 - 0
src/main/java/com/fdkankan/scene/service/ICommonService.java

@@ -0,0 +1,9 @@
+package com.fdkankan.scene.service;
+
+public interface ICommonService {
+
+    void transferToFlv(String num, String fileName, String bucket) throws Exception;
+
+
+
+}

+ 27 - 0
src/main/java/com/fdkankan/scene/service/ICutModelService.java

@@ -0,0 +1,27 @@
+package com.fdkankan.scene.service;
+
+import cn.hutool.core.collection.CollUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.redis.constant.RedisKey;
+import com.fdkankan.scene.vo.BaseJsonArrayParamVO;
+import com.fdkankan.scene.vo.BaseSceneParamVO;
+import com.fdkankan.scene.vo.DeleteSidListParamVO;
+import com.fdkankan.web.response.ResultData;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public interface ICutModelService {
+
+    ResultData saveCutModel(BaseJsonArrayParamVO param) throws Exception;
+
+    List<JSONObject> listCutModel(BaseSceneParamVO param) throws Exception;
+
+    ResultData deleteCutModel(DeleteSidListParamVO param) throws Exception;
+
+    void publicCutModel(String num, String bucket) throws IOException;
+
+}

+ 8 - 2
src/main/java/com/fdkankan/scene/service/ISceneAsynOperLogService.java

@@ -1,5 +1,7 @@
 package com.fdkankan.scene.service;
 
+import com.fdkankan.common.constant.SceneAsynFuncType;
+import com.fdkankan.common.constant.SceneAsynOperType;
 import com.fdkankan.scene.entity.SceneAsynOperLog;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fdkankan.scene.vo.SceneAsynOperLogParamVO;
@@ -12,13 +14,17 @@ import org.springframework.web.bind.annotation.RequestBody;
  *  服务类
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-12-07
  */
 public interface ISceneAsynOperLogService extends IService<SceneAsynOperLog> {
 
     ResultData getAsynOperLog(SceneAsynOperLogParamVO param);
 
-    void cleanDownloadPanorama();
+    void cleanDownloadOssPage(String asynFuncType, int preMonth);
+
+    void checkSceneAsynOper(String num, String operType, String module, String function);
+
+    void cleanLog(String num, String moduleType, String funcType, String... operTypes);
 
 }

+ 20 - 0
src/main/java/com/fdkankan/scene/service/ISceneDrawService.java

@@ -0,0 +1,20 @@
+package com.fdkankan.scene.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.scene.vo.BaseJsonArrayParamVO;
+import com.fdkankan.scene.vo.DeleteSidListParamVO;
+
+import java.io.IOException;
+import java.util.List;
+
+public interface ISceneDrawService {
+
+    void saveSceneDraw(BaseJsonArrayParamVO param) throws Exception;
+
+    List<JSONObject> listSceneDraw(String num) throws Exception;
+
+    void deleteSceneDraw(DeleteSidListParamVO param) throws Exception;
+
+    void publicSceneDraw(String sceneNum, String bucket) throws IOException;
+
+}

+ 25 - 0
src/main/java/com/fdkankan/scene/service/ISceneDynamicPanelService.java

@@ -0,0 +1,25 @@
+package com.fdkankan.scene.service;
+
+import com.fdkankan.scene.entity.SceneDynamicPanel;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.scene.vo.BaseJsonDataParamVO;
+import com.fdkankan.scene.vo.SceneDynamicPanelVO;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 场景动态面板 服务类
+ * </p>
+ *
+ * @author
+ * @since 2024-05-21
+ */
+public interface ISceneDynamicPanelService extends IService<SceneDynamicPanel> {
+
+    List<SceneDynamicPanelVO> list(String num);
+
+    void update(BaseJsonDataParamVO param);
+
+    Byte checkDynamicPanel(String num);
+}

+ 5 - 1
src/main/java/com/fdkankan/scene/service/ISceneEditInfoService.java

@@ -35,7 +35,7 @@ import javax.servlet.http.HttpServletRequest;
  *  服务类
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-01-18
  */
 public interface ISceneEditInfoService extends IService<SceneEditInfo> {
@@ -54,6 +54,10 @@ public interface ISceneEditInfoService extends IService<SceneEditInfo> {
 
     ResultData saveCad(BaseDataParamVO param) throws Exception;
 
+    ResultData uploadDxf(MultipartFile file, String num) throws Exception;
+
+    ResultData downloadDxf(String num) throws Exception;
+
     ResultData resetCad(String num) throws IOException;
 
     ResultData renameCad(RenameCadParamVO param) throws IOException;

+ 2 - 2
src/main/java/com/fdkankan/scene/service/ISceneProService.java

@@ -46,9 +46,9 @@ public interface ISceneProService extends IService<ScenePro> {
 
     void updateUserIdByCameraId(Long userId, Long cameraId);
 
-    ResultData uploadObjAndImg(String num, MultipartFile file) throws Exception;
+    ResultData uploadModel(String num, MultipartFile file) throws Exception;
 
-    ResultData downloadTexData(String num) throws Exception;
+    ResultData downloadModel(String num) throws Exception;
 
     ScenePro getByNum(String num);
 

+ 2 - 0
src/main/java/com/fdkankan/scene/service/ISceneResourceService.java

@@ -17,4 +17,6 @@ public interface ISceneResourceService extends IService<SceneResource> {
 
     List<SceneResource> findByCooperationId(Long id);
 
+    long countByVersion(String version);
+
 }

+ 5 - 3
src/main/java/com/fdkankan/scene/service/ISurveillanceService.java

@@ -6,6 +6,8 @@ import com.fdkankan.scene.vo.BaseSidParamVO;
 import com.fdkankan.scene.vo.SurveillanceParamVO;
 import com.fdkankan.scene.vo.SurveillanceVO;
 import com.fdkankan.web.response.ResultData;
+
+import java.io.IOException;
 import java.util.List;
 
 /**
@@ -13,14 +15,14 @@ import java.util.List;
  * 监控推拉流信息 服务类
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-09-16
  */
 public interface ISurveillanceService extends IService<Surveillance> {
 
-    ResultData saveSurveillance(SurveillanceParamVO param);
+    ResultData saveSurveillance(SurveillanceParamVO param) throws Exception;
 
-    ResultData deleteSurveillance(BaseSidParamVO param);
+    ResultData deleteSurveillance(BaseSidParamVO param) throws IOException;
 
     List<SurveillanceVO> listSurveillance(String num);
 

+ 47 - 0
src/main/java/com/fdkankan/scene/service/impl/CommonServiceImpl.java

@@ -0,0 +1,47 @@
+package com.fdkankan.scene.service.impl;
+
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.model.utils.CreateObjUtil;
+import com.fdkankan.scene.service.ICommonService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+
+@Service
+public class CommonServiceImpl implements ICommonService {
+
+    @Resource
+    private FYunFileServiceInterface fYunFileService;
+
+    @Override
+    public void transferToFlv(String num, String fileName, String bucket) throws Exception {
+        String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
+        String localImagesPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num);
+        String localFilePath = localImagesPath + fileName;
+
+        File targetFile = new File(localImagesPath);
+        if (!targetFile.exists()){
+            targetFile.mkdirs();
+        }
+
+        targetFile = new File(localFilePath);
+        if (targetFile.exists()){
+            FileUtils.deleteFile(localFilePath);
+        }
+
+        //从用户编辑目录中下载视频到本地
+        String filePath = userEditPath + fileName;
+        fYunFileService.downloadFile(bucket, filePath, localImagesPath + fileName);
+
+        //视频格式转换
+        CreateObjUtil.mp4ToFlv(localFilePath, localFilePath.replace("mp4", "flv"));
+
+        //上传
+        String flvFileName = fileName.replace("mp4", "flv");
+        fYunFileService.uploadFile(bucket, localFilePath.replace("mp4", "flv"), userEditPath+flvFileName);
+    }
+}

+ 283 - 0
src/main/java/com/fdkankan/scene/service/impl/CutModelServiceImpl.java

@@ -0,0 +1,283 @@
+package com.fdkankan.scene.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.common.constant.CommonStatus;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.constant.FileBizType;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.redis.constant.RedisKey;
+import com.fdkankan.redis.constant.RedisLockKey;
+import com.fdkankan.redis.util.RedisLockUtil;
+import com.fdkankan.redis.util.RedisUtil;
+import com.fdkankan.scene.bean.TagBean;
+import com.fdkankan.scene.entity.SceneEditInfoExt;
+import com.fdkankan.scene.entity.ScenePlus;
+import com.fdkankan.scene.entity.ScenePlusExt;
+import com.fdkankan.scene.service.*;
+import com.fdkankan.scene.vo.BaseJsonArrayParamVO;
+import com.fdkankan.scene.vo.BaseSceneParamVO;
+import com.fdkankan.scene.vo.DeleteFileParamVO;
+import com.fdkankan.scene.vo.DeleteSidListParamVO;
+import com.fdkankan.web.response.ResultData;
+import com.google.j2objc.annotations.AutoreleasePool;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class CutModelServiceImpl implements ICutModelService {
+
+    private final String CUT_MODEL_JSON_NAME = "cutModel.json";
+
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private ISceneEditInfoExtService sceneEditInfoExtService;
+    @Autowired
+    private ISceneEditInfoService sceneEditInfoService;
+    @Autowired
+    private RedisUtil redisUtil;
+    @Autowired
+    private RedisLockUtil redisLockUtil;
+    @Autowired
+    private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private ISceneUploadService sceneUploadService;
+
+
+    @Override
+    public ResultData saveCutModel(BaseJsonArrayParamVO param) throws Exception {
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
+
+        this.addOrUpdate(param.getNum(), param.getData());
+
+        //保存数据库
+        SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByScenePlusId(scenePlus.getId());
+        this.updateDb(param.getNum(), scenePlus.getId());
+//        this.updateById(sceneEditInfoExt);
+
+        sceneEditInfoService.upgradeVersionById(sceneEditInfoExt.getEditInfoId());
+
+        return ResultData.ok();
+    }
+
+    @Override
+    public List<JSONObject> listCutModel(BaseSceneParamVO param) throws Exception {
+
+        List<JSONObject> tags = new ArrayList<>();
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
+        SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByScenePlusId(scenePlus.getId());
+
+        this.syncFileToRedis(param.getNum());
+
+        //获取裁剪模型数据
+        String key = String.format(RedisKey.SCENE_CUT_MODEL, param.getNum());
+        List<String> list = redisUtil.hgetValues(key);
+        if(CollUtil.isNotEmpty(list)){
+            List<TagBean> sortList = list.stream().map(str -> {
+                JSONObject jsonObject = JSON.parseObject(str);
+                TagBean tagBean = new TagBean();
+                tagBean.setCreateTime(jsonObject.getLong("createTime"));
+                jsonObject.remove("createTime");
+                tagBean.setTag(jsonObject);
+                return tagBean;
+            }).collect(Collectors.toList());
+            sortList.sort(Comparator.comparingLong(TagBean::getCreateTime).reversed());
+            tags = sortList.stream().map(item -> item.getTag()).collect(Collectors.toList());
+        }
+
+        return tags;
+    }
+
+    @Override
+    public ResultData deleteCutModel(DeleteSidListParamVO param) throws Exception {
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
+        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+        String bucket = scenePlusExt.getYunFileBucket();
+
+        List<String> deleteSidList = param.getSidList();
+
+        this.syncFileToRedis(param.getNum());
+
+        //处理删除状态数据
+        List<String> deleteList = this.deleteCutModel(param.getNum(), deleteSidList, bucket);
+
+        //写入本地文件,作为备份
+        this.writeFile(param.getNum());
+
+        //删除oss文件
+        List<String> deleteFileList = new ArrayList<>();
+        deleteList.stream().forEach(str -> {
+            JSONObject parse = JSON.parseObject(str);
+            String playUrl = parse.getString("playUrl");
+            if(StrUtil.isNotEmpty(playUrl) && playUrl.length() > 1){
+                deleteFileList.add(playUrl);
+            }
+            String poster = parse.getString("poster");
+            if(StrUtil.isNotEmpty(poster) && poster.length() > 1){
+                deleteFileList.add(poster);
+            }
+        });
+        sceneUploadService.delete(
+                DeleteFileParamVO.builder()
+                        .num(param.getNum())
+                        .fileNames(deleteFileList)
+                        .bizType(FileBizType.CUT_MODEL.code()).build());
+
+        //保存数据库
+        SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByScenePlusId(scenePlus.getId());
+        this.updateDb(param.getNum(), scenePlus.getId());
+        sceneEditInfoService.upgradeVersionById(sceneEditInfoExt.getEditInfoId());
+
+        return ResultData.ok();
+    }
+
+    @Override
+    public void publicCutModel(String sceneNum, String bucket) throws IOException {
+        String Key = String.format(RedisKey.SCENE_CUT_MODEL, sceneNum);
+        String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, sceneNum) + "cutModel.json";
+        List<String> list = redisUtil.hgetValues(Key);
+        if(CollUtil.isEmpty(list)){
+            fYunFileService.deleteFile(bucket, userEditPath);
+            return;
+        }
+        List<JSONObject> collect = list.stream().map(str -> JSON.parseObject(str)).collect(Collectors.toList());
+        fYunFileService.uploadFile(bucket, JSON.toJSONString(collect).getBytes(), userEditPath);
+    }
+
+    private List<String> deleteCutModel(String num, List<String> deleteSidList, String bucket) throws Exception {
+        if(CollUtil.isEmpty(deleteSidList)){
+            return null;
+        }
+
+        //从redis中加载热点数据
+        String key = String.format(RedisKey.SCENE_CUT_MODEL, num);
+        List<String> deletDataList = redisUtil.hMultiGet(key, deleteSidList);
+        if(CollUtil.isNotEmpty(deletDataList)){
+            redisUtil.hdel(key, deleteSidList.toArray());
+        }
+        return deletDataList;
+    }
+
+    private void updateDb(String num, Long scenePlusId){
+        //查询缓存是否包含热点数据
+        String key = String.format(RedisKey.SCENE_CUT_MODEL, num);
+        Map<String, String> cutModelMap = redisUtil.hmget(key);
+        boolean hasCutModel= false;
+        for (Map.Entry<String, String> tagMap : cutModelMap.entrySet()) {
+            if(StrUtil.isEmpty(tagMap.getValue())){
+                continue;
+            }
+            hasCutModel = true;
+            break;
+        }
+
+        //更改热点状态
+        sceneEditInfoExtService.update(
+                new LambdaUpdateWrapper<SceneEditInfoExt>()
+                        .set(SceneEditInfoExt::getCutModel, hasCutModel ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code().intValue())
+                        .eq(SceneEditInfoExt::getScenePlusId,scenePlusId));
+    }
+
+    private void addOrUpdate(String num, List<JSONObject> data) throws Exception{
+        Map<String, String> addOrUpdateMap = new HashMap<>();
+        int i = 0;
+        for (JSONObject jsonObject : data) {
+            jsonObject.put("createTime", Calendar.getInstance().getTimeInMillis() + i++);
+            addOrUpdateMap.put(jsonObject.getString("sid"), JSON.toJSONString(jsonObject));
+        }
+
+        this.syncFileToRedis(num);
+
+        //处理新增和修改数据
+        this.addOrUpdateHandler(num, addOrUpdateMap);
+    }
+
+    private void addOrUpdateHandler(String num, Map<String, String> addOrUpdateMap){
+        if(CollUtil.isEmpty(addOrUpdateMap))
+            return;
+
+        //批量写入缓存
+        String key = String.format(RedisKey.SCENE_CUT_MODEL, num);
+        redisUtil.hmset(key, addOrUpdateMap);
+
+        //写入本地文件,作为备份
+        this.writeFile(num);
+    }
+
+    private void writeFile(String num){
+        String lockKey = String.format(RedisLockKey.LOCK_CUT_MODEL_SYNC, num);
+        String lockVal = cn.hutool.core.lang.UUID.randomUUID().toString();
+        boolean lock = redisLockUtil.lock(lockKey, lockVal, RedisKey.EXPIRE_TIME_1_MINUTE);
+        if(!lock){
+            return;
+        }
+        try{
+            String dataKey = String.format(RedisKey.SCENE_CUT_MODEL, num);
+            String cutModelJsonPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + CUT_MODEL_JSON_NAME;
+            if(!redisUtil.hasKey(dataKey)){
+                FileUtil.del(cutModelJsonPath);
+                return;
+            }
+            Map<String, String> cutModelmap = redisUtil.hmget(dataKey);
+            List<JSONObject>  list = cutModelmap.entrySet().stream().map(entry->JSON.parseObject(entry.getValue())).collect(Collectors.toList());
+            FileUtil.writeUtf8String(JSON.toJSONString(list), cutModelJsonPath);
+        }finally {
+            redisLockUtil.unlockLua(lockKey, lockVal);
+        }
+    }
+
+    private void syncFileToRedis(String num) throws Exception{
+
+        String key = String.format(RedisKey.SCENE_CUT_MODEL, num);
+        boolean exist = redisUtil.hasKey(key);
+        if(exist){
+            return;
+        }
+        String lockKey = String.format(RedisLockKey.LOCK_CUT_MODEL_SYNC, num);
+        String lockVal = cn.hutool.core.lang.UUID.randomUUID().toString();
+        boolean lock = redisLockUtil.lock(lockKey, lockVal, RedisKey.EXPIRE_TIME_1_MINUTE);
+        if(!lock){
+            throw new BusinessException(ErrorCode.SYSTEM_BUSY);
+        }
+        try{
+            exist = redisUtil.hasKey(key);
+            if(exist){
+                return;
+            }
+            String cutModelFilePath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + CUT_MODEL_JSON_NAME;
+            String cutModelData = FileUtils.readUtf8String(cutModelFilePath);
+            if(StrUtil.isEmpty(cutModelData)){
+                return;
+            }
+            JSONArray tagsArr = JSON.parseArray(cutModelData);
+            if(CollUtil.isEmpty(tagsArr)){
+                return;
+            }
+            Map<String, String> map = new HashMap<>();
+            for (Object o : tagsArr) {
+                JSONObject jo = (JSONObject)o;
+                map.put(jo.getString("sid"), jo.toJSONString());
+            }
+            redisUtil.hmset(key, map);
+        }finally {
+            redisLockUtil.unlockLua(lockKey, lockVal);
+        }
+    }
+
+}

+ 44 - 12
src/main/java/com/fdkankan/scene/service/impl/SceneAsynOperLogServiceImpl.java

@@ -3,14 +3,12 @@ package com.fdkankan.scene.service.impl;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ArrayUtil;
 import cn.hutool.core.util.StrUtil;
 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.CommonStatus;
-import com.fdkankan.common.constant.SceneAsynFuncType;
-import com.fdkankan.common.constant.SceneAsynModuleType;
-import com.fdkankan.common.constant.SceneAsynOperType;
+import com.fdkankan.common.constant.*;
+import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.scene.entity.SceneAsynOperLog;
 import com.fdkankan.scene.mapper.ISceneAsynOperLogMapper;
@@ -19,6 +17,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.scene.vo.SceneAsynOperLogParamVO;
 import com.fdkankan.web.response.ResultData;
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.Calendar;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -31,7 +30,7 @@ import org.springframework.stereotype.Service;
  *  服务实现类
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-12-07
  */
 @Slf4j
@@ -79,20 +78,20 @@ public class SceneAsynOperLogServiceImpl extends ServiceImpl<ISceneAsynOperLogMa
     }
 
     @Override
-    public void cleanDownloadPanorama() {
+    public void cleanDownloadOssPage(String asynFuncType, int preMonth) {
 
         List<SceneAsynOperLog> downloadList = this.list(
             new LambdaQueryWrapper<SceneAsynOperLog>()
                 .eq(SceneAsynOperLog::getOperType, SceneAsynOperType.DOWNLOAD.code())
                 .eq(SceneAsynOperLog::getModule, SceneAsynModuleType.UPLOAD_DOWNLOAD.code())
-                .eq(SceneAsynOperLog::getFunc, SceneAsynFuncType.PANORAMIC_IMAGE.code()));
+                .eq(SceneAsynOperLog::getFunc, asynFuncType));
         if(CollUtil.isEmpty(downloadList)){
             return;
         }
-        DateTime preMonth = DateUtil.offsetMonth(Calendar.getInstance().getTime(), -1);
+        DateTime preDate = DateUtil.offsetMonth(Calendar.getInstance().getTime(), -preMonth);
         List<SceneAsynOperLog> deleteList = downloadList.parallelStream().filter(log -> {
-            if (log.getCreateTime().before(preMonth)) {
-                return Boolean.TRUE;
+            if (log.getCreateTime().before(preDate)) {
+                return true;
             }
             return false;
         }).collect(Collectors.toList());
@@ -109,10 +108,43 @@ public class SceneAsynOperLogServiceImpl extends ServiceImpl<ISceneAsynOperLogMa
                 try {
                     fYunFileService.deleteFile(item.getUrl());
                 } catch (IOException e) {
-                    log.warn("删除oss全景图下载压缩包失败,key:{}", item.getUrl());
+                    log.warn("删除oss下载压缩包失败,key:{}", item.getUrl());
                 }
             }
         });
 
     }
+
+    @Override
+    public void checkSceneAsynOper(String num, String operType, String module, String function) {
+        LambdaQueryWrapper<SceneAsynOperLog> queryWrapper =
+                new LambdaQueryWrapper<SceneAsynOperLog>()
+                        .eq(SceneAsynOperLog::getNum,num)
+                        .eq(SceneAsynOperLog::getState, CommonOperStatus.WAITING.code());
+        if(StrUtil.isNotEmpty(operType)){
+            queryWrapper.eq(SceneAsynOperLog::getOperType, operType);
+        }
+        if(StrUtil.isNotEmpty(module)){
+            queryWrapper.eq(SceneAsynOperLog::getModule, module);
+        }
+        if(StrUtil.isNotEmpty(function)){
+            queryWrapper.eq(SceneAsynOperLog::getFunc, function);
+        }
+        List<SceneAsynOperLog> waittingLogList = this.list(queryWrapper);
+        if(CollUtil.isNotEmpty(waittingLogList)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5066);
+        }
+    }
+
+    @Override
+    public void cleanLog(String num, String moduleType, String funcType, String... operTypes) {
+        LambdaQueryWrapper<SceneAsynOperLog> wrapper = new LambdaQueryWrapper<SceneAsynOperLog>()
+                .eq(SceneAsynOperLog::getNum, num)
+                .eq(SceneAsynOperLog::getModule, moduleType)
+                .eq(SceneAsynOperLog::getFunc, funcType);
+        if(ArrayUtil.isNotEmpty(operTypes)){
+            wrapper.in(SceneAsynOperLog::getOperType, operTypes);
+        }
+        this.remove(wrapper);
+    }
 }

+ 9 - 1
src/main/java/com/fdkankan/scene/service/impl/SceneCleanOrigServiceImpl.java

@@ -11,6 +11,8 @@ import com.fdkankan.common.constant.CommonSuccessStatus;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.constant.OperationType;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.fyun.config.FYunFileConfig;
+import com.fdkankan.fyun.constant.FYunTypeEnum;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.model.constants.ConstantFilePath;
 import com.fdkankan.model.constants.UploadFilePath;
@@ -65,6 +67,8 @@ public class SceneCleanOrigServiceImpl extends ServiceImpl<ISceneCleanOrigMapper
     private ICameraService cameraService;
     @Autowired
     private ISceneColdStorageService sceneColdStorageService;
+    @Autowired
+    private FYunFileConfig fYunFileConfig;
 
 
     @Autowired
@@ -284,7 +288,11 @@ public class SceneCleanOrigServiceImpl extends ServiceImpl<ISceneCleanOrigMapper
         String homePath = dataSource.replace(ConstantFilePath.BUILD_MODEL_PATH, ConstantFilePath.OSS_PREFIX);
 
         //将文件复制到冷归档bucket
-        fYunFileService.copyFileBetweenBucket(bucket, homePath, coldBucket, homePath);
+        if(fYunFileConfig.getFyunType().equals(FYunTypeEnum.AWS.code())){
+            fYunFileService.copyFileToArchive(bucket, homePath, coldBucket, homePath);
+        }else{
+            fYunFileService.copyFileBetweenBucket(bucket, homePath, coldBucket, homePath);
+        }
 
         List<String> origList = fYunFileService.listRemoteFiles(bucket, homePath);
         List<String> coldList = fYunFileService.listRemoteFiles(coldBucket, homePath);

+ 244 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneDrawServiceImpl.java

@@ -0,0 +1,244 @@
+package com.fdkankan.scene.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.common.constant.CommonStatus;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.constant.FileBizType;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFilePath;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.redis.constant.RedisKey;
+import com.fdkankan.redis.constant.RedisLockKey;
+import com.fdkankan.redis.util.RedisLockUtil;
+import com.fdkankan.redis.util.RedisUtil;
+import com.fdkankan.scene.bean.TagBean;
+import com.fdkankan.scene.entity.SceneEditInfoExt;
+import com.fdkankan.scene.entity.ScenePlus;
+import com.fdkankan.scene.entity.ScenePlusExt;
+import com.fdkankan.scene.service.*;
+import com.fdkankan.scene.vo.BaseJsonArrayParamVO;
+import com.fdkankan.scene.vo.DeleteFileParamVO;
+import com.fdkankan.scene.vo.DeleteSidListParamVO;
+import com.fdkankan.web.response.ResultData;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class SceneDrawServiceImpl implements ISceneDrawService {
+
+    private final String SCENE_DRAW_JSON_NAME = "sceneDraw.json";
+
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private RedisUtil redisUtil;
+    @Autowired
+    private RedisLockUtil redisLockUtil;
+    @Autowired
+    private ISceneEditInfoExtService sceneEditInfoExtService;
+    @Autowired
+    private ISceneEditInfoService sceneEditInfoService;
+    @Resource
+    private FYunFileServiceInterface fYunFileService;
+
+    @Override
+    public void saveSceneDraw(BaseJsonArrayParamVO param) throws Exception {
+
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
+
+        this.addOrUpdate(param.getNum(), param.getData());
+
+        //保存数据库
+        SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByScenePlusId(scenePlus.getId());
+        this.updateDb(param.getNum(), scenePlus.getId());
+
+        sceneEditInfoService.upgradeVersionById(sceneEditInfoExt.getEditInfoId());
+    }
+
+    private void updateDb(String num, Long scenePlusId){
+        //查询缓存是否包含热点数据
+        String key = String.format(RedisKey.SCENE_DRAW, num);
+        Map<String, String> map = redisUtil.hmget(key);
+        boolean hasSceneDraw= false;
+        for (Map.Entry<String, String> tagMap : map.entrySet()) {
+            if(StrUtil.isEmpty(tagMap.getValue())){
+                continue;
+            }
+            hasSceneDraw = true;
+            break;
+        }
+
+        //更改热点状态
+        sceneEditInfoExtService.update(
+                new LambdaUpdateWrapper<SceneEditInfoExt>()
+                        .set(SceneEditInfoExt::getSceneDraw, hasSceneDraw ? CommonStatus.YES.code().intValue() : CommonStatus.NO.code().intValue())
+                        .eq(SceneEditInfoExt::getScenePlusId,scenePlusId));
+    }
+
+    private void addOrUpdate(String num, List<JSONObject> data) throws Exception{
+        Map<String, String> addOrUpdateMap = new HashMap<>();
+        int i = 0;
+        for (JSONObject jsonObject : data) {
+            jsonObject.put("createTime", Calendar.getInstance().getTimeInMillis() + i++);
+            addOrUpdateMap.put(jsonObject.getString("sid"), JSON.toJSONString(jsonObject));
+        }
+
+        this.syncFileToRedis(num);
+
+        //处理新增和修改数据
+        this.addOrUpdateHandler(num, addOrUpdateMap);
+    }
+
+    private void addOrUpdateHandler(String num, Map<String, String> addOrUpdateMap){
+        if(CollUtil.isEmpty(addOrUpdateMap))
+            return;
+
+        //批量写入缓存
+        String key = String.format(RedisKey.SCENE_DRAW, num);
+        redisUtil.hmset(key, addOrUpdateMap);
+
+        //写入本地文件,作为备份
+        this.writeFile(num);
+    }
+
+    private void writeFile(String num){
+        String lockKey = String.format(RedisLockKey.LOCK_SCENE_DRAW, num);
+        String lockVal = cn.hutool.core.lang.UUID.randomUUID().toString();
+        boolean lock = redisLockUtil.lock(lockKey, lockVal, RedisKey.EXPIRE_TIME_1_MINUTE);
+        if(!lock){
+            return;
+        }
+        try{
+            String dataKey = String.format(RedisKey.SCENE_DRAW, num);
+            String sceneDrawJsonPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + SCENE_DRAW_JSON_NAME;
+            if(!redisUtil.hasKey(dataKey)){
+                FileUtil.del(sceneDrawJsonPath);
+                return;
+            }
+            Map<String, String> map = redisUtil.hmget(dataKey);
+            List<JSONObject>  list = map.entrySet().stream().map(entry->JSON.parseObject(entry.getValue())).collect(Collectors.toList());
+            FileUtil.writeUtf8String(JSON.toJSONString(list), sceneDrawJsonPath);
+        }finally {
+            redisLockUtil.unlockLua(lockKey, lockVal);
+        }
+    }
+
+    private void syncFileToRedis(String num) throws Exception{
+
+        String key = String.format(RedisKey.SCENE_DRAW, num);
+        boolean exist = redisUtil.hasKey(key);
+        if(exist){
+            return;
+        }
+        String lockKey = String.format(RedisLockKey.LOCK_SCENE_DRAW, num);
+        String lockVal = cn.hutool.core.lang.UUID.randomUUID().toString();
+        boolean lock = redisLockUtil.lock(lockKey, lockVal, RedisKey.EXPIRE_TIME_1_MINUTE);
+        if(!lock){
+            throw new BusinessException(ErrorCode.SYSTEM_BUSY);
+        }
+        try{
+            exist = redisUtil.hasKey(key);
+            if(exist){
+                return;
+            }
+            String sceneDrawFilePath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + SCENE_DRAW_JSON_NAME;
+            String sceneDrawData = FileUtils.readUtf8String(sceneDrawFilePath);
+            if(StrUtil.isEmpty(sceneDrawData)){
+                return;
+            }
+            JSONArray tagsArr = JSON.parseArray(sceneDrawData);
+            if(CollUtil.isEmpty(tagsArr)){
+                return;
+            }
+            Map<String, String> map = new HashMap<>();
+            for (Object o : tagsArr) {
+                JSONObject jo = (JSONObject)o;
+                map.put(jo.getString("sid"), jo.toJSONString());
+            }
+            redisUtil.hmset(key, map);
+        }finally {
+            redisLockUtil.unlockLua(lockKey, lockVal);
+        }
+    }
+
+    @Override
+    public List<JSONObject> listSceneDraw(String num) throws Exception {
+        List<JSONObject> tags = new ArrayList<>();
+        this.syncFileToRedis(num);
+
+        //获取裁剪模型数据
+        String key = String.format(RedisKey.SCENE_DRAW, num);
+        List<String> list = redisUtil.hgetValues(key);
+        if(CollUtil.isNotEmpty(list)){
+            List<TagBean> sortList = list.stream().map(str -> {
+                JSONObject jsonObject = JSON.parseObject(str);
+                TagBean tagBean = new TagBean();
+                tagBean.setCreateTime(jsonObject.getLong("createTime"));
+                jsonObject.remove("createTime");
+                tagBean.setTag(jsonObject);
+                return tagBean;
+            }).collect(Collectors.toList());
+            sortList.sort(Comparator.comparingLong(TagBean::getCreateTime).reversed());
+            tags = sortList.stream().map(item -> item.getTag()).collect(Collectors.toList());
+        }
+
+        return tags;
+    }
+
+    @Override
+    public void deleteSceneDraw(DeleteSidListParamVO param) throws Exception {
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
+        List<String> deleteSidList = param.getSidList();
+        this.syncFileToRedis(param.getNum());
+        //处理删除状态数据
+        this.deleteCache(param.getNum(), deleteSidList);
+        //写入本地文件,作为备份
+        this.writeFile(param.getNum());
+        //保存数据库
+        SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByScenePlusId(scenePlus.getId());
+        this.updateDb(param.getNum(), scenePlus.getId());
+        sceneEditInfoService.upgradeVersionById(sceneEditInfoExt.getEditInfoId());
+    }
+
+    private List<String> deleteCache(String num, List<String> deleteSidList) {
+        if(CollUtil.isEmpty(deleteSidList)){
+            return null;
+        }
+
+        //从redis中加载热点数据
+        String key = String.format(RedisKey.SCENE_DRAW, num);
+        List<String> deletDataList = redisUtil.hMultiGet(key, deleteSidList);
+        if(CollUtil.isNotEmpty(deletDataList)){
+            redisUtil.hdel(key, deleteSidList.toArray());
+        }
+        return deletDataList;
+    }
+
+    @Override
+    public void publicSceneDraw(String sceneNum, String bucket) throws IOException {
+        String Key = String.format(RedisKey.SCENE_DRAW, sceneNum);
+        String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, sceneNum) + SCENE_DRAW_JSON_NAME;
+        List<String> list = redisUtil.hgetValues(Key);
+        if(CollUtil.isEmpty(list)){
+            fYunFileService.deleteFile(bucket, userEditPath);
+            return;
+        }
+        List<JSONObject> collect = list.stream().map(str -> JSON.parseObject(str)).collect(Collectors.toList());
+        fYunFileService.uploadFile(bucket, JSON.toJSONString(collect).getBytes(), userEditPath);
+    }
+}

+ 101 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneDynamicPanelServiceImpl.java

@@ -0,0 +1,101 @@
+package com.fdkankan.scene.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.io.FileUtil;
+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.query.LambdaQueryWrapper;
+import com.fdkankan.common.constant.CommonStatus;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.scene.entity.SceneDynamicPanel;
+import com.fdkankan.scene.entity.SceneEditInfo;
+import com.fdkankan.scene.entity.ScenePlus;
+import com.fdkankan.scene.mapper.ISceneDynamicPanelMapper;
+import com.fdkankan.scene.service.ISceneDynamicPanelService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.scene.service.ISceneEditInfoService;
+import com.fdkankan.scene.service.IScenePlusService;
+import com.fdkankan.scene.vo.BaseJsonDataParamVO;
+import com.fdkankan.scene.vo.SceneDynamicPanelVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 场景动态面板 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2024-05-21
+ */
+@Service
+public class SceneDynamicPanelServiceImpl extends ServiceImpl<ISceneDynamicPanelMapper, SceneDynamicPanel> implements ISceneDynamicPanelService {
+
+    @Resource
+    private FYunFileServiceInterface fileServiceInterface;
+    @Autowired
+    private ISceneEditInfoService sceneEditInfoService;
+    @Autowired
+    private IScenePlusService scenePlusService;
+
+    @Override
+    public List<SceneDynamicPanelVO> list(String num) {
+        List<SceneDynamicPanel> list = this.list(new LambdaQueryWrapper<SceneDynamicPanel>().eq(SceneDynamicPanel::getNum, num));
+        return BeanUtil.copyToList(list, SceneDynamicPanelVO.class);
+    }
+
+    @Override
+    public void update(BaseJsonDataParamVO param) {
+        JSONObject data = param.getData();
+        String sid = data.getString("sid");
+        if(StrUtil.isEmpty(sid)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3001, "sid can not be null");
+        }
+
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
+        SceneDynamicPanel one = this.getOne(new LambdaQueryWrapper<SceneDynamicPanel>().eq(SceneDynamicPanel::getNum, param.getNum()).eq(SceneDynamicPanel::getSid, sid));
+        if(Objects.isNull(one)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3001, "sid error");
+        }
+
+        //上传文件
+        String editPath = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + "dynamicPanel.json";
+        String viewPath = String.format(UploadFilePath.USER_VIEW_PATH, param.getNum()) + "dynamicPanel.json";
+
+        String fileContent = fileServiceInterface.getFileContent(editPath);
+        JSONArray jsonArray = JSON.parseArray(fileContent);
+        Map<String, JSONObject> map = new HashMap<>();
+        jsonArray.stream().forEach(v->{
+            JSONObject obj = (JSONObject) v;
+            map.put(obj.getString("sid"), obj);
+        });
+        JSONObject oldObj = map.get(sid);
+        if(Objects.nonNull(oldObj)){
+            data.put("text", oldObj.get("text"));
+        }
+        map.put(sid, data);
+        Collection<JSONObject> values = map.values();
+        fileServiceInterface.uploadFile(JSON.toJSONString(values).getBytes(StandardCharsets.UTF_8), editPath);
+        fileServiceInterface.uploadFile(JSON.toJSONString(values).getBytes(StandardCharsets.UTF_8), viewPath);
+
+        //更新版本号
+        SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
+        sceneEditInfoService.upgradeVersionById(sceneEditInfo.getId());
+    }
+
+    @Override
+    public Byte checkDynamicPanel(String num) {
+        Long count = this.count(new LambdaQueryWrapper<SceneDynamicPanel>().eq(SceneDynamicPanel::getNum, num));
+        return count > 0 ? CommonStatus.YES.code() : CommonStatus.NO.code();
+    }
+}

+ 152 - 73
src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java

@@ -9,6 +9,7 @@ import com.fdkankan.scene.vo.SaveFiltersParamVO;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.CharsetUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.ZipUtil;
 import com.alibaba.fastjson.JSON;
@@ -18,10 +19,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.common.constant.*;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.util.FileMd5Util;
+import com.fdkankan.common.util.FileSizeUtil;
 import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.dxf.parse.utils.FdJsonToDxfUtil;
+import com.fdkankan.fyun.config.FYunFileConfig;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.fyun.util.OssFileUtil;
 import com.fdkankan.model.constants.ConstantFilePath;
 import com.fdkankan.model.constants.UploadFilePath;
 import com.fdkankan.model.utils.ComputerUtil;
@@ -40,7 +46,11 @@ import com.fdkankan.scene.bean.StyleBean;
 import com.fdkankan.scene.bean.TagBean;
 import com.fdkankan.scene.bean.VertexBean;
 import com.fdkankan.scene.bean.WallBean;
+import com.fdkankan.scene.bean.*;
+import com.fdkankan.scene.entity.*;
 import com.fdkankan.scene.mapper.ISceneEditInfoMapper;
+import com.fdkankan.scene.service.*;
+import com.fdkankan.scene.vo.*;
 import com.fdkankan.scene.vo.BallScreenVideoParamVO;
 import com.fdkankan.scene.vo.BaseDataParamVO;
 import com.fdkankan.scene.vo.BaseFileParamVO;
@@ -96,12 +106,22 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+
 /**
  * <p>
  *  服务实现类
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-01-18
  */
 @Slf4j
@@ -147,6 +167,16 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
     @Autowired
     private ISceneAsynOperLogService sceneAsynOperLogService;
     @Autowired
+    private ICutModelService cutModelService;
+    @Autowired
+    private ICommonService commonService;
+    @Autowired
+    private FYunFileConfig fYunFileConfig;
+    @Autowired
+    private ISceneDrawService sceneDrawService;
+    @Autowired
+    private ISceneDynamicPanelService sceneDynamicPanelService;
+    @Autowired
     private IJmgaService jmgaService;
 
     @Transactional
@@ -179,6 +209,12 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         if(Objects.nonNull(param.getSns())){
             sceneEditInfoExt.setSnsInfo(JSON.toJSONString(param.getSns()));
         }
+        if(Objects.nonNull(param.getStarted())){
+            sceneEditInfoExt.setStarted(JSON.toJSONString(param.getStarted()));
+        }
+//        else{
+//            sceneEditInfoExt.setStarted("");
+//        }
         sceneEditInfoExtService.updateById(sceneEditInfoExt);
 
         if(Objects.nonNull(param.getControls())){
@@ -252,7 +288,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
 
         //生成sceneJson
         SceneJsonBean sceneJson = new SceneJsonBean();
-        BeanUtil.copyProperties(sceneEditInfoExt, sceneJson);
+        BeanUtil.copyProperties(sceneEditInfoExt, sceneJson, "started");
         BeanUtil.copyProperties(sceneEditInfo, sceneJson);
         sceneJson.setFloorPlanUpload(JSON.parseArray(sceneEditInfo.getFloorPlanUpload()));
         SceneEditControlsVO sceneEditControlsVO = BeanUtil.copyProperties(sceneEditControls, SceneEditControlsVO.class);
@@ -274,6 +310,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         //发布分享配置
         sceneJson.setSns(JSON.parseObject(sceneEditInfoExt.getSnsInfo()));
 
+        //发布启动页配置
+        sceneJson.setStarted(JSON.parseObject(sceneEditInfoExt.getStarted()));
+
         //处理热点数据,生成hot.json
         this.publicHotData(num, bucket);
 
@@ -289,6 +328,14 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         //发布指示牌数据
         this.publicBillboardData(num, bucket);
 
+        //发布模型裁剪
+        cutModelService.publicCutModel(num, bucket);
+
+        //发布场景绘制
+        sceneDrawService.publicSceneDraw(num, bucket);
+
+        sceneJson.setDynamicPanel(sceneDynamicPanelService.checkDynamicPanel(num));
+
         //本地写sceneJson文件
         String localSceneJsonPath = String.format(ConstantFilePath.SCENE_DATA_PATH_V4, num) + "scene.json";
         FileUtils.writeFile(localSceneJsonPath, JSON.toJSONString(sceneJson));
@@ -377,12 +424,28 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         if(CollUtil.isEmpty(linkPanMap)){
             return;
         }
-        JSONArray linkPanArr = new JSONArray();
-        linkPanMap.values().stream().forEach(linkPan->{
-            linkPanArr.add(JSON.parseObject(linkPan));
-        });
+        List<JSONObject> tags = Lists.newArrayList();
+        List<TagBean> tagBeanList = new ArrayList<>();
+        if(CollUtil.isNotEmpty(linkPanMap)){
+            linkPanMap.entrySet().stream().forEach(entry -> {
+                JSONObject jsonObject = JSON.parseObject(entry.getValue());
+                tagBeanList.add(
+                        TagBean.builder()
+                                .createTime(jsonObject.getLong("createTime"))
+                                .tag(jsonObject).build());
+            });
+            //按创建时间倒叙排序
+            tagBeanList.sort(Comparator.comparingLong(TagBean::getCreateTime).reversed());
+
+            //移除createTime字段
+            tags = tagBeanList.stream().map(tagBean -> {
+                JSONObject tag = tagBean.getTag();
+                tag.remove("createTime");
+                return tag;
+            }).collect(Collectors.toList());
+        }
         String linkScenePath = userEditPath + "links.json";
-        fYunFileService.uploadFile(bucket, linkPanArr.toString().getBytes(), linkScenePath);
+        fYunFileService.uploadFile(bucket, JSON.toJSONString(tags).getBytes(StandardCharsets.UTF_8), linkScenePath);
 
         //拷贝编辑目录到发布目录
         fYunFileService.copyFileBetweenBucket(bucket, imgEditPath + "panorama", bucket, imgViewPath + "panorama");
@@ -466,7 +529,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
         SceneEditControls sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
         SceneInfoVO sceneInfoVO = new SceneInfoVO();
-        BeanUtil.copyProperties(sceneEditInfoExt, sceneInfoVO);
+        BeanUtil.copyProperties(sceneEditInfoExt, sceneInfoVO, "started");
         BeanUtil.copyProperties(sceneEditInfo, sceneInfoVO);
         sceneInfoVO.setFloorPlanUpload(JSON.parseArray(sceneEditInfo.getFloorPlanUpload()));
         if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
@@ -489,18 +552,21 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         }
         sceneInfoVO.setSpace(FileSizeUtil.convert(scenePlusExt.getSpace(), FileSizeUnitType.MB.code()));
         sceneInfoVO.setSns(JSON.parseObject(sceneEditInfoExt.getSnsInfo()));
+        sceneInfoVO.setStarted(JSON.parseObject(sceneEditInfoExt.getStarted()));
 
         this.SortBoxVideos(sceneInfoVO);
 
         this.setExtData(sceneInfoVO, scenePlus.getCameraId());
 
+        sceneInfoVO.setDynamicPanel(sceneDynamicPanelService.checkDynamicPanel(num));
+
         return sceneInfoVO;
     }
 
     public static void main(String[] args) {
         String test = "";
-        JSONObject jsonObject = JSON.parseObject(test);
-        System.out.println(jsonObject);
+//        JSONObject jsonObject = JSON.parseObject(test);
+        System.out.println(JSON.toJSONString(test));
     }
 
     private void SortBoxVideos(SceneInfoVO sceneInfoVO){
@@ -606,6 +672,11 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         if(Objects.isNull(controls.getShowBillboardTitle())){
             controls.setShowBillboardTitle(CommonStatus.YES.code().intValue());
         }
+        if(Objects.isNull(controls.getShowDrawTitle())){
+            controls.setShowDrawTitle(CommonStatus.YES.code().intValue());
+        }
+
+        sceneInfoVO.setPayStatus(scenePlus.getPayStatus());
 
         //江门公安需求,如果是业务授权或者带有签名的链接进来的场景,不需要校验场景查看密码
         if(StrUtil.isNotEmpty(param.getSign()) || jmgaService.isBizAuth(num)){
@@ -689,6 +760,72 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
     }
 
     @Override
+    public ResultData uploadDxf(MultipartFile file, String num) throws Exception {
+
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+
+        String extName =  FileUtil.extName(file.getOriginalFilename());
+        if(!"dxf".equals(extName)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_7007.code(), ErrorCode.FAILURE_CODE_7007.formatMessage("dxf"));
+        }
+        String dfxPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + UUID.randomUUID() + "." + extName;
+        String floorplanUserPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + UUID.randomUUID() + ".json";
+        file.transferTo(new File(dfxPath));
+        try {
+            String editUserPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
+            FdJsonToDxfUtil.dxfToFdJson(dfxPath, floorplanUserPath);
+            fYunFileService.uploadFile(scenePlusExt.getYunFileBucket(), floorplanUserPath, editUserPath + "floorplan.json");
+            JSONObject houseTypeJson = CreateHouseJsonUtil
+                    .createHouseTypeJsonByUser(floorplanUserPath);
+            if(Objects.nonNull(houseTypeJson)) {
+                fYunFileService.uploadFile(scenePlusExt.getYunFileBucket(), houseTypeJson.toJSONString().getBytes(), editUserPath + "houseType.json");
+            }
+
+            SceneEditInfo sceneEditInfoDb = this.getByScenePlusId(scenePlus.getId());
+            this.update(new LambdaUpdateWrapper<SceneEditInfo>()
+                    .setSql("version=version+" + 1)
+                    .set(SceneEditInfo::getFloorPlanUser, 1)
+                    .eq(SceneEditInfo::getId, sceneEditInfoDb.getId()));
+
+            SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfoDb.getId());
+            sceneEditInfoExt.setFloorPlanAngle(0f);
+            sceneEditInfoExt.setFloorPlanCompass(0f);
+            sceneEditInfoExtService.saveOrUpdate(sceneEditInfoExt);
+        }catch (Exception e){
+            log.error("cad文件转换失败");
+            ResultData.error(ErrorCode.FAILURE_CODE_7013);
+        }finally {
+            FileUtil.del(dfxPath);
+            FileUtil.del(floorplanUserPath);
+        }
+
+        return ResultData.ok();
+    }
+
+    @Override
+    public ResultData downloadDxf(String num) throws Exception {
+
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+        SceneEditInfo sceneEditInfo = this.getByScenePlusId(scenePlus.getId());
+        if(Objects.isNull(sceneEditInfo.getFloorPlanUser()) || sceneEditInfo.getFloorPlanUser() == CommonStatus.NO.code()){
+            return ResultData.ok();
+        }
+
+        String localFloorplan = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + UUID.randomUUID() + ".json";
+        fYunFileService.downloadFile(scenePlusExt.getYunFileBucket(),
+                String.format(UploadFilePath.USER_EDIT_PATH, num) + "floorplan.json", localFloorplan);
+        String localDxf = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + UUID.randomUUID() + ".dxf";
+        FdJsonToDxfUtil.fdJsonToDxf(localFloorplan, localDxf);
+        String key = OssFileUtil.getUploadTempFileKey(null, "dxf");
+        fYunFileService.uploadFile(scenePlusExt.getYunFileBucket(), localDxf, key);
+        String url = fYunFileConfig.getHost() + key;
+
+        return ResultData.ok(url);
+    }
+
+    @Override
     public ResultData resetCad(String num) throws IOException {
 
         ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
@@ -979,15 +1116,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         }
 
         //查询是否存在等待中的异步操作记录,如果存在,抛出业务异常,终止操作
-        this.checkSceneAsynOper(num, null, SceneAsynModuleType.UPLOAD_DOWNLOAD.code() , SceneAsynFuncType.PANORAMIC_IMAGE.code());
+        sceneAsynOperLogService.checkSceneAsynOper(num, null, SceneAsynModuleType.UPLOAD_DOWNLOAD.code() , SceneAsynFuncType.PANORAMIC_IMAGE.code());
 
         //清除全景图异步操作记录,防止再次下载的时候请求到旧的压缩包
-        sceneAsynOperLogService.remove(
-            new LambdaQueryWrapper<SceneAsynOperLog>()
-            .eq(SceneAsynOperLog::getNum, num)
-            .eq(SceneAsynOperLog::getModule, SceneAsynModuleType.UPLOAD_DOWNLOAD.code())
-            .eq(SceneAsynOperLog::getFunc, SceneAsynFuncType.PANORAMIC_IMAGE.code())
-        );
+        sceneAsynOperLogService.cleanLog(num, SceneAsynModuleType.UPLOAD_DOWNLOAD.code(), SceneAsynFuncType.PANORAMIC_IMAGE.code());
 
 
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
@@ -1177,26 +1309,6 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         return ResultData.ok(uploadPanoramaVO);
     }
 
-    private void checkSceneAsynOper(String num, String operType, String module, String function){
-        LambdaQueryWrapper<SceneAsynOperLog> queryWrapper =
-            new LambdaQueryWrapper<SceneAsynOperLog>()
-                .eq(SceneAsynOperLog::getNum,num)
-                .eq(SceneAsynOperLog::getState, CommonOperStatus.WAITING.code());
-        if(StrUtil.isNotEmpty(operType)){
-            queryWrapper.eq(SceneAsynOperLog::getOperType, operType);
-        }
-        if(StrUtil.isNotEmpty(module)){
-            queryWrapper.eq(SceneAsynOperLog::getModule, module);
-        }
-        if(StrUtil.isNotEmpty(function)){
-            queryWrapper.eq(SceneAsynOperLog::getFunc, function);
-        }
-        List<SceneAsynOperLog> waittingLogList = sceneAsynOperLogService.list(queryWrapper);
-        if(CollUtil.isNotEmpty(waittingLogList)){
-            throw new BusinessException(ErrorCode.FAILURE_CODE_5066);
-        }
-    }
-
     public void uploadPanoramaHandler(String num, String bucket, String target, String imgViewPath, List<String> uploadFileList, String targetImagesPath) throws Exception {
         CreateObjUtil.build3dModel(target , "1");
 
@@ -1289,7 +1401,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         }
 
         //查询是否存在等待中的异步操作记录,如果存在,抛出业务异常,终止操作
-        this.checkSceneAsynOper(num,null, SceneAsynModuleType.UPLOAD_DOWNLOAD.code() , SceneAsynFuncType.PANORAMIC_IMAGE.code());
+        sceneAsynOperLogService.checkSceneAsynOper(num,null, SceneAsynModuleType.UPLOAD_DOWNLOAD.code() , SceneAsynFuncType.PANORAMIC_IMAGE.code());
 
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
         String bucket = scenePlusExt.getYunFileBucket();
@@ -1335,12 +1447,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
             return ResultData.ok(map);
         }else{
             //清除旧的下载记录
-            sceneAsynOperLogService.remove(
-                new LambdaQueryWrapper<SceneAsynOperLog>()
-                    .eq(SceneAsynOperLog::getNum, num)
-                    .eq(SceneAsynOperLog::getOperType, SceneAsynOperType.DOWNLOAD.code())
-                    .eq(SceneAsynOperLog::getModule, SceneAsynModuleType.UPLOAD_DOWNLOAD.code())
-                    .eq(SceneAsynOperLog::getFunc, SceneAsynFuncType.PANORAMIC_IMAGE.code()));
+            sceneAsynOperLogService.cleanLog(num, SceneAsynModuleType.UPLOAD_DOWNLOAD.code(), SceneAsynFuncType.PANORAMIC_IMAGE.code(), SceneAsynOperType.DOWNLOAD.code());
 
             //开始异步执行下载全景图压缩包操作
             CompletableFuture.runAsync(() -> {
@@ -1455,7 +1562,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         SceneEditInfo sceneEditInfo = this.getByScenePlusId(scenePlus.getId());
 
         //转换视频格式
-        this.transferToFlv(param.getNum(), param.getFileName(), bucket);
+        commonService.transferToFlv(param.getNum(), param.getFileName(), bucket);
 
         //生成boxVideos数据
         String boxVideos = this.createBoxVideos(param.getNum(), sid, boxVideo, sceneEditInfo, OperationType.ADDORUPDATE.code());
@@ -2676,34 +2783,6 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         return result;
     }
 
-    private void transferToFlv(String num, String fileName, String bucket) throws Exception {
-
-        String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
-        String localImagesPath = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num);
-        String localFilePath = localImagesPath + fileName;
-
-        File targetFile = new File(localImagesPath);
-        if (!targetFile.exists()){
-            targetFile.mkdirs();
-        }
-
-        targetFile = new File(localFilePath);
-        if (targetFile.exists()){
-            FileUtils.deleteFile(localFilePath);
-        }
-
-        //从用户编辑目录中下载视频到本地
-        String filePath = userEditPath + fileName;
-        fYunFileService.downloadFile(bucket, filePath, localImagesPath + fileName);
-
-        //视频格式转换
-        CreateObjUtil.mp4ToFlv(localFilePath, localFilePath.replace("mp4", "flv"));
-
-        //上传
-        String flvFileName = fileName.replace("mp4", "flv");
-        fYunFileService.uploadFile(bucket, localFilePath.replace("mp4", "flv"), userEditPath+flvFileName);
-    }
-
     @Override
     public ResultData deleteMosaics(DeleteMosaicParamVO param) throws Exception {
 

+ 194 - 116
src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java

@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.io.FileUtil;
-import cn.hutool.core.util.RuntimeUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.ZipUtil;
 import com.alibaba.fastjson.JSON;
@@ -14,63 +13,45 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.common.constant.*;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.model.constants.ConstantFileName;
 import com.fdkankan.model.constants.ConstantFilePath;
 import com.fdkankan.model.constants.UploadFilePath;
-import com.fdkankan.common.exception.BusinessException;
-import com.fdkankan.scene.bean.SceneBean;
-import com.fdkankan.web.response.ResultData;
 import com.fdkankan.model.utils.ComputerUtil;
 import com.fdkankan.model.utils.ConvertUtils;
 import com.fdkankan.model.utils.CreateObjUtil;
-import com.fdkankan.common.util.FileUtils;
-import com.fdkankan.common.util.OkHttpUtils;
-import com.fdkankan.fyun.constant.FYunTypeEnum;
-import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.constant.RedisLockKey;
 import com.fdkankan.redis.util.RedisLockUtil;
 import com.fdkankan.redis.util.RedisUtil;
 import com.fdkankan.scene.bean.IconBean;
+import com.fdkankan.scene.bean.SceneBean;
 import com.fdkankan.scene.bean.TagBean;
-import com.fdkankan.scene.entity.SceneEditInfo;
-import com.fdkankan.scene.entity.ScenePlus;
-import com.fdkankan.scene.entity.ScenePlusExt;
-import com.fdkankan.scene.entity.ScenePro;
+import com.fdkankan.scene.entity.*;
 import com.fdkankan.scene.mapper.ISceneProMapper;
-import com.fdkankan.scene.service.ISceneDataDownloadService;
-import com.fdkankan.scene.service.ISceneEditControlsService;
-import com.fdkankan.scene.service.ISceneEditInfoService;
-import com.fdkankan.scene.service.IScenePlusExtService;
-import com.fdkankan.scene.service.IScenePlusService;
-import com.fdkankan.scene.service.ISceneProService;
-import com.fdkankan.scene.service.ISceneUploadService;
-import com.fdkankan.scene.vo.BaseDataParamVO;
-import com.fdkankan.scene.vo.DeleteFileParamVO;
-import com.fdkankan.scene.vo.DeleteHotIconParamVO;
-import com.fdkankan.scene.vo.DeleteHotParamVO;
-import com.fdkankan.scene.vo.FileNameAndDataParamVO;
-import com.fdkankan.scene.vo.HotParamVO;
-import com.fdkankan.scene.vo.SaveTagsParamVO;
-import com.fdkankan.scene.vo.SaveTagsVisibleParamVO;
+import com.fdkankan.scene.service.*;
+import com.fdkankan.scene.vo.*;
+import com.fdkankan.web.response.ResultData;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.stream.Collectors;
 import lombok.extern.slf4j.Slf4j;
-import org.redisson.Redisson;
-import org.redisson.RedissonLock;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+
 /**
  * <p>
  * pro场景表 服务实现类
@@ -92,7 +73,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
     @Value("${ecs.checkFile.waitTime:5000}")
     private int waitTime;
 
-    @Autowired
+    @Resource
     private FYunFileServiceInterface fYunFileService;
     @Autowired
     private RedisLockUtil redisLockUtil;
@@ -106,6 +87,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
     private IScenePlusExtService scenePlusExtService;
     @Autowired
     private ISceneUploadService sceneUploadService;
+    @Autowired
+    private ISceneAsynOperLogService sceneAsynOperLogService;
 
     @Transactional
     @Override
@@ -633,7 +616,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
                 String currentPanoId = jo.getString("panoID");
                 JSONArray visibles = jo.getJSONArray("visibles");
                 JSONArray visibles3 = jo.getJSONArray("visibles3");
-                if (pano.getString("uuid").equals(currentPanoId)) {
+                if (pano.getString("uuid").replaceAll("-", "").equals(currentPanoId)) {
                     pano.put("visibles", visibles);
                     pano.put("visibles3", visibles3);
                 }
@@ -668,7 +651,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
     }
 
     @Override
-    public ResultData uploadObjAndImg(String num, MultipartFile file) throws Exception{
+    public ResultData uploadModel(String num, MultipartFile file) throws Exception{
         if(StrUtil.isEmpty(num)){
             throw new BusinessException(ServerCode.PARAM_REQUIRED, "num");
         }
@@ -680,6 +663,13 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         if(scenePlus == null){
             throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
         }
+
+        //查询是否存在等待中的异步操作记录,如果存在,抛出业务异常,终止操作
+        sceneAsynOperLogService.checkSceneAsynOper(num, null, SceneAsynModuleType.UPLOAD_DOWNLOAD.code() , SceneAsynFuncType.MODEL.code());
+
+        //清除全景图异步操作记录,防止再次下载的时候请求到旧的压缩包
+        sceneAsynOperLogService.cleanLog(num, SceneAsynModuleType.UPLOAD_DOWNLOAD.code(), SceneAsynFuncType.MODEL.code());
+
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
         String bucket = scenePlusExt.getYunFileBucket();
 
@@ -689,31 +679,10 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
             this.buildModel4Dam(num, bucket, scenePlusExt.getDataSource(), scenePlusExt.getBuildType(), file);
         }
 
-        //更新版本信息
-        SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
-        if(Objects.isNull(sceneEditInfo)){
-            sceneEditInfo = new SceneEditInfo();
-            sceneEditInfo.setScenePlusId(scenePlus.getId());
-            sceneEditInfo.setFloorPublishVer(1);
-            sceneEditInfo.setFloorEditVer(1);
-            sceneEditInfo.setIsUploadObj(CommonStatus.YES.code());
-            sceneEditInfoService.save(sceneEditInfo);
-        }else{
-            sceneEditInfoService.update(
-                new LambdaUpdateWrapper<SceneEditInfo>()
-                    .setSql("version = version + 1")
-                    .setSql("floor_edit_ver = floor_edit_ver + 1")
-                    .setSql("floor_publish_ver = floor_publish_ver + 1")
-                    .setSql("img_version = img_version + 1")
-                    .set(SceneEditInfo::getIsUploadObj, CommonStatus.YES.code())
-                    .eq(SceneEditInfo::getId, sceneEditInfo.getId()));
-
-            sceneEditInfoService.upgradeSceneJsonVersion(num, sceneEditInfo.getVersion() + 1, sceneEditInfo.getImgVersion() + 1, bucket);
-        }
-
         return ResultData.ok();
     }
 
+
     /**
      * 老算法(dam)上传模型逻辑
      * @param num
@@ -735,16 +704,46 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         //创建data.json
         this.writeDataJson(path);
 
-        //调用算法,不同的类型调用不同的算法
-        if("V2".equals(buildType)){
-            CreateObjUtil.objToTxt(path , "1");
-        }
-        if("V3".equals(buildType)){
-            CreateObjUtil.build3dModel(path , "1");
-        }
+        CompletableFuture.runAsync(() -> {
+            SceneAsynOperLog sceneAsynOperLog = new SceneAsynOperLog();
+            sceneAsynOperLog.setNum(num);
+            sceneAsynOperLog.setOperType(SceneAsynOperType.UPLOAD.code());
+            sceneAsynOperLog.setModule(SceneAsynModuleType.UPLOAD_DOWNLOAD.code());
+            sceneAsynOperLog.setFunc(SceneAsynFuncType.MODEL.code());
+            sceneAsynOperLogService.save(sceneAsynOperLog);
+            try {
+                //调用算法,不同的类型调用不同的算法
+                if("V2".equals(buildType)){
+                    CreateObjUtil.objToTxt(path , "1");
+                }
+                if("V3".equals(buildType)){
+                    CreateObjUtil.build3dModel(path , "1");
+                }
 
-        //算法计算完后,生成压缩文件,上传到oss
-        this.uploadFileofterRebuildPanoram(path, filePath, num, bucket);
+                //算法计算完后,生成压缩文件,上传到oss
+                uploadFileofterBuildDamModel(path, filePath, num, bucket);
+
+                //更新版本信息
+                ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+                SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
+                sceneEditInfoService.update(
+                        new LambdaUpdateWrapper<SceneEditInfo>()
+                                .setSql("version = version + 1")
+                                .setSql("floor_edit_ver = floor_edit_ver + 1")
+                                .setSql("floor_publish_ver = floor_publish_ver + 1")
+                                .setSql("img_version = img_version + 1")
+                                .set(SceneEditInfo::getIsUploadObj, CommonStatus.YES.code())
+                                .eq(SceneEditInfo::getId, sceneEditInfo.getId()));
+
+                sceneEditInfoService.upgradeSceneJsonVersion(num, sceneEditInfo.getVersion() + 1, sceneEditInfo.getImgVersion() + 1, bucket);
+
+                sceneAsynOperLog.setState(CommonOperStatus.SUCCESS.code());
+            } catch (Exception e) {
+                log.error("上传dam模型,num:" + num, e);
+                sceneAsynOperLog.setState(CommonOperStatus.FAILD.code());
+            }
+            sceneAsynOperLogService.updateById(sceneAsynOperLog);
+        });
     }
 
     /**
@@ -769,18 +768,27 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         file.transferTo(zipFile);
         ZipUtil.unzip(zipFilePath, meshPath);
 
+        String jsonName = "";
+        if(fYunFileService.fileExist(bucket, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh/floors.json")){
+            jsonName = "floors.json";
+        }
+        if(fYunFileService.fileExist(bucket, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh/mesh.json")){
+            jsonName = "mesh.json";
+        }
+
         //检测文件
-        String floorsJsonPath = meshPath + File.separator + "floors.json";
+        String floorsJsonPath = meshPath + File.separator + jsonName;
         if(!FileUtil.exist(floorsJsonPath)){
-            throw new BusinessException(ErrorCode.FAILURE_CODE_5068);
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5068.code(), "json file is not exist!");
         }
         String floorsJsonStr = FileUtil.readUtf8String(floorsJsonPath);
         JSONObject floorsJsonObj = JSON.parseObject(floorsJsonStr);
         JSONArray floorArr = floorsJsonObj.getJSONArray("floors");
         if(CollUtil.isEmpty(floorArr)){
-            throw new BusinessException(ErrorCode.FAILURE_CODE_5069);
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5069.code(), "json content is error");
         }
         Set<String> floorNameSet = new HashSet<>();
+        String finalJsonName = jsonName;
         floorArr.stream().forEach(item->{
             JSONObject itemObj = (JSONObject) item;
             //楼层目录是否存在
@@ -789,9 +797,23 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
                 throw new BusinessException(ErrorCode.FAILURE_CODE_5070);
             }
             //检测obj文件是否存在
-            String objPath = itemObj.getString("objPath");
-            if(StrUtil.isEmpty(objPath) || !FileUtil.exist(path + objPath)){
-                throw new BusinessException(ErrorCode.FAILURE_CODE_5070);
+            if("floors.json".equals(finalJsonName)){
+                String objPath = itemObj.getString("objPath");
+                if(StrUtil.isEmpty(objPath) || !FileUtil.exist(path + objPath)){
+                    throw new BusinessException(ErrorCode.FAILURE_CODE_5070);
+                }
+            }else{
+                JSONArray lods = itemObj.getJSONArray("lods");
+                if(CollUtil.isEmpty(lods)){
+                    throw new BusinessException(ErrorCode.FAILURE_CODE_5069.code(), "json content is error");
+                }
+                for (Object lod : lods) {
+                    JSONObject lodObj = (JSONObject) lod;
+                    String objPath = lodObj.getString("objPath");
+                    if(StrUtil.isEmpty(objPath) || !FileUtil.exist(path + objPath)){
+                        throw new BusinessException(ErrorCode.FAILURE_CODE_5070);
+                    }
+                }
             }
             if(floorNameSet.contains(name)){
                 throw new BusinessException(ErrorCode.FAILURE_CODE_5069);
@@ -800,7 +822,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         });
 
         //读取oss上的floors.jsoon用于校验用户上传的模型楼层数是否一一对应
-        String ossFloorsJson = fYunFileService.getFileContent(bucket, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh/floors.json");
+        String ossFloorsJson = fYunFileService.getFileContent(bucket, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh/" + jsonName);
         JSONObject orginFloorsJsonObj = JSON.parseObject(ossFloorsJson);
         JSONArray orginFloorArr = orginFloorsJsonObj.getJSONArray("floors");
         Set<String> orginFloorNameSet = orginFloorArr.stream().map(item -> {
@@ -816,36 +838,64 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
             }
         });
 
+        SceneAsynOperLog sceneAsynOperLog = new SceneAsynOperLog();
+        sceneAsynOperLog.setNum(num);
+        sceneAsynOperLog.setOperType(SceneAsynOperType.UPLOAD.code());
+        sceneAsynOperLog.setModule(SceneAsynModuleType.UPLOAD_DOWNLOAD.code());
+        sceneAsynOperLog.setFunc(SceneAsynFuncType.MODEL.code());
+        sceneAsynOperLogService.save(sceneAsynOperLog);
+        CompletableFuture.runAsync(() -> {
+            try {
+                //调用算法
+                String command = "bash /home/ubuntu/bin/Obj2Tiles.sh " + path;
+                log.info("上传3dtiles模型开始, num:{}, targetPath:{}", num, path);
+                CreateObjUtil.callshell(command);
+                log.info("上传3dtiles模型结束, num:{}, targetPath:{}", num, path);
+
+                //检测计算结果
+                String tilesPath = path + "3dtiles";
+                String tilesetJsonPath = tilesPath + File.separator + "tileset.json";
+                boolean success = ComputerUtil.checkComputeCompleted(tilesetJsonPath, maxCheckTimes, waitTime);
+                if(!success){
+                    throw new BusinessException(ErrorCode.FAILURE_CODE_7013);
+                }
 
-        //调用算法
-        String command = "bash /home/ubuntu/bin/Obj2Tiles.sh " + path;
-        log.info("上传3dtiles模型开始, num:{}, targetPath:{}", num, path);
-//        RuntimeUtil.exec(command);
-        CreateObjUtil.callshell(command);
-        log.info("上传3dtiles模型结束, num:{}, targetPath:{}", num, path);
-
-        //检测计算结果
-        String tilesPath = path + "3dtiles";
-        String tilesetJsonPath = tilesPath + File.separator + "tileset.json";
-        boolean success = ComputerUtil.checkComputeCompleted(tilesetJsonPath, maxCheckTimes, waitTime);
-        if(!success){
-            throw new BusinessException(ErrorCode.FAILURE_CODE_7013);
-        }
-
-        //删除logs
-        FileUtil.del(tilesPath + File.separator + "logs");
-
-        //算法计算完后,生成压缩文件,上传到oss
-        //上传3dtiles
-        fYunFileService.deleteFolder(bucket, String.format(UploadFilePath.IMG_VIEW_PATH, num) + "3dtiles");
-        fYunFileService.uploadFileByCommand(bucket, tilesPath, String.format(UploadFilePath.IMG_VIEW_PATH, num) + "3dtiles");
-        //上传mesh
-        fYunFileService.deleteFolder(bucket, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh");
-        fYunFileService.uploadFileByCommand(bucket, meshPath, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh");
+                //删除logs
+                FileUtil.del(tilesPath + File.separator + "logs");
+
+                //算法计算完后,生成压缩文件,上传到oss
+                //上传3dtiles
+                fYunFileService.deleteFolder(bucket, String.format(UploadFilePath.IMG_VIEW_PATH, num) + "3dtiles");
+                fYunFileService.uploadFileByCommand(bucket, tilesPath, String.format(UploadFilePath.IMG_VIEW_PATH, num) + "3dtiles");
+                //上传mesh
+                fYunFileService.deleteFolder(bucket, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh");
+                fYunFileService.uploadFileByCommand(bucket, meshPath, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh");
+
+                //更新版本信息
+                ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+                SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
+                sceneEditInfoService.update(
+                        new LambdaUpdateWrapper<SceneEditInfo>()
+                                .setSql("version = version + 1")
+                                .setSql("floor_edit_ver = floor_edit_ver + 1")
+                                .setSql("floor_publish_ver = floor_publish_ver + 1")
+                                .setSql("img_version = img_version + 1")
+                                .set(SceneEditInfo::getIsUploadObj, CommonStatus.YES.code())
+                                .eq(SceneEditInfo::getId, sceneEditInfo.getId()));
+
+                sceneEditInfoService.upgradeSceneJsonVersion(num, sceneEditInfo.getVersion() + 1, sceneEditInfo.getImgVersion() + 1, bucket);
+
+                sceneAsynOperLog.setState(CommonOperStatus.SUCCESS.code());
+            } catch (Exception e) {
+                log.error("上传全景图报错,num:" + num, e);
+                sceneAsynOperLog.setState(CommonOperStatus.FAILD.code());
+            }
+            sceneAsynOperLogService.updateById(sceneAsynOperLog);
+        });
 
     }
 
-    private void uploadFileofterRebuildPanoram(String path, String filePath, String sceneNum, String bucket) throws Exception {
+    private void uploadFileofterBuildDamModel(String path, String filePath, String sceneNum, String bucket) throws Exception {
         //因为共享目录有延迟,这里循环检测算法是否计算完毕3次,每次隔五秒
         String uploadJsonPath = path + File.separator + "results" +File.separator+"upload.json";
         boolean exist = ComputerUtil.checkComputeCompleted(uploadJsonPath, maxCheckTimes, waitTime);
@@ -1008,7 +1058,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         }
     }
 
-    public ResultData downloadTexData(String num) throws Exception {
+    public ResultData downloadModel(String num) throws Exception {
 
         if(StrUtil.isEmpty(num)){
             throw new BusinessException(ErrorCode.PARAM_REQUIRED);
@@ -1017,16 +1067,46 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         if(scenePlus == null){
             throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
         }
+
+        //查询是否存在等待中的异步操作记录,如果存在,抛出业务异常,终止操作
+        sceneAsynOperLogService.checkSceneAsynOper(num,null, SceneAsynModuleType.UPLOAD_DOWNLOAD.code() , SceneAsynFuncType.MODEL.code());
+
+        //清除旧的下载记录
+        sceneAsynOperLogService.cleanLog(num, SceneAsynModuleType.UPLOAD_DOWNLOAD.code(), SceneAsynFuncType.MODEL.code(), SceneAsynOperType.DOWNLOAD.code());
+
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
         String bucket = scenePlusExt.getYunFileBucket();
 
         SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
 
-        if(ModelKind.THREE_D_TILE.code().equals(scenePlusExt.getModelKind())){
-            return this.downloadModel43dtiles(num, bucket, scenePlusExt, sceneEditInfo);
-        }
+        //开始异步执行下载全景图压缩包操作
+        CompletableFuture.runAsync(() -> {
+            SceneAsynOperLog sceneAsynOperLog = new SceneAsynOperLog();
+            sceneAsynOperLog.setNum(num);
+            sceneAsynOperLog.setOperType(SceneAsynOperType.DOWNLOAD.code());
+            sceneAsynOperLog.setModule(SceneAsynModuleType.UPLOAD_DOWNLOAD.code());
+            sceneAsynOperLog.setFunc(SceneAsynFuncType.MODEL.code());
+            sceneAsynOperLog.setVersion(sceneEditInfo.getImgVersion());
+            sceneAsynOperLogService.save(sceneAsynOperLog);
+            try {
+
+                String url = null;
+                if(ModelKind.THREE_D_TILE.code().equals(scenePlusExt.getModelKind())){
+                    url = downloadModel43dtiles(num, bucket, scenePlusExt, sceneEditInfo);
+                }else{
+                    url = downloadModel4Dam(num, bucket);
+                }
 
-        return this.downloadModel4Dam(num, bucket);
+                sceneAsynOperLog.setState(CommonOperStatus.SUCCESS.code());
+                sceneAsynOperLog.setUrl(url);
+            }catch (Exception e){
+                sceneAsynOperLog.setState(CommonOperStatus.FAILD.code());
+                log.error("下载模型压缩包失败,num:" + num, e);
+            }
+            sceneAsynOperLogService.saveOrUpdate(sceneAsynOperLog);
+        });
+
+        return ResultData.ok();
     }
 
     @Override
@@ -1034,7 +1114,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         return this.getOne(new LambdaQueryWrapper<ScenePro>().eq(ScenePro::getNum, num));
     }
 
-    private ResultData downloadModel43dtiles(String num, String bucket, ScenePlusExt scenePlusExt, SceneEditInfo sceneEditInfo){
+    private String downloadModel43dtiles(String num, String bucket, ScenePlusExt scenePlusExt, SceneEditInfo sceneEditInfo){
 
         //下载mesh到本地
         String meshOssPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh/";
@@ -1051,19 +1131,17 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         FileUtil.del(meshLocalPath);
         FileUtil.del(zipFilePath);
         String url = "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
-        return ResultData.ok(url);
+        return url;
     }
 
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
 
-        Date time = Calendar.getInstance().getTime();
-        time = DateUtil.beginOfDay(DateUtil.offset(time, DateField.MONTH, -12));
-        System.out.println(time);
+        ConvertUtils.convertVisionModelDataToTxt( "D:\\test\\vision.modeldata", "D:\\test\\vision.json");
 
     }
 
 
-    private ResultData downloadModel4Dam(String num, String bucket){
+    private String downloadModel4Dam(String num, String bucket){
         String localImagePath = String.format(ConstantFilePath.IMAGESBUFFER_FORMAT, num);
         if(!new File(localImagePath).exists()){
             new File(localImagePath).mkdirs();
@@ -1110,7 +1188,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
         String url = "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
         FileUtil.del(zipPath);
-        return ResultData.ok(url);
+        return url;
     }
 
     @Override

+ 15 - 8
src/main/java/com/fdkankan/scene/service/impl/SceneResourceServiceImpl.java

@@ -3,6 +3,8 @@ package com.fdkankan.scene.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.ErrorCode;
+import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.scene.entity.SceneResource;
 import com.fdkankan.scene.entity.SceneResourceCooperation;
 import com.fdkankan.scene.mapper.ISceneResourceMapper;
@@ -18,7 +20,7 @@ import org.springframework.stereotype.Service;
  * 场景资源表 服务实现类
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-07-18
  */
 @Service
@@ -30,21 +32,26 @@ public class SceneResourceServiceImpl extends ServiceImpl<ISceneResourceMapper,
     @Override
     public List<SceneResource> findByCooperationId(Long sceneCooperationId) {
 
+        long countV4Resource = this.countByVersion("v4");
+
         List<SceneResourceCooperation> sceneResourceCooperationList
             = sceneResourceCooperationService.list(
             new LambdaQueryWrapper<SceneResourceCooperation>()
                 .eq(SceneResourceCooperation::getSceneCooperationId, sceneCooperationId));
 
-        List<Long> sceneResourceIdList = null;
-        if(CollUtil.isNotEmpty(sceneResourceCooperationList)){
-            sceneResourceIdList = sceneResourceCooperationList.stream()
-                .map(sceneResourceCooperation -> sceneResourceCooperation.getSceneResourceId())
-                .collect(Collectors.toList());
-        }
-        if(CollUtil.isEmpty(sceneResourceIdList)){
+        if(countV4Resource == sceneResourceCooperationList.size()){//如果协作菜单数量与资源数量相同,则返回空,由前端判断当前用户拥有所有该场景编辑权限
             return null;
         }
 
+        List<Long> sceneResourceIdList = sceneResourceCooperationList.stream()
+                .map(sceneResourceCooperation -> sceneResourceCooperation.getSceneResourceId())
+                .collect(Collectors.toList());
+
         return this.listByIds(sceneResourceIdList);
     }
+
+    @Override
+    public long countByVersion(String version) {
+        return this.count(new LambdaQueryWrapper<SceneResource>().eq(SceneResource::getVersion, version));
+    }
 }

+ 9 - 5
src/main/java/com/fdkankan/scene/service/impl/SceneUploadServiceImpl.java

@@ -3,6 +3,7 @@ package com.fdkankan.scene.service.impl;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.date.TimeInterval;
+import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -12,6 +13,7 @@ import com.fdkankan.common.constant.RecStatus;
 import com.fdkankan.common.constant.ServerCode;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.fyun.constant.FYunTypeEnum;
+import com.fdkankan.model.constants.ConstantFilePath;
 import com.fdkankan.model.constants.UploadFilePath;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.web.response.ResultData;
@@ -50,7 +52,7 @@ import org.springframework.web.multipart.MultipartFile;
  *  服务实现类
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-01-19
  */
 @Slf4j
@@ -140,8 +142,10 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
             String fileName = file.getOriginalFilename();
             // 获取文件后缀
             String prefix = fileName.substring(fileName.lastIndexOf("."));
-            File newFile = File.createTempFile(UUID.randomUUID().toString() ,prefix);
-            file.transferTo(newFile);
+            String path = String.format(ConstantFilePath.SCENE_TMP_PATH_V4, num).concat(UUID.randomUUID().toString()).concat(prefix);
+//            File newFile = File.createTempFile(UUID.randomUUID().toString() ,prefix);
+            FileUtil.mkParentDirs(path);
+            file.transferTo(new File(path));
             String realFileName = fileName;
             if(files.size() ==1 && StringUtils.isNotBlank(sendFileName)){
                 realFileName = sendFileName ;
@@ -154,7 +158,7 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
             String ossPath = StrUtil.isNotBlank(uploadPath) ? uploadPath : (String.format(UploadFilePath.USER_EDIT_PATH ,num) + realFileName);
             try {
                 TimeInterval timer = DateUtil.timer();
-                fYunFileService.uploadFile(bucket, newFile.getPath(), ossPath);
+                fYunFileService.uploadFile(bucket, path, ossPath);
                 System.out.println(timer.intervalRestart());
             }catch (Exception e){
                 log.error(ossPath+"上传文件失败"+e);
@@ -163,7 +167,7 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
 
             urlList.add(realFileName);
 
-            FileUtils.delFile(newFile.getPath());
+            FileUtils.delFile(path);
             //添加记录
             this.saveData(num,ossPath,bizType,userId);
         }

+ 61 - 13
src/main/java/com/fdkankan/scene/service/impl/SurveillanceServiceImpl.java

@@ -1,37 +1,39 @@
 package com.fdkankan.scene.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 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.ErrorCode;
+import com.fdkankan.common.constant.ServerCode;
 import com.fdkankan.common.exception.BusinessException;
-import com.fdkankan.scene.entity.SceneEditInfo;
-import com.fdkankan.scene.entity.SceneEditInfoExt;
-import com.fdkankan.scene.entity.ScenePlus;
-import com.fdkankan.scene.entity.Surveillance;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.UploadFilePath;
+import com.fdkankan.scene.entity.*;
 import com.fdkankan.scene.mapper.ISurveillanceMapper;
-import com.fdkankan.scene.service.ISceneEditInfoExtService;
-import com.fdkankan.scene.service.ISceneEditInfoService;
-import com.fdkankan.scene.service.IScenePlusService;
-import com.fdkankan.scene.service.ISurveillanceService;
+import com.fdkankan.scene.service.*;
 import com.fdkankan.scene.vo.BaseSidParamVO;
 import com.fdkankan.scene.vo.SurveillanceParamVO;
 import com.fdkankan.scene.vo.SurveillanceVO;
 import com.fdkankan.web.response.ResultData;
+
+import java.io.IOException;
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+
 /**
  * <p>
  * 监控推拉流信息 服务实现类
  * </p>
  *
- * @author 
+ * @author
  * @since 2022-09-16
  */
 @Service
@@ -43,14 +45,37 @@ public class SurveillanceServiceImpl extends ServiceImpl<ISurveillanceMapper, Su
     private ISceneEditInfoExtService sceneEditInfoExtService;
     @Autowired
     private ISceneEditInfoService sceneEditInfoService;
+    @Resource
+    private FYunFileServiceInterface yunFileService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private ICommonService commonService;
 
     @Override
-    public ResultData saveSurveillance(SurveillanceParamVO param) {
+    public ResultData saveSurveillance(SurveillanceParamVO param) throws Exception {
+
+        if(param.getUrlType() == 1){
+            if(StrUtil.isEmpty(param.getPlayUrl())){
+                throw new BusinessException(ServerCode.PARAM_REQUIRED.code(), ServerCode.PARAM_REQUIRED.formatMessage("playUrl"));
+            }
+        }else{
+            if(StrUtil.isEmpty(param.getFileName()) || StrUtil.isEmpty(param.getPoster())){
+                throw new BusinessException(ServerCode.PARAM_REQUIRED.code(), ServerCode.PARAM_REQUIRED.formatMessage("fileName、poster"));
+            }
+        }
 
         ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
         if(Objects.isNull(scenePlus)){
             throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
         }
+        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+
+        //转换视频格式
+        if(param.getUrlType() == 2){
+            commonService.transferToFlv(param.getNum(), param.getFileName(), scenePlusExt.getYunFileBucket());
+        }
+
         SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
         SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByScenePlusId(scenePlus.getId());
 
@@ -64,25 +89,36 @@ public class SurveillanceServiceImpl extends ServiceImpl<ISurveillanceMapper, Su
         surveillance.setName(param.getName());
         surveillance.setData(param.getData().toJSONString());
         surveillance.setPlayUrl(param.getPlayUrl());
+        surveillance.setUrlType(param.getUrlType());
+        surveillance.setFileName(param.getFileName());
+        surveillance.setPoster(param.getPoster());
         this.saveOrUpdate(surveillance);
 
         sceneEditInfoExt.setSurveillances(CommonStatus.YES.code().intValue());
         sceneEditInfoExtService.updateById(sceneEditInfoExt);
-
         sceneEditInfoService.upgradeVersionById(sceneEditInfo.getId());
 
-
         return ResultData.ok();
     }
 
     @Override
-    public ResultData deleteSurveillance(BaseSidParamVO param) {
+    public ResultData deleteSurveillance(BaseSidParamVO param) throws IOException {
         ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
         if(Objects.isNull(scenePlus)){
             throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
         }
+
+        Surveillance surveillance = this.getBySid(param.getNum(), param.getSid());
+        if(Objects.isNull(surveillance)){
+            return ResultData.ok("sid不存在");
+        }
+
+        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
         SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
         SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByScenePlusId(scenePlus.getId());
+        String bucket = scenePlusExt.getYunFileBucket();
+
+
 
         this.remove(new LambdaQueryWrapper<Surveillance>().eq(Surveillance::getSid, param.getSid()));
 
@@ -90,6 +126,18 @@ public class SurveillanceServiceImpl extends ServiceImpl<ISurveillanceMapper, Su
         if(count < 1){
             sceneEditInfoExt.setSurveillances(CommonStatus.NO.code().intValue());
         }
+
+        //如果是视频类型监控,需要删除oss文件
+        if(surveillance.getUrlType() == 2){
+            String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum());
+            if(StrUtil.isNotEmpty(surveillance.getFileName())){
+                yunFileService.deleteFile(bucket, userEditPath.concat(surveillance.getFileName()));
+            }
+            if(StrUtil.isNotEmpty(surveillance.getPoster())){
+                yunFileService.deleteFile(bucket, userEditPath.concat(surveillance.getPoster()));
+            }
+        }
+
         sceneEditInfoExtService.updateById(sceneEditInfoExt);
 
         sceneEditInfoService.upgradeVersionById(sceneEditInfo.getId());

+ 29 - 0
src/main/java/com/fdkankan/scene/vo/SceneDynamicPanelParamVO.java

@@ -0,0 +1,29 @@
+package com.fdkankan.scene.vo;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 场景动态面板
+ * </p>
+ *
+ * @author
+ * @since 2024-05-21
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SceneDynamicPanelParamVO extends BaseSceneParamVO {
+
+    private static final long serialVersionUID = 1L;
+
+    private JSONObject data;
+
+}

+ 27 - 0
src/main/java/com/fdkankan/scene/vo/SceneDynamicPanelVO.java

@@ -0,0 +1,27 @@
+package com.fdkankan.scene.vo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.*;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 场景动态面板
+ * </p>
+ *
+ * @author
+ * @since 2024-05-21
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SceneDynamicPanelVO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String sid;
+
+}

+ 10 - 0
src/main/java/com/fdkankan/scene/vo/SceneEditControlsParamVO.java

@@ -117,6 +117,16 @@ public class SceneEditControlsParamVO implements Serializable {
      */
     private Integer showLinkTitle;
 
+    /**
+     * 空间绘制信息
+     */
+    private Integer showDrawTitle;
+
+    /**
+     * 是否显示全部模型
+     */
+    private Integer showAllModel;
+
 
 
 

+ 11 - 0
src/main/java/com/fdkankan/scene/vo/SceneEditControlsVO.java

@@ -107,4 +107,15 @@ public class SceneEditControlsVO implements Serializable {
      */
     private Integer showLinkTitle;
 
+    /**
+     * 空间绘制信息
+     */
+    private Integer showDrawTitle;
+
+    /**
+     * 是否显示全部模型
+     */
+    private Integer showAllModel;
+
+
 }

+ 4 - 1
src/main/java/com/fdkankan/scene/vo/SceneEditInfoParamVO.java

@@ -79,7 +79,10 @@ public class SceneEditInfoParamVO extends BaseSceneParamVO{
      */
     private JSONObject sns;
 
-
+    /**
+     * 启动页信息
+     */
+    private JSONObject started;
 
 
 }

+ 20 - 0
src/main/java/com/fdkankan/scene/vo/SceneInfoVO.java

@@ -244,5 +244,25 @@ public class SceneInfoVO {
      */
     private Integer billboards;
 
+    /**
+     * 是否有模型裁剪(0-否,1-是)
+     */
+    private Integer cutModel = 0;
+
+    /**
+     * 启动页配置信息
+     */
+    private JSONObject started;
+
+    /**
+     * 空间绘制
+     */
+    private Integer sceneDraw;
+
+    //动态面板
+    private int dynamicPanel;
+
+    private Integer payStatus;
+
 
 }

+ 9 - 1
src/main/java/com/fdkankan/scene/vo/SurveillanceParamVO.java

@@ -3,6 +3,8 @@ package com.fdkankan.scene.vo;
 import com.alibaba.fastjson.JSONObject;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
 import lombok.Data;
 
 /**
@@ -25,9 +27,15 @@ public class SurveillanceParamVO {
     @NotBlank(message = "name不能为空")
     private String name;
 
-    @NotBlank(message = "playUrl不能为空")
     private String playUrl;
 
+    @NotNull(message = "urlType不能为空")
+    private Integer urlType = 1;
+
+    private String poster;
+
+    private String fileName;
+
     @NotBlank(message = "panoId不能为空")
     private String panoId;
 

+ 8 - 0
src/main/java/com/fdkankan/scene/vo/SurveillanceVO.java

@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
 import java.io.Serializable;
 import lombok.Data;
 
+import javax.validation.constraints.NotNull;
+
 /**
  * <p>
  * 监控推拉流信息
@@ -34,6 +36,12 @@ public class SurveillanceVO implements Serializable {
      */
     private String playUrl;
 
+    private Integer urlType;
+
+    private String poster;
+
+    private String fileName;
+
     private String sid;
 
     private String panoId;

+ 10 - 1
src/main/resources/bootstrap-dev.yml

@@ -4,7 +4,7 @@ spring:
   cloud:
     nacos:
       server-addr: 120.24.144.164:8848
-      namespace: 4dkankan-v4-test
+      namespace: 4dkankan-v4-dev
       config:
         file-extension: yaml
         namespace: ${spring.cloud.nacos.namespace}
@@ -24,8 +24,17 @@ spring:
           - data-id: common-fyun-config.yaml
             group: DEFAULT_GROUP
             refresh: true
+
+          - data-id: common-rabbitmq-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+
+          - data-id: forest-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
       discovery:
         namespace: ${spring.cloud.nacos.namespace}
+#        namespace: public
 
 
 

+ 5 - 0
src/main/resources/mapper/scene/SceneDynamicPanelMapper.xml

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