GetCameraPreviewURL.java 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 org.slf4j.Logger;
  11. import org.slf4j.LoggerFactory;
  12. import java.util.HashMap;
  13. import java.util.Map;
  14. /**
  15. * 调用海康接口工具类
  16. */
  17. public class GetCameraPreviewURL {
  18. private static Logger logger = LoggerFactory.getLogger(GetCameraPreviewURL.class);
  19. public GetCameraPreviewURL() {
  20. }
  21. public static String GetCameraPreviewURL() {
  22. // ArtemisConfig.host = "192.168.161.72:443";
  23. ArtemisConfig.host = "172.16.7.200:443";
  24. ArtemisConfig.appKey = "22263265";
  25. ArtemisConfig.appSecret = "fPjOY3vB865ACoQNj6yj";
  26. String ARTEMIS_PATH = "/artemis";
  27. String previewURLsApi = "/artemis/api/eventService/v1/eventSubscriptionByEventTypes";
  28. Map<String, String> path = new HashMap<String, String>(2) {
  29. {
  30. this.put("https://", "/artemis/api/eventService/v1/eventSubscriptionByEventTypes");
  31. }
  32. };
  33. String contentType = "application/json";
  34. JSONObject jsonBody = new JSONObject();
  35. int[] ingArr = new int[]{131588, 131586, 131587, 131603, 131608, 131604, 930335};
  36. jsonBody.put("eventTypes", ingArr);
  37. String url = "http://192.168.161.224:8080/wanzai/eventRcv/subscription";
  38. jsonBody.put("eventDest", url);
  39. String body = jsonBody.toJSONString();
  40. String result = ArtemisHttpUtil.doPostStringArtemis(path, body, (Map) null, (String) null, contentType, (Map) null);
  41. return result;
  42. }
  43. public static String CameraPreviewURL(String url, JSONObject jsonBody) {
  44. // ArtemisConfig.host = "192.168.161.72:443";
  45. ArtemisConfig.host = "172.16.7.200:443";
  46. ArtemisConfig.appKey = "22263265";
  47. ArtemisConfig.appSecret = "fPjOY3vB865ACoQNj6yj";
  48. String ARTEMIS_PATH = "/artemis";
  49. final String previewURLsApi = "/artemis" + url;
  50. Map<String, String> path = new HashMap<String, String>(2) {
  51. {
  52. this.put("https://", previewURLsApi);
  53. }
  54. };
  55. String contentType = "application/json";
  56. String body = jsonBody.toJSONString();
  57. String result = ArtemisHttpUtil.doPostStringArtemis(path, body, (Map) null, (String) null, contentType, (Map) null);
  58. return result;
  59. }
  60. public static String CameraPreviewURL2(String url, JSONArray jsonBody) {
  61. // ArtemisConfig.host = "192.168.161.72:443";
  62. ArtemisConfig.host = "172.16.7.200:443";
  63. ArtemisConfig.appKey = "22263265";
  64. ArtemisConfig.appSecret = "fPjOY3vB865ACoQNj6yj";
  65. String ARTEMIS_PATH = "/artemis";
  66. final String previewURLsApi = "/artemis" + url;
  67. Map<String, String> path = new HashMap<String, String>(2) {
  68. {
  69. this.put("https://", previewURLsApi);
  70. }
  71. };
  72. String contentType = "application/json";
  73. String body = jsonBody.toString();
  74. String result = ArtemisHttpUtil.doPostStringArtemis(path, body, (Map) null, (String) null, contentType, (Map) null);
  75. return result;
  76. }
  77. public static void main(String[] args) {
  78. JSONObject jsonBody = new JSONObject();
  79. // 人脸比对
  80. int[] ingArr=new int[]{131659};
  81. // String url = "http://192.168.161.224:8080/wanzai/eventRcv/faceComparison";
  82. // String url = "https://www.campussmartlife.com/smartApi/wanzai/eventRcv/faceComparison";
  83. String url = "http://122.51.35.116:8080/wanzai/eventRcv/faceComparison";
  84. // 区域入侵,进入区域,离开区域,倒地
  85. // int[] ingArr=new int[]{131588,131586,131587,131605};
  86. // String url = "http://192.168.161.224:8080/wanzai/eventRcv/subscription";
  87. // String url = "https://www.campussmartlife.com/smartApi/wanzai/eventRcv/subscription";
  88. // String url = "http://122.51.35.116:8080/wanzai/eventRcv/subscription";
  89. // 重点人员识别事件
  90. // int[] ingArr = new int[]{1644175361};
  91. // String url = "http://192.168.161.224:8080/wanzai/eventRcv/emphasisFace";
  92. // String url = "https://www.campussmartlife.com/smartApi/wanzai/eventRcv/emphasisFace";
  93. // String url = "http://122.51.35.116:8080/wanzai/eventRcv/emphasisFace";
  94. jsonBody.put("eventTypes", ingArr);
  95. jsonBody.put("eventDest", url);
  96. // 订阅
  97. String result = CameraPreviewURL("/api/eventService/v1/eventSubscriptionByEventTypes", jsonBody);
  98. // 取消订阅
  99. // String result = CameraPreviewURL("/api/eventService/v1/eventUnSubscriptionByEventTypes", jsonBody);
  100. logger.info("result结果示例: " + result);
  101. }
  102. }