GetCameraPreviewURL.java 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //
  2. // Source code recreated from a .class file by IntelliJ IDEA
  3. // (powered by FernFlower decompiler)
  4. //
  5. package com.template.common.utils;
  6. import com.alibaba.fastjson.JSONArray;
  7. import com.alibaba.fastjson.JSONObject;
  8. import com.hikvision.artemis.sdk.ArtemisHttpUtil;
  9. import com.hikvision.artemis.sdk.config.ArtemisConfig;
  10. import java.util.HashMap;
  11. import java.util.Map;
  12. /**
  13. * 调用海康接口工具类
  14. */
  15. public class GetCameraPreviewURL {
  16. public GetCameraPreviewURL() {
  17. }
  18. public static String GetCameraPreviewURL() {
  19. ArtemisConfig.host = "192.168.161.72:443";
  20. ArtemisConfig.appKey = "29849943";
  21. ArtemisConfig.appSecret = "e1eXZtEvJhi4waZmSgmd";
  22. String ARTEMIS_PATH = "/artemis";
  23. String previewURLsApi = "/artemis/api/eventService/v1/eventSubscriptionByEventTypes";
  24. Map<String, String> path = new HashMap<String, String>(2) {
  25. {
  26. this.put("https://", "/artemis/api/eventService/v1/eventSubscriptionByEventTypes");
  27. }
  28. };
  29. String contentType = "application/json";
  30. JSONObject jsonBody = new JSONObject();
  31. int[] ingArr = new int[]{131588, 131586, 131587, 131603, 131608, 131604, 930335};
  32. jsonBody.put("eventTypes", ingArr);
  33. String url = "http://192.168.161.224:8080/wanzai/eventRcv/subscription";
  34. jsonBody.put("eventDest", url);
  35. String body = jsonBody.toJSONString();
  36. String result = ArtemisHttpUtil.doPostStringArtemis(path, body, (Map) null, (String) null, contentType, (Map) null);
  37. return result;
  38. }
  39. public static String CameraPreviewURL(String url, JSONObject jsonBody) {
  40. ArtemisConfig.host = "192.168.161.72:443";
  41. ArtemisConfig.appKey = "29849943";
  42. ArtemisConfig.appSecret = "e1eXZtEvJhi4waZmSgmd";
  43. String ARTEMIS_PATH = "/artemis";
  44. final String previewURLsApi = "/artemis" + url;
  45. Map<String, String> path = new HashMap<String, String>(2) {
  46. {
  47. this.put("https://", previewURLsApi);
  48. }
  49. };
  50. String contentType = "application/json";
  51. String body = jsonBody.toJSONString();
  52. String result = ArtemisHttpUtil.doPostStringArtemis(path, body, (Map) null, (String) null, contentType, (Map) null);
  53. return result;
  54. }
  55. public static String CameraPreviewURL2(String url, JSONArray jsonBody) {
  56. ArtemisConfig.host = "192.168.161.72:443";
  57. ArtemisConfig.appKey = "29849943";
  58. ArtemisConfig.appSecret = "e1eXZtEvJhi4waZmSgmd";
  59. String ARTEMIS_PATH = "/artemis";
  60. final String previewURLsApi = "/artemis" + url;
  61. Map<String, String> path = new HashMap<String, String>(2) {
  62. {
  63. this.put("https://", previewURLsApi);
  64. }
  65. };
  66. String contentType = "application/json";
  67. String body = jsonBody.toString();
  68. String result = ArtemisHttpUtil.doPostStringArtemis(path, body, (Map) null, (String) null, contentType, (Map) null);
  69. return result;
  70. }
  71. public static void main(String[] args) {
  72. JSONObject jsonBody = new JSONObject();
  73. // 人脸比对
  74. int[] ingArr=new int[]{131659};
  75. String url = "http://192.168.161.224:8080/wanzai/eventRcv/faceComparison";
  76. // String url = "https://www.campussmartlife.com/smartApi/wanzai/eventRcv/faceComparison";
  77. // 区域入侵,进入区域,离开区域,倒地
  78. // int[] ingArr=new int[]{131588,131586,131587,131605};
  79. // String url = "http://192.168.161.224:8080/wanzai/eventRcv/subscription";
  80. // String url = "https://www.campussmartlife.com/smartApi/wanzai/eventRcv/subscription";
  81. // 重点人员识别事件
  82. // int[] ingArr = new int[]{1644175361};
  83. // String url = "http://192.168.161.224:8080/wanzai/eventRcv/emphasisFace";
  84. // String url = "https://www.campussmartlife.com/smartApi/wanzai/eventRcv/emphasisFace";
  85. jsonBody.put("eventTypes", ingArr);
  86. jsonBody.put("eventDest", url);
  87. // 订阅
  88. String result = CameraPreviewURL("/api/eventService/v1/eventSubscriptionByEventTypes", jsonBody);
  89. // 取消订阅
  90. // String result = CameraPreviewURL("/api/eventService/v1/eventUnSubscriptionByEventTypes", jsonBody);
  91. System.out.println("result结果示例: " + result);
  92. }
  93. }