diff --git a/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java b/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java index 582bcad..24f2165 100644 --- a/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java +++ b/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java @@ -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; + } } diff --git a/inspect-ivs/src/main/java/com/inspect/ivs/view/IvsStreamStartView.java b/inspect-ivs/src/main/java/com/inspect/ivs/view/IvsStreamStartView.java index 06fcf9a..3dc5275 100644 --- a/inspect-ivs/src/main/java/com/inspect/ivs/view/IvsStreamStartView.java +++ b/inspect-ivs/src/main/java/com/inspect/ivs/view/IvsStreamStartView.java @@ -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() { diff --git a/inspect-job/src/main/java/com/inspect/job/task/PatrolEqpbookChannelTask.java b/inspect-job/src/main/java/com/inspect/job/task/PatrolEqpbookChannelTask.java index 84c6196..034c150 100644 --- a/inspect-job/src/main/java/com/inspect/job/task/PatrolEqpbookChannelTask.java +++ b/inspect-job/src/main/java/com/inspect/job/task/PatrolEqpbookChannelTask.java @@ -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"))) { diff --git a/inspect-main/inspect-main-video/src/main/java/com/inspect/patrol/service/impl/Video2NvrComponent.java b/inspect-main/inspect-main-video/src/main/java/com/inspect/patrol/service/impl/Video2NvrComponent.java index 21ed6c2..cdfb5cc 100644 --- a/inspect-main/inspect-main-video/src/main/java/com/inspect/patrol/service/impl/Video2NvrComponent.java +++ b/inspect-main/inspect-main-video/src/main/java/com/inspect/patrol/service/impl/Video2NvrComponent.java @@ -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;