revert 添加海康接口 优化票务服务
This commit is contained in:
tesra 2025-01-21 20:39:38 +08:00
parent c47e0f0ffc
commit bebc3ac904

View File

@ -1,503 +0,0 @@
package cn.iocoder.yudao.module.hiking;
import cn.iocoder.yudao.module.hiking.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.module.hiking.service.region.RegionService;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
public class IntegrationURL {
//设置平台参数根据实际情况,设置host appKey appSecret 三个参数.
static {
ArtemisConfig.host = "127.0.0.1:443"; // 平台的ip端口
ArtemisConfig.appKey = "29180881"; // 密钥appkey
ArtemisConfig.appSecret = "XO0wCAYGi4KV70ybjznx";// 密钥appSecret
}
//设置OpenAPI接口的上下文
public static final String ARTEMIS_PATH = "/artemis";
// 获取根区域信息
public static String getRegionsRootURL(String accessToken) {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/regions/root";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//请求头添加 access_token认证
Map<String, String> attributesMap = new HashMap<>();
attributesMap.put("access_token", accessToken);
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, null, null, null, contentType , attributesMap);// post请求application/json类型参数
return result;
}
//查询区域列表v2
public static String getRegionListURL(String resourceType,int pageNo,int pageSize,String accessToken) {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/irds/v2/region/nodesByParams";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//组装请求参数
JSONObject jsonBody = new JSONObject();
jsonBody.put("resourceType",resourceType);
jsonBody.put("pageNo", pageNo);
jsonBody.put("pageSize", pageSize);
String body = jsonBody.toJSONString();
//请求头添加 access_token认证
Map<String, String> attributesMap = new HashMap<>();
attributesMap.put("access_token", accessToken);
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , attributesMap);// post请求application/json类型参数
return result;
}
// 根据区域编号获取下一级区域列表v2
public static String getRegionListByParentIndexCodeURL(String parentIndexCode, String resourceType,int pageNo,int pageSize,String accessToken) {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v2/regions/subRegions";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//组装请求参数
JSONObject jsonBody = new JSONObject();
jsonBody.put("parentIndexCode", parentIndexCode);
jsonBody.put("resourceType",resourceType);
jsonBody.put("pageNo", pageNo);
jsonBody.put("pageSize", pageSize);
String body = jsonBody.toJSONString();
//请求头添加 access_token认证
Map<String, String> attributesMap = new HashMap<>();
attributesMap.put("access_token", accessToken);
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , attributesMap);// post请求application/json类型参数
return result;
}
// 分页获取区域列表
public static String getRegionListPageURL(int pageNo,int pageSize,String accessToken) {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/regions";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//组装请求参数
JSONObject jsonBody = new JSONObject();
jsonBody.put("pageNo", pageNo);
jsonBody.put("pageSize", pageSize);
String body = jsonBody.toJSONString();
//请求头添加 access_token认证
Map<String, String> attributesMap = new HashMap<>();
attributesMap.put("access_token", accessToken);
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , attributesMap);// post请求application/json类型参数
return result;
}
// 根据编号获取区域详细信息
public static String getRegionByIndexCodesURL(String[] indexCodes,String accessToken) {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/region/regionCatalog/regionInfo";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//组装请求参数
JSONObject jsonBody = new JSONObject();
jsonBody.put("indexCodes", indexCodes);
String body = jsonBody.toJSONString();
//请求头添加 access_token认证
Map<String, String> attributesMap = new HashMap<>();
attributesMap.put("access_token", accessToken);
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , attributesMap);// post请求application/json类型参数
return result;
}
// 增量获取区域数据
public static String getRegionTimeRangeURL(String startTime, String pageNo, String pageSize,String accessToken) {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/region/timeRange";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//组装请求参数
JSONObject jsonBody = new JSONObject();
jsonBody.put("startTime", startTime);
jsonBody.put("pageNo", pageNo);
jsonBody.put("pageSize", pageSize);
String body = jsonBody.toJSONString();
//请求头添加 access_token认证
Map<String, String> attributesMap = new HashMap<>();
attributesMap.put("access_token", accessToken);
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , attributesMap);// post请求application/json类型参数
return result;
}
//查询监控点列表v2
public static String getCameraListURL(int pageNo,int pageSize,String accessToken) {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v2/camera/search";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//组装请求参数
JSONObject jsonBody = new JSONObject();
jsonBody.put("pageNo", pageNo); //当前页码
jsonBody.put("pageSize", pageSize); //分页大小
String body = jsonBody.toJSONString();
//请求头添加 access_token认证
Map<String, String> attributesMap = new HashMap<>();
attributesMap.put("access_token", accessToken);
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , attributesMap);// post请求application/json类型参数
return result;
}
//分页获取监控点资源
public static String getCameraResourceURL(int pageNo,int pageSize,String accessToken) {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/cameras";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//组装请求参数
JSONObject jsonBody = new JSONObject();
jsonBody.put("pageNo", pageNo); //当前页码
jsonBody.put("pageSize", pageSize); //分页大小
String body = jsonBody.toJSONString();
//请求头添加 access_token认证
Map<String, String> attributesMap = new HashMap<>();
attributesMap.put("access_token", accessToken);
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , attributesMap);// post请求application/json类型参数
return result;
}
// 根据区域编号获取下级监控点列表
public static String getCameraListByRegionIndexCodeURL(String regionIndexCode, int pageNo,int pageSize,String accessToken) {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/regions/regionIndexCode/cameras";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//组装请求参数
JSONObject jsonBody = new JSONObject();
jsonBody.put("regionIndexCode", regionIndexCode); //区域编号
jsonBody.put("pageNo", pageNo); //当前页码
jsonBody.put("pageSize", pageSize); //分页大小
String body = jsonBody.toJSONString();
//请求头添加 access_token认证
Map<String, String> attributesMap = new HashMap<>();
attributesMap.put("access_token", accessToken);
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , attributesMap);// post请求application/json类型参数
return result;
}
// 根据编号获取监控点详细信息
public static String getCameraByCameraIndexCodeURL(String cameraIndexCode,String accessToken) {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/cameras/indexCode";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//组装请求参数
JSONObject jsonBody = new JSONObject();
jsonBody.put("cameraIndexCode", cameraIndexCode); //监控点唯一标识
String body = jsonBody.toJSONString();
//请求头添加 access_token认证
Map<String, String> attributesMap = new HashMap<>();
attributesMap.put("access_token", accessToken);
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , attributesMap);// post请求application/json类型参数
return result;
}
// 增量获取监控点数据
public static String getCameraTimeRangeURL(String startTime, int pageNo, int pageSize, String accessToken) {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/camera/timeRange";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//组装请求参数
JSONObject jsonBody = new JSONObject();
jsonBody.put("startTime", startTime);
jsonBody.put("pageNo", pageNo); //当前页码
jsonBody.put("pageSize", pageSize); //分页大小
String body = jsonBody.toJSONString();
//请求头添加 access_token认证
Map<String, String> attributesMap = new HashMap<>();
attributesMap.put("access_token", accessToken);
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , attributesMap);// post请求application/json类型参数
return result;
}
//获取监控点预览取流URLv2
public static String getPreviewURL(String cameraIndexCode,String accessToken) {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/video/v2/cameras/previewURLs";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//组装请求参数
JSONObject jsonBody = new JSONObject();
jsonBody.put("cameraIndexCode", cameraIndexCode); //监控点唯一标识分页获取监控点资源接口获取返回参数cameraIndexCode
String body = jsonBody.toJSONString();
//请求头添加 access_token认证
Map<String, String> attributesMap = new HashMap<>();
attributesMap.put("access_token", accessToken);
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , attributesMap);// post请求application/json类型参数
return result;
}
//获取监控点回放取流URLv2
public static String getPlaybackURL(String cameraIndexCode,String beginTime,String endTime,String accessToken) {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/video/v2/cameras/playbackURLs";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//组装请求参数
JSONObject jsonBody = new JSONObject();
jsonBody.put("cameraIndexCode", cameraIndexCode);//监控点唯一标识分页获取监控点资源接口获取返回参数cameraIndexCode
jsonBody.put("beginTime",beginTime );//开始查询时间IOS8601格式yyyy-MM-ddTHH:mm:ss.SSSXXX例如北京时间2017-06-14T00:00:00.000+08:00
jsonBody.put("endTime",endTime);//结束时间
String body = jsonBody.toJSONString();
//请求头添加 access_token认证
Map<String, String> attributesMap = new HashMap<>();
attributesMap.put("access_token", accessToken);
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , attributesMap);// post请求application/json类型参数
return result;
}
//监控点3D放大
public static String getControlURL(String cameraIndexCode,int startX,int startY,int endX,int endY,String accessToken) {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/video/v1/ptzs/selZoom";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//组装请求参数
JSONObject jsonBody = new JSONObject();
jsonBody.put("cameraIndexCode",cameraIndexCode );
jsonBody.put("startX",startX );
jsonBody.put("startY",startY );
jsonBody.put("endX",endX );
jsonBody.put("endY",endY );
String body = jsonBody.toJSONString();
//请求头添加 access_token认证
Map<String, String> attributesMap = new HashMap<>();
attributesMap.put("access_token", accessToken);
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , attributesMap);// post请求application/json类型参数
return result;
}
//根据监控点编号进行云台操作
public static String getYunTaiOperationURL(String cameraIndexCode,int action,String command,String accessToken) {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/video/v1/ptzs/controlling";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//组装请求参数
JSONObject jsonBody = new JSONObject();
jsonBody.put("cameraIndexCode", cameraIndexCode);
jsonBody.put("action",action );
jsonBody.put("command",command );
String body = jsonBody.toJSONString();
//请求头添加 access_token认证
Map<String, String> attributesMap = new HashMap<>();
attributesMap.put("access_token", accessToken);
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , attributesMap);// post请求application/json类型参数
return result;
}
//access_token认证
public static String getAccessTokenURL() {
//设置接口的URI地址
final String previewURLsApi = ARTEMIS_PATH + "/api/v1/oauth/token";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
//设置参数提交方式
String contentType = "application/json";
//组装请求参数
JSONObject jsonBody = new JSONObject();
String body = jsonBody.toJSONString();
//调用接口
String result = ArtemisHttpUtil.doPostStringArtemis(path, null, null, null, contentType , null);// post请求application/json类型参数
return result;
}
}