浏览代码

场景中心业务代码迁移

dengsixing 3 年之前
父节点
当前提交
a31c2e63f5

+ 21 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/controller/PicSceneProgressController.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 2022-01-14
+ */
+@RestController
+@RequestMapping("/scene/picSceneProgress")
+public class PicSceneProgressController {
+
+}
+

+ 21 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/controller/VideoSceneProgressController.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 2022-01-14
+ */
+@RestController
+@RequestMapping("/scene/videoSceneProgress")
+public class VideoSceneProgressController {
+
+}
+

+ 111 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/PicSceneProgress.java

@@ -0,0 +1,111 @@
+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 2022-01-14
+ */
+@Getter
+@Setter
+@TableName("t_pic_scene_progress")
+public class PicSceneProgress implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 大场景序号
+     */
+    @TableField("scene_code")
+    private String sceneCode;
+
+    /**
+     * 重算开始时间(进入队列)
+     */
+    @TableField("rebuild_queue_start_time")
+    private Date rebuildQueueStartTime;
+
+    /**
+     * 重算开始时间
+     */
+    @TableField("rebuild_start_time")
+    private Date rebuildStartTime;
+
+    /**
+     * 重算结束时间
+     */
+    @TableField("rebuild_end_time")
+    private Date rebuildEndTime;
+
+    /**
+     * 视频名称
+     */
+    @TableField("video_name")
+    private String videoName;
+
+    /**
+     * 原场景路径
+     */
+    @TableField("data_source")
+    private String dataSource;
+
+    /**
+     * 重算结果  0-失败,1-成功 2-等待 3-重算中  9-成功且轮询过
+     */
+    @TableField("rebuild_result")
+    private Integer rebuildResult;
+
+    /**
+     * 重算参数
+     */
+    @TableField("rebuild_param")
+    private String rebuildParam;
+
+    /**
+     * videos_hdr_param 参数
+     */
+    @TableField("hdr_param")
+    private String hdrParam;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+    /**
+     * 记录的状态,A: 生效,I: 禁用
+     */
+    @TableField("rec_status")
+    private String recStatus;
+
+    /**
+     * 更新时间
+     */
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * 0-有效,1-删除
+     */
+    @TableField("tb_status")
+    @TableLogic
+    private Integer tbStatus;
+
+
+}

+ 111 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/entity/VideoSceneProgress.java

@@ -0,0 +1,111 @@
+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 2022-01-14
+ */
+@Getter
+@Setter
+@TableName("t_video_scene_progress")
+public class VideoSceneProgress implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 大场景序号
+     */
+    @TableField("scene_code")
+    private String sceneCode;
+
+    /**
+     * 重算开始时间(进入队列)
+     */
+    @TableField("rebuild_queue_start_time")
+    private Date rebuildQueueStartTime;
+
+    /**
+     * 重算开始时间
+     */
+    @TableField("rebuild_start_time")
+    private Date rebuildStartTime;
+
+    /**
+     * 重算结束时间
+     */
+    @TableField("rebuild_end_time")
+    private Date rebuildEndTime;
+
+    /**
+     * 视频名称
+     */
+    @TableField("video_name")
+    private String videoName;
+
+    /**
+     * 原场景路径
+     */
+    @TableField("data_source")
+    private String dataSource;
+
+    /**
+     * 重算结果  0-失败,1-成功,2-等待, 3-重算中,9-成功且轮询过
+     */
+    @TableField("rebuild_result")
+    private Integer rebuildResult;
+
+    /**
+     * 重算参数
+     */
+    @TableField("rebuild_param")
+    private String rebuildParam;
+
+    /**
+     * videos_hdr_param 参数
+     */
+    @TableField("hdr_param")
+    private String hdrParam;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+    /**
+     * 记录的状态,A: 生效,I: 禁用
+     */
+    @TableField("rec_status")
+    private String recStatus;
+
+    /**
+     * 更新时间
+     */
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * 0-有效,1-删除
+     */
+    @TableField("tb_status")
+    @TableLogic
+    private Integer tbStatus;
+
+
+}

+ 18 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/IPicSceneProgressMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.scene.mapper;
+
+import com.fdkankan.scene.entity.PicSceneProgress;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 视频重算进度 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2022-01-14
+ */
+@Mapper
+public interface IPicSceneProgressMapper extends BaseMapper<PicSceneProgress> {
+
+}

+ 18 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/mapper/IVideoSceneProgressMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.scene.mapper;
+
+import com.fdkankan.scene.entity.VideoSceneProgress;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 视频重算进度 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2022-01-14
+ */
+@Mapper
+public interface IVideoSceneProgressMapper extends BaseMapper<VideoSceneProgress> {
+
+}

+ 31 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/IPicSceneProgressService.java

@@ -0,0 +1,31 @@
+package com.fdkankan.scene.service;
+
+import com.fdkankan.common.response.ResultData;
+import com.fdkankan.scene.entity.PicSceneProgress;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.scene.vo.RebuildVedioSceneParamVO;
+import com.fdkankan.scene.vo.VideoSceneProgressVO;
+
+/**
+ * <p>
+ * 视频重算进度 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2022-01-14
+ */
+public interface IPicSceneProgressService extends IService<PicSceneProgress> {
+
+    VideoSceneProgressVO findPicSceneProgress(RebuildVedioSceneParamVO param);
+
+    void updateProgressRec(RebuildVedioSceneParamVO param);
+
+    PicSceneProgress findrebuildVideoProgressDetail (String num,String panId );
+
+    void updateProgress(String num,String panId,Integer status);
+
+    void updatePageView(String sceneCode);
+
+    ResultData rebuildPicSceneProgress(RebuildVedioSceneParamVO param) throws Exception;
+
+}

+ 31 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/IVideoSceneProgressService.java

@@ -0,0 +1,31 @@
+package com.fdkankan.scene.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.common.response.ResultData;
+import com.fdkankan.scene.entity.VideoSceneProgress;
+import com.fdkankan.scene.vo.RebuildVedioSceneParamVO;
+import com.fdkankan.scene.vo.VideoSceneProgressVO;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 视频重算进度 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2022-01-14
+ */
+public interface IVideoSceneProgressService extends IService<VideoSceneProgress> {
+
+    List<VideoSceneProgressVO> findVideoSceneProgress(RebuildVedioSceneParamVO param);
+
+    void updateProgressRec(RebuildVedioSceneParamVO param);
+
+    VideoSceneProgress findrebuildVideoProgressDetail (String num,String panId );
+
+    void updateProgress(String num,String panId,Integer status);
+
+    ResultData rebuildVideoSceneProgress(RebuildVedioSceneParamVO param) throws Exception;
+
+}

+ 102 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/PicSceneProgressServiceImpl.java

@@ -0,0 +1,102 @@
+package com.fdkankan.scene.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.constant.RebuildResult;
+import com.fdkankan.common.constant.RecStatus;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.response.ResultData;
+import com.fdkankan.scene.entity.PicSceneProgress;
+import com.fdkankan.scene.entity.ScenePro;
+import com.fdkankan.scene.mapper.IPicSceneProgressMapper;
+import com.fdkankan.scene.service.IPicSceneProgressService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.scene.service.ISceneProService;
+import com.fdkankan.scene.vo.RebuildVedioSceneParamVO;
+import com.fdkankan.scene.vo.VideoSceneProgressVO;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Calendar;
+import java.util.List;
+
+/**
+ * <p>
+ * 视频重算进度 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2022-01-14
+ */
+@Service
+public class PicSceneProgressServiceImpl extends ServiceImpl<IPicSceneProgressMapper, PicSceneProgress> implements IPicSceneProgressService {
+
+    @Autowired
+    ISceneProService sceneProService;
+
+    @Override
+    public VideoSceneProgressVO findPicSceneProgress(RebuildVedioSceneParamVO param) {
+        List<PicSceneProgress> list = this.list(
+                new LambdaQueryWrapper<PicSceneProgress>()
+                        .eq(PicSceneProgress::getRecStatus, RecStatus.VALID.code())
+                        .eq(PicSceneProgress::getSceneCode, param.getSceneNum()));
+        VideoSceneProgressVO videoSceneProgressVO = new VideoSceneProgressVO();
+        BeanUtils.copyProperties(list.get(0), videoSceneProgressVO);
+        //更新访问量
+        this.updatePageView(param.getSceneNum());
+
+        return videoSceneProgressVO;
+    }
+
+    @Override
+    public void updateProgressRec(RebuildVedioSceneParamVO param) {
+        this.update(new LambdaUpdateWrapper<PicSceneProgress>()
+                .set(PicSceneProgress::getRecStatus, RecStatus.DISABLE.code())
+                .eq(PicSceneProgress::getSceneCode, param.getSceneNum()));
+    }
+
+    @Override
+    public PicSceneProgress findrebuildVideoProgressDetail(String num,String panId) {
+        PicSceneProgress picSceneProgress = this.getOne(new LambdaQueryWrapper<PicSceneProgress>()
+                .eq(PicSceneProgress::getRecStatus, RecStatus.VALID.code())
+                .eq(PicSceneProgress::getSceneCode, num));
+        return picSceneProgress;
+    }
+
+    @Override
+    public void updateProgress(String num, String panId, Integer status) {
+        this.update(new LambdaUpdateWrapper<PicSceneProgress>()
+                .set(PicSceneProgress::getRebuildResult, status)
+                .set(PicSceneProgress::getRebuildEndTime, Calendar.getInstance().getTime())
+                .eq(PicSceneProgress::getSceneCode, num)
+                .eq(PicSceneProgress::getRecStatus, RecStatus.VALID.code()));
+    }
+
+    @Override
+    public void updatePageView(String sceneCode) {
+        this.update(new LambdaUpdateWrapper<PicSceneProgress>()
+                .set(PicSceneProgress::getRebuildResult, RebuildResult.POLLED.code())
+                .eq(PicSceneProgress::getSceneCode, sceneCode)
+                .eq(PicSceneProgress::getRecStatus, RecStatus.VALID.code())
+                .eq(PicSceneProgress::getRebuildResult, RebuildResult.SUCCESS.code()));
+    }
+
+    public ResultData rebuildPicSceneProgress(RebuildVedioSceneParamVO param) throws Exception {
+
+        if(StringUtils.isEmpty(param.getSceneNum())){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
+        }
+
+        ScenePro sceneProEntity = sceneProService.findBySceneNum(param.getSceneNum());
+        if(null == sceneProEntity){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+
+        VideoSceneProgressVO picSceneProgress =this.findPicSceneProgress(param);
+        return ResultData.ok(picSceneProgress.getRebuildResult());
+    }
+
+}

+ 111 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/VideoSceneProgressServiceImpl.java

@@ -0,0 +1,111 @@
+package com.fdkankan.scene.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.constant.RebuildResult;
+import com.fdkankan.common.constant.RecStatus;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.response.ResultData;
+import com.fdkankan.scene.entity.ScenePro;
+import com.fdkankan.scene.entity.VideoSceneProgress;
+import com.fdkankan.scene.mapper.IVideoSceneProgressMapper;
+import com.fdkankan.scene.service.ISceneProService;
+import com.fdkankan.scene.service.IVideoSceneProgressService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.scene.vo.RebuildVedioSceneParamVO;
+import com.fdkankan.scene.vo.VideoSceneProgressVO;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Calendar;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 视频重算进度 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2022-01-14
+ */
+@Service
+public class VideoSceneProgressServiceImpl extends ServiceImpl<IVideoSceneProgressMapper, VideoSceneProgress> implements IVideoSceneProgressService {
+
+    @Autowired
+    private ISceneProService sceneProService;
+
+    @Override
+    public List<VideoSceneProgressVO> findVideoSceneProgress(RebuildVedioSceneParamVO param) {
+
+        List<VideoSceneProgress> videoSceneProgressyList =
+                this.list(new LambdaQueryWrapper<VideoSceneProgress>()
+                        .select(VideoSceneProgress::getId, VideoSceneProgress::getVideoName, VideoSceneProgress::getRebuildResult)
+                        .eq(VideoSceneProgress::getRecStatus, RecStatus.VALID.code())
+                        .eq(VideoSceneProgress::getSceneCode, param.getSceneNum()));
+
+        List<VideoSceneProgressVO> result = videoSceneProgressyList.parallelStream().map(vsp -> {
+            VideoSceneProgressVO vo = new VideoSceneProgressVO();
+            BeanUtils.copyProperties(vsp, vo);
+            return vo;
+        }).collect(Collectors.toList());
+
+        this.update(new LambdaUpdateWrapper<VideoSceneProgress>()
+                .set(VideoSceneProgress::getRebuildResult, RebuildResult.POLLED.code())
+                .eq(VideoSceneProgress::getSceneCode, param.getSceneNum())
+                .eq(VideoSceneProgress::getRecStatus, RecStatus.VALID.code())
+                .eq(VideoSceneProgress::getRebuildResult, RebuildResult.SUCCESS.code()));
+
+        //更新访问量
+        return result;
+    }
+
+    @Override
+    public void updateProgressRec(RebuildVedioSceneParamVO param) {
+        this.update(new LambdaUpdateWrapper<VideoSceneProgress>()
+                .set(VideoSceneProgress::getRecStatus, RecStatus.DISABLE.code())
+                .eq(VideoSceneProgress::getSceneCode, param.getSceneNum())
+                .eq(VideoSceneProgress::getVideoName, param.getPanoId()));
+    }
+
+    @Override
+    public VideoSceneProgress findrebuildVideoProgressDetail(String num,String panId) {
+        VideoSceneProgress videoSceneProgress =
+                this.getOne(new LambdaQueryWrapper<VideoSceneProgress>()
+                        .eq(VideoSceneProgress::getRecStatus, RecStatus.VALID.code())
+                        .eq(VideoSceneProgress::getSceneCode, num)
+                        .eq(VideoSceneProgress::getVideoName, panId));
+        return videoSceneProgress;
+    }
+
+    @Override
+    public void updateProgress(String num, String panId, Integer status) {
+
+        this.update(new LambdaUpdateWrapper<VideoSceneProgress>()
+                .set(VideoSceneProgress::getRebuildResult, status)
+                .set(VideoSceneProgress::getRebuildEndTime, Calendar.getInstance().getTime())
+                .eq(VideoSceneProgress::getSceneCode, num)
+                .eq(VideoSceneProgress::getRecStatus, RecStatus.VALID.code())
+                .eq(VideoSceneProgress::getVideoName, panId));
+
+    }
+
+    public ResultData rebuildVideoSceneProgress(RebuildVedioSceneParamVO param) throws Exception {
+
+        if(StringUtils.isEmpty(param.getSceneNum())){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
+        }
+
+        ScenePro scenePro = sceneProService.findBySceneNum(param.getSceneNum());
+        if(null == scenePro){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+        }
+
+        return ResultData.ok(this.findVideoSceneProgress(param));
+    }
+
+
+}

+ 5 - 0
4dkankan-center-scene/src/main/resources/mapper/scene/PicSceneProgressMapper.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.IPicSceneProgressMapper">
+
+</mapper>

+ 5 - 0
4dkankan-center-scene/src/main/resources/mapper/scene/VideoSceneProgressMapper.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.IVideoSceneProgressMapper">
+
+</mapper>