|
@@ -0,0 +1,82 @@
|
|
|
|
+package com.ruoyi.web.controller.parkLot;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
|
+import com.hikvision.artemis.sdk.ArtemisHttpUtil;
|
|
|
|
+import com.hikvision.artemis.sdk.config.ArtemisConfig;
|
|
|
|
+
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.Map;
|
|
|
|
+/**
|
|
|
|
+ * @Author: tjf
|
|
|
|
+ * @Date: 2023/1/3 15:01
|
|
|
|
+ * @Describe:
|
|
|
|
+ */
|
|
|
|
+public class GetCameraPreviewURL {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 提供给皖事通剩余地面车位数量
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static String GetCameraPreviewURL() {
|
|
|
|
+ /**
|
|
|
|
+ * STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
|
|
|
|
+ */
|
|
|
|
+ ArtemisConfig.host = "114.99.51.58:442"; // 平台的ip端口
|
|
|
|
+ ArtemisConfig.appKey = "26665995"; // 密钥appkey
|
|
|
|
+ ArtemisConfig.appSecret = "P9y9211M5ftH8P1Xrcef";// 密钥appSecret
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * STEP2:设置OpenAPI接口的上下文
|
|
|
|
+ */
|
|
|
|
+ final String ARTEMIS_PATH = "/artemis";
|
|
|
|
+ /**
|
|
|
|
+ * STEP3:设置接口的URI地址
|
|
|
|
+ */
|
|
|
|
+ final String previewURLsApi = ARTEMIS_PATH + "/api/pms/v1/park/remainSpaceNum";
|
|
|
|
+ Map<String, String> path = new HashMap<String, String>(2) {
|
|
|
|
+ {
|
|
|
|
+ put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * STEP4:设置参数提交方式
|
|
|
|
+ */
|
|
|
|
+ String contentType = "application/json";
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * STEP5:组装请求参数
|
|
|
|
+ */
|
|
|
|
+ JSONObject jsonBody = new JSONObject();
|
|
|
|
+ jsonBody.put("parkSyscode", "v45gh45gergf34g34g354g35ger");
|
|
|
|
+ String body = jsonBody.toJSONString();
|
|
|
|
+ /**
|
|
|
|
+ * STEP6:调用接口
|
|
|
|
+ */
|
|
|
|
+ String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , null);// post请求application/json类型参数
|
|
|
|
+ System.out.println(result);
|
|
|
|
+ /**
|
|
|
|
+ * {
|
|
|
|
+ * "code": "0",
|
|
|
|
+ * "msg": "success",
|
|
|
|
+ * "data": [
|
|
|
|
+ * {
|
|
|
|
+ * "parkSyscode": "h45h3gh3g34g324g345",
|
|
|
|
+ * "parkName": "停车库1",
|
|
|
|
+ * "parentParkSyscode": "g354g45g345g35g2345gh5",
|
|
|
|
+ * "totalPlace": 5000,
|
|
|
|
+ * "totalPermPlace": 5000,
|
|
|
|
+ * "totalReservePlace": 0,
|
|
|
|
+ * "leftPlace": 0,
|
|
|
|
+ * "leftPermPlace": 0,
|
|
|
|
+ * "leftReservePlace": 0
|
|
|
|
+ * }
|
|
|
|
+ * ]
|
|
|
|
+ * }
|
|
|
|
+ */
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|