|
@@ -1,14 +1,24 @@
|
|
|
package org.jeecg.modules.hikiot;
|
|
|
|
|
|
+import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
+import com.google.gson.JsonObject;
|
|
|
+import com.google.gson.JsonParser;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
+import org.jeecg.modules.hikiot.dto.AddDoorWeekPlanDTO;
|
|
|
+import org.jeecg.modules.hikiot.dto.AddFaceRequestDTO;
|
|
|
+import org.jeecg.modules.hikiot.dto.AddUserRequestDTO;
|
|
|
+import org.jeecg.modules.hikiot.dto.AddUserWeekPlanDTO;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.net.URI;
|
|
|
import java.net.http.HttpClient;
|
|
|
import java.net.http.HttpRequest;
|
|
|
import java.net.http.HttpResponse;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.LocalTime;
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
+import java.util.*;
|
|
|
|
|
|
import static com.alibaba.dashscope.utils.JsonUtils.gson;
|
|
|
import static org.jeecg.modules.hikiot.HikiotConstant.*;
|
|
@@ -23,18 +33,36 @@ public class HikiotTool {
|
|
|
* @param jsonParam 请求参数(JSON格式)
|
|
|
* @return 响应结果
|
|
|
*/
|
|
|
- public static String sendPostRequest(String url, String jsonParam) {
|
|
|
+ public static String sendPostRequest(String url, String jsonParam, Map<String, String> variables) {
|
|
|
+ // 参数校验
|
|
|
+ Objects.requireNonNull(url, "请求URL不能为空");
|
|
|
+ Objects.requireNonNull(jsonParam, "JSON参数不能为空");
|
|
|
+
|
|
|
try {
|
|
|
- HttpRequest request = HttpRequest.newBuilder()
|
|
|
+ // 构建请求基础配置
|
|
|
+ HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
|
|
|
.uri(URI.create(url))
|
|
|
.header("Content-Type", "application/json; charset=UTF-8")
|
|
|
- .POST(HttpRequest.BodyPublishers.ofString(jsonParam, StandardCharsets.UTF_8))
|
|
|
- .build();
|
|
|
+ .POST(HttpRequest.BodyPublishers.ofString(jsonParam, StandardCharsets.UTF_8));
|
|
|
+
|
|
|
+ // 添加自定义Header
|
|
|
+ if (variables != null) {
|
|
|
+ variables.forEach(requestBuilder::header);
|
|
|
+ }
|
|
|
|
|
|
+ // 构建最终请求
|
|
|
+ HttpRequest request = requestBuilder.build();
|
|
|
+
|
|
|
+ // 发送请求并返回结果
|
|
|
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
|
|
return response.body();
|
|
|
- } catch (Exception e) {
|
|
|
- throw new JeecgBootException("请求海康开放平台接口异常", e);
|
|
|
+
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new JeecgBootException("请求海康开放平台接口IO异常", e);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ // 恢复中断状态
|
|
|
+ Thread.currentThread().interrupt();
|
|
|
+ throw new JeecgBootException("请求海康开放平台接口被中断", e);
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
@@ -42,18 +70,33 @@ public class HikiotTool {
|
|
|
* @param url 完整请求地址(包含查询参数)
|
|
|
* @return 响应结果
|
|
|
*/
|
|
|
- public static String sendGetRequest(String url) {
|
|
|
- try {
|
|
|
- HttpRequest request = HttpRequest.newBuilder()
|
|
|
- .uri(URI.create(url))
|
|
|
- .header("Accept", "application/json")
|
|
|
- .GET()
|
|
|
- .build();
|
|
|
- HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
|
|
- return response.body();
|
|
|
- } catch (Exception e) {
|
|
|
- throw new JeecgBootException("请求海康开放平台接口异常", e);
|
|
|
+ public static String sendGetRequest(String url, Map<String, String> headers) throws IOException, InterruptedException {
|
|
|
+ // 获取访问凭证
|
|
|
+ JsonObject appAccessToken = JsonParser.parseString(HikiotTool.getAppAccessToken()).getAsJsonObject();
|
|
|
+ if (appAccessToken.get("code").getAsInt() == 0) {
|
|
|
+ appAccessToken = appAccessToken.getAsJsonObject("data");
|
|
|
+ } else {
|
|
|
+ throw new JeecgBootException("海康API appAccessToken请求失败: " + appAccessToken.get("msg").getAsString());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构建请求基础配置
|
|
|
+ HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
|
|
|
+ .uri(URI.create(url))
|
|
|
+ .GET()
|
|
|
+ .header("Content-Type", "application/json")
|
|
|
+ .header(APP_ACCESS_TOKEN_AUTH_HEADER, appAccessToken.get("appAccessToken").getAsString());
|
|
|
+
|
|
|
+ // 添加动态header
|
|
|
+ if (headers != null) {
|
|
|
+ headers.forEach(requestBuilder::header);
|
|
|
}
|
|
|
+
|
|
|
+ // 构建最终请求
|
|
|
+ HttpRequest request = requestBuilder.build();
|
|
|
+
|
|
|
+ // 发送请求
|
|
|
+ HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
|
|
+ return response.body();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -65,7 +108,7 @@ public class HikiotTool {
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
map.put(APP_KEY, APP_KEY_VALUE);
|
|
|
map.put(APP_SECRET, APP_SECRET_VALUE);
|
|
|
- return HikiotTool.sendPostRequest(GET_ACCESS_TOKEN_URL, gson.toJson(map));
|
|
|
+ return HikiotTool.sendPostRequest(GET_ACCESS_TOKEN_URL, gson.toJson(map), null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -77,9 +120,322 @@ public class HikiotTool {
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
map.put(APP_ACCESS_TOKEN, appAccessToken);
|
|
|
map.put(REFRESH_APP_TOKEN, refreshAppToken);
|
|
|
- return HikiotTool.sendPostRequest(REFRESH_ACCESS_TOKEN_URL, gson.toJson(map));
|
|
|
+ return HikiotTool.sendPostRequest(REFRESH_ACCESS_TOKEN_URL, gson.toJson(map), null);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 申请授权码
|
|
|
+ * @Date 14:04 2025/8/14
|
|
|
+ * @Param
|
|
|
+ * @return
|
|
|
+ **/
|
|
|
+ public static String getAuthCode() {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put(USER_NAME, USER_NAME_VALUE);
|
|
|
+ map.put(PASSWORD, PASSWORD_VALUE);
|
|
|
+ map.put(APP_KEY, APP_KEY_VALUE);
|
|
|
+ map.put(REDIRECT_URL, REDIRECT_URL_VALUE);
|
|
|
+ return HikiotTool.sendPostRequest(GET_AUTH_CODE_URL, gson.toJson(map), null);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 授权码获取用户访问凭证
|
|
|
+ * @Date 11:36 2025/8/14
|
|
|
+ * @Param
|
|
|
+ * @return
|
|
|
+ **/
|
|
|
+ public static String getUserAccessToken() throws IOException, InterruptedException {
|
|
|
+ JsonObject dataAuthCode = JsonParser.parseString(HikiotTool.getAuthCode()).getAsJsonObject();
|
|
|
+ if (dataAuthCode.get("code").getAsInt() == 0) {
|
|
|
+ dataAuthCode = dataAuthCode.getAsJsonObject("data");
|
|
|
+ } else {
|
|
|
+ throw new JeecgBootException("海康API authCode请求失败: " + dataAuthCode.get("msg").getAsString());
|
|
|
+ }
|
|
|
+ return sendGetRequest(GET_USER_ACCESS_TOKEN_URL + dataAuthCode.get("authCode").getAsString(), null);
|
|
|
}
|
|
|
- public static void main(String[] args) {
|
|
|
- System.out.println(HikiotTool.getAppAccessToken());
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 新增/修改人员
|
|
|
+ * @Date 9:35 2025/8/15
|
|
|
+ **/
|
|
|
+ public static String addUser() throws IOException, InterruptedException {
|
|
|
+ AddUserRequestDTO addUserRequestDTO = new AddUserRequestDTO();
|
|
|
+ addUserRequestDTO.setDeviceSerial("FX0889961");
|
|
|
+ addUserRequestDTO.setPayload(new AddUserRequestDTO.Payload()
|
|
|
+ .setUserInfo(new AddUserRequestDTO.Payload.UserInfo()
|
|
|
+ .setUserType(VISITOR)
|
|
|
+ .setEmployeeNo("0002")
|
|
|
+ .setName("Sheep2")
|
|
|
+ .setPermanentValid(true)
|
|
|
+ .setEnableBeginTime(LocalDateTimeUtil.format(LocalDateTime.now().with(LocalTime.MIN), "yyyy-MM-dd'T'HH:mm:ss"))
|
|
|
+ .setEnableEndTime(LocalDateTimeUtil.format(LocalDateTime.now()
|
|
|
+ .with(LocalTime.MAX)
|
|
|
+ .truncatedTo(ChronoUnit.SECONDS), "yyyy-MM-dd'T'HH:mm:ss"))));
|
|
|
+ return sendPostRequest(ADD_USER_URL, gson.toJson(addUserRequestDTO),setHeaders());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 设备添加
|
|
|
+ * @Date 10:47 2025/8/15
|
|
|
+ **/
|
|
|
+ public static String addDevice() throws IOException, InterruptedException {
|
|
|
+ Map<String, String> device = new HashMap<>();
|
|
|
+ device.put("deviceSerial", "FX0889961");
|
|
|
+ device.put("validateCode", "zswl8812");
|
|
|
+ device.put("addMethod", "DeviceToken");
|
|
|
+ device.put("qrCode", "");
|
|
|
+ return sendPostRequest(ADD_DEVICE_URL, gson.toJson(device),setHeaders());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 设置请求头
|
|
|
+ * @Date 10:56 2025/8/15
|
|
|
+ **/
|
|
|
+ private static Map<String, String> setHeaders() throws IOException, InterruptedException {
|
|
|
+ Map<String, String> variables = new HashMap<>();
|
|
|
+ JsonObject appAccessToken = JsonParser.parseString(HikiotTool.getAppAccessToken()).getAsJsonObject();
|
|
|
+ JsonObject userAccessToken = JsonParser.parseString(HikiotTool.getUserAccessToken()).getAsJsonObject();
|
|
|
+ if (appAccessToken.get("code").getAsInt() == 0) {
|
|
|
+ appAccessToken = appAccessToken.getAsJsonObject("data");
|
|
|
+ }
|
|
|
+ if (userAccessToken.get("code").getAsInt() == 0) {
|
|
|
+ userAccessToken = userAccessToken.getAsJsonObject("data");
|
|
|
+ }
|
|
|
+ variables.put(APP_ACCESS_TOKEN_AUTH_HEADER, appAccessToken.get("appAccessToken").getAsString());
|
|
|
+ variables.put(USER_ACCESS_TOKEN, userAccessToken.get("userAccessToken").getAsString());
|
|
|
+ return variables;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 设备/通道能力查询
|
|
|
+ * @Date 12:00 2025/8/15
|
|
|
+ **/
|
|
|
+ public static String getDeviceAbility() throws IOException, InterruptedException {
|
|
|
+ Map<String, String> headers = new HashMap<>();
|
|
|
+ JsonObject userAccessToken = JsonParser.parseString(HikiotTool.getUserAccessToken()).getAsJsonObject();
|
|
|
+ if (userAccessToken.get("code").getAsInt() == 0) {
|
|
|
+ userAccessToken = userAccessToken.getAsJsonObject("data");
|
|
|
+ }
|
|
|
+ headers.put(USER_ACCESS_TOKEN, userAccessToken.get("userAccessToken").getAsString());
|
|
|
+ return sendGetRequest(QUERY_DEVICE_ABILITY_URL + "FX0889961",headers);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 新增/修改人脸
|
|
|
+ * @Date 14:28 2025/8/15
|
|
|
+ **/
|
|
|
+ public static String addFace() throws IOException, InterruptedException {
|
|
|
+ AddFaceRequestDTO addFaceRequestDTO = new AddFaceRequestDTO();
|
|
|
+ addFaceRequestDTO.setDeviceSerial("FX0889961");
|
|
|
+ addFaceRequestDTO.setPayload(new AddFaceRequestDTO.Payload()
|
|
|
+ .setFaceInfo(new AddFaceRequestDTO.Payload.FaceInfo().setEmployeeNo("0002")
|
|
|
+ .setFaceURL("https://dst-health.oss-cn-chengdu.aliyuncs.com/20250815/99e0a736139b4c52a53365486c810452.jpg")));
|
|
|
+ return sendPostRequest(ADD_FACE_URL, gson.toJson(addFaceRequestDTO),setHeaders());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 人员信息查询
|
|
|
+ * @Date 15:08 2025/8/15
|
|
|
+ **/
|
|
|
+ public static String queryUserInfo() throws IOException, InterruptedException {
|
|
|
+ Map<String, String> queryUserInfo = new HashMap<>();
|
|
|
+ queryUserInfo.put("deviceSerial", "FX0889961");
|
|
|
+ queryUserInfo.put("keyword", "0002");
|
|
|
+ return sendPostRequest(QUERY_USER_INFO_URL, gson.toJson(queryUserInfo),setHeaders());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 配置人员周计划
|
|
|
+ * @Date 16:12 2025/8/15
|
|
|
+ **/
|
|
|
+ public static String addUserWeekPlan() throws IOException, InterruptedException {
|
|
|
+ AddUserWeekPlanDTO dto = new AddUserWeekPlanDTO();
|
|
|
+
|
|
|
+ // 基础配置
|
|
|
+ dto.setDeviceSerial("FX0889961");
|
|
|
+
|
|
|
+ // 初始化payload
|
|
|
+ AddUserWeekPlanDTO.Payload payload = new AddUserWeekPlanDTO.Payload();
|
|
|
+ AddUserWeekPlanDTO.UserWeekPlan userWeekPlan = new AddUserWeekPlanDTO.UserWeekPlan();
|
|
|
+
|
|
|
+ userWeekPlan.setDoorWeekId(1);
|
|
|
+ userWeekPlan.setEnable(true);
|
|
|
+
|
|
|
+ // 生成时间配置
|
|
|
+ userWeekPlan.setTimeSegment(createTimeSegments());
|
|
|
+
|
|
|
+ payload.setUserWeekPlan(userWeekPlan);
|
|
|
+ dto.setPayload(payload);
|
|
|
+
|
|
|
+ return sendPostRequest(CONFIG_USER_WEEK_PLAN_URL, gson.toJson(dto), setHeaders());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成时间片段
|
|
|
+ private static List<AddUserWeekPlanDTO.TimeSegment> createTimeSegments() {
|
|
|
+ List<AddUserWeekPlanDTO.TimeSegment> segments = new ArrayList<>();
|
|
|
+ // 默认时间片段配置
|
|
|
+ for (String day : Arrays.asList("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")) {
|
|
|
+ for (int i = 1; i <= 8; i++) {
|
|
|
+ AddUserWeekPlanDTO.TimeSegment segment = new AddUserWeekPlanDTO.TimeSegment();
|
|
|
+ segment.setDoorWeekTimeSegmentId(i);
|
|
|
+ segment.setWeek(day);
|
|
|
+ segment.setDoorStatus("remainClosed");
|
|
|
+ segment.setBeginTime("00:00:00");
|
|
|
+ segment.setEndTime("00:00:00");
|
|
|
+
|
|
|
+ // 特殊配置
|
|
|
+ if (i == 1 && (day.equals("Monday") || day.equals("Tuesday"))) {
|
|
|
+ segment.setEnable(true);
|
|
|
+ segment.setEndTime("23:59:59");
|
|
|
+ } else {
|
|
|
+ segment.setEnable(false);
|
|
|
+ }
|
|
|
+ segments.add(segment);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return segments;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 配置人员计划模板
|
|
|
+ * @Date 17:09 2025/8/15
|
|
|
+ **/
|
|
|
+ public static String addUserPlanTemplate() throws IOException, InterruptedException {
|
|
|
+ String addUserPlanTemplate = "{\n" +
|
|
|
+ " \"deviceSerial\": \"FX0889961\",\n" +
|
|
|
+ " \"payload\": {\n" +
|
|
|
+ " \"userPlanTemplate\": {\n" +
|
|
|
+ " \"doorPlanTemplateId\": 1,\n" +
|
|
|
+ " \"enable\": true,\n" +
|
|
|
+ " \"name\": \"全天通行计划模板\",\n" +
|
|
|
+ " \"doorWeekId\": 1,\n" +
|
|
|
+ " \"holidayGroupId\": [\n" +
|
|
|
+ " 1\n" +
|
|
|
+ " ]\n" +
|
|
|
+ " }\n" +
|
|
|
+ " }\n" +
|
|
|
+ "}";
|
|
|
+ return sendPostRequest(CONFIG_USER_PLAN_TEMPLATE_URL, addUserPlanTemplate, setHeaders());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 配置门周计划
|
|
|
+ * @Date 16:42 2025/8/15
|
|
|
+ **/
|
|
|
+ public static String addDoorWeekPlan() throws IOException, InterruptedException {
|
|
|
+ AddDoorWeekPlanDTO dto = new AddDoorWeekPlanDTO();
|
|
|
+ // 基础配置
|
|
|
+ dto.setDeviceSerial("FX0889961");
|
|
|
+ // 初始化payload
|
|
|
+ AddDoorWeekPlanDTO.Payload payload = new AddDoorWeekPlanDTO.Payload();
|
|
|
+ AddDoorWeekPlanDTO.WeekPlan weekPlan = new AddDoorWeekPlanDTO.WeekPlan();
|
|
|
+ weekPlan.setDoorWeekId(1);
|
|
|
+ weekPlan.setEnable(true);
|
|
|
+ // 生成时间配置
|
|
|
+ weekPlan.setTimeSegment(createTimeSegments1());
|
|
|
+ payload.setWeekPlan(weekPlan);
|
|
|
+ dto.setPayload(payload);
|
|
|
+ return sendPostRequest(CONFIG_DOOR_WEEK_PLAN_URL, gson.toJson(dto), setHeaders());
|
|
|
+ }
|
|
|
+ private static List<AddDoorWeekPlanDTO.TimeSegment> createTimeSegments1() {
|
|
|
+ List<AddDoorWeekPlanDTO.TimeSegment> segments = new ArrayList<>();
|
|
|
+
|
|
|
+ List<String> days = Arrays.asList(
|
|
|
+ "Monday", "Tuesday", "Wednesday", "Thursday",
|
|
|
+ "Friday", "Saturday", "Sunday"
|
|
|
+ );
|
|
|
+
|
|
|
+ for (String day : days) {
|
|
|
+ for (int i = 1; i <= 8; i++) {
|
|
|
+ AddDoorWeekPlanDTO.TimeSegment segment = new AddDoorWeekPlanDTO.TimeSegment();
|
|
|
+ segment.setDoorWeekTimeSegmentId(i);
|
|
|
+ segment.setWeek(day);
|
|
|
+
|
|
|
+ // 设置默认值
|
|
|
+ segment.setBeginTime("00:00:00");
|
|
|
+ segment.setEndTime("00:00:00");
|
|
|
+
|
|
|
+ // 特殊配置
|
|
|
+ if (i == 1 && (day.equals("Monday") || day.equals("Tuesday")
|
|
|
+ || day.equals("Wednesday") || day.equals("Thursday")
|
|
|
+ || day.equals("Friday"))) {
|
|
|
+ segment.setEnable(true);
|
|
|
+ segment.setEndTime("23:59:59");
|
|
|
+ } else {
|
|
|
+ segment.setEnable(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ segments.add(segment);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return segments;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 配置门关联计划模板
|
|
|
+ * @Date 16:48 2025/8/15
|
|
|
+ **/
|
|
|
+ public static String addDoorPlanTemplate() throws IOException, InterruptedException {
|
|
|
+ String str = "{\n" +
|
|
|
+ " \"deviceSerial\": \"FX0889961\",\n" +
|
|
|
+ " \"payload\": {\n" +
|
|
|
+ " \"doorRightPlan\": {\n" +
|
|
|
+ " \"doorNo\": 1,\n" +
|
|
|
+ " \"planTemplateId\": 1\n" +
|
|
|
+ " }\n" +
|
|
|
+ " }\n" +
|
|
|
+ "}";
|
|
|
+ return sendPostRequest(CONFIG_DOOR_PLAN_TEMPLATE_URL, str, setHeaders());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 配置门计划模板
|
|
|
+ * @Date 16:51 2025/8/15
|
|
|
+ **/
|
|
|
+ public static String addDoorPlanTemplate1() throws IOException, InterruptedException {
|
|
|
+ String str = "{\n" +
|
|
|
+ " \"deviceSerial\": \"FX0889961\",\n" +
|
|
|
+ " \"payload\": {\n" +
|
|
|
+ " \"planTemplate\": {\n" +
|
|
|
+ " \"doorPlanTemplateId\": 1,\n" +
|
|
|
+ " \"enable\": true,\n" +
|
|
|
+ " \"name\": \"全天常开计划模板\",\n" +
|
|
|
+ " \"doorWeekId\": 1,\n" +
|
|
|
+ " \"holidayGroupId\": [\n" +
|
|
|
+ " 1\n" +
|
|
|
+ " ]\n" +
|
|
|
+ " }\n" +
|
|
|
+ " }\n" +
|
|
|
+ "}";
|
|
|
+ return sendPostRequest(CONFIG_DOOR_PLAN_TEMPLATE_URL2, str, setHeaders());
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) throws IOException, InterruptedException {
|
|
|
+ addUser();
|
|
|
+// addUser();
|
|
|
+// addFace();
|
|
|
+// addUserWeekPlan();
|
|
|
+// JsonObject root = JsonParser.parseString(HikiotTool.getAppAccessToken()).getAsJsonObject();
|
|
|
+// JsonObject data;
|
|
|
+// if (root.get("code").getAsInt() == 0) {
|
|
|
+// data = root.getAsJsonObject("data");
|
|
|
+// sendGetRequest(GET_USER_ACCESS_TOKEN_URL + AUTH_CODE + "FX0889961", data.get("appAccessToken").getAsString());
|
|
|
+// } else {
|
|
|
+// throw new JeecgBootException("海康API 请求失败: " + root.get("msg").getAsString());
|
|
|
+// }
|
|
|
}
|
|
|
}
|