|
|
@@ -44,6 +44,12 @@ public class SDeviceService extends ServiceImpl<SDeviceMapper, SDevice> {
|
|
|
private DeviceApi deviceApi;
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 录像回放左边筛选 - 获取设备流标签信息
|
|
|
+ *
|
|
|
+ * @author Aick Spt
|
|
|
+ * @date 2024-05-08 18:44
|
|
|
+ */
|
|
|
public List<DevicesPathVo> getDevicePathList(String keywords) {
|
|
|
//查询出所有已新增在流表里的设备id
|
|
|
SDevice sDevice = new SDevice();
|
|
|
@@ -59,6 +65,7 @@ public class SDeviceService extends ServiceImpl<SDeviceMapper, SDevice> {
|
|
|
//根据设备id查询设备表,获取到设备id和设备name
|
|
|
DevicesNameVo devicesNameVo = new DevicesNameVo();
|
|
|
devicesNameVo.setIds(ids);
|
|
|
+ devicesNameVo.setKeywords(keywords);
|
|
|
List<DevicesVo> devicesVos = deviceApi.devicesQuery(devicesNameVo);
|
|
|
//获取到设备id和设备name,再去查设备表,获取到设备id和设备path
|
|
|
DevicesPathVo devicesPathVo = new DevicesPathVo();
|
|
|
@@ -76,10 +83,27 @@ public class SDeviceService extends ServiceImpl<SDeviceMapper, SDevice> {
|
|
|
return devicesPathVos;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 新增流视频信息
|
|
|
+ *
|
|
|
+ * @author Aick Spt
|
|
|
+ * @date 2024-05-08 20:05
|
|
|
+ */
|
|
|
public int add(StreamAddRes streamAddRes) {
|
|
|
SDevice sDevice = new SDevice();
|
|
|
BeanUtil.copyProperties(streamAddRes, sDevice);
|
|
|
- return sDeviceMapper.insert(sDevice);
|
|
|
+ int insert = sDeviceMapper.insert(sDevice);
|
|
|
+ //这里需要拉流一下
|
|
|
+ if (insert > 0) {
|
|
|
+ //视频流类型 1-rtsp 2-rtmp
|
|
|
+ if (streamAddRes.getType() == 1) {
|
|
|
+ apiProxy.rtspPull(sDevice.getPath(), sDevice.getTarget(), "");
|
|
|
+ }
|
|
|
+ if (streamAddRes.getType() == 2) {
|
|
|
+ apiProxy.rtmpPull(sDevice.getPath(), sDevice.getTarget(), "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return insert;
|
|
|
}
|
|
|
|
|
|
public int update(StreamUpdateRes streamUpdateRes) {
|
|
|
@@ -108,48 +132,82 @@ public class SDeviceService extends ServiceImpl<SDeviceMapper, SDevice> {
|
|
|
return streamMediaProperties.getUrl() + sDevice.getPath();
|
|
|
}
|
|
|
|
|
|
+// /**
|
|
|
+// * rtmp列表查询
|
|
|
+// *
|
|
|
+// * @param streamPage
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// public List<Object> rtmpPage(StreamPage streamPage) {
|
|
|
+// log.info("rtmpPage in...");
|
|
|
+// //根据设备名称模糊筛选设备,获得设备id列表
|
|
|
+// String keywords = streamPage.getKeywords();
|
|
|
+// List<Long> ids = new ArrayList<>();
|
|
|
+// if (keywords != null && !keywords.isEmpty()) {
|
|
|
+// //如果有设备,需要先查出设备id
|
|
|
+// DevicesNameVo devicesNameVo = new DevicesNameVo();
|
|
|
+// devicesNameVo.setKeywords(keywords);
|
|
|
+// List<DevicesVo> devicesVos = deviceApi.devicesQuery(devicesNameVo);
|
|
|
+// if (Objects.isNull(devicesVos)) {
|
|
|
+// throw new BusinessException("查无产品");
|
|
|
+// }
|
|
|
+// for (DevicesVo devicesVo : devicesVos) {
|
|
|
+// ids.add(devicesVo.getId());
|
|
|
+// }
|
|
|
+// streamPage.setDeviceIds(ids);
|
|
|
+// }
|
|
|
+// log.info("rtmpList:{}", ids);
|
|
|
+// //数据库查询
|
|
|
+// StreamPageRes streamPageRes = sDeviceMapper.selectStreamPage(streamPage);
|
|
|
+// if (Objects.isNull(streamPageRes)) {
|
|
|
+// throw new BusinessException("查无产品!");
|
|
|
+// }
|
|
|
+// //API调用
|
|
|
+// ArrayList<Object> objects = new ArrayList<>();
|
|
|
+// Object o = apiProxy.rtmpList();
|
|
|
+// log.info("rtmpList:{}", o);
|
|
|
+// return new ArrayList<>() {{
|
|
|
+// add(o);
|
|
|
+// }};
|
|
|
+// }
|
|
|
+
|
|
|
/**
|
|
|
- * rtmp列表查询
|
|
|
+ * 分页查询
|
|
|
*
|
|
|
- * @param streamPage
|
|
|
- * @return
|
|
|
+ * @author Aick Spt
|
|
|
+ * @date 2024-05-09 09:10
|
|
|
*/
|
|
|
- public List<Object> rtmpPage(StreamPage streamPage) {
|
|
|
- log.info("rtmpPage in...");
|
|
|
+ public Object pageQuery(VideoPage videoPage) {
|
|
|
+ PageHelper.startPage(videoPage.getPage(), videoPage.getPageSize());
|
|
|
//根据设备名称模糊筛选设备,获得设备id列表
|
|
|
- String keywords = streamPage.getKeywords();
|
|
|
List<Long> ids = new ArrayList<>();
|
|
|
- if (keywords != null && !keywords.isEmpty()) {
|
|
|
- //如果有设备,需要先查出设备id
|
|
|
- DevicesNameVo devicesNameVo = new DevicesNameVo();
|
|
|
- devicesNameVo.setKeywords(keywords);
|
|
|
- List<DevicesVo> devicesVos = deviceApi.devicesQuery(devicesNameVo);
|
|
|
- if (Objects.isNull(devicesVos)) {
|
|
|
- throw new BusinessException("查无产品");
|
|
|
- }
|
|
|
+ //如果有设备,需要先查出设备id
|
|
|
+ DevicesNameVo devicesNameVo = new DevicesNameVo();
|
|
|
+ devicesNameVo.setKeywords(videoPage.getKeywords());
|
|
|
+ List<DevicesVo> devicesVos = deviceApi.devicesQuery(devicesNameVo);
|
|
|
+ if (Objects.isNull(devicesVos)) {
|
|
|
+ throw new BusinessException("查无产品");
|
|
|
+ }
|
|
|
+ for (DevicesVo devicesVo : devicesVos) {
|
|
|
+ ids.add(devicesVo.getId());
|
|
|
+ }
|
|
|
+ log.info("ids : {}", ids);
|
|
|
+ List<SDevice> sDevices = sDeviceMapper.selectList(new LambdaQueryWrapper<SDevice>().in(SDevice::getDeviceId, ids));
|
|
|
+ if (Objects.isNull(sDevices)) {
|
|
|
+ throw new BusinessException("查无产品");
|
|
|
+ }
|
|
|
+ StreamPageRes streamPageRes = new StreamPageRes();
|
|
|
+ List<StreamPageRes> streamPageRes2 = new ArrayList<>();
|
|
|
+ for (SDevice sDevice : sDevices) {
|
|
|
+ sDevice.setPath(streamMediaProperties.getUrl() + sDevice.getPath());
|
|
|
for (DevicesVo devicesVo : devicesVos) {
|
|
|
- ids.add(devicesVo.getId());
|
|
|
+ if (devicesVo.getId().equals(sDevice.getDeviceId())) {
|
|
|
+ BeanUtil.copyProperties(sDevice, streamPageRes);
|
|
|
+ streamPageRes.setDeviceName(devicesVo.getName());
|
|
|
+ streamPageRes2.add(streamPageRes);
|
|
|
+ }
|
|
|
}
|
|
|
- streamPage.setDeviceIds(ids);
|
|
|
- }
|
|
|
- log.info("rtmpList:{}", ids);
|
|
|
- //数据库查询
|
|
|
- StreamPageRes streamPageRes = sDeviceMapper.selectStreamPage(streamPage);
|
|
|
- if (Objects.isNull(streamPageRes)) {
|
|
|
- throw new BusinessException("查无产品!");
|
|
|
}
|
|
|
- //API调用
|
|
|
- ArrayList<Object> objects = new ArrayList<>();
|
|
|
- Object o = apiProxy.rtmpList();
|
|
|
- log.info("rtmpList:{}", o);
|
|
|
- return new ArrayList<>() {{
|
|
|
- add(o);
|
|
|
- }};
|
|
|
- }
|
|
|
-
|
|
|
- public Object pageQuery(VideoPage videoPage) {
|
|
|
- PageHelper.startPage(videoPage.getPage(), videoPage.getPageSize());
|
|
|
- List<SDevice> sDevices = sDeviceMapper.selectList(new LambdaQueryWrapper<>());
|
|
|
- return sDevices;
|
|
|
+ return streamPageRes2;
|
|
|
}
|
|
|
}
|