提交 dc45166e 作者: Administrator

refactor : 视频监控点位参数变化

上级 9289132c
......@@ -3,6 +3,7 @@ package com.yiring.app.param.video;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
......@@ -24,6 +25,7 @@ import lombok.experimental.FieldDefaults;
@FieldDefaults(level = AccessLevel.PRIVATE)
public class VideoParam implements Serializable {
@Serial
private static final long serialVersionUID = 6031274771790265507L;
@ApiModelProperty(value = "编号", example = "88888888", required = true)
......@@ -40,11 +42,11 @@ public class VideoParam implements Serializable {
@ApiModelProperty(value = "经度", example = "1.00", required = true)
@NotNull(message = "经度")
double lon;
Double lon;
@ApiModelProperty(value = "纬度", example = "1.00", required = true)
@NotNull(message = "纬度")
double lat;
Double lat;
@ApiModelProperty(value = "备注", example = "厂区摄像头")
@Size(max = 100, message = "备注不能超过100字")
......
......@@ -73,13 +73,8 @@ public class VideoServiceImpl implements VideoService {
Video video = Video
.builder()
.createTime(LocalDateTime.now())
// .enable(videoParam.getEnable())
// .m3u8(videoParam.getM3u8())
// .point(videoParam.getPoint())
.m3u8(videoParam.getM3u8())
.point(GeoUtils.createPoint(videoParam.getLon(), videoParam.getLat()))
// .online(videoParam.getOnline())
// .type(videoParam.getType())
//默认正常
.videoName(videoParam.getVideoName())
.status("1")
......@@ -89,7 +84,6 @@ public class VideoServiceImpl implements VideoService {
videoRepository.saveAndFlush(video);
//还需要同步添加国标28181中对应的摄像头信息
//标识uuid对应流id,m3u8对应拉流地址,如m3u8中有标注 则将类型切换为FFmpeg,摄像头名称videoName对应名称,流名称默认"stream",超时时间默认60
new Thread(() -> {
StreamProxyItem streamProxyItem = StreamProxyItem
.builder()
.name(video.getVideoName())
......@@ -106,8 +100,6 @@ public class VideoServiceImpl implements VideoService {
if (!jsonObject.get("code").equals(0)) {
throw new RuntimeException(jsonObject.get("msg").toString());
}
})
.start();
return Result.ok();
}
......@@ -119,13 +111,10 @@ public class VideoServiceImpl implements VideoService {
}
Video video = optional.get();
//还需要同步删除国标28181中对应的摄像头信息
new Thread(() -> {
JSONObject jsonObject = gbClient.proxyDel("stream", video.getUuid(), gbCookie());
if (!jsonObject.get("code").equals(0)) {
throw new RuntimeException(jsonObject.get("msg").toString());
}
})
.start();
videoRepository.delete(video);
return Result.ok();
......@@ -147,16 +136,14 @@ public class VideoServiceImpl implements VideoService {
// if (
// !video.getVideoName().equals(videoParam.getVideoName()) && !video.getM3u8().equals(videoParam.getM3u8())
// ) {
new Thread(() -> {
JSONObject jsonObject = gbClient.proxyDel("stream", video.getUuid(), gbCookie());
if (!jsonObject.get("code").equals(0)) {
throw new RuntimeException(jsonObject.get("msg").toString());
}
})
.start();
}
// }
BeanUtils.copyProperties(videoParam, video);
video.setPoint(GeoUtils.createPoint(videoParam.getLon(), videoParam.getLat()));
videoRepository.saveAndFlush(video);
//将信息发送到队列,等待同步至国标
// new Thread(() -> {
......@@ -214,9 +201,10 @@ public class VideoServiceImpl implements VideoService {
List<Video> all = videoRepository.findAll(condition(videoQueryParam), sort);
List<VideoVo> data = all
.stream()
.map(car -> {
.map(video -> {
VideoVo vo = new VideoVo();
BeanUtils.copyProperties(car, vo);
BeanUtils.copyProperties(video, vo);
// vo.setPoint(video.getPoint());
return vo;
})
.collect(Collectors.toList());
......@@ -287,6 +275,7 @@ public class VideoServiceImpl implements VideoService {
String fileName = URLEncoder.encode("监控点位来访信息.xlsx", StandardCharsets.UTF_8);
response.setContentType("application/octet-stream");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
OutputStream out = response.getOutputStream();
......@@ -324,6 +313,8 @@ public class VideoServiceImpl implements VideoService {
.map(videoImportExcel -> {
Video video = new Video();
BeanUtils.copyProperties(videoImportExcel, video);
video.setPoint(GeoUtils.createPoint(videoImportExcel.getLon(), videoImportExcel.getLat()));
video.setCreateTime(LocalDateTime.now());
return video;
})
.toList();
......@@ -333,7 +324,6 @@ public class VideoServiceImpl implements VideoService {
videoRepository
.findOne((root, cq, cb) -> {
List<Predicate> predicates = new ArrayList<>();
if (StrUtil.isNotBlank(video.getUuid())) {
predicates.add(cb.equal(root.get("uuid").as(String.class), video.getUuid()));
}
......
......@@ -5,10 +5,11 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.awt.*;
import java.io.Serial;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.FieldDefaults;
import org.locationtech.jts.geom.Point;
/**
* @author tzl
......@@ -22,6 +23,7 @@ import lombok.experimental.FieldDefaults;
@FieldDefaults(level = AccessLevel.PRIVATE)
public class VideoVo implements Serializable {
@Serial
private static final long serialVersionUID = 3968078657827350557L;
@JsonSerialize(using = ToStringSerializer.class)
......@@ -37,7 +39,7 @@ public class VideoVo implements Serializable {
@ApiModelProperty(value = "m3u8地址", example = "m3u8地址")
String m3u8;
@ApiModelProperty(value = "备注", example = "摄像头")
@ApiModelProperty(value = "备注", example = "备注")
String remark;
@ApiModelProperty(value = "摄像头名称", example = "摄像头1")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论