Browse Source

Merge remote-tracking branch 'origin/lyh-cp' into release

# Conflicts:
#	src/main/java/com/fdkankan/scene/generate/AutoGenerate.java
dengsixing 10 months ago
parent
commit
9a242afb6d

+ 21 - 0
src/main/java/com/fdkankan/scene/controller/FolderSceneController.java

@@ -0,0 +1,21 @@
+package com.fdkankan.scene.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 文件夹和场景关联表 前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-31
+ */
+@RestController
+@RequestMapping("/scene/folderScene")
+public class FolderSceneController {
+
+}
+

+ 21 - 0
src/main/java/com/fdkankan/scene/controller/SceneProEditController.java

@@ -0,0 +1,21 @@
+package com.fdkankan.scene.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * pro场景编辑数据表 前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-31
+ */
+@RestController
+@RequestMapping("/scene/sceneProEdit")
+public class SceneProEditController {
+
+}
+

+ 48 - 0
src/main/java/com/fdkankan/scene/entity/FolderScene.java

@@ -0,0 +1,48 @@
+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-07-31
+ */
+@Getter
+@Setter
+@TableName("t_folder_scene")
+public class FolderScene implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    @TableField("folder_id")
+    private Long folderId;
+
+    @TableField("scene_id")
+    private Long sceneId;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+
+}

+ 5 - 1
src/main/java/com/fdkankan/scene/entity/ScenePlusExt.java

@@ -170,5 +170,9 @@ public class ScenePlusExt implements Serializable {
     @TableLogic(value = "A", delval = "I")
     private String recStatus;
 
-
+    /**
+     * 是否是mesh场景
+     */
+    @TableField("is_obj")
+    private Integer isObj;
 }

+ 285 - 0
src/main/java/com/fdkankan/scene/entity/SceneProEdit.java

@@ -0,0 +1,285 @@
+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>
+ * pro场景编辑数据表
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-31
+ */
+@Getter
+@Setter
+@TableName("t_scene_pro_edit")
+public class SceneProEdit implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * pro场景id
+     */
+    @TableField("pro_id")
+    private Long proId;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+    /**
+     * 大场景的密钥
+     */
+    @TableField("scene_key")
+    private String sceneKey;
+
+    /**
+     * 展示页面密码,0不需要,1需要
+     */
+    @TableField("need_key")
+    private Integer needKey;
+
+    /**
+     * 版本
+     */
+    @TableField("version")
+    private Integer version;
+
+    /**
+     * 表示缩略图是否存在
+     */
+    @TableField("thumb_status")
+    private Integer thumbStatus;
+
+    /**
+     * 地面点位标志
+     */
+    @TableField("marker_logo")
+    private String markerLogo;
+
+    /**
+     * 0表示默认,1表示自己上传
+     */
+    @TableField("floor_logo")
+    private String floorLogo;
+
+    /**
+     * 标记大小
+     */
+    @TableField("floor_logo_size")
+    private Integer floorLogoSize;
+
+    /**
+     * 要上传的热点的id集合,用逗号隔开
+     */
+    @TableField("hots_ids")
+    private String hotsIds;
+
+    /**
+     * 表示初始点信息
+     */
+    @TableField("entry")
+    private String entry;
+
+    /**
+     * 背景音乐名称
+     */
+    @TableField("bg_music")
+    private String bgMusic;
+
+    /**
+     * 记录的状态,A: 生效,I: 禁用
+     */
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    /**
+     * 更新时间
+     */
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * 普通录屏文件地址
+     */
+    @TableField("screencap_voice_src")
+    private String screencapVoiceSrc;
+
+    /**
+     * 录音文件地址
+     */
+    @TableField("screencap_voice_sound")
+    private String screencapVoiceSound;
+
+    /**
+     * 同步录音地址
+     */
+    @TableField("screencap_voice_soundsync")
+    private String screencapVoiceSoundsync;
+
+    /**
+     * 选择的类型,sound为screencapVoiceSound,file为screencapVoiceSrc,soundsync为screencap_voice_soundsync
+     */
+    @TableField("screencap_voice_type")
+    private String screencapVoiceType;
+
+    /**
+     * 录屏文件地址
+     */
+    @TableField("play_data")
+    private String playData;
+
+    /**
+     * 重新建模的版本
+     */
+    @TableField("floor_edit_ver")
+    private Integer floorEditVer;
+
+    /**
+     * 正式发布重新建模的版本
+     */
+    @TableField("floor_publish_ver")
+    private Integer floorPublishVer;
+
+    /**
+     * 录屏图片存放文件
+     */
+    @TableField("screencap_thumb")
+    private String screencapThumb;
+
+    /**
+     * 分享的logo和生成二维码的logo
+     */
+    @TableField("share_logo")
+    private String shareLogo;
+
+    /**
+     * 小地图浏览
+     */
+    @TableField("map_visi")
+    private Integer mapVisi;
+
+    /**
+     * 自动导览
+     */
+    @TableField("tour_visi")
+    private Integer tourVisi;
+
+    /**
+     * vr模式
+     */
+    @TableField("vr_visi")
+    private Integer vrVisi;
+
+    /**
+     * 展示页面是否显示标尺
+     */
+    @TableField("ruler_visi")
+    private Integer rulerVisi;
+
+    /**
+     * 展示页面cad图在平面图是否显示
+     */
+    @TableField("cad_img_visi")
+    private Integer cadImgVisi;
+
+    /**
+     * cad平面图
+     */
+    @TableField("floor_plan_png")
+    private String floorPlanPng;
+
+    /**
+     * cad平面图参数
+     */
+    @TableField("cad_info")
+    private String cadInfo;
+
+    @TableField("pano_visi")
+    private Integer panoVisi;
+
+    @TableField("m2d_visi")
+    private Integer m2dVisi;
+
+    @TableField("m3d_visi")
+    private Integer m3dVisi;
+
+    @TableField("measure_visi")
+    private Integer measureVisi;
+
+    /**
+     * 肖安需求,场景于场景之间的关联
+     */
+    @TableField("link_scene")
+    private String linkScene;
+
+    @TableField("overlay")
+    private String overlay;
+
+    /**
+     * 是否显示底部logo,1显示,0不显示
+     */
+    @TableField("show_logo_bottom")
+    private Boolean showLogoBottom;
+
+    /**
+     * 全景图版本号
+     */
+    @TableField("images_version")
+    private Integer imagesVersion;
+
+    /**
+     * 上传的背景音乐
+     */
+    @TableField("bg_music_name")
+    private String bgMusicName;
+
+    @TableField("jump_scene")
+    private Boolean jumpScene;
+
+    /**
+     * 旋转角度
+     */
+    @TableField("floor_plan_angle")
+    private String floorPlanAngle;
+
+    /**
+     * 场景下载次数
+     */
+    @TableField("download_num")
+    private Integer downloadNum;
+
+    /**
+     * 绿幕抠图json数据
+     */
+    @TableField("videos_user")
+    private String videosUser;
+
+    /**
+     * 大场景序号(随心装场景码)
+     */
+    @TableField("vr_num")
+    private String vrNum;
+
+    /**
+     * 随心装封面图
+     */
+    @TableField("vr_thumb")
+    private String vrThumb;
+
+
+}

+ 20 - 0
src/main/java/com/fdkankan/scene/mapper/IFolderSceneMapper.java

@@ -0,0 +1,20 @@
+package com.fdkankan.scene.mapper;
+
+import com.fdkankan.scene.entity.FolderScene;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 文件夹和场景关联表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-31
+ */
+@Mapper
+public interface IFolderSceneMapper extends BaseMapper<FolderScene> {
+
+    FolderScene getByType(@Param("sceneId")Long sceneId, @Param("type")Integer type);
+}

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

@@ -0,0 +1,18 @@
+package com.fdkankan.scene.mapper;
+
+import com.fdkankan.scene.entity.SceneProEdit;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * pro场景编辑数据表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-31
+ */
+@Mapper
+public interface ISceneProEditMapper extends BaseMapper<SceneProEdit> {
+
+}

+ 47 - 0
src/main/java/com/fdkankan/scene/mq/consumer/CopySceneConsumer.java

@@ -0,0 +1,47 @@
+package com.fdkankan.scene.mq.consumer;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.redis.util.RedisUtil;
+import com.fdkankan.scene.service.ISceneCopyService;
+import com.rabbitmq.client.Channel;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.nio.charset.StandardCharsets;
+
+/**
+ * 场景封存解封 mq
+ */
+@Slf4j
+@Component
+public class CopySceneConsumer {
+
+
+    @Autowired
+    ISceneCopyService sceneCopyService;
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.scene.copy:ucenter-copy-scene}") ,
+            concurrency = "1"
+    )
+    public void consumerQueue(Channel channel, Message message)  {
+        try {
+            String messageId = message.getMessageProperties().getMessageId();
+            String msg = new String(message.getBody(), StandardCharsets.UTF_8);
+            log.info("copy-scene--messageId:{},msg:{}",messageId,msg);
+            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+
+            JSONObject jsonObject = JSONObject.parseObject(msg);
+            String oldNum = jsonObject.getString("oldNum");
+            String newNum = jsonObject.getString("newNum");
+            sceneCopyService.copyScene(oldNum,newNum);
+        }catch (Exception e){
+            log.info("copy-scene----消费失败",e);
+        }
+
+    }
+
+}

+ 33 - 0
src/main/java/com/fdkankan/scene/mq/consumer/SceneResourcePath.java

@@ -0,0 +1,33 @@
+package com.fdkankan.scene.mq.consumer;
+
+public class SceneResourcePath {
+    /*
+     * data/data{SceneNum}
+     * images/images{SceneNum}
+     * video/video{SceneNum}
+     * voice/voice{SceneNum}
+     */
+    public static String nasBasePath = "/mnt/4Dkankan/scene/";
+    public static String nasBasePath_v4 = "/mnt/4Dkankan/scene_v4/";
+    public static String qrCodeBasePath = "/mnt/4Dkankan/sceneQRcode/";
+
+    public static String dataPath = "data/data%s";
+    public static String imagesPath = "images/images%s";
+    public static String videoPath = "video/video%s";
+    public static String voicePath = "voice/voice%s";
+
+
+    public static final String EDIT_PATH_v4 =  "scene_edit_data/%s/";
+    public static final String VIEW_PATH_v4 =  "scene_view_data/%s/";
+
+    public static final String SCENE_RESULT_DATA_PATH = "scene_result_data/%s/";
+
+    public static final String DATA_EDIT_PATH =  "scene_edit_data/%s/data";
+    public static final String DATA_VIEW_PATH =  "scene_view_data/%s/data";
+    public static final String USER_VIEW_PATH =  "scene_view_data/%s/user";
+    public static final String DYNAMIC_VIEW_PATH =  "scene_view_data/%s/user/dynamicPanel.json";
+    public static final String DYNAMIC_EDIT_PATH =  "scene_edit_data/%s/user/dynamicPanel.json";
+
+    public static final String DOWNLOADS_QRCODE = "downloads/scene/%s/QRcode/";
+
+}

+ 17 - 0
src/main/java/com/fdkankan/scene/service/IFolderSceneService.java

@@ -0,0 +1,17 @@
+package com.fdkankan.scene.service;
+
+import com.fdkankan.scene.entity.FolderScene;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 文件夹和场景关联表 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-31
+ */
+public interface IFolderSceneService extends IService<FolderScene> {
+
+    FolderScene getByType(Long sceneId, Integer type);
+}

+ 8 - 0
src/main/java/com/fdkankan/scene/service/ILaserService.java

@@ -0,0 +1,8 @@
+package com.fdkankan.scene.service;
+
+public interface ILaserService {
+
+    void copy(String oldNum , String newNum, String  path,Boolean flag);
+
+    void cloudPointBuild(String oldNum, String newNum);
+}

+ 6 - 0
src/main/java/com/fdkankan/scene/service/ISceneCopyService.java

@@ -0,0 +1,6 @@
+package com.fdkankan.scene.service;
+
+public interface ISceneCopyService {
+
+    void copyScene(String oldNum,String newNum);
+}

+ 17 - 0
src/main/java/com/fdkankan/scene/service/ISceneProEditService.java

@@ -0,0 +1,17 @@
+package com.fdkankan.scene.service;
+
+import com.fdkankan.scene.entity.SceneProEdit;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * pro场景编辑数据表 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-31
+ */
+public interface ISceneProEditService extends IService<SceneProEdit> {
+
+    SceneProEdit getByProId(Long sceneProId);
+}

+ 24 - 0
src/main/java/com/fdkankan/scene/service/impl/FolderSceneServiceImpl.java

@@ -0,0 +1,24 @@
+package com.fdkankan.scene.service.impl;
+
+import com.fdkankan.scene.entity.FolderScene;
+import com.fdkankan.scene.mapper.IFolderSceneMapper;
+import com.fdkankan.scene.service.IFolderSceneService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 文件夹和场景关联表 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-31
+ */
+@Service
+public class FolderSceneServiceImpl extends ServiceImpl<IFolderSceneMapper, FolderScene> implements IFolderSceneService {
+
+    @Override
+    public FolderScene getByType(Long sceneId, Integer type) {
+        return getBaseMapper().getByType(sceneId,type);
+    }
+}

+ 60 - 0
src/main/java/com/fdkankan/scene/service/impl/LaserServiceImpl.java

@@ -0,0 +1,60 @@
+package com.fdkankan.scene.service.impl;
+
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+import com.fdkankan.scene.service.ILaserService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+@Slf4j
+public class LaserServiceImpl implements ILaserService {
+
+    @Autowired
+    RabbitMqProducer rabbitMqProducer;
+    @Autowired
+    private FYunFileServiceInterface fYunFileService;
+
+
+    @Value("${4dkk.laserService.cloud-point-fyun-path:testdata/%s/data/bundle_%s/building/}")
+    private String cloudPointFyunPath;
+    @Value("${4dkk.laserService.bucket:laser-data}")
+    private String bucket;
+    @Value("${queue.application.laser.cloud-point-build:laser-cloud-point-build}")
+    private String cloudPointBuild;
+    @Value("${queue.application.laser.copy-scene:laser-copy-scene}")
+    private String laserCopyScene;
+    @Override
+    public void copy(String oldNum, String newNum, String path, Boolean flag) {
+        Map<String,Object> params = new HashMap<>();
+        params.put("sceneCode", newNum);
+        params.put("oldSceneCode", oldNum);
+        params.put("path",path);
+        params.put("init",flag);
+        rabbitMqProducer.sendByWorkQueue(laserCopyScene,params);
+    }
+
+    @Override
+    public void cloudPointBuild(String oldSceneCode,String sceneCode) {
+        if (!fYunFileService.fileExist(bucket,String.format(cloudPointFyunPath,oldSceneCode,oldSceneCode) +"vision_edit.txt")){
+            return;
+        }
+        log.info("开始同步点云编辑文件");
+        // 上传点云编辑文件,并通知激光系统
+        fYunFileService.copyFileBetweenBucket(bucket,String.format(cloudPointFyunPath,oldSceneCode,oldSceneCode) + "vision_edit.txt",
+                bucket,String.format(cloudPointFyunPath,sceneCode,sceneCode) + "vision_edit.txt");
+
+        fYunFileService.copyFileBetweenBucket(bucket,String.format(cloudPointFyunPath,oldSceneCode,oldSceneCode) + "uuidcloud",
+                bucket,String.format(cloudPointFyunPath,sceneCode,sceneCode) + "uuidcloud");
+
+        Map<String, Object> params = new HashMap<>();
+        params.put("sceneNum", sceneCode);
+        params.put("businessType", 0);
+        rabbitMqProducer.sendByWorkQueue(cloudPointBuild, params);
+    }
+}

+ 490 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneCopyServiceImpl.java

@@ -0,0 +1,490 @@
+package com.fdkankan.scene.service.impl;
+
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import cn.hutool.extra.qrcode.QrConfig;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.common.constant.SceneVersionType;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.common.util.SnowflakeIdGenerator;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+import com.fdkankan.scene.entity.*;
+import com.fdkankan.scene.mq.consumer.SceneResourcePath;
+import com.fdkankan.scene.service.*;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.util.*;
+
+@Service
+@Slf4j
+public class SceneCopyServiceImpl implements ISceneCopyService {
+
+    @Autowired
+    ISceneProService sceneProService;
+    @Autowired
+    ISceneProEditService sceneProEditService;
+    @Autowired
+    IScenePlusService scenePlusService;
+    @Autowired
+    IScenePlusExtService scenePlusExtService;
+    @Autowired
+    ISceneEditInfoService sceneEditInfoService;
+    @Autowired
+    ISceneEditInfoExtService sceneEditInfoExtService;
+    @Autowired
+    ISceneEditControlsService sceneEditControlsService;
+    @Autowired
+    ISurveillanceService surveillanceService;
+    @Autowired
+    IFolderSceneService folderSceneService;
+
+    @Autowired
+    ILaserService laserService;
+    @Autowired
+    FYunFileServiceInterface fYunFileServiceInterface;
+    @Autowired
+    RabbitMqProducer rabbitMqProducer;
+    @Override
+    public void copyScene(String oldNum, String newNum) {
+        ScenePro scenePro = sceneProService.getByNum(oldNum);
+        if(scenePro != null && scenePro.getIsUpgrade() == 0){
+            cpV3(scenePro,oldNum,newNum);
+        }
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(oldNum);
+        if(scenePlus != null){
+            cpV4(scenePlus,oldNum,newNum);
+        }
+    }
+
+    private void cpV4(ScenePlus scenePlus, String oldNum, String newNum) {
+        try {
+            Long plusId = scenePlus.getId();
+            ScenePlusExt plusExt = scenePlusExtService.getScenePlusExtByPlusId(plusId);
+            if(plusExt == null){
+                return;
+            }
+            scenePlus.setNum(newNum);
+            scenePlus.setTitle(scenePlus.getTitle() +"(copy)");
+            scenePlus.setSceneStatus(0);
+            scenePlus.setId(null);
+            scenePlusService.save(scenePlus);
+
+            this.saveFolder(plusId,scenePlus.getId());
+
+            String oldDataSource = plusExt.getDataSource();
+            String newDataSource = this.getNewDataSource(oldDataSource);
+            log.info("sceneCopy-V4-oldNum:{},oldDataSource:{},newNum:{},newDataSource:{}", oldNum,oldDataSource,newNum,newDataSource);
+
+            String newVideos = plusExt.getVideos();
+            if(StrUtil.isNotEmpty(newVideos)){
+                newVideos = plusExt.getVideos().replaceAll("/data/data" + oldNum, "/scene_view_data/" + newNum + "/data").replaceAll(oldNum, newNum);
+            }
+            plusExt.setId(null);
+            plusExt.setPlusId(scenePlus.getId());
+            plusExt.setDataSource(newDataSource);
+            plusExt.setWebSite(plusExt.getWebSite().replace(oldNum, newNum));
+            plusExt.setThumb(plusExt.getThumb().replace(oldNum, newNum));
+            plusExt.setVideos(newVideos);
+            plusExt.setViewCount(0);
+            scenePlusExtService.save(plusExt);
+
+            SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(plusId);
+            Long sceneEditInfoId = sceneEditInfo.getId();
+
+            sceneEditInfo.setId(null);
+            sceneEditInfo.setScenePlusId(scenePlus.getId());
+            sceneEditInfo.setSceneProId(null);
+            sceneEditInfo.setTitle(scenePlus.getTitle());
+            sceneEditInfoService.save(sceneEditInfo);
+
+            SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfoId);
+            sceneEditInfoExt.setId(null);
+            sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
+            sceneEditInfoExt.setScenePlusId(scenePlus.getId());
+            sceneEditInfoExt.setSceneProId(null);
+            sceneEditInfoExtService.save(sceneEditInfoExt);
+
+            SceneEditControls sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfoId);
+            sceneEditControls.setId(null);
+            sceneEditControls.setEditInfoId(sceneEditInfo.getId());
+            sceneEditControlsService.save(sceneEditControls);
+
+            List<Surveillance> list = surveillanceService.list(new LambdaQueryWrapper<Surveillance>().eq(Surveillance::getNum, oldNum));
+            if (!Objects.isNull(list)) {
+                list.stream().forEach(item -> {
+                    item.setNum(newNum);
+                    item.setId(null);
+                    surveillanceService.save(item);
+                });
+            }
+
+            if(scenePlus.getSceneSource() == 4 || scenePlus.getSceneSource() == 5){  //深时复制
+                laserService.copy(oldNum,newNum,newDataSource,true);
+            }else {
+                laserService.cloudPointBuild(oldNum,newNum);
+            }
+
+            //重新生成编辑页基础设置二维码
+            this.createNewQrCode(SceneVersionType.V4.code(),sceneEditInfoExt.getShareLogoImg(),newNum,plusExt.getWebSite());
+            //copyDataSource
+            //cn.hutool.core.io.FileUtil.copyContent(new File(oldDataSource),new File(newDataSource),true);
+
+            this.copyOssAndNasV4(oldNum,newNum);
+
+            //修改 oss status.json ,nas scene.json
+            String targetData = String.format(SceneResourcePath.DATA_VIEW_PATH,newNum);
+            this.updateOssJson(targetData,oldNum,newNum,"status.json");
+
+            this.updateNasSceneJson(targetData,oldNum,newNum,scenePlus.getTitle(),"v4","scene.json");
+
+            if(scenePlus.getSceneSource() == 4 || scenePlus.getSceneSource() == 5){  //深时复制
+                laserService.copy(oldNum,newNum,newDataSource,false);
+            }else {
+                scenePlus.setSceneStatus(-2);
+                scenePlusService.updateById(scenePlus);
+                sendMq(oldNum,newNum);
+            }
+        }catch (Exception e){
+            log.error("copy-V4-error-oldNum:{},newNum:{}",oldNum,newNum,e);
+            scenePlus.setSceneStatus(-1);
+            scenePlusService.updateById(scenePlus);
+        }
+
+    }
+
+    private void cpV3(ScenePro scenePro ,String oldNum,String newNum) {
+        try {
+            Long sceneProId = scenePro.getId();
+            scenePro.setNum(newNum);
+            scenePro.setId(null);
+            scenePro.setSceneName(scenePro.getSceneName() +"(copy)");
+            scenePro.setViewCount(0);
+            scenePro.setThumb(scenePro.getThumb().replaceAll(oldNum,scenePro.getNum()));
+            scenePro.setWebSite(scenePro.getWebSite().replaceAll(oldNum,scenePro.getNum()));
+            scenePro.setStatus(0);
+            sceneProService.save(scenePro);
+
+            this.saveFolder(sceneProId,scenePro.getId());
+
+            String oldDataSource = scenePro.getDataSource();
+            String newDataSource = this.getNewDataSource(oldDataSource);
+            if(StringUtils.isBlank(newDataSource)){
+                log.info("cpv3-error-newDataSource为空:{}",newDataSource);
+                return;
+            }
+            log.info("sceneCopy-v3-oldNum:{},oldDataSource:{},newNum:{},newDataSource:{}", oldNum,oldDataSource,newNum,newDataSource);
+            scenePro.setDataSource(newDataSource);
+
+            SceneProEdit oldEditScene = sceneProEditService.getByProId(sceneProId);
+            oldEditScene.setId(null);
+            oldEditScene.setProId(scenePro.getId());
+            oldEditScene.setScreencapVoiceSrc(oldEditScene.getScreencapVoiceSrc() == null ? null : oldEditScene.getScreencapVoiceSrc().replace(oldNum, scenePro.getNum()));
+            oldEditScene.setScreencapVoiceSound(oldEditScene.getScreencapVoiceSound() == null ? null : oldEditScene.getScreencapVoiceSound().replace(oldNum, scenePro.getNum()));
+            oldEditScene.setScreencapVoiceSoundsync(oldEditScene.getScreencapVoiceSoundsync() == null ? null : oldEditScene.getScreencapVoiceSoundsync().replace(oldNum, scenePro.getNum()));
+            oldEditScene.setPlayData(oldEditScene.getPlayData() == null ? null : oldEditScene.getPlayData().replace(oldNum, scenePro.getNum()));
+            oldEditScene.setScreencapThumb(oldEditScene.getScreencapThumb() == null ? null : oldEditScene.getScreencapThumb().replace(oldNum, scenePro.getNum()));
+            oldEditScene.setFloorPlanPng(oldEditScene.getFloorPlanPng() == null ? null : oldEditScene.getFloorPlanPng().replace(oldNum, scenePro.getNum()));
+            sceneProEditService.save(oldEditScene);
+
+            if(scenePro.getSceneSource() == 4 || scenePro.getSceneSource() == 5) {  //深时复制
+                laserService.copy(oldNum,newNum,newDataSource,true);
+            }
+            //重新生成编辑页基础设置二维码
+            this.createNewQrCode(SceneVersionType.V3.code(),oldEditScene.getShareLogo(),newNum,scenePro.getWebSite());
+            //copyDataSource
+            // cn.hutool.core.io.FileUtil.copyContent(new File(oldDataSource),new File(newDataSource),true);
+            String sourceData = String.format(SceneResourcePath.dataPath, oldNum);
+            String targetData = String.format(SceneResourcePath.dataPath, scenePro.getNum());
+            this.copyOssAndNasV3(oldNum,scenePro.getNum(),sourceData,targetData);
+            //修改 oss status.json ,nas scene.json
+            this.updateOssJson(targetData,oldNum,newNum,"status.json");
+            this.updateOssJson(targetData,oldNum,newNum,"hot.json");
+            this.updateNasSceneJson(targetData,oldNum,newNum,scenePro.getSceneName(),"v3","scene.json");
+            this.updateNasSceneJson(targetData,oldNum,newNum,scenePro.getSceneName(),"v3","hot.json");
+
+            String sourceImages = String.format(SceneResourcePath.imagesPath, oldNum);
+            String targetImages = String.format(SceneResourcePath.imagesPath, scenePro.getNum());
+            this.copyOssAndNasV3(oldNum,scenePro.getNum(),sourceImages,targetImages);
+
+            String sourceVideo = String.format(SceneResourcePath.videoPath, oldNum);
+            String targetVideo = String.format(SceneResourcePath.videoPath, scenePro.getNum());
+            this.copyOssAndNasV3(oldNum,scenePro.getNum(),sourceVideo,targetVideo);
+
+            String sourceVoice = String.format(SceneResourcePath.voicePath, oldNum);
+            String targetVoice = String.format(SceneResourcePath.voicePath, scenePro.getNum());
+            this.copyOssAndNasV3(oldNum,scenePro.getNum(),sourceVoice,targetVoice);
+
+            if(scenePro.getSceneSource() == 4 || scenePro.getSceneSource() == 5){  //深时复制
+                laserService.copy(oldNum,newNum,newDataSource,false);
+            }else {
+                scenePro.setStatus(-2);
+                sceneProService.updateById(scenePro);
+                sendMq(oldNum,newNum);
+            }
+        }catch (Exception e){
+            log.info("cpv3-error:{},{}",oldNum,newNum,e);
+            scenePro.setStatus(-1);
+            sceneProService.updateById(scenePro);
+        }
+
+    }
+
+    private void saveFolder(Long oldSceneId,Long newSceneId) {
+        FolderScene folderScene = folderSceneService.getByType(oldSceneId, null);
+        if(folderScene!= null){
+            folderScene.setId(null);
+            folderScene.setSceneId(newSceneId);
+            folderSceneService.save(folderScene);
+        }
+    }
+
+
+    @Value("${queue.scene.copy.result:ucenter-copy-scene-result}")
+    private String ucenterCpResultQueue;
+
+    private void sendMq(String oldNum, String newNum) {
+        HashMap<String,Object> map = new HashMap<>();
+        map.put("oldNum",oldNum);
+        map.put("newNum",newNum);
+        rabbitMqProducer.sendByWorkQueue(ucenterCpResultQueue,map);
+    }
+
+
+
+    public String getNewDataSource(String oldDataSource){
+
+        String newDataSource = null;
+        if(StringUtils.isBlank(oldDataSource)){
+            log.info("oldDataSource为空:{}",oldDataSource);
+            return null;
+        }
+        if(!oldDataSource.contains("/")){
+            log.info("oldDataSource格式错误:{}",oldDataSource);
+            return null;
+        }
+
+        String time = com.fdkankan.common.util.DateUtil.date2String(new Date(), com.fdkankan.common.util.DateUtil.YYYYMMDDHHMMSSSSS_DATA_FORMAT);
+        String[] split = oldDataSource.split("/");
+        if(split.length == 6 ){
+            String oldFileId = split[4];
+            Long fileId = new SnowflakeIdGenerator(1,1).nextId();
+            newDataSource = oldDataSource.replace(oldFileId,fileId.toString());
+
+            String snCodeTime = split[5];
+            if(!snCodeTime.contains("_") || snCodeTime.split("_").length <= 1){
+                log.info("oldDataSource格式错误:{}",oldDataSource);
+            }
+            newDataSource = newDataSource.replace(snCodeTime.split("_")[1],time);
+            //this.copyFdage(oldDataSource,newDataSource,time);
+        }
+        if(newDataSource == null){
+            log.info("newDataSource格式错误:{}",newDataSource);
+        }
+        return newDataSource;
+    }
+
+
+    public  void createNewQrCode(String sceneVersion,String logoPath ,String newNum, String webSite){
+        String localLogoPath = null;
+        try {
+            if(StringUtils.isNotBlank(logoPath)){
+                if(sceneVersion.equals(SceneVersionType.V3.code())){
+                    localLogoPath = SceneResourcePath.nasBasePath + logoPath;
+                }else{
+                    localLogoPath = SceneResourcePath.qrCodeBasePath + newNum +"/logo/logo.png";
+                    fYunFileServiceInterface.downloadFile(logoPath,localLogoPath);
+                }
+            }
+            String outPathZh = SceneResourcePath.qrCodeBasePath + newNum + ".png";
+            String outPathEn = SceneResourcePath.qrCodeBasePath + newNum + "_en.png";
+            QrConfig qrConfig = QrConfig.create();
+            qrConfig.setWidth(1024);
+            qrConfig.setHeight(1024);
+            if(!ObjectUtils.isEmpty(localLogoPath)){
+                qrConfig.setImg(localLogoPath);
+            }
+            QrCodeUtil.generate(webSite, qrConfig, FileUtil.file(outPathZh));
+            QrCodeUtil.generate(webSite + "&lang=en", qrConfig, FileUtil.file(outPathEn));
+
+            fYunFileServiceInterface.uploadFile(outPathZh, String.format(SceneResourcePath.DOWNLOADS_QRCODE, newNum) + newNum + ".png");
+            fYunFileServiceInterface.uploadFile(outPathEn, String.format(SceneResourcePath.DOWNLOADS_QRCODE, newNum) + newNum + "_en.png");
+        }catch (Exception e){
+            log.info("copy-scene-error:{},newNum:{},error:{}",newNum,e);
+        }
+
+    }
+
+
+    public void updateNasSceneJson(String targetPath, String oldNum, String newNum,String newSceneName,String sceneVersion,String fileName) {
+        String fileContent = null;
+        if("v3".equals(sceneVersion)){
+            String localPath = SceneResourcePath.nasBasePath + targetPath + "/" + fileName;
+            File file = new File(localPath);
+            if(!file.exists()){
+                log.error("sceneCopy-error--localFileExist:localPath:{},oldNum:{},newNum:{}",localPath,oldNum,newNum);
+                return;
+            }
+            fileContent = FileUtil.readUtf8String(file);
+        }
+        if("v4".equals(sceneVersion)){
+            String ossStatusJsonPath =  targetPath + "/" + fileName;
+            if(!fYunFileServiceInterface.fileExist(ossStatusJsonPath)){
+                log.error("sceneCopy-error--ossFileExist:targetPath:{},oldNum:{},newNum:{}",ossStatusJsonPath,oldNum,newNum);
+                return;
+            }
+            fileContent = fYunFileServiceInterface.getFileContent(ossStatusJsonPath);
+        }
+
+        if(StringUtils.isNotBlank(fileContent)){
+            //v3编辑器使用
+            String localPath = SceneResourcePath.nasBasePath + targetPath +"/" + fileName;
+            File file = new File(localPath);
+            if(!file.getParentFile().exists()){
+                file.getParentFile().mkdirs();
+            }
+            String newJson = fileContent.replaceAll(oldNum,newNum);
+            try {
+                if("v3".equals(sceneVersion)){
+                    if(fileName.contains("scene.json")){
+                        JSONObject jsonObject = JSONObject.parseObject(newJson);
+                        jsonObject.put("sceneName",newSceneName);
+                        FileUtils.writeFile(localPath ,jsonObject.toJSONString());
+                        String sceneJsonPath = String.format(SceneResourcePath.dataPath+"/"+fileName, newNum);
+                        fYunFileServiceInterface.uploadFile(localPath, sceneJsonPath);
+                    }else {
+                        FileUtils.writeFile(localPath ,newJson);
+                    }
+
+                }
+                if("v4".equals(sceneVersion)){
+                    JSONObject jsonObject = JSONObject.parseObject(newJson);
+                    jsonObject.put("title",newSceneName);
+                    jsonObject.put("dynamicPanel",0);
+                    FileUtils.writeFile(localPath, jsonObject.toJSONString());
+
+                    String sceneJsonPath = String.format(SceneResourcePath.DATA_VIEW_PATH+"/" + fileName, newNum);
+                    fYunFileServiceInterface.uploadFile(localPath, sceneJsonPath);
+
+                    //修改图片名称
+                    String filePath = String.format(SceneResourcePath.USER_VIEW_PATH, newNum) ;
+                    List<String> files = fYunFileServiceInterface.listRemoteFiles(filePath);
+                    for (String ossFilePath : files) {
+                        if(ossFilePath.contains(oldNum)){
+                            String oldName = ossFilePath;
+                            ossFilePath = ossFilePath.replace(oldNum,newNum);
+                            fYunFileServiceInterface.copyFileInBucket(oldName,ossFilePath);
+                            fYunFileServiceInterface.deleteFile(oldName);
+                        }
+                    }
+                    String dynamicViewPath = String.format(SceneResourcePath.DYNAMIC_VIEW_PATH, newNum);
+                    String dynamicEditPath = String.format(SceneResourcePath.DYNAMIC_EDIT_PATH, newNum);
+                    if(fYunFileServiceInterface.fileExist(dynamicViewPath)){
+                        fYunFileServiceInterface.deleteFile(dynamicViewPath);
+                    }
+                    if(fYunFileServiceInterface.fileExist(dynamicEditPath)){
+                        fYunFileServiceInterface.deleteFile(dynamicEditPath);
+                    }
+
+                }
+            }catch (Exception e){
+                log.error("writeFile-error:{}",e);
+            }
+
+        }
+
+    }
+
+
+    public void updateOssJson(String targetPath,String oldNum, String newNum,String fileName) {
+        String ossStatusJsonPath =  targetPath + "/" + fileName;
+
+        if(!fYunFileServiceInterface.fileExist(ossStatusJsonPath)){
+            log.error("sceneCopy-error--ossFileExist:targetPath:{},oldNum:{},newNum:{}",ossStatusJsonPath,oldNum,newNum);
+            return;
+        }
+        String localPath = SceneResourcePath.nasBasePath + ossStatusJsonPath;
+        File file = new File(localPath);
+        if(!file.getParentFile().exists()){
+            file.getParentFile().mkdirs();
+        }
+        String fileContent = fYunFileServiceInterface.getFileContent(ossStatusJsonPath);
+        if(StringUtils.isNotBlank(fileContent)){
+            String newJson = fileContent.replaceAll(oldNum,newNum);
+            try {
+                FileUtils.writeFile(localPath, newJson);
+                fYunFileServiceInterface.uploadFile(localPath,ossStatusJsonPath);
+            }catch (Exception e){
+                log.error("writeFile-error:{}",e);
+            }
+        }
+
+    }
+
+    private void copyOssAndNasV3(String oldNum ,String newNum ,String sourcePath,String targetPath){
+        log.info("sceneCopy-ossSource-oldNum:{},newNum:{},sourcePath:{},targetPath:{}",oldNum,newNum,sourcePath,targetPath);
+        fYunFileServiceInterface.copyFileInBucket(sourcePath,targetPath);
+        File fileData = new File(SceneResourcePath.nasBasePath + sourcePath);
+        if(fileData.exists()){
+            if(targetPath.contains("images")){
+                this.delLink(fileData.getPath());
+            }
+            cn.hutool.core.io.FileUtil.copyContent(fileData,new File(SceneResourcePath.nasBasePath + targetPath),true);
+        }
+    }
+    private  void copyOssAndNasV4(String oldNum,String newNum){
+        // 拷贝场景编辑资源
+        String oldEditPath = String.format(SceneResourcePath.EDIT_PATH_v4, oldNum);
+        String newEditPath = String.format(SceneResourcePath.EDIT_PATH_v4, newNum);
+        fYunFileServiceInterface.copyFileInBucket(oldEditPath, newEditPath);
+
+        // 拷贝场景展示资源
+        String oldViewPath = String.format(SceneResourcePath.VIEW_PATH_v4, oldNum);
+        String newViewPath = String.format(SceneResourcePath.VIEW_PATH_v4, newNum);
+        fYunFileServiceInterface.copyFileInBucket(oldViewPath, newViewPath);
+
+        //复制计算结果文件
+        String oldResultPath = String.format(SceneResourcePath.SCENE_RESULT_DATA_PATH, oldNum);
+        String newResultPath = String.format(SceneResourcePath.SCENE_RESULT_DATA_PATH, newNum);
+        fYunFileServiceInterface.copyFileInBucket(oldResultPath, newResultPath);
+
+        // 拷贝本地资源
+        String oldPath = SceneResourcePath.nasBasePath + oldNum;
+        String newPath = SceneResourcePath.nasBasePath + newNum;
+        if(new File(oldPath).exists()){
+            FileUtil.copyContent(new File(oldPath), new File(newPath),true);
+        }
+        String oldPath_v4 = SceneResourcePath.nasBasePath_v4 + oldNum;
+        String newPath_v4 = SceneResourcePath.nasBasePath_v4 + newNum;
+        if(new File(oldPath_v4).exists()){
+            FileUtil.copyContent(new File(oldPath_v4), new File(newPath_v4),true);
+        }
+    }
+
+
+    public void delLink(String path) {
+        String panPath = path +"/panorama";
+        File file = new File(panPath);
+        if(file.exists()){
+            File[] files = file.listFiles();
+            if(files == null || files.length == 0){
+                return;
+            }
+            for (File file1 : files) {
+                String linkPath =file1.getPath() + "/capture";
+                log.info("delLink--filePath:{}",linkPath);
+                org.apache.commons.io.FileUtils.deleteQuietly(new File(linkPath));
+            }
+        }
+    }
+
+}

+ 32 - 0
src/main/java/com/fdkankan/scene/service/impl/SceneProEditServiceImpl.java

@@ -0,0 +1,32 @@
+package com.fdkankan.scene.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.scene.entity.SceneProEdit;
+import com.fdkankan.scene.mapper.ISceneProEditMapper;
+import com.fdkankan.scene.service.ISceneProEditService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * pro场景编辑数据表 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-31
+ */
+@Service
+public class SceneProEditServiceImpl extends ServiceImpl<ISceneProEditMapper, SceneProEdit> implements ISceneProEditService {
+
+    public SceneProEdit getByProId(Long proId) {
+        LambdaQueryWrapper<SceneProEdit> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(SceneProEdit::getProId,proId);
+        List<SceneProEdit> list = this.list(wrapper);
+        if(list != null && list.size() >0){
+            return list.get(0);
+        }
+        return null;
+    }
+}

+ 13 - 0
src/main/resources/mapper/scene/FolderSceneMapper.xml

@@ -0,0 +1,13 @@
+<?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.IFolderSceneMapper">
+
+    <select id="getByType" resultType="com.fdkankan.scene.entity.FolderScene">
+        SELECT b.* from t_folder a left join t_folder_scene b on a.id = b.folder_id
+        where  b.rec_status ='A' and b.scene_id = #{sceneId}
+        <if test= 'type != null'>
+            and a.type = #{type}
+        </if>
+        limit 1
+    </select>
+</mapper>

+ 5 - 0
src/main/resources/mapper/scene/SceneProEditMapper.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.ISceneProEditMapper">
+
+</mapper>