diff --git a/ludu-module-hiking/ludu-module-hiking-biz/src/main/java/cn/iocoder/yudao/module/hiking/IntegrationURL.java b/ludu-module-hiking/ludu-module-hiking-biz/src/main/java/cn/iocoder/yudao/module/hiking/IntegrationURL.java deleted file mode 100644 index ce2b919e4..000000000 --- a/ludu-module-hiking/ludu-module-hiking-biz/src/main/java/cn/iocoder/yudao/module/hiking/IntegrationURL.java +++ /dev/null @@ -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 path = new HashMap(2) { - { - put("https://", previewURLsApi);//根据现场环境部署确认是http还是https - } - }; - - //设置参数提交方式 - String contentType = "application/json"; - - //请求头添加 access_token认证 - Map 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 path = new HashMap(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 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 path = new HashMap(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 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 path = new HashMap(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 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 path = new HashMap(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 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 path = new HashMap(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 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 path = new HashMap(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 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 path = new HashMap(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 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 path = new HashMap(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 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 path = new HashMap(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 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 path = new HashMap(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 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 path = new HashMap(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 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 path = new HashMap(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-dd’T’HH:mm:ss.SSSXXX)例如北京时间:2017-06-14T00:00:00.000+08:00, - jsonBody.put("endTime",endTime);//结束时间 - String body = jsonBody.toJSONString(); - - //请求头添加 access_token认证 - Map 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 path = new HashMap(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 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 path = new HashMap(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 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 path = new HashMap(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; - } - - - - - -}