视频监控

This commit is contained in:
cwchen 2024-04-01 19:02:08 +08:00
parent c8492a928a
commit 1feb8ab8bc
8 changed files with 184 additions and 2 deletions

View File

@ -0,0 +1,31 @@
package com.securitycontrol.entity.screen.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @authorcwchen
* @date2024-04-01-10:09
* @version1.0
* @descriptionDtree实体类
*/
@Data
public class DtreeVo {
@ApiModelProperty("id")
private String id;
@ApiModelProperty("名称")
private String title;
@ApiModelProperty("父ID")
private String parentId;
@ApiModelProperty("设备是否在线")
private String onLine;
@ApiModelProperty("层级")
private String level;
private boolean spread = true;
}

View File

@ -138,7 +138,7 @@
<select id="getPersonnelAccessLists" resultType="com.securitycontrol.entity.background.vo.UserAccessVo"> <select id="getPersonnelAccessLists" resultType="com.securitycontrol.entity.background.vo.UserAccessVo">
SELECT tua.user_name AS userName, SELECT tua.user_name AS userName,
tua.access_time AS accessTime, tua.access_time AS accessTime,
IF(access_type == '1','入场','出场') AS accessType IF(access_type = '1','入场','出场') AS accessType
FROM tb_user_access tua FROM tb_user_access tua
WHERE user_id = #{id} WHERE user_id = #{id}
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''"> <if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">

View File

@ -121,7 +121,7 @@
</select> </select>
<select id="getProCostList" resultType="com.securitycontrol.entity.screen.vo.ProCostVo"> <select id="getProCostList" resultType="com.securitycontrol.entity.screen.vo.ProCostVo">
SELECT pro.pro_name proName,tpc.cost ,tpc.remark,tpc.create_time createTime SELECT pro.pro_name proName,tpc.cost ,tpc.remark,tpc.create_time createTime,tpc.id
FROM tb_project_cost tpc FROM tb_project_cost tpc
left join tb_project pro on pro.bid_code=tpc.bid_code left join tb_project pro on pro.bid_code=tpc.bid_code
where pro.bid_code=#{bidCode} where pro.bid_code=#{bidCode}

View File

@ -0,0 +1,32 @@
package com.securitycontrol.screen.controller;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
import com.securitycontrol.screen.service.IVideoService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @authorcwchen
* @date2024-04-01-10:01
* @version1.0
* @description视频监控
*/
@RestController
@RequestMapping("/largeScreen/video/")
public class VideoController {
@Resource(name = "IVideoService")
private IVideoService service;
@ApiOperation(value = "视频树")
@GetMapping("getVideoTree")
public AjaxResult getVideoTree(ScreenParamDto dto){
return service.getVideoTree(dto);
}
}

View File

@ -0,0 +1,26 @@
package com.securitycontrol.screen.mapper;
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
import com.securitycontrol.entity.screen.vo.DtreeVo;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @authorcwchen
* @date2024-04-01-10:03
* @version1.0
* @description视频监控-数据库访问层
*/
@Repository(value = "IVideoMapper")
public interface IVideoMapper {
/**
* 视频列表获取
* @param dto
* @return List<DtreeVo>
* @description
* @author cwchen
* @date 2024/4/1 10:13
*/
List<DtreeVo> getVideoTree(ScreenParamDto dto);
}

View File

@ -0,0 +1,22 @@
package com.securitycontrol.screen.service;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
/**
* @authorcwchen
* @date2024-04-01-10:02
* @version1.0
* @description视频监控-业务层
*/
public interface IVideoService {
/**
* 视频列表获取
* @param dto
* @return AjaxResult
* @description
* @author cwchen
* @date 2024/4/1 10:11
*/
AjaxResult getVideoTree(ScreenParamDto dto);
}

View File

@ -0,0 +1,42 @@
package com.securitycontrol.screen.service.impl;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
import com.securitycontrol.entity.screen.vo.DtreeVo;
import com.securitycontrol.screen.mapper.IVideoMapper;
import com.securitycontrol.screen.service.IVideoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* @authorcwchen
* @date2024-04-01-10:03
* @version1.0
* @description视频监控业务逻辑层
*/
@Service(value = "IVideoService")
@Slf4j
public class VideoServiceImpl implements IVideoService {
@Resource(name = "IVideoMapper")
private IVideoMapper mapper;
@Override
public AjaxResult getVideoTree(ScreenParamDto dto) {
List<DtreeVo> list = new ArrayList<>();
try {
list = mapper.getVideoTree(dto);
List<DtreeVo> sortDataList = list.stream().sorted(Comparator.comparing(DtreeVo::getOnLine, Comparator.reverseOrder())).collect(Collectors.toList());
return AjaxResult.success(sortDataList);
} catch (Exception e) {
log.error("视频列表",e);
}
return AjaxResult.success(list);
}
}

View File

@ -0,0 +1,29 @@
<?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.securitycontrol.screen.mapper.IVideoMapper">
<!--视频列表获取-->
<select id="getVideoTree" resultType="com.securitycontrol.entity.screen.vo.DtreeVo">
(SELECT '0' AS id,'球机' AS title, '-1' AS parentId,'0' AS onLine,'1' AS level)
UNION ALL
(
SELECT CONCAT('QJ',td.device_code) AS id,
td.device_name AS title,
'0' AS parentId,
on_line AS onLine,
'2' AS level
FROM tb_device td
INNER JOIN t_class_metting tcm on td.device_code = tcm.puid AND tcm.work_day = CURRENT_DATE
WHERE td.del_flag = 0
<if test="param!=null and param!=''">
AND INSTR(td.device_name,#{param}) > 0
</if>
<if test="bidCode!=null and bidCode!=''">
AND INSTR(tcm.bid_code,#{bidCode}) > 0
</if>
<if test="bidCode==null or bidCode==''">
AND tcm.bid_code = '-1'
</if>
)
</select>
</mapper>