|
@@ -139,32 +139,56 @@ public class VideoEquipmentInfoServiceImpl extends ServiceImpl<VideoEquipmentInf
|
|
|
@Override
|
|
|
public MessageInfo getVideoUrl(String videoCode) {
|
|
|
// 获取token
|
|
|
- String url = "http://10.18.17.85:9090/oauth/token?client_id=2d24b314552f460ab74a5e3b891b1646&client_secret=cbb8b46a7f014b158eefb3542ec66c2d";
|
|
|
- Map<String, String> map = restTemplate.getForObject(url, Map.class);
|
|
|
- System.out.println("map:" + map);
|
|
|
- String token = map.get("access_token");
|
|
|
-
|
|
|
- // 请求数据
|
|
|
- String url2 = "http://10.18.17.85:9090/service/api/api/v1/cameras/previewURLs?client_id=2d24b314552f460ab74a5e3b891b1646&access_token=" + token;
|
|
|
- Map<String, String> parameters = new LinkedHashMap<>();
|
|
|
- parameters.put("cameraIndexCode", videoCode);
|
|
|
- parameters.put("protocol", "ws");
|
|
|
- MessageInfo result = restTemplate.postForObject(url2, JSONObject.toJSONString(parameters), MessageInfo.class);
|
|
|
- // ws地址转化,从10段到59段
|
|
|
-// Map<String, String> data = result.getData();
|
|
|
-// if (data != null) {
|
|
|
-// String wsUrl = data.get("url");
|
|
|
-// String replace;
|
|
|
-//
|
|
|
-// // 解决院网不能播放视频问题
|
|
|
-// replace = wsUrl.replace("10.18.18.53:559", "59.255.61.152:80/ws");
|
|
|
-//
|
|
|
-// // 地址转换 10.18.18.53 -> 59.255.61.78
|
|
|
-// // replace = wsUrl.replace("10.18.18.53", "59.255.61.78");
|
|
|
+// String url = "http://dgs-servicebusgate2.zww.yjcloud.cn/oauth/token?client_id=8a7b785f08d04d439b71bc2b415cb685&client_secret=OA!Bq_P!";
|
|
|
+// Map<String, String> map = restTemplate.getForObject(url, Map.class);
|
|
|
+// System.out.println("map:" + map);
|
|
|
+// String token = map.get("access_token");
|
|
|
//
|
|
|
-// data.put("url", replace);
|
|
|
-// result.setData(data);
|
|
|
-// }
|
|
|
+// // 请求数据
|
|
|
+// String url2 = "http://dgs-servicebusgate2.zww.yjcloud.cn/service/api/api/v1/cameras/previewURLs?client_id=8a7b785f08d04d439b71bc2b415cb685&access_token=" + token;
|
|
|
+// Map<String, String> parameters = new LinkedHashMap<>();
|
|
|
+// parameters.put("cameraIndexCode", videoCode);
|
|
|
+// parameters.put("protocol", "ws");
|
|
|
+// MessageInfo result = restTemplate.postForObject(url2, JSONObject.toJSONString(parameters), MessageInfo.class);
|
|
|
+ // ws地址转化,从10段到59段
|
|
|
+ /**
|
|
|
+ * {
|
|
|
+ * "code": "0",
|
|
|
+ * "msg": "success",
|
|
|
+ * "data": {
|
|
|
+ * "url": "wss://10.18.18.53:6014/proxy/10.18.18.53:559/openUrl/uQhfGdq"
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ */
|
|
|
+ MessageInfo result = new MessageInfo();
|
|
|
+ result.setCode(200);
|
|
|
+ Map<String, String> data11 = new HashMap<>();
|
|
|
+ data11.put("url", "wss://10.18.18.53:6014/proxy/10.18.18.53:559/openUrl/uQhfGdq");
|
|
|
+ //wss://10.18.18.53:6014/proxy/10.18.18.53:559/openUrl/yrtJ9EA
|
|
|
+ //data11.put("url", "ws://10.18.18.53:559/openUrl/gC42FPi");
|
|
|
+ // wss://10.18.18.53:6014/proxy/10.18.18.53:559/openUrl/uQhfGdq
|
|
|
+ // => wss:/splw2.mem.cegn.cn:6014/proxy/splw2.mem.cegn.cn:559/openurl/xlgbLPy
|
|
|
+
|
|
|
+ result.setData(
|
|
|
+ data11
|
|
|
+ );
|
|
|
+ Map<String, String> data = (Map<String, String>) result.getData();
|
|
|
+ if (data != null) {
|
|
|
+ String wsUrl = data.get("url");
|
|
|
+ String replace;
|
|
|
+
|
|
|
+ // 解决院网不能播放视频问题
|
|
|
+ //replace = wsUrl.replace("10.18.18.53", "splw2.mem.cegn.cn");
|
|
|
+ replace = wsUrl.replace("10.210.114.45", "splw1.mem.cegn.cn");
|
|
|
+ replace = wsUrl.replace("10.210.114.46", "splw2.mem.cegn.cn");
|
|
|
+ replace = wsUrl.replace("10.210.114.47", "splw3.mem.cegn.cn");
|
|
|
+
|
|
|
+ // 地址转换 10.18.18.53 -> 59.255.61.78
|
|
|
+ //replace = wsUrl.replace("10.18.18.53:6014", "splw2.mem.cegn.cn:6014");
|
|
|
+
|
|
|
+ data.put("url", replace);
|
|
|
+ result.setData(data);
|
|
|
+ }
|
|
|
return result;
|
|
|
|
|
|
}
|