// // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) // package com.template.common.utils; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hikvision.artemis.sdk.ArtemisHttpUtil; import com.hikvision.artemis.sdk.config.ArtemisConfig; import java.util.HashMap; import java.util.Map; /** * 调用海康接口工具类 */ public class GetCameraPreviewURL { public GetCameraPreviewURL() { } public static String GetCameraPreviewURL() { ArtemisConfig.host = "192.168.161.72:443"; ArtemisConfig.appKey = "29849943"; ArtemisConfig.appSecret = "e1eXZtEvJhi4waZmSgmd"; String ARTEMIS_PATH = "/artemis"; String previewURLsApi = "/artemis/api/eventService/v1/eventSubscriptionByEventTypes"; Map path = new HashMap(2) { { this.put("https://", "/artemis/api/eventService/v1/eventSubscriptionByEventTypes"); } }; String contentType = "application/json"; JSONObject jsonBody = new JSONObject(); int[] ingArr = new int[]{131588, 131586, 131587, 131603, 131608, 131604, 930335}; jsonBody.put("eventTypes", ingArr); String url = "http://192.168.161.224:8080/wanzai/eventRcv/subscription"; jsonBody.put("eventDest", url); String body = jsonBody.toJSONString(); String result = ArtemisHttpUtil.doPostStringArtemis(path, body, (Map) null, (String) null, contentType, (Map) null); return result; } public static String CameraPreviewURL(String url, JSONObject jsonBody) { ArtemisConfig.host = "192.168.161.72:443"; ArtemisConfig.appKey = "29849943"; ArtemisConfig.appSecret = "e1eXZtEvJhi4waZmSgmd"; String ARTEMIS_PATH = "/artemis"; final String previewURLsApi = "/artemis" + url; Map path = new HashMap(2) { { this.put("https://", previewURLsApi); } }; String contentType = "application/json"; String body = jsonBody.toJSONString(); String result = ArtemisHttpUtil.doPostStringArtemis(path, body, (Map) null, (String) null, contentType, (Map) null); return result; } public static String CameraPreviewURL2(String url, JSONArray jsonBody) { ArtemisConfig.host = "192.168.161.72:443"; ArtemisConfig.appKey = "29849943"; ArtemisConfig.appSecret = "e1eXZtEvJhi4waZmSgmd"; String ARTEMIS_PATH = "/artemis"; final String previewURLsApi = "/artemis" + url; Map path = new HashMap(2) { { this.put("https://", previewURLsApi); } }; String contentType = "application/json"; String body = jsonBody.toString(); String result = ArtemisHttpUtil.doPostStringArtemis(path, body, (Map) null, (String) null, contentType, (Map) null); return result; } public static void main(String[] args) { JSONObject jsonBody = new JSONObject(); // 人脸比对 int[] ingArr=new int[]{131659}; String url = "http://192.168.161.224:8080/wanzai/eventRcv/faceComparison"; // String url = "https://www.campussmartlife.com/smartApi/wanzai/eventRcv/faceComparison"; // 区域入侵,进入区域,离开区域,倒地 // int[] ingArr=new int[]{131588,131586,131587,131605}; // String url = "http://192.168.161.224:8080/wanzai/eventRcv/subscription"; // String url = "https://www.campussmartlife.com/smartApi/wanzai/eventRcv/subscription"; // 重点人员识别事件 // int[] ingArr = new int[]{1644175361}; // String url = "http://192.168.161.224:8080/wanzai/eventRcv/emphasisFace"; // String url = "https://www.campussmartlife.com/smartApi/wanzai/eventRcv/emphasisFace"; jsonBody.put("eventTypes", ingArr); jsonBody.put("eventDest", url); // 订阅 String result = CameraPreviewURL("/api/eventService/v1/eventSubscriptionByEventTypes", jsonBody); // 取消订阅 // String result = CameraPreviewURL("/api/eventService/v1/eventUnSubscriptionByEventTypes", jsonBody); System.out.println("result结果示例: " + result); } }