Browse Source

监控摄像:获取设置点位及点位状态

zhj 2 years ago
parent
commit
3d2db7f064

+ 64 - 0
src/main/java/com/welampiot/controller/VideoController.java

@@ -7,13 +7,16 @@ import com.welampiot.common.BaseResult;
 import com.welampiot.common.Constant;
 import com.welampiot.common.InterfaceResultEnum;
 import com.welampiot.dto.VideoMonitorDTO;
+import com.welampiot.dto.VideoPointInfoDTO;
 import com.welampiot.service.SystemConfigService;
 import com.welampiot.service.VideoMonitorService;
+import com.welampiot.service.VideoPointInfoService;
 import com.welampiot.utils.ToolUtils;
 import com.welampiot.utils.VideoUtil;
 import com.welampiot.utils.WebUtils;
 import com.welampiot.vo.VideoMonitorDetailVO;
 import com.welampiot.vo.VideoMonitorVO;
+import com.welampiot.vo.VideoPointInfoVO;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
@@ -42,6 +45,10 @@ public class VideoController {
 
     @Autowired
     private SystemConfigService systemConfigService;
+
+    @Autowired
+    private VideoPointInfoService videoPointInfoService;
+
     /**
      * 设置AI开关状态
      * @param request
@@ -344,4 +351,61 @@ public class VideoController {
         }
         return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
     }
+
+    /**
+     * 获取视屏监控点位信息
+     * @param vo id
+     * @return 获取视屏监控点位信息
+     */
+    @RequestMapping(value = "/getPointInfo", method = RequestMethod.POST)
+    public BaseResult<?> getPointInfo(VideoPointInfoVO vo) {
+        if (vo.getVersion() == null) vo.setVersion(0);
+        Integer version = vo.getVersion();
+        Integer id = vo.getId();
+        if (id == null || id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        List<VideoPointInfoDTO> videoPointList = videoPointInfoService.getVideoPointListByVideoId(id);
+        VideoPointInfoVO videoPointInfoVO = new VideoPointInfoVO();
+        videoPointInfoVO.setList(videoPointList);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,videoPointInfoVO);
+    }
+
+    /**
+     * 设置点位信息
+     * @param vo 点位属性
+     * @return 设置点位信息
+     */
+    @RequestMapping(value = "/setPointInfo", method = RequestMethod.POST)
+    public BaseResult<?> setPointInfo(VideoPointInfoVO vo) {
+        if (vo.getVersion() == null) vo.setVersion(0);
+        Integer version = vo.getVersion();
+        Integer point = vo.getPoint();
+        Integer time = vo.getTime();
+        Integer videoId = vo.getVideoId();
+        if (point == null || time == null || videoId == null)
+            return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        VideoPointInfoDTO videoPointInfoDTO = new VideoPointInfoDTO();
+        BeanUtils.copyProperties(vo,videoPointInfoDTO);
+        videoPointInfoService.addVideoPointData(videoPointInfoDTO);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
+
+    /**
+     * 设置点位状态
+     * @param vo 点位属性
+     * @return 设置点位状态
+     */
+    @RequestMapping(value = "/setPointStatus", method = RequestMethod.POST)
+    public BaseResult<?> setPointStatus(VideoPointInfoVO vo) {
+        if (vo.getVersion() == null) vo.setVersion(0);
+        Integer version = vo.getVersion();
+        Integer point = vo.getPoint();
+        Integer status = vo.getStatus();
+        Integer videoId = vo.getVideoId();
+        if (point == null || status == null || videoId == null)
+            return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        VideoPointInfoDTO videoPointInfoDTO = new VideoPointInfoDTO();
+        BeanUtils.copyProperties(vo,videoPointInfoDTO);
+        videoPointInfoService.updateVideoPointStatus(videoPointInfoDTO);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
 }

+ 23 - 0
src/main/java/com/welampiot/dao/VideoPointInfoDao.java

@@ -0,0 +1,23 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.VideoPointInfoDTO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * ClassName: VideoPointInfoDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/24 - 14:23
+ * @Version: v1.0
+ */
+public interface VideoPointInfoDao {
+    List<VideoPointInfoDTO> getVideoPointListByVideoId(@Param("videoId") Integer videoId);
+
+    void addVideoPointData(VideoPointInfoDTO dto);
+
+    void updateVideoPointStatus(VideoPointInfoDTO dto);
+}

+ 29 - 0
src/main/java/com/welampiot/dto/VideoPointInfoDTO.java

@@ -0,0 +1,29 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * ClassName: VideoPointInfoDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/24 - 14:15
+ * @Version: v1.0
+ */
+@Data
+public class VideoPointInfoDTO implements Serializable {
+    private Integer id;
+
+    private Integer videoId;
+
+    private Integer point; // 点位值(1,2,3,4)
+
+    private Integer status; // 点位状态(0 启用,1 禁用)
+
+    private Integer index; // 萤石云点位
+
+    private Integer time; // 点位停留时间(min)
+}

+ 22 - 0
src/main/java/com/welampiot/service/VideoPointInfoService.java

@@ -0,0 +1,22 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.VideoPointInfoDTO;
+
+import java.util.List;
+
+/**
+ * ClassName: VideoPointInfoService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/24 - 14:24
+ * @Version: v1.0
+ */
+public interface VideoPointInfoService {
+    List<VideoPointInfoDTO> getVideoPointListByVideoId(Integer videoId);
+
+    void addVideoPointData(VideoPointInfoDTO dto);
+
+    void updateVideoPointStatus(VideoPointInfoDTO dto);
+}

+ 38 - 0
src/main/java/com/welampiot/service/VideoPointInfoServiceImpl.java

@@ -0,0 +1,38 @@
+package com.welampiot.service;
+
+import com.welampiot.dao.VideoPointInfoDao;
+import com.welampiot.dto.VideoPointInfoDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * ClassName: VideoPointInfoServiceImpl
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/24 - 14:25
+ * @Version: v1.0
+ */
+@Service
+public class VideoPointInfoServiceImpl implements VideoPointInfoService{
+    @Autowired
+    private VideoPointInfoDao videoPointInfoDao;
+
+    @Override
+    public List<VideoPointInfoDTO> getVideoPointListByVideoId(Integer videoId) {
+        return videoPointInfoDao.getVideoPointListByVideoId(videoId);
+    }
+
+    @Override
+    public void addVideoPointData(VideoPointInfoDTO dto) {
+        videoPointInfoDao.addVideoPointData(dto);
+    }
+
+    @Override
+    public void updateVideoPointStatus(VideoPointInfoDTO dto) {
+        videoPointInfoDao.updateVideoPointStatus(dto);
+    }
+}

+ 33 - 0
src/main/java/com/welampiot/vo/VideoPointInfoVO.java

@@ -0,0 +1,33 @@
+package com.welampiot.vo;
+
+import com.welampiot.dto.VideoPointInfoDTO;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: VideoPointInfoVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/24 - 14:27
+ * @Version: v1.0
+ */
+@Data
+public class VideoPointInfoVO implements Serializable {
+    private Integer id;
+
+    private Integer version;
+
+    private Integer videoId;
+
+    private Integer status;
+
+    private Integer point;
+
+    private Integer time;
+
+    private List<VideoPointInfoDTO> list;
+}

+ 24 - 0
src/main/resources/mapper/VideoPointInfoMapper.xml

@@ -0,0 +1,24 @@
+<?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.welampiot.dao.VideoPointInfoDao">
+
+    <select id="getVideoPointListByVideoId" resultType="VideoPointInfoDTO">
+        select v.id,v.point,v.status,v.time
+        from video_point_info v
+        where v.videoid = #{videoId}
+    </select>
+
+    <insert id="addVideoPointData" parameterType="VideoPointInfoDTO" keyProperty="id" useGeneratedKeys="true">
+        INSERT INTO video_point_info(videoid, `point`, `time`)
+        VALUES (#{videoId},#{point},#{time})
+    </insert>
+
+    <update id="updateVideoPointStatus" parameterType="VideoPointInfoDTO">
+        update video_point_info v
+        set
+            v.status = #{status},
+            v.point = #{point}
+        where v.videoid = #{videoId}
+    </update>
+
+</mapper>