

返回参数
| 参数名称 | 数据类型 | 是否必须 | 参数描述 |
|---|---|---|---|
| code | string | False | 返回码,0:接口业务处理成功,其它参考附录E.other.1 |
| msg | string | False | 接口执行情况说明信息 |
| data | object | False | 区域信息结构体 |
| +total | number | False | 查询数据记录总数 |
| +pageNo | number | False | 当前页码 |
| +pageSize | number | False | 每页记录总数 |
| +list | object[] | False | 监控点列表 |
| ++altitude | string | False | 海拔 |
| ++cameraIndexCode | string | False | 监控点唯一标识 |
| ++cameraName | string | False | 监控点名称 |
| ++cameraType | number | False | 监控点类型,参考附录A.4 |
| ++cameraTypeName | string | False | 监控点类型说明 |
| ++capabilitySet | string | False | 设备能力集,参考附录A.22 |
| ++capabilitySetName | string | False | 能力集说明 |
| ++intelligentSet | string | False | 智能分析能力集,扩展字段,暂不使用 |
| ++intelligentSetName | string | False | 智能分析能力集说明,扩展字段,暂不使用 |
| ++channelNo | string | False | 通道编号 |
| ++channelType | string | False | 通道类型,附录A.5 |
| ++channelTypeName | string | False | 通道类型说明 |
| ++createTime | string | False | 创建时间,采用ISO8601标准,如2018-07-26T21:30:08+08:00 表示北京时间2018年7月26日21时30分08秒 |
| ++encodeDevIndexCode | string | False | 所属编码设备唯一标识 |
| ++encodeDevResourceType | string | False | 所属设备类型,扩展字段,暂不使用 |
| ++encodeDevResourceTypeName | string | False | 所属设备类型说明,扩展字段,暂不使用 |
| ++gbIndexCode | string | False | 监控点国标编号,即外码编号externalIndexCode |
| ++installLocation | string | False | 安装位置,详见附录附录A.81 安装位置 |
| ++keyBoardCode | string | False | 键盘控制码 |
| ++latitude | string | False | 纬度 |
| ++longitude | string | False | 经度 |
| ++pixel | string | False | 摄像机像素(1-普通像素,2-130万高清,3-200万高清,4-300万高清),扩展字段,暂不使用 |
| ++ptz | string | False | 云镜类型(1-全方位云台(带转动和变焦),2-只有变焦,不带转动,3-只有转动,不带变焦,4-无云台,无变焦),扩展字段,暂不使用 |
| ++ptzName | string | False | 云镜类型说明,扩展字段,暂不使用 |
| ++ptzController | string | False | 云台控制(1-DVR,2-模拟矩阵,3-MU4000,4-NC600),扩展字段,暂不使用 |
| ++ptzControllerName | string | False | 云台控制说明,扩展字段,暂不使用 |
| ++recordLocation | string | False | 录像存储位置 |
| ++recordLocationName | string | False | 录像存储位置说明 |
| ++regionIndexCode | string | False | 所属区域唯一标识 |
| ++status | string | False | 在线状态(0-未知,1-在线,2-离线),扩展字段,暂不使用 |
| ++statusName | string | False | 状态说明 |
| ++transType | number | False | 传输协议,参考附录A.40 |
| ++transTypeName | string | False | 传输协议类型说明 |
| ++treatyType | string | False | 接入协议,参考附录A.6 |
| ++treatyTypeName | string | False | 接入协议类型说明 |
| ++viewshed | string | False | 可视域相关(JSON格式),扩展字段,暂不使用 |
| ++updateTime | string | False | 更新时间 采用ISO8601标准,如2018-07-26T21:30:08+08:00 表示北京时间2017年7月26日21时30分08秒 |
变来这边直接有一个status状态字段返回,以为可以用,结果都是null
问了海康

在调一个

注意,这边indexCodes即为cameraIndexCode

以online区分
核心class
- package com.ars.camera.main;
-
- import cn.hutool.json.JSONArray;
- import cn.hutool.json.JSONObject;
- import cn.hutool.json.JSONUtil;
- import com.hikvision.artemis.sdk.ArtemisHttpUtil;
- import com.hikvision.artemis.sdk.config.ArtemisConfig;
-
- import java.util.HashMap;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Map;
- import java.util.stream.Collectors;
-
- /**
- * @author cmy
- * @date 2022/8/4 11:14
- */
- public class Start {
- /**
- * STEP2:设置OpenAPI接口的上下文
- */
- private static final String ARTEMIS_PATH = "/artemis";
-
- public static void main(String[] args) {
-
- ArtemisConfig.host = "XXX";
- ArtemisConfig.appKey = "26111111";
- ArtemisConfig.appSecret = "SECRET";
-
-
-
- final String camerasURLsApi = ARTEMIS_PATH + "/api/resource/v1/cameras";
- Map
camerasPath = new HashMap(2) { - {
- put("https://", camerasURLsApi);//根据现场环境部署确认是http还是https
- }
- };
-
-
- String contentType = "application/json";
-
- JSONObject jsonObject = JSONUtil.createObj()
- .set("pageNo",1)
- .set("pageSize",10);
-
- String result = ArtemisHttpUtil.doPostStringArtemis(camerasPath, jsonObject.toString(), null, null, contentType , null);
- System.out.println(result);
-
- JSONObject resultJson = new JSONObject(result);
- Integer total = resultJson.getInt("total");
- Integer pageNo = resultJson.getInt("pageNo");
- Integer pageSize = resultJson.getInt("pageSize");
- System.out.println(total);
- JSONObject dataJson = resultJson.getJSONObject("data");
- JSONArray list = dataJson.getJSONArray("list");
-
-
- JSONArray objects =JSONUtil.parseArray(list);
- List
camerasList = JSONUtil.toList(objects, Bean.class); -
- for (Bean bean : camerasList) {
- System.out.println(bean.getCameraName()+"--------------"+bean.getCameraIndexCode());
- }
-
-
-
-
- final String onLineURLsApi = ARTEMIS_PATH + "/api/nms/v1/online/camera/get";
- Map
onlinePath = new HashMap(2) { - {
- put("https://", onLineURLsApi);//根据现场环境部署确认是http还是https
- }
- };
-
- JSONObject onLineParam = JSONUtil.createObj()
- .set("pageNo",1)
- .set("pageSize",10)
- .set("indexCodes",camerasList.stream().map(Bean::getCameraIndexCode).collect(Collectors.toList()).toArray(new String[]{}));
-
-
- String result2 = ArtemisHttpUtil.doPostStringArtemis(onlinePath, onLineParam.toString(), null, null, contentType , null);
- System.out.println(result2);
-
- JSONObject result2Json = new JSONObject(result2);
- JSONObject data2Json = result2Json.getJSONObject("data");
- JSONArray list2 = data2Json.getJSONArray("list");
-
- JSONArray objects2 =JSONUtil.parseArray(list2);
- List
onlineBeanList = JSONUtil.toList(objects2, OnlineBean.class); -
- Map
mapCameras = camerasList.stream().collect(Collectors.toMap(Bean::getCameraIndexCode, t -> t)); - for (OnlineBean onlineBean : onlineBeanList) {
- mapCameras.get(onlineBean.getIndexCode()).setOnline(onlineBean.getOnline());
- }
-
-
- Iterator
iterator = mapCameras.keySet().iterator(); - while (iterator.hasNext()){
- String key = iterator.next();
- System.out.println(key + "---------"+mapCameras.get(key).getOnline());
- }
-
-
- }
- }
上服务器测试

结果第二个接口懵了,服务不支持
需要安装



安装之后,重启api网管

后端做好关联,把cameraIndexCode 传给前端,还有加密的secret,前端引入安装插件,引入相关js,即可。