Merge remote-tracking branch 'origin/jtdev' into jtdev
| | |
| | | */ |
| | | public static final String HOST = "36.134.79.80:1443"; |
| | | |
| | | /** |
| | | * newPost |
| | | */ |
| | | public static final String NEW_HOST = "223.76.234.232:1443"; |
| | | |
| | | |
| | | /** |
| | | * STEP2:设置OpenAPI接口的上下文 |
| | |
| | | @ApiOperation(value = "海康设备-分页列表查询", notes = "海康设备-分页列表查询") |
| | | @GetMapping(value = "/queryHkList") |
| | | public R queryHkList(Query query) { |
| | | String result = GetCameraResourcePage(query.getCurrent(), query.getSize(), HkConstant.cameras); |
| | | String result = GetCameraResourcePage(1,query.getCurrent(), query.getSize(), HkConstant.cameras); |
| | | JSONObject jsonObject1 = JSONObject.parseObject(result); |
| | | // 查询海康设备列表并返回 |
| | | return R.data(jsonObject1); |
| | |
| | | public R queryHkPreviewUrl(HkVO hk) { |
| | | String url = ""; |
| | | // 获取海康播放url |
| | | String result = GetCameraPreviewURL(HkConstant.previewURLs, hk.getCameraIndexCode(), ProtocolConstant.WS); |
| | | String result = GetCameraPreviewURL(hk.getType(),HkConstant.previewURLs, hk.getCameraIndexCode(), ProtocolConstant.WS); |
| | | if (null!=result) { |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | Map map = (Map) jsonObject.get("data"); |
| | |
| | | public R queryHkPreviewUrlCommon(HkVO hk) { |
| | | String url = ""; |
| | | // 获取海康播放url |
| | | String result = GetCameraPreviewURL(HkConstant.previewURLs, hk.getCameraIndexCode(), hk.getProtocol()); |
| | | String result = GetCameraPreviewURL(hk.getType(),HkConstant.previewURLs, hk.getCameraIndexCode(), hk.getProtocol()); |
| | | if (null!=result) { |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | Map map = (Map) jsonObject.get("data"); |
| | |
| | | public R queryHkPreviewUrlByHls(HkVO hk) { |
| | | String url = ""; |
| | | // 获取海康播放url |
| | | String result = GetCameraPreviewURL(HkConstant.previewURLs, hk.getCameraIndexCode(), ProtocolConstant.HLS); |
| | | String result = GetCameraPreviewURL(hk.getType(),HkConstant.previewURLs, hk.getCameraIndexCode(), ProtocolConstant.HLS); |
| | | if (null!=result) { |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | Map map = (Map) jsonObject.get("data"); |
| | |
| | | @GetMapping(value = "/handleCameraPosition") |
| | | public R handleCameraPosition(HkVO hk) { |
| | | // 获取海康播放url |
| | | String result = controlling(HkConstant.controllingURLs, |
| | | String result = controlling(hk.getType(),HkConstant.controllingURLs, |
| | | hk.getCameraIndexCode(),hk.getAction(),hk.getCommand(),hk.getSpeed(),hk.getPresetIndex()); |
| | | // 返回 |
| | | return R.data(result); |
| | |
| | | @GetMapping(value = "/selZoom") |
| | | public R selZoom(HkVO hk) { |
| | | // 获取海康播放url |
| | | String result = selZoomURLs(HkConstant.selZoomURLs, |
| | | String result = selZoomURLs(hk.getType(),HkConstant.selZoomURLs, |
| | | hk.getCameraIndexCode(),hk.getStartX(),hk.getStartY(),hk.getEndX(),hk.getEndY()); |
| | | // 返回 |
| | | return R.data(result); |
| | |
| | | @GetMapping(value = "/presetsSearchesUrls") |
| | | public R presetsSearchesUrls(HkVO hk) { |
| | | // 获取海康播放url |
| | | String result = presetsSearches(HkConstant.presetsSearchesUrls,hk.getCameraIndexCode()); |
| | | String result = presetsSearches(hk.getType(),HkConstant.presetsSearchesUrls,hk.getCameraIndexCode()); |
| | | // 返回 |
| | | return R.data(result); |
| | | } |
| | |
| | | @GetMapping(value = "/manualCapture") |
| | | public R manualCapture(HkVO hk) { |
| | | // 获取海康播放url |
| | | String result = manualCaptureUrls(HkConstant.manualCaptureUrls, |
| | | String result = manualCaptureUrls(hk.getType(),HkConstant.manualCaptureUrls, |
| | | hk.getCameraIndexCode()); |
| | | // 返回 |
| | | return R.data(result); |
| | |
| | | * 调用接口并返回数据 |
| | | * post请求application/json类型参数; |
| | | */ |
| | | return R.data(common(HkConstant.playbackURLs, body)); |
| | | return R.data(common(hk.getType(),HkConstant.playbackURLs, body)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 调用接口并返回数据 |
| | | * post请求application/json类型参数; |
| | | */ |
| | | return R.data(common(HkConstant.talkURLs, body)); |
| | | return R.data(common(hk.getType(),HkConstant.talkURLs, body)); |
| | | } |
| | | |
| | | } |
| | |
| | | // 获取根区域编号 |
| | | String rootRegionId = getRootRegionId(hk); |
| | | // 查询摄像头统计数据(需要有在线状态) |
| | | hashMap.put("total",getCameraStatisticCount(rootRegionId,null)); |
| | | hashMap.put("onlineTotal",getCameraStatisticCount(rootRegionId,1)); |
| | | hashMap.put("offlineTotal",getCameraStatisticCount(rootRegionId,0)); |
| | | hashMap.put("total",getCameraStatisticCount(hk.getType(),rootRegionId,null)); |
| | | hashMap.put("onlineTotal",getCameraStatisticCount(hk.getType(),rootRegionId,1)); |
| | | hashMap.put("offlineTotal",getCameraStatisticCount(hk.getType(),rootRegionId,0)); |
| | | // 查询摄像头集合数据 |
| | | hashMap.put("list",getCameraStatisticList(rootRegionId, hk,query)); |
| | | hashMap.put("list",getCameraStatisticList(hk.getType(),rootRegionId, hk,query)); |
| | | // 返回数据 |
| | | return hashMap; |
| | | } |
| | |
| | | * @param cameraIndexCode |
| | | * @return |
| | | */ |
| | | private String getCameraAddress(String regionIndexCode,String cameraIndexCode) { |
| | | private String getCameraAddress(Integer type,String regionIndexCode,String cameraIndexCode) { |
| | | // 组装请求参数 |
| | | JSONObject jsonBody = new JSONObject(); |
| | | jsonBody.put("regionIndexCodes", Arrays.asList(regionIndexCode)); |
| | |
| | | list.add(map); |
| | | jsonBody.put("expressions", list); |
| | | String body = jsonBody.toJSONString(); |
| | | String result = GetCameraUtils.common(regionInfoUrls, body); |
| | | String result = GetCameraUtils.common(type,regionInfoUrls, body); |
| | | // 数据处理 |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | JSONObject data = (JSONObject) jsonObject.get("data"); |
| | |
| | | * @param cameraIndexCode |
| | | * @return |
| | | */ |
| | | private JSONObject getCameraDetail(String cameraIndexCode) { |
| | | private JSONObject getCameraDetail(Integer type,String cameraIndexCode) { |
| | | // 组装请求参数 |
| | | JSONObject jsonBody = new JSONObject(); |
| | | jsonBody.put("cameraIndexCode", cameraIndexCode); |
| | | String body = jsonBody.toJSONString(); |
| | | String result = GetCameraUtils.common(camerasIndexCodeUrls, body); |
| | | String result = GetCameraUtils.common(type,camerasIndexCodeUrls, body); |
| | | // 数据处理 |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | // 返回 |
| | |
| | | * @param query |
| | | * @return |
| | | */ |
| | | private JSONObject getCameraStatisticList(String regionId, HkVO hk,Query query) { |
| | | private JSONObject getCameraStatisticList(Integer type,String regionId, HkVO hk,Query query) { |
| | | // 组装请求参数 |
| | | JSONObject jsonBody = new JSONObject(); |
| | | jsonBody.put("regionId", regionId); |
| | |
| | | jsonBody.put("status",hk.getStatus()); |
| | | } |
| | | String body = jsonBody.toJSONString(); |
| | | String result = GetCameraUtils.common(onlineCameraGetUrls, body); |
| | | String result = GetCameraUtils.common(type,onlineCameraGetUrls, body); |
| | | // 数据处理 |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | // 返回数据 |
| | |
| | | * @param status |
| | | * @return |
| | | */ |
| | | private String getCameraStatisticCount(String regionId,Integer status) { |
| | | private String getCameraStatisticCount(Integer type,String regionId,Integer status) { |
| | | // 组装请求参数 |
| | | JSONObject jsonBody = new JSONObject(); |
| | | jsonBody.put("regionId", regionId); |
| | |
| | | jsonBody.put("status",status); |
| | | } |
| | | String body = jsonBody.toJSONString(); |
| | | String result = GetCameraUtils.common(onlineCameraGetUrls, body); |
| | | String result = GetCameraUtils.common(type,onlineCameraGetUrls, body); |
| | | // 数据处理 |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | JSONObject data = (JSONObject) jsonObject.get("data"); |
| | |
| | | // 组装请求参数 |
| | | JSONObject jsonBody = new JSONObject(); |
| | | String body = jsonBody.toJSONString(); |
| | | String result = GetCameraUtils.common(regionsRootUrls, body); |
| | | String result = GetCameraUtils.common(hk.getType(),regionsRootUrls, body); |
| | | // 数据处理 |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | JSONObject data = (JSONObject) jsonObject.get("data"); |
| | |
| | | * @param body |
| | | * @return |
| | | */ |
| | | public static String common(String url, String body) { |
| | | public static String common(Integer type,String url, String body) { |
| | | /** |
| | | * STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数. |
| | | */ |
| | | // artemis网关服务器ip端口 |
| | | ArtemisConfig.host = HkConstant.HOST; |
| | | if (null==type){ |
| | | ArtemisConfig.host = HkConstant.HOST; |
| | | } |
| | | if (type==1) { |
| | | ArtemisConfig.host = HkConstant.HOST; |
| | | } |
| | | if (type==2) { |
| | | ArtemisConfig.host = HkConstant.NEW_HOST; |
| | | } |
| | | // 秘钥appKey |
| | | ArtemisConfig.appKey = HkConstant.AppKey; |
| | | // 秘钥appSecret |
| | |
| | | * @param cameraIndexCode 监控点唯一标识 |
| | | * @return |
| | | */ |
| | | public static String GetCameraPreviewURL(String url, String cameraIndexCode, String protocol) { |
| | | public static String GetCameraPreviewURL(Integer type,String url, String cameraIndexCode, String protocol) { |
| | | /** |
| | | * 组装请求参数 |
| | | */ |
| | |
| | | // jsonBody.put("expand", "streamform=ps"); |
| | | String body = jsonBody.toJSONString(); |
| | | // 调用公共方法 |
| | | return common(url,body); |
| | | return common(type,url,body); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param cameraCode 监控点唯一标识 |
| | | * @return |
| | | */ |
| | | public static String QueryCameraPreviewURL(String url, |
| | | public static String QueryCameraPreviewURL(Integer type, |
| | | String url, |
| | | String cameraCode, |
| | | String resourceType, |
| | | String key) { |
| | |
| | | jsonBody.put("expressions", list); |
| | | String body = jsonBody.toJSONString(); |
| | | System.out.println(jsonBody); |
| | | return common(url,body); |
| | | return common(type,url,body); |
| | | } |
| | | |
| | | |
| | |
| | | * @param cameraIndexCode 监控点唯一标识 |
| | | * @return |
| | | */ |
| | | public static String GetTalkURLs(String url, String cameraIndexCode) { |
| | | public static String GetTalkURLs(Integer type, String url, String cameraIndexCode) { |
| | | /** |
| | | * 组装请求参数 |
| | | */ |
| | |
| | | jsonBody.put("talkIndexCode", "ce744c4c67df464f92994185d825b6fa"); |
| | | jsonBody.put("protocol", "wss"); |
| | | String body = jsonBody.toJSONString(); |
| | | return common(url,body); |
| | | return common(type,url,body); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param command 命令 |
| | | * @return |
| | | */ |
| | | public static String controlling(String url, |
| | | public static String controlling(Integer type, |
| | | String url, |
| | | String cameraIndexCode, |
| | | Integer action, |
| | | String command, |
| | |
| | | /** |
| | | * 调用接口 |
| | | */ |
| | | return common(url,body); |
| | | return common(type,url,body); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param cameraIndexCode 监控点唯一标识 |
| | | * @return |
| | | */ |
| | | public static String presetsSearches(String url,String cameraIndexCode) { |
| | | public static String presetsSearches(Integer type,String url,String cameraIndexCode) { |
| | | /** |
| | | * 组装请求参数 |
| | | */ |
| | |
| | | /** |
| | | * 调用接口 |
| | | */ |
| | | return common(url,body); |
| | | return common(type,url,body); |
| | | } |
| | | |
| | | |
| | |
| | | * @param endY 命令 |
| | | * @return |
| | | */ |
| | | public static String selZoomURLs(String url, |
| | | public static String selZoomURLs(Integer type, |
| | | String url, |
| | | String cameraIndexCode, |
| | | Integer startX, |
| | | Integer startY, |
| | |
| | | /** |
| | | * 调用接口 |
| | | */ |
| | | return common(url,body); |
| | | return common(type,url,body); |
| | | } |
| | | |
| | | |
| | |
| | | * @param url 监控资源url |
| | | * @return |
| | | */ |
| | | public static String GetCameraResourcePage(Integer pageNo, Integer pageSize, String url) { |
| | | public static String GetCameraResourcePage(Integer type,Integer pageNo, Integer pageSize, String url) { |
| | | /** |
| | | * 组装请求参数 |
| | | */ |
| | |
| | | * 调用接口并返回数据 |
| | | * post请求application/json类型参数; |
| | | */ |
| | | return common(url, body); |
| | | return common(type,url, body); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param url 监控资源url |
| | | * @return |
| | | */ |
| | | public static String manualCaptureUrls(String url,String cameraIndexCode) { |
| | | public static String manualCaptureUrls(Integer type,String url,String cameraIndexCode) { |
| | | /** |
| | | * 组装请求参数 |
| | | */ |
| | |
| | | * 调用接口并返回数据 |
| | | * post请求application/json类型参数; |
| | | */ |
| | | return common(url, body); |
| | | return common(type,url, body); |
| | | } |
| | | |
| | | // public static void main(String[] args) { |
| | |
| | | */ |
| | | private String endTime; |
| | | |
| | | |
| | | /** |
| | | * 类型 1:老平台 2:新平台 |
| | | */ |
| | | private Integer type; |
| | | } |