| | |
| | | String code2 = data2.get("indexCode").toString(); |
| | | |
| | | //根据子节点编号获取设备播放地址 |
| | | String result3 = GetCameraPreviewURL.GetCameraPreviewURL(HkConstant.previewURLs, code2, ProtocolConstant.HLS); |
| | | String result3 = GetCameraPreviewURL.GetCameraPreviewURL(HkConstant.previewURLshttps, code2, ProtocolConstant.HLSS); |
| | | res = JSONObject.parseObject(result3); |
| | | } |
| | | |
| | | return R.data(res); |
| | | } |
| | | |
| | | /** |
| | | * 获取设备语音对讲的信息 |
| | | * @param equipmentPlayInfo 设备语音对讲对象,只需包含设备编号,以及设备语音对讲格式即可 |
| | | * @param response 响应域,设置跨域 |
| | | * @return |
| | | */ |
| | | @GetMapping("/EquimentVoice") |
| | | public R EquimentVoice(EquipmentPlayInfo equipmentPlayInfo,HttpServletResponse response){ |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials", "true"); |
| | | //返回 |
| | | // equipmentService.selectEquimentPlayInfo(equipmentPlayInfo) |
| | | |
| | | JSONObject res = new JSONObject(); |
| | | |
| | | //根据设备id获取设备编号 |
| | | String result1 = GetCameraPreviewURL.QueryCameraPreviewURL(HkConstant.camerasID, equipmentPlayInfo.getNumber(), "encodeDevice", "deviceCode"); |
| | | |
| | | JSONObject jsonObject1 = JSONObject.parseObject(result1); |
| | | JSONObject res1 = (JSONObject) jsonObject1.get("data"); |
| | | JSONArray arr1 = JSON.parseArray(res1.getString("list")); |
| | | if (arr1.size() > 0){ |
| | | JSONObject data1 = (JSONObject) arr1.get(0); |
| | | String code1 = data1.get("indexCode").toString(); |
| | | |
| | | //根据设备编号获取子节点编号 |
| | | String result2 = GetCameraPreviewURL.QueryCameraPreviewURL(HkConstant.camerasID, code1, "camera", "parentIndexCode"); |
| | | |
| | | JSONObject jsonObject2 = JSONObject.parseObject(result2); |
| | | JSONObject res2 = (JSONObject) jsonObject2.get("data"); |
| | | JSONArray arr2 = JSON.parseArray(res2.getString("list")); |
| | | JSONObject data2 = (JSONObject) arr2.get(0); |
| | | String code2 = data2.get("indexCode").toString(); |
| | | |
| | | //根据子节点获取设备语音对讲的信息 |
| | | String result4 = GetCameraPreviewURL.GetTalkURLs(HkConstant.talkURLs, code2); |
| | | res = JSONObject.parseObject(result4); |
| | | } |
| | | |
| | | return R.data(res); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static final String previewURLs = "/api/video/v2/cameras/previewURLs"; |
| | | |
| | | public static final String previewURLshttps = "/api/vnsc/mls/v1/preview/openApi/getPreviewParam"; |
| | | |
| | | /** |
| | | * 设备查询 |
| | | */ |
| | |
| | | */ |
| | | String HLS = "hls"; |
| | | |
| | | String HLSS = "hlss"; |
| | | |
| | | /** |
| | | * Websocket协议(一般用于H5视频播放器取流播放) |
| | | */ |
| | |
| | | * STEP5:组装请求参数 |
| | | */ |
| | | JSONObject jsonBody = new JSONObject(); |
| | | jsonBody.put("cameraIndexCode", cameraIndexCode); |
| | | jsonBody.put("indexCode", cameraIndexCode); |
| | | jsonBody.put("streamType", 0); |
| | | jsonBody.put("netZoneCode", 0); |
| | | jsonBody.put("protocol", protocol); |
| | | jsonBody.put("transmode", 1); |
| | | jsonBody.put("expand", "streamform=ps"); |
| | | jsonBody.put("expireTime", 300); |
| | | String body = jsonBody.toJSONString(); |
| | | |
| | | |
| | | // JSONObject jsonBody = new JSONObject(); |
| | | // jsonBody.put("cameraIndexCode", cameraIndexCode); |
| | | // jsonBody.put("streamType", 0); |
| | | // jsonBody.put("protocol", protocol); |
| | | // jsonBody.put("transmode", 1); |
| | | // jsonBody.put("expand", "streamform=ps"); |
| | | // String body = jsonBody.toJSONString(); |
| | | |
| | | |
| | | /** |
| | | * STEP6:调用接口 |
| | | */ |
| | |
| | | |
| | | String result = GetCameraResourcePage(1, 1, HkConstant.cameras); |
| | | //根据设备id获取设备编号 |
| | | String result1 = QueryCameraPreviewURL(HkConstant.camerasID, "111111", "encodeDevice", "deviceCode"); |
| | | String result1 = QueryCameraPreviewURL(HkConstant.camerasID, "111111222", "encodeDevice", "deviceCode"); |
| | | |
| | | JSONObject jsonObject1 = JSONObject.parseObject(result1); |
| | | JSONObject res1 = (JSONObject) jsonObject1.get("data"); |
| | |
| | | JSONArray arr2 = JSON.parseArray(res2.getString("list")); |
| | | JSONObject data2 = (JSONObject) arr2.get(0); |
| | | String code2 = data2.get("indexCode").toString(); |
| | | |
| | | //根据子节点编号获取设备播放地址 |
| | | String result3 = GetCameraPreviewURL(HkConstant.previewURLs, code2, ProtocolConstant.HLS); |
| | | String result3 = GetCameraPreviewURL(HkConstant.previewURLshttps, code2, ProtocolConstant.HLSS); |
| | | //根据子节点编号获取音频对讲地址 |
| | | String result4 = GetTalkURLs(HkConstant.talkURLs, code2); |
| | | |
| | |
| | | } |
| | | } else if (CSType.equals("HK")) { |
| | | |
| | | if (content.substring(25, 26) != "3"){ |
| | | return; |
| | | } |
| | | |
| | | List<String> outData = new ArrayList<>(); |
| | | |
| | | switch (content.substring(0, 2)) { |
| | | case "BJ": |
| | | //报警信息 |
| | | String devId = content.substring(12, 24); |
| | | String devId = content.substring(12, 21); |
| | | List<Map<String, Object>> list = serverHandler.equipmentService.selectInfos(devId); |
| | | Alarm alarm = new Alarm(); |
| | | alarm.setWaringType("紧急求救"); |
| | |
| | | alarm.setAlarmTime(df.format(day)); |
| | | alarm.setPlace((String) list.get(0).get("streeName"));//事发地址 |
| | | alarm.setDeviceNumber((String) list.get(0).get("deviceNumber"));//设备编号 |
| | | |
| | | alarm.setDistrict((String) list.get(0).get("district"));//县区 |
| | | alarm.setProvince((String) list.get(0).get("province"));//市 |
| | | alarm.setCity((String) list.get(0).get("city")); |
| | |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | alarm.setJjTime(dateFormat.format(date)); |
| | | |
| | | |
| | | |
| | | serverHandler.alarmService.updatePoliceStatus(online_police.get(0).getId().toString(), "1"); |
| | | } |
| | | } |