视频管理
This commit is contained in:
parent
3006962315
commit
ebeb51ea9b
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.bonus.web.controller.data;
|
||||||
|
|
||||||
|
import com.bonus.common.annotation.RequiresPermissions;
|
||||||
|
import com.bonus.common.annotation.SysLog;
|
||||||
|
import com.bonus.common.core.domain.AjaxResult;
|
||||||
|
import com.bonus.common.domain.data.dto.LineDto;
|
||||||
|
import com.bonus.common.domain.data.dto.ParamsDto;
|
||||||
|
import com.bonus.common.enums.OperaType;
|
||||||
|
import com.bonus.web.service.data.LineService;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @className:LineController
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2025-12-24-15:34
|
||||||
|
* @version:1.0
|
||||||
|
* @description:画线-web层
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/data/line")
|
||||||
|
public class LineController {
|
||||||
|
|
||||||
|
@Resource(name = "LineService")
|
||||||
|
private LineService lineService;
|
||||||
|
|
||||||
|
@ApiOperation(notes = "查询初始线的位置",value = "查询初始线的位置")
|
||||||
|
@RequiresPermissions("data:line:detail")
|
||||||
|
@GetMapping("/getLineDetail")
|
||||||
|
@SysLog(title = "设备管理", businessType = OperaType.QUERY, logType = 1, module = "设备管理->视频管理", details = "查询初始线的位置")
|
||||||
|
public AjaxResult getLineDetail(ParamsDto dto) {
|
||||||
|
return lineService.getLineDetail(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(notes = "更新画线位置",value = "更新画线位置")
|
||||||
|
@RequiresPermissions("data:line:update")
|
||||||
|
@PostMapping("/updateLine")
|
||||||
|
@SysLog(title = "设备管理", businessType = OperaType.UPDATE, logType = 1, module = "设备管理->视频管理", details = "更新画线位置")
|
||||||
|
public AjaxResult updateLine(@RequestBody LineDto dto) {
|
||||||
|
return lineService.updateLine(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(notes = "获取设备视频流",value = "获取设备视频流")
|
||||||
|
@RequiresPermissions("data:line:detail")
|
||||||
|
@GetMapping("/getVideoStream")
|
||||||
|
@SysLog(title = "设备管理", businessType = OperaType.QUERY, logType = 1, module = "设备管理->视频管理", details = "获取设备视频流")
|
||||||
|
public AjaxResult getVideoStreamAPI(ParamsDto dto) {
|
||||||
|
return lineService.getVideoStreamAPI(dto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
package com.bonus.web.service.data;
|
||||||
|
|
||||||
|
import com.bonus.common.core.domain.AjaxResult;
|
||||||
|
import com.bonus.common.domain.admin.dto.TeamDto;
|
||||||
|
import com.bonus.common.domain.data.dto.LineDto;
|
||||||
|
import com.bonus.common.domain.data.dto.ParamsDto;
|
||||||
|
import com.bonus.common.domain.data.vo.LineVo;
|
||||||
|
import com.bonus.common.domain.data.vo.StreamVo;
|
||||||
|
import com.bonus.common.utils.ValidatorsUtils;
|
||||||
|
import com.bonus.data.service.DILineService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @className:LineService
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2025-12-24-15:35
|
||||||
|
* @version:1.0
|
||||||
|
* @description:画线-业务逻辑层
|
||||||
|
*/
|
||||||
|
@Service(value = "LineService")
|
||||||
|
@Slf4j
|
||||||
|
public class LineService {
|
||||||
|
|
||||||
|
@Resource(name = "DILineService")
|
||||||
|
private DILineService lineService;
|
||||||
|
|
||||||
|
@Resource(name = "ValidatorsUtils")
|
||||||
|
private ValidatorsUtils validatorsUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询初始线的位置
|
||||||
|
* @param dto
|
||||||
|
* @return AjaxResult
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/12/24 15:41
|
||||||
|
*/
|
||||||
|
public AjaxResult getLineDetail(ParamsDto dto) {
|
||||||
|
LineVo vo = null;
|
||||||
|
try {
|
||||||
|
vo = lineService.getLineDetail(dto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新线的位置
|
||||||
|
* @param dto
|
||||||
|
* @return AjaxResult
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/12/24 16:11
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult updateLine(LineDto dto) {
|
||||||
|
// 校验数据是否合法
|
||||||
|
String validResult = validatorsUtils.valid(dto, LineDto.ADD.class);
|
||||||
|
if (StringUtils.isNotBlank(validResult)) {
|
||||||
|
return AjaxResult.error(validResult);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// 1.添加线的位置
|
||||||
|
lineService.addLineData(dto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.toString(), e);
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备视频流
|
||||||
|
* @param dto
|
||||||
|
* @return AjaxResult
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/12/24 16:29
|
||||||
|
*/
|
||||||
|
public AjaxResult getVideoStreamAPI(ParamsDto dto) {
|
||||||
|
StreamVo vo = null;
|
||||||
|
try {
|
||||||
|
vo = lineService.getVideoStreamAPI(dto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(vo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.bonus.common.domain.data.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @className:LineDto
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2025-12-24-15:32
|
||||||
|
* @version:1.0
|
||||||
|
* @description:画线-dto
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LineDto {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线id
|
||||||
|
*/
|
||||||
|
private Long lineId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统id
|
||||||
|
*/
|
||||||
|
private Long systemId = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始位置-X坐标
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "开始位置-X坐标不能为空", groups = {ADD.class})
|
||||||
|
@Length(max = 32, message = "开始位置-X坐标字符长度不能超过32", groups = {ADD.class})
|
||||||
|
private String startX;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始位置-Y坐标
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "开始位置-Y坐标不能为空", groups = {ADD.class})
|
||||||
|
@Length(max = 32, message = "开始位置-Y坐标字符长度不能超过32", groups = {ADD.class})
|
||||||
|
private String startY;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束位置-X坐标
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "结束位置-X坐标不能为空", groups = {ADD.class})
|
||||||
|
@Length(max = 32, message = "结束位置-X坐标字符长度不能超过32", groups = {ADD.class})
|
||||||
|
private String endX;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束位置-Y坐标
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "结束位置-Y坐标不能为空", groups = {ADD.class})
|
||||||
|
@Length(max = 32, message = "结束位置-Y坐标字符长度不能超过32", groups = {ADD.class})
|
||||||
|
private String endY;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画线时间
|
||||||
|
*/
|
||||||
|
private Date lineTime = new Date();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增条件限制
|
||||||
|
*/
|
||||||
|
public interface ADD {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -31,7 +31,7 @@ public class ParamsDto {
|
||||||
private String equipmentName;
|
private String equipmentName;
|
||||||
|
|
||||||
/**设备ID*/
|
/**设备ID*/
|
||||||
private Long systemId;
|
private Long systemId = 1L;
|
||||||
|
|
||||||
/**告警状态*/
|
/**告警状态*/
|
||||||
private String alarmStatus;
|
private String alarmStatus;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.bonus.common.domain.data.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @className:LineVo
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2025-12-24-15:32
|
||||||
|
* @version:1.0
|
||||||
|
* @description:画线-vo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LineVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* line_id
|
||||||
|
*/
|
||||||
|
private Long lineId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统id
|
||||||
|
*/
|
||||||
|
private Long systemId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
* */
|
||||||
|
private String equipmentName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备状态 1.在线/0.离线/2.待机/3.升级中
|
||||||
|
* */
|
||||||
|
private String equipmentStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始位置-X坐标
|
||||||
|
*/
|
||||||
|
private String startX;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始位置-Y坐标
|
||||||
|
*/
|
||||||
|
private String startY;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束位置-X坐标
|
||||||
|
*/
|
||||||
|
private String endX;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束位置-Y坐标
|
||||||
|
*/
|
||||||
|
private String endY;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画线时间
|
||||||
|
*/
|
||||||
|
private Date lineTime;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.bonus.common.domain.data.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @className:StreamVo
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2025-12-24-16:31
|
||||||
|
* @version:1.0
|
||||||
|
* @description:设备视频流-vo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StreamVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备视频流
|
||||||
|
* */
|
||||||
|
private String streamUrl;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.bonus.data.mapper;
|
||||||
|
|
||||||
|
import com.bonus.common.domain.data.dto.LineDto;
|
||||||
|
import com.bonus.common.domain.data.dto.ParamsDto;
|
||||||
|
import com.bonus.common.domain.data.vo.LineVo;
|
||||||
|
import com.bonus.common.domain.data.vo.StreamVo;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @className:DLineMapper
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2025-12-24-15:38
|
||||||
|
* @version:1.0
|
||||||
|
* @description:画线-数据层
|
||||||
|
*/
|
||||||
|
@Repository(value = "DLineMapper")
|
||||||
|
public interface DLineMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询初始线的位置
|
||||||
|
* @param dto
|
||||||
|
* @return LineVo
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/12/24 15:43
|
||||||
|
*/
|
||||||
|
LineVo getLineDetail(ParamsDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加线的位置
|
||||||
|
* @param dto
|
||||||
|
* @return void
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/12/24 16:12
|
||||||
|
*/
|
||||||
|
void addLineData(LineDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备视频流
|
||||||
|
* @param dto
|
||||||
|
* @return StreamVo
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/12/24 16:33
|
||||||
|
*/
|
||||||
|
StreamVo getVideoStreamAPI(ParamsDto dto);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.bonus.data.service;
|
||||||
|
|
||||||
|
import com.bonus.common.domain.data.dto.LineDto;
|
||||||
|
import com.bonus.common.domain.data.dto.ParamsDto;
|
||||||
|
import com.bonus.common.domain.data.vo.LineVo;
|
||||||
|
import com.bonus.common.domain.data.vo.StreamVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @className:DIlineService
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2025-12-24-15:35
|
||||||
|
* @version:1.0
|
||||||
|
* @description:画线-业务层
|
||||||
|
*/
|
||||||
|
public interface DILineService {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param dto
|
||||||
|
* @return LineVo
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/12/24 15:43
|
||||||
|
*/
|
||||||
|
LineVo getLineDetail(ParamsDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加线的位置
|
||||||
|
* @param dto
|
||||||
|
* @return void
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/12/24 16:12
|
||||||
|
*/
|
||||||
|
void addLineData(LineDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备视频流
|
||||||
|
* @param dto
|
||||||
|
* @return StreamVo
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/12/24 16:33
|
||||||
|
*/
|
||||||
|
StreamVo getVideoStreamAPI(ParamsDto dto);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.bonus.data.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.common.domain.data.dto.LineDto;
|
||||||
|
import com.bonus.common.domain.data.dto.ParamsDto;
|
||||||
|
import com.bonus.common.domain.data.vo.LineVo;
|
||||||
|
import com.bonus.common.domain.data.vo.StreamVo;
|
||||||
|
import com.bonus.data.mapper.DLineMapper;
|
||||||
|
import com.bonus.data.service.DILineService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @className:DLineServiceImpl
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2025-12-24-15:36
|
||||||
|
* @version:1.0
|
||||||
|
* @description:画线-业务逻辑层
|
||||||
|
*/
|
||||||
|
@Service(value = "DILineService")
|
||||||
|
public class DLineServiceImpl implements DILineService {
|
||||||
|
|
||||||
|
@Resource(name = "DLineMapper")
|
||||||
|
private DLineMapper dLineMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LineVo getLineDetail(ParamsDto dto) {
|
||||||
|
return dLineMapper.getLineDetail(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addLineData(LineDto dto) {
|
||||||
|
dLineMapper.addLineData(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StreamVo getVideoStreamAPI(ParamsDto dto) {
|
||||||
|
return dLineMapper.getVideoStreamAPI(dto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?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.bonus.data.mapper.DLineMapper">
|
||||||
|
|
||||||
|
<!--查询初始线的位置-->
|
||||||
|
<select id="getLineDetail" resultType="com.bonus.common.domain.data.vo.LineVo">
|
||||||
|
SELECT tdl.start_x AS startX,
|
||||||
|
tdl.start_y AS startY,
|
||||||
|
tdl.end_x AS endX,
|
||||||
|
tdl.end_y AS endY,
|
||||||
|
tsi.equipment_name AS equipmentName,
|
||||||
|
tsi.equipment_status AS equipmentStatus
|
||||||
|
FROM tb_system_info tsi
|
||||||
|
LEFT JOIN tb_device_line tdl on tsi.system_id = tdl.system_id
|
||||||
|
WHERE tsi.system_id = #{systemId}
|
||||||
|
ORDER BY line_time DESC
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--添加线的位置-->
|
||||||
|
<insert id="addLineData">
|
||||||
|
INSERT INTO tb_device_line
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="systemId!=null ">system_id,</if>
|
||||||
|
<if test="startX != null and startX!=''">start_x,</if>
|
||||||
|
<if test="startY != null and startY!=''">start_y,</if>
|
||||||
|
<if test="endX != null and endX!=''">end_x,</if>
|
||||||
|
<if test="endY != null and endY!=''">end_y,</if>
|
||||||
|
<if test="lineTime != null">line_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="systemId!=null ">#{systemId},</if>
|
||||||
|
<if test="startX != null and startX!=''">#{startX},</if>
|
||||||
|
<if test="startY != null and startY!=''">#{startY},</if>
|
||||||
|
<if test="endX != null and endX!=''">#{endX},</if>
|
||||||
|
<if test="endY != null and endY!=''">#{endY},</if>
|
||||||
|
<if test="lineTime != null">#{lineTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!--获取设备视频流-->
|
||||||
|
<select id="getVideoStreamAPI" resultType="com.bonus.common.domain.data.vo.StreamVo">
|
||||||
|
SELECT stream_url AS streamUrl FROM tb_device_stream
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue