Commit c581974027cb6ff2123d5a7dd0b39fd3b3217bd4
1 parent
bb948311
使用GetMapping替换RequestMapping
Showing
6 changed files
with
98 additions
and
94 deletions
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
| @@ -141,6 +141,9 @@ public class PlayController { | @@ -141,6 +141,9 @@ public class PlayController { | ||
| 141 | streamInfo.channgeStreamIp(host); | 141 | streamInfo.channgeStreamIp(host); |
| 142 | } | 142 | } |
| 143 | wvpResult.setData(new StreamContent(streamInfo)); | 143 | wvpResult.setData(new StreamContent(streamInfo)); |
| 144 | + }else { | ||
| 145 | + wvpResult.setCode(code); | ||
| 146 | + wvpResult.setMsg(msg); | ||
| 144 | } | 147 | } |
| 145 | }else { | 148 | }else { |
| 146 | wvpResult.setCode(code); | 149 | wvpResult.setCode(code); |
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiControlController.java
| @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; | @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; | ||
| 8 | import org.slf4j.Logger; | 8 | import org.slf4j.Logger; |
| 9 | import org.slf4j.LoggerFactory; | 9 | import org.slf4j.LoggerFactory; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 11 | import org.springframework.web.bind.annotation.RequestMapping; | 12 | import org.springframework.web.bind.annotation.RequestMapping; |
| 12 | import org.springframework.web.bind.annotation.RequestParam; | 13 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | import org.springframework.web.bind.annotation.RestController; | 14 | import org.springframework.web.bind.annotation.RestController; |
| @@ -41,7 +42,7 @@ public class ApiControlController { | @@ -41,7 +42,7 @@ public class ApiControlController { | ||
| 41 | * @param speed 速度(0~255) 默认值: 129 | 42 | * @param speed 速度(0~255) 默认值: 129 |
| 42 | * @return | 43 | * @return |
| 43 | */ | 44 | */ |
| 44 | - @RequestMapping(value = "/ptz") | 45 | + @GetMapping(value = "/ptz") |
| 45 | private void list(String serial,String command, | 46 | private void list(String serial,String command, |
| 46 | @RequestParam(required = false)Integer channel, | 47 | @RequestParam(required = false)Integer channel, |
| 47 | @RequestParam(required = false)String code, | 48 | @RequestParam(required = false)String code, |
| @@ -114,7 +115,7 @@ public class ApiControlController { | @@ -114,7 +115,7 @@ public class ApiControlController { | ||
| 114 | * @param name 预置位名称, command=set 时有效 | 115 | * @param name 预置位名称, command=set 时有效 |
| 115 | * @return | 116 | * @return |
| 116 | */ | 117 | */ |
| 117 | - @RequestMapping(value = "/preset") | 118 | + @GetMapping(value = "/preset") |
| 118 | private void list(String serial,String command, | 119 | private void list(String serial,String command, |
| 119 | @RequestParam(required = false)Integer channel, | 120 | @RequestParam(required = false)Integer channel, |
| 120 | @RequestParam(required = false)String code, | 121 | @RequestParam(required = false)String code, |
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiController.java
| @@ -6,6 +6,7 @@ import org.slf4j.Logger; | @@ -6,6 +6,7 @@ import org.slf4j.Logger; | ||
| 6 | import org.slf4j.LoggerFactory; | 6 | import org.slf4j.LoggerFactory; |
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | import org.springframework.stereotype.Controller; | 8 | import org.springframework.stereotype.Controller; |
| 9 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 9 | import org.springframework.web.bind.annotation.RequestMapping; | 10 | import org.springframework.web.bind.annotation.RequestMapping; |
| 10 | import org.springframework.web.bind.annotation.ResponseBody; | 11 | import org.springframework.web.bind.annotation.ResponseBody; |
| 11 | 12 | ||
| @@ -23,7 +24,7 @@ public class ApiController { | @@ -23,7 +24,7 @@ public class ApiController { | ||
| 23 | private SipConfig sipConfig; | 24 | private SipConfig sipConfig; |
| 24 | 25 | ||
| 25 | 26 | ||
| 26 | - @RequestMapping("/getserverinfo") | 27 | + @GetMapping("/getserverinfo") |
| 27 | private JSONObject getserverinfo(){ | 28 | private JSONObject getserverinfo(){ |
| 28 | JSONObject result = new JSONObject(); | 29 | JSONObject result = new JSONObject(); |
| 29 | result.put("Authorization","ceshi"); | 30 | result.put("Authorization","ceshi"); |
| @@ -50,7 +51,7 @@ public class ApiController { | @@ -50,7 +51,7 @@ public class ApiController { | ||
| 50 | return result; | 51 | return result; |
| 51 | } | 52 | } |
| 52 | 53 | ||
| 53 | - @RequestMapping(value = "/userinfo") | 54 | + @GetMapping(value = "/userinfo") |
| 54 | private JSONObject userinfo(){ | 55 | private JSONObject userinfo(){ |
| 55 | // JSONObject result = new JSONObject(); | 56 | // JSONObject result = new JSONObject(); |
| 56 | // result.put("ID","ceshi"); | 57 | // result.put("ID","ceshi"); |
| @@ -83,7 +84,7 @@ public class ApiController { | @@ -83,7 +84,7 @@ public class ApiController { | ||
| 83 | * @param password 密码(经过md5加密,32位长度,不带中划线,不区分大小写) | 84 | * @param password 密码(经过md5加密,32位长度,不带中划线,不区分大小写) |
| 84 | * @return | 85 | * @return |
| 85 | */ | 86 | */ |
| 86 | - @RequestMapping(value = "/login") | 87 | + @GetMapping(value = "/login") |
| 87 | @ResponseBody | 88 | @ResponseBody |
| 88 | private JSONObject login(String username,String password ){ | 89 | private JSONObject login(String username,String password ){ |
| 89 | if (logger.isDebugEnabled()) { | 90 | if (logger.isDebugEnabled()) { |
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java
| @@ -18,6 +18,7 @@ import org.slf4j.Logger; | @@ -18,6 +18,7 @@ import org.slf4j.Logger; | ||
| 18 | import org.slf4j.LoggerFactory; | 18 | import org.slf4j.LoggerFactory; |
| 19 | import org.springframework.beans.factory.annotation.Autowired; | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 20 | import org.springframework.util.ObjectUtils; | 20 | import org.springframework.util.ObjectUtils; |
| 21 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 21 | import org.springframework.web.bind.annotation.RequestMapping; | 22 | import org.springframework.web.bind.annotation.RequestMapping; |
| 22 | import org.springframework.web.bind.annotation.RequestParam; | 23 | import org.springframework.web.bind.annotation.RequestParam; |
| 23 | import org.springframework.web.bind.annotation.RestController; | 24 | import org.springframework.web.bind.annotation.RestController; |
| @@ -59,7 +60,7 @@ public class ApiDeviceController { | @@ -59,7 +60,7 @@ public class ApiDeviceController { | ||
| 59 | * @param online | 60 | * @param online |
| 60 | * @return | 61 | * @return |
| 61 | */ | 62 | */ |
| 62 | - @RequestMapping(value = "/list") | 63 | + @GetMapping(value = "/list") |
| 63 | public JSONObject list( @RequestParam(required = false)Integer start, | 64 | public JSONObject list( @RequestParam(required = false)Integer start, |
| 64 | @RequestParam(required = false)Integer limit, | 65 | @RequestParam(required = false)Integer limit, |
| 65 | @RequestParam(required = false)String q, | 66 | @RequestParam(required = false)String q, |
| @@ -105,7 +106,7 @@ public class ApiDeviceController { | @@ -105,7 +106,7 @@ public class ApiDeviceController { | ||
| 105 | return result; | 106 | return result; |
| 106 | } | 107 | } |
| 107 | 108 | ||
| 108 | - @RequestMapping(value = "/channellist") | 109 | + @GetMapping(value = "/channellist") |
| 109 | public JSONObject channellist( String serial, | 110 | public JSONObject channellist( String serial, |
| 110 | @RequestParam(required = false)String channel_type, | 111 | @RequestParam(required = false)String channel_type, |
| 111 | @RequestParam(required = false)String code , | 112 | @RequestParam(required = false)String code , |
| @@ -186,7 +187,7 @@ public class ApiDeviceController { | @@ -186,7 +187,7 @@ public class ApiDeviceController { | ||
| 186 | * @param timeout 超时时间(秒) 默认值: 15 | 187 | * @param timeout 超时时间(秒) 默认值: 15 |
| 187 | * @return | 188 | * @return |
| 188 | */ | 189 | */ |
| 189 | - @RequestMapping(value = "/fetchpreset") | 190 | + @GetMapping(value = "/fetchpreset") |
| 190 | private DeferredResult<Object> list(String serial, | 191 | private DeferredResult<Object> list(String serial, |
| 191 | @RequestParam(required = false)Integer channel, | 192 | @RequestParam(required = false)Integer channel, |
| 192 | @RequestParam(required = false)String code, | 193 | @RequestParam(required = false)String code, |
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiStreamController.java
| @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.web.gb28181; | @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.web.gb28181; | ||
| 3 | import com.alibaba.fastjson2.JSONObject; | 3 | import com.alibaba.fastjson2.JSONObject; |
| 4 | import com.genersoft.iot.vmp.common.InviteInfo; | 4 | import com.genersoft.iot.vmp.common.InviteInfo; |
| 5 | import com.genersoft.iot.vmp.common.InviteSessionType; | 5 | import com.genersoft.iot.vmp.common.InviteSessionType; |
| 6 | +import com.genersoft.iot.vmp.common.StreamInfo; | ||
| 6 | import com.genersoft.iot.vmp.conf.UserSetting; | 7 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 7 | import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; | 8 | import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; |
| 8 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 9 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| @@ -13,15 +14,11 @@ import com.genersoft.iot.vmp.service.IDeviceService; | @@ -13,15 +14,11 @@ import com.genersoft.iot.vmp.service.IDeviceService; | ||
| 13 | import com.genersoft.iot.vmp.service.IInviteStreamService; | 14 | import com.genersoft.iot.vmp.service.IInviteStreamService; |
| 14 | import com.genersoft.iot.vmp.service.IPlayService; | 15 | import com.genersoft.iot.vmp.service.IPlayService; |
| 15 | import com.genersoft.iot.vmp.service.bean.InviteErrorCode; | 16 | import com.genersoft.iot.vmp.service.bean.InviteErrorCode; |
| 16 | -import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | ||
| 17 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 17 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 18 | import org.slf4j.Logger; | 18 | import org.slf4j.Logger; |
| 19 | import org.slf4j.LoggerFactory; | 19 | import org.slf4j.LoggerFactory; |
| 20 | import org.springframework.beans.factory.annotation.Autowired; | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| 21 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 22 | -import org.springframework.web.bind.annotation.RequestParam; | ||
| 23 | -import org.springframework.web.bind.annotation.ResponseBody; | ||
| 24 | -import org.springframework.web.bind.annotation.RestController; | 21 | +import org.springframework.web.bind.annotation.*; |
| 25 | import org.springframework.web.context.request.async.DeferredResult; | 22 | import org.springframework.web.context.request.async.DeferredResult; |
| 26 | 23 | ||
| 27 | import javax.sip.InvalidArgumentException; | 24 | import javax.sip.InvalidArgumentException; |
| @@ -49,9 +46,6 @@ public class ApiStreamController { | @@ -49,9 +46,6 @@ public class ApiStreamController { | ||
| 49 | private UserSetting userSetting; | 46 | private UserSetting userSetting; |
| 50 | 47 | ||
| 51 | @Autowired | 48 | @Autowired |
| 52 | - private IRedisCatchStorage redisCatchStorage; | ||
| 53 | - | ||
| 54 | - @Autowired | ||
| 55 | private IDeviceService deviceService; | 49 | private IDeviceService deviceService; |
| 56 | 50 | ||
| 57 | @Autowired | 51 | @Autowired |
| @@ -73,7 +67,7 @@ public class ApiStreamController { | @@ -73,7 +67,7 @@ public class ApiStreamController { | ||
| 73 | * @param timeout 拉流超时(秒), | 67 | * @param timeout 拉流超时(秒), |
| 74 | * @return | 68 | * @return |
| 75 | */ | 69 | */ |
| 76 | - @RequestMapping(value = "/start") | 70 | + @GetMapping("/start") |
| 77 | private DeferredResult<JSONObject> start(String serial , | 71 | private DeferredResult<JSONObject> start(String serial , |
| 78 | @RequestParam(required = false)Integer channel , | 72 | @RequestParam(required = false)Integer channel , |
| 79 | @RequestParam(required = false)String code, | 73 | @RequestParam(required = false)String code, |
| @@ -85,107 +79,111 @@ public class ApiStreamController { | @@ -85,107 +79,111 @@ public class ApiStreamController { | ||
| 85 | @RequestParam(required = false)String timeout | 79 | @RequestParam(required = false)String timeout |
| 86 | 80 | ||
| 87 | ){ | 81 | ){ |
| 88 | - DeferredResult<JSONObject> resultDeferredResult = new DeferredResult<>(userSetting.getPlayTimeout().longValue() + 10); | 82 | + DeferredResult<JSONObject> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue() + 10); |
| 89 | Device device = storager.queryVideoDevice(serial); | 83 | Device device = storager.queryVideoDevice(serial); |
| 90 | if (device == null ) { | 84 | if (device == null ) { |
| 91 | - JSONObject result = new JSONObject(); | ||
| 92 | - result.put("error","device[ " + serial + " ]未找到"); | ||
| 93 | - resultDeferredResult.setResult(result); | ||
| 94 | - return resultDeferredResult; | 85 | + JSONObject resultJSON = new JSONObject(); |
| 86 | + resultJSON.put("error","device[ " + serial + " ]未找到"); | ||
| 87 | + result.setResult(resultJSON); | ||
| 88 | + return result; | ||
| 95 | }else if (!device.isOnLine()) { | 89 | }else if (!device.isOnLine()) { |
| 96 | - JSONObject result = new JSONObject(); | ||
| 97 | - result.put("error","device[ " + code + " ]offline"); | ||
| 98 | - resultDeferredResult.setResult(result); | ||
| 99 | - return resultDeferredResult; | 90 | + JSONObject resultJSON = new JSONObject(); |
| 91 | + resultJSON.put("error","device[ " + code + " ]offline"); | ||
| 92 | + result.setResult(resultJSON); | ||
| 93 | + return result; | ||
| 100 | } | 94 | } |
| 101 | - resultDeferredResult.onTimeout(()->{ | 95 | + result.onTimeout(()->{ |
| 102 | logger.info("播放等待超时"); | 96 | logger.info("播放等待超时"); |
| 103 | - JSONObject result = new JSONObject(); | ||
| 104 | - result.put("error","timeout"); | ||
| 105 | - resultDeferredResult.setResult(result); | ||
| 106 | - | 97 | + JSONObject resultJSON = new JSONObject(); |
| 98 | + resultJSON.put("error","timeout"); | ||
| 99 | + result.setResult(resultJSON); | ||
| 100 | + inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, serial, code); | ||
| 101 | + storager.stopPlay(serial, code); | ||
| 107 | // 清理RTP server | 102 | // 清理RTP server |
| 108 | }); | 103 | }); |
| 109 | 104 | ||
| 110 | DeviceChannel deviceChannel = storager.queryChannel(serial, code); | 105 | DeviceChannel deviceChannel = storager.queryChannel(serial, code); |
| 111 | if (deviceChannel == null) { | 106 | if (deviceChannel == null) { |
| 112 | - JSONObject result = new JSONObject(); | ||
| 113 | - result.put("error","channel[ " + code + " ]未找到"); | ||
| 114 | - resultDeferredResult.setResult(result); | ||
| 115 | - return resultDeferredResult; | 107 | + JSONObject resultJSON = new JSONObject(); |
| 108 | + resultJSON.put("error","channel[ " + code + " ]未找到"); | ||
| 109 | + result.setResult(resultJSON); | ||
| 110 | + return result; | ||
| 116 | }else if (!deviceChannel.isStatus()) { | 111 | }else if (!deviceChannel.isStatus()) { |
| 117 | - JSONObject result = new JSONObject(); | ||
| 118 | - result.put("error","channel[ " + code + " ]offline"); | ||
| 119 | - resultDeferredResult.setResult(result); | ||
| 120 | - return resultDeferredResult; | 112 | + JSONObject resultJSON = new JSONObject(); |
| 113 | + resultJSON.put("error","channel[ " + code + " ]offline"); | ||
| 114 | + result.setResult(resultJSON); | ||
| 115 | + return result; | ||
| 121 | } | 116 | } |
| 122 | MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device); | 117 | MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device); |
| 123 | 118 | ||
| 124 | - | ||
| 125 | playService.play(newMediaServerItem, serial, code, null, (errorCode, msg, data) -> { | 119 | playService.play(newMediaServerItem, serial, code, null, (errorCode, msg, data) -> { |
| 126 | if (errorCode == InviteErrorCode.SUCCESS.getCode()) { | 120 | if (errorCode == InviteErrorCode.SUCCESS.getCode()) { |
| 127 | - InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, serial, code); | ||
| 128 | - if (inviteInfo != null && inviteInfo.getStreamInfo() != null) { | ||
| 129 | - JSONObject result = new JSONObject(); | ||
| 130 | - result.put("StreamID", inviteInfo.getStreamInfo().getStream()); | ||
| 131 | - result.put("DeviceID", device.getDeviceId()); | ||
| 132 | - result.put("ChannelID", code); | ||
| 133 | - result.put("ChannelName", deviceChannel.getName()); | ||
| 134 | - result.put("ChannelCustomName", ""); | ||
| 135 | - result.put("FLV", inviteInfo.getStreamInfo().getFlv().getUrl()); | ||
| 136 | - if(inviteInfo.getStreamInfo().getHttps_flv() != null) { | ||
| 137 | - result.put("HTTPS_FLV", inviteInfo.getStreamInfo().getHttps_flv().getUrl()); | 121 | + if (data != null) { |
| 122 | + StreamInfo streamInfo = (StreamInfo)data; | ||
| 123 | + JSONObject resultJjson = new JSONObject(); | ||
| 124 | + resultJjson.put("StreamID", streamInfo.getStream()); | ||
| 125 | + resultJjson.put("DeviceID", serial); | ||
| 126 | + resultJjson.put("ChannelID", code); | ||
| 127 | + resultJjson.put("ChannelName", deviceChannel.getName()); | ||
| 128 | + resultJjson.put("ChannelCustomName", ""); | ||
| 129 | + resultJjson.put("FLV", streamInfo.getFlv().getUrl()); | ||
| 130 | + if(streamInfo.getHttps_flv() != null) { | ||
| 131 | + resultJjson.put("HTTPS_FLV", streamInfo.getHttps_flv().getUrl()); | ||
| 138 | } | 132 | } |
| 139 | - result.put("WS_FLV", inviteInfo.getStreamInfo().getWs_flv().getUrl()); | ||
| 140 | - if(inviteInfo.getStreamInfo().getWss_flv() != null) { | ||
| 141 | - result.put("WSS_FLV", inviteInfo.getStreamInfo().getWss_flv().getUrl()); | 133 | + resultJjson.put("WS_FLV", streamInfo.getWs_flv().getUrl()); |
| 134 | + if(streamInfo.getWss_flv() != null) { | ||
| 135 | + resultJjson.put("WSS_FLV", streamInfo.getWss_flv().getUrl()); | ||
| 142 | } | 136 | } |
| 143 | - result.put("RTMP", inviteInfo.getStreamInfo().getRtmp().getUrl()); | ||
| 144 | - if (inviteInfo.getStreamInfo().getRtmps() != null) { | ||
| 145 | - result.put("RTMPS", inviteInfo.getStreamInfo().getRtmps().getUrl()); | 137 | + resultJjson.put("RTMP", streamInfo.getRtmp().getUrl()); |
| 138 | + if (streamInfo.getRtmps() != null) { | ||
| 139 | + resultJjson.put("RTMPS", streamInfo.getRtmps().getUrl()); | ||
| 146 | } | 140 | } |
| 147 | - result.put("HLS", inviteInfo.getStreamInfo().getHls().getUrl()); | ||
| 148 | - if (inviteInfo.getStreamInfo().getHttps_hls() != null) { | ||
| 149 | - result.put("HTTPS_HLS", inviteInfo.getStreamInfo().getHttps_hls().getUrl()); | 141 | + resultJjson.put("HLS", streamInfo.getHls().getUrl()); |
| 142 | + if (streamInfo.getHttps_hls() != null) { | ||
| 143 | + resultJjson.put("HTTPS_HLS", streamInfo.getHttps_hls().getUrl()); | ||
| 150 | } | 144 | } |
| 151 | - result.put("RTSP", inviteInfo.getStreamInfo().getRtsp().getUrl()); | ||
| 152 | - if (inviteInfo.getStreamInfo().getRtsps() != null) { | ||
| 153 | - result.put("RTSPS", inviteInfo.getStreamInfo().getRtsps().getUrl()); | 145 | + resultJjson.put("RTSP", streamInfo.getRtsp().getUrl()); |
| 146 | + if (streamInfo.getRtsps() != null) { | ||
| 147 | + resultJjson.put("RTSPS", streamInfo.getRtsps().getUrl()); | ||
| 154 | } | 148 | } |
| 155 | - result.put("WEBRTC", inviteInfo.getStreamInfo().getRtc().getUrl()); | ||
| 156 | - if (inviteInfo.getStreamInfo().getRtcs() != null) { | ||
| 157 | - result.put("HTTPS_WEBRTC", inviteInfo.getStreamInfo().getRtcs().getUrl()); | 149 | + resultJjson.put("WEBRTC", streamInfo.getRtc().getUrl()); |
| 150 | + if (streamInfo.getRtcs() != null) { | ||
| 151 | + resultJjson.put("HTTPS_WEBRTC", streamInfo.getRtcs().getUrl()); | ||
| 158 | } | 152 | } |
| 159 | - result.put("CDN", ""); | ||
| 160 | - result.put("SnapURL", ""); | ||
| 161 | - result.put("Transport", device.getTransport()); | ||
| 162 | - result.put("StartAt", ""); | ||
| 163 | - result.put("Duration", ""); | ||
| 164 | - result.put("SourceVideoCodecName", ""); | ||
| 165 | - result.put("SourceVideoWidth", ""); | ||
| 166 | - result.put("SourceVideoHeight", ""); | ||
| 167 | - result.put("SourceVideoFrameRate", ""); | ||
| 168 | - result.put("SourceAudioCodecName", ""); | ||
| 169 | - result.put("SourceAudioSampleRate", ""); | ||
| 170 | - result.put("AudioEnable", ""); | ||
| 171 | - result.put("Ondemand", ""); | ||
| 172 | - result.put("InBytes", ""); | ||
| 173 | - result.put("InBitRate", ""); | ||
| 174 | - result.put("OutBytes", ""); | ||
| 175 | - result.put("NumOutputs", ""); | ||
| 176 | - result.put("CascadeSize", ""); | ||
| 177 | - result.put("RelaySize", ""); | ||
| 178 | - result.put("ChannelPTZType", "0"); | ||
| 179 | - resultDeferredResult.setResult(result); | 153 | + resultJjson.put("CDN", ""); |
| 154 | + resultJjson.put("SnapURL", ""); | ||
| 155 | + resultJjson.put("Transport", device.getTransport()); | ||
| 156 | + resultJjson.put("StartAt", ""); | ||
| 157 | + resultJjson.put("Duration", ""); | ||
| 158 | + resultJjson.put("SourceVideoCodecName", ""); | ||
| 159 | + resultJjson.put("SourceVideoWidth", ""); | ||
| 160 | + resultJjson.put("SourceVideoHeight", ""); | ||
| 161 | + resultJjson.put("SourceVideoFrameRate", ""); | ||
| 162 | + resultJjson.put("SourceAudioCodecName", ""); | ||
| 163 | + resultJjson.put("SourceAudioSampleRate", ""); | ||
| 164 | + resultJjson.put("AudioEnable", ""); | ||
| 165 | + resultJjson.put("Ondemand", ""); | ||
| 166 | + resultJjson.put("InBytes", ""); | ||
| 167 | + resultJjson.put("InBitRate", ""); | ||
| 168 | + resultJjson.put("OutBytes", ""); | ||
| 169 | + resultJjson.put("NumOutputs", ""); | ||
| 170 | + resultJjson.put("CascadeSize", ""); | ||
| 171 | + resultJjson.put("RelaySize", ""); | ||
| 172 | + resultJjson.put("ChannelPTZType", "0"); | ||
| 173 | + result.setResult(resultJjson); | ||
| 174 | + }else { | ||
| 175 | + JSONObject resultJjson = new JSONObject(); | ||
| 176 | + resultJjson.put("error", "channel[ " + code + " ] " + msg); | ||
| 177 | + result.setResult(resultJjson); | ||
| 180 | } | 178 | } |
| 181 | }else { | 179 | }else { |
| 182 | - JSONObject result = new JSONObject(); | ||
| 183 | - result.put("error", "channel[ " + code + " ] " + msg); | ||
| 184 | - resultDeferredResult.setResult(result); | 180 | + JSONObject resultJjson = new JSONObject(); |
| 181 | + resultJjson.put("error", "channel[ " + code + " ] " + msg); | ||
| 182 | + result.setResult(resultJjson); | ||
| 185 | } | 183 | } |
| 186 | }); | 184 | }); |
| 187 | 185 | ||
| 188 | - return resultDeferredResult; | 186 | + return result; |
| 189 | } | 187 | } |
| 190 | 188 | ||
| 191 | /** | 189 | /** |
| @@ -196,7 +194,7 @@ public class ApiStreamController { | @@ -196,7 +194,7 @@ public class ApiStreamController { | ||
| 196 | * @param check_outputs | 194 | * @param check_outputs |
| 197 | * @return | 195 | * @return |
| 198 | */ | 196 | */ |
| 199 | - @RequestMapping(value = "/stop") | 197 | + @GetMapping("/stop") |
| 200 | @ResponseBody | 198 | @ResponseBody |
| 201 | private JSONObject stop(String serial , | 199 | private JSONObject stop(String serial , |
| 202 | @RequestParam(required = false)Integer channel , | 200 | @RequestParam(required = false)Integer channel , |
| @@ -236,7 +234,7 @@ public class ApiStreamController { | @@ -236,7 +234,7 @@ public class ApiStreamController { | ||
| 236 | * @param code 通道国标编号 | 234 | * @param code 通道国标编号 |
| 237 | * @return | 235 | * @return |
| 238 | */ | 236 | */ |
| 239 | - @RequestMapping(value = "/touch") | 237 | + @GetMapping("/touch") |
| 240 | @ResponseBody | 238 | @ResponseBody |
| 241 | private JSONObject touch(String serial ,String t, | 239 | private JSONObject touch(String serial ,String t, |
| 242 | @RequestParam(required = false)Integer channel , | 240 | @RequestParam(required = false)Integer channel , |
src/main/java/com/genersoft/iot/vmp/web/gb28181/AuthController.java
| @@ -13,7 +13,7 @@ public class AuthController { | @@ -13,7 +13,7 @@ public class AuthController { | ||
| 13 | @Autowired | 13 | @Autowired |
| 14 | private IUserService userService; | 14 | private IUserService userService; |
| 15 | 15 | ||
| 16 | - @RequestMapping("/login") | 16 | + @GetMapping("/login") |
| 17 | public String devices(String name, String passwd){ | 17 | public String devices(String name, String passwd){ |
| 18 | User user = userService.getUser(name, passwd); | 18 | User user = userService.getUser(name, passwd); |
| 19 | if (user != null) { | 19 | if (user != null) { |