From 221f99c764b51c3cd284c6e5a41492c26c5c7ffc Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期五, 09 九月 2022 17:06:19 +0800 Subject: [PATCH] 优化sip消息 --- src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java | 21 +++++++-------------- 1 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java index 4ad39a9..b876cf9 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java @@ -1,12 +1,14 @@ package com.genersoft.iot.vmp.vmanager.gb28181.media; import com.genersoft.iot.vmp.common.StreamInfo; +import com.genersoft.iot.vmp.conf.exception.ControllerException; import com.genersoft.iot.vmp.conf.security.SecurityUtils; import com.genersoft.iot.vmp.conf.security.dto.LoginUser; import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; import com.genersoft.iot.vmp.service.IStreamProxyService; import com.genersoft.iot.vmp.service.IMediaService; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; +import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -51,7 +53,7 @@ @Parameter(name = "useSourceIpAsStreamIp", description = "鏄惁浣跨敤璇锋眰IP浣滀负杩斿洖鐨勫湴鍧�IP") @GetMapping(value = "/stream_info_by_app_and_stream") @ResponseBody - public WVPResult<StreamInfo> getStreamInfoByAppAndStream(HttpServletRequest request, @RequestParam String app, + public StreamInfo getStreamInfoByAppAndStream(HttpServletRequest request, @RequestParam String app, @RequestParam String stream, @RequestParam(required = false) String mediaServerId, @RequestParam(required = false) String callId, @@ -63,10 +65,7 @@ if (streamAuthorityInfo.getCallId().equals(callId)) { authority = true; }else { - WVPResult<StreamInfo> result = new WVPResult<>(); - result.setCode(401); - result.setMsg("fail"); - return result; + throw new ControllerException(ErrorCode.ERROR400); } }else { // 鏄惁鐧婚檰鐢ㄦ埛, 鐧婚檰鐢ㄦ埛杩斿洖瀹屾暣淇℃伅 @@ -89,9 +88,7 @@ WVPResult<StreamInfo> result = new WVPResult<>(); if (streamInfo != null){ - result.setCode(0); - result.setMsg("scccess"); - result.setData(streamInfo); + return streamInfo; }else { //鑾峰彇娴佸け璐ワ紝閲嶅惎鎷夋祦鍚庨噸璇曚竴娆� streamProxyService.stop(app,stream); @@ -110,14 +107,10 @@ streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, authority); } if (streamInfo != null){ - result.setCode(0); - result.setMsg("scccess"); - result.setData(streamInfo); + return streamInfo; }else { - result.setCode(-1); - result.setMsg("fail"); + throw new ControllerException(ErrorCode.ERROR100); } } - return result; } } -- Gitblit v1.8.0