Browse Source

fix:新增ivs获取rtspUrl地址接口用于sip视频流对接,及相机在线状态同步修改

master
wangguangyuan 1 month ago
parent
commit
b2bb2e0164
4 changed files with 53 additions and 5 deletions
  1. +28
    -0
      inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java
  2. +1
    -0
      inspect-ivs/src/main/java/com/inspect/ivs/view/IvsStreamStartView.java
  3. +14
    -3
      inspect-job/src/main/java/com/inspect/job/task/PatrolEqpbookChannelTask.java
  4. +10
    -2
      inspect-main/inspect-main-video/src/main/java/com/inspect/patrol/service/impl/Video2NvrComponent.java

+ 28
- 0
inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java View File

@ -18,6 +18,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@ -91,4 +92,31 @@ public class IvsStreamController {
log.debug("[GAB] streamId: {}", streamId);
return Response.ok();
}
@GetMapping({"rtspUrl"})
public IvsVideoRtspView rtspUrl(@RequestParam("cameraCode") String cameraCode) {
log.info("IVS_STREAM_START rtspUrl param: {}", cameraCode);
IvsVideoRtspVo ivsVideoRtspVo = IvsVideoRtspVo.realStream(cameraCode);
log.info("IVS_STREAM_START rtspUrl ivsVideoRtspVo: {}", ivsVideoRtspVo);
IvsVideoRtspView ivsVideoRtspView;
if (bIvsTestMode) {
// ivsVideoRtspView = IvsVideoRtspView.builder()
// .rtspURL("rtsp://admin:wd19216811@192.168.1.249:554/h264/ch39/main/av_stream")
// .build();
ivsVideoRtspView = new IvsVideoRtspView();
ivsVideoRtspView.setRtspURL("rtsp://admin:htjc2018@192.168.1.134:554/cam/realmonitor?channel=3&subtype=0");
} else {
String label = java.util.UUID.randomUUID().toString().trim().replaceAll(StringUtils.DASH, StringUtils.EMPTY);
ivsVideoRtspView = ivsCommonService.postJson(
label,
ivsVideoRtspVo,
IvsConst.URI_VIDEO_RTSP,
IvsVideoRtspView.class);
}
log.debug("[IVS] {}", ivsVideoRtspView);
return ivsVideoRtspView;
}
}

+ 1
- 0
inspect-ivs/src/main/java/com/inspect/ivs/view/IvsStreamStartView.java View File

@ -86,6 +86,7 @@ public class IvsStreamStartView implements Serializable {
this.WEBRTC = ivsVideoRtspView.getWebrtcURL();
this.HLS = ivsVideoRtspView.getHlsURL();
this.FLV = ivsVideoRtspView.getFlvURL();
this.RTSP = ivsVideoRtspView.getRtspURL();
}
public String getStreamID() {


+ 14
- 3
inspect-job/src/main/java/com/inspect/job/task/PatrolEqpbookChannelTask.java View File

@ -52,15 +52,26 @@ public class PatrolEqpbookChannelTask {
// logger.info("同步巡检设备在线状态:{}", result);
JSONObject jsonObject = JSONObject.parseObject(result);
if (null != jsonObject) {
JSONObject cameraBriefInfos = jsonObject.getJSONObject("cameraBriefInfos");
JSONObject cameraBriefInfos = null;
if (jsonObject.getJSONObject("cameraBriefInfos") != null) {
cameraBriefInfos = jsonObject.getJSONObject("cameraBriefInfos").getJSONObject("cameraBriefInfoList");
}
if (cameraBriefInfos == null) {
if (jsonObject.getJSONObject("cameraBriefInfosV2") != null) {
cameraBriefInfos = jsonObject.getJSONObject("cameraBriefInfosV2").getJSONObject("cameraBriefInfoList");
}
}
if (null != cameraBriefInfos) {
JSONArray jsonObjectItems = cameraBriefInfos.getJSONArray("cameraBriefInfoList");
JSONArray jsonObjectItems = cameraBriefInfos.getJSONArray("cameraBriefInfo");
if (null != jsonObjectItems) {
for (EqpBookChannel eqpBookChannel : eqpBookChannels) {
for (int i = 0; i < jsonObjectItems.size(); i++) {
JSONObject cameraInfo = jsonObjectItems.getJSONObject(i);
//cameracode相等
if (eqpBookChannel.getChannelCode().equals(cameraInfo.getString("code") + "#" + cameraInfo.getString("domainCode"))) {
String code = cameraInfo.getString("code");
String domainCode = cameraInfo.getString("domainCode");
String channelCode = eqpBookChannel.getChannelCode();
if (channelCode.equals(code) || channelCode.equals(code + "#" + domainCode)) {
//状态发生改变 修改
if (!eqpBookChannel.getOnlineState().equals(cameraInfo.getString("status")) ||
!eqpBookChannel.getChannelName().equals(cameraInfo.getString("name"))) {


+ 10
- 2
inspect-main/inspect-main-video/src/main/java/com/inspect/patrol/service/impl/Video2NvrComponent.java View File

@ -3,6 +3,8 @@ package com.inspect.patrol.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.inspect.base.core.exception.ServiceException;
import com.inspect.base.core.utils.StringUtils;
import com.inspect.base.core.web.domain.AjaxResult;
import com.inspect.base.core.web.page.TableDataInfo;
import com.inspect.base.redis.service.RedisService;
import com.inspect.patrol.service.BasedataEqpbookService;
import org.springframework.beans.factory.annotation.Autowired;
@ -25,11 +27,17 @@ public class Video2NvrComponent {
} else {
Object value = this.redisService.redisTemplate.opsForHash().get(PATROL_EQP_BOOK_VIDEO_NVR, videoCode);
if (value == null) {
Object object = this.basedataEqpbookService.list((new JSONObject()).fluentPut("patrolDeviceCode", videoCode)).getRows().get(0);
// Object object = this.basedataEqpbookService.list((new JSONObject()).fluentPut("patrolDeviceCode", videoCode)).getRows().get(0);
TableDataInfo tableDataInfo = basedataEqpbookService.list((new JSONObject()).fluentPut("patrolDeviceCode", videoCode));
if (tableDataInfo == null || tableDataInfo.getRows() == null || tableDataInfo.getRows().isEmpty()) {
return "";
}
Object object = tableDataInfo.getRows().get(0);
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object));
String videoNvrCode = jsonObject.getString("videoNvrCode");
if (StringUtils.isEmpty(videoCode)) {
throw new ServiceException("No NVR bound for this device!");
return "";
} else {
this.redisService.redisTemplate.opsForHash().put(PATROL_EQP_BOOK_VIDEO_NVR, videoCode, videoNvrCode);
return videoNvrCode;


Loading…
Cancel
Save