Commit 30979eb6ead1e2db67af7a3d84a148b4b26e8c05
Committed by
GitHub
Merge pull request #627 from 648540858/wvp-dialog
修复兼通api错误
Showing
1 changed file
with
4 additions
and
12 deletions
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiStreamController.java
| @@ -83,10 +83,12 @@ public class ApiStreamController { | @@ -83,10 +83,12 @@ public class ApiStreamController { | ||
| 83 | JSONObject result = new JSONObject(); | 83 | JSONObject result = new JSONObject(); |
| 84 | result.put("error","device[ " + serial + " ]未找到"); | 84 | result.put("error","device[ " + serial + " ]未找到"); |
| 85 | resultDeferredResult.setResult(result); | 85 | resultDeferredResult.setResult(result); |
| 86 | + return resultDeferredResult; | ||
| 86 | }else if (device.getOnline() == 0) { | 87 | }else if (device.getOnline() == 0) { |
| 87 | JSONObject result = new JSONObject(); | 88 | JSONObject result = new JSONObject(); |
| 88 | result.put("error","device[ " + code + " ]offline"); | 89 | result.put("error","device[ " + code + " ]offline"); |
| 89 | resultDeferredResult.setResult(result); | 90 | resultDeferredResult.setResult(result); |
| 91 | + return resultDeferredResult; | ||
| 90 | } | 92 | } |
| 91 | resultDeferredResult.onTimeout(()->{ | 93 | resultDeferredResult.onTimeout(()->{ |
| 92 | logger.info("播放等待超时"); | 94 | logger.info("播放等待超时"); |
| @@ -102,10 +104,12 @@ public class ApiStreamController { | @@ -102,10 +104,12 @@ public class ApiStreamController { | ||
| 102 | JSONObject result = new JSONObject(); | 104 | JSONObject result = new JSONObject(); |
| 103 | result.put("error","channel[ " + code + " ]未找到"); | 105 | result.put("error","channel[ " + code + " ]未找到"); |
| 104 | resultDeferredResult.setResult(result); | 106 | resultDeferredResult.setResult(result); |
| 107 | + return resultDeferredResult; | ||
| 105 | }else if (deviceChannel.getStatus() == 0) { | 108 | }else if (deviceChannel.getStatus() == 0) { |
| 106 | JSONObject result = new JSONObject(); | 109 | JSONObject result = new JSONObject(); |
| 107 | result.put("error","channel[ " + code + " ]offline"); | 110 | result.put("error","channel[ " + code + " ]offline"); |
| 108 | resultDeferredResult.setResult(result); | 111 | resultDeferredResult.setResult(result); |
| 112 | + return resultDeferredResult; | ||
| 109 | } | 113 | } |
| 110 | MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device); | 114 | MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device); |
| 111 | PlayResult play = playService.play(newMediaServerItem, serial, code, (mediaServerItem, response)->{ | 115 | PlayResult play = playService.play(newMediaServerItem, serial, code, (mediaServerItem, response)->{ |
| @@ -143,18 +147,6 @@ public class ApiStreamController { | @@ -143,18 +147,6 @@ public class ApiStreamController { | ||
| 143 | result.put("RelaySize", ""); | 147 | result.put("RelaySize", ""); |
| 144 | result.put("ChannelPTZType", "0"); | 148 | result.put("ChannelPTZType", "0"); |
| 145 | resultDeferredResult.setResult(result); | 149 | resultDeferredResult.setResult(result); |
| 146 | -// Class<?> aClass = responseEntity.getClass().getSuperclass(); | ||
| 147 | -// Field body = null; | ||
| 148 | -// try { | ||
| 149 | -// // 使用反射动态修改返回的body | ||
| 150 | -// body = aClass.getDeclaredField("body"); | ||
| 151 | -// body.setAccessible(true); | ||
| 152 | -// body.set(responseEntity, result); | ||
| 153 | -// } catch (NoSuchFieldException e) { | ||
| 154 | -// e.printStackTrace(); | ||
| 155 | -// } catch (IllegalAccessException e) { | ||
| 156 | -// e.printStackTrace(); | ||
| 157 | -// } | ||
| 158 | }, (eventResult) -> { | 150 | }, (eventResult) -> { |
| 159 | JSONObject result = new JSONObject(); | 151 | JSONObject result = new JSONObject(); |
| 160 | result.put("error", "channel[ " + code + " ] " + eventResult.msg); | 152 | result.put("error", "channel[ " + code + " ] " + eventResult.msg); |