zhanghua
2023-10-26 8c80a8d7d70d0aa19fe194df49c21a88d2ba7589
ycl-platform/src/main/java/com/ycl/util/VideoUtil.java
@@ -186,7 +186,7 @@
        config.setHost(HOST); // 代理API网关nginx服务器ip端口
        config.setAppKey(APP_KEY);  // 秘钥appkey
        config.setAppSecret(APP_SECRET);// 秘钥appSecret
        final String getSecurityApi = ARTEMIS_PATH + "/api/resource/v1/cameras/previewURLs"; // 接口路径
        final String getSecurityApi = ARTEMIS_PATH + "/api/video/v1/cameras/previewURLs"; // 接口路径
        Map<String, String> path = new HashMap<String, String>(2) {
            {
                put("https://", getSecurityApi);
@@ -210,8 +210,53 @@
        String body = jsonBody.toString();
        //参数根据接口实际情况设置
        HttpResponse result = ArtemisHttpUtil.doPostStringImgArtemis(config, path, body, query, null, "application/json", head);
        System.out.println("海康完成请求");
        try {
            String strResult = EntityUtils.toString(result.getEntity());
            System.out.println("海康返回结果:" + strResult);
            HttpResponseResult responseResult = com.alibaba.fastjson.JSONObject.parseObject(strResult, HttpResponseResult.class);
            if ("0".equals(responseResult.getCode())) {
                com.alibaba.fastjson.JSONObject jsonObject = responseResult.getData();
                String url = jsonObject.getString("url");
                return url;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
    }
    public String getKHPresets(String code) throws Exception {
        ArtemisConfig config = new ArtemisConfig();
        config.setHost(HOST); // 代理API网关nginx服务器ip端口
        config.setAppKey(APP_KEY);  // 秘钥appkey
        config.setAppSecret(APP_SECRET);// 秘钥appSecret
        final String getSecurityApi = ARTEMIS_PATH + "/api/video/v1/presets/searches"; // 接口路径
        Map<String, String> path = new HashMap<String, String>(2) {
            {
                put("https://", getSecurityApi);
            }
        };
        Map<String, String> head = new HashMap<String, String>(2) {  //get请求的head参数
            {
                put("headpost", "sky-test");
            }
        };
        Map<String, String> query = new HashMap<String, String>(2) {  //get请求的head参数
            {
                put("domainId", "0");
            }
        };
        JSONObject jsonBody = new JSONObject();
        jsonBody.put("cameraIndexCode", code);
        String body = jsonBody.toString();
        //参数根据接口实际情况设置
        HttpResponse result = ArtemisHttpUtil.doPostStringImgArtemis(config, path, body, query, null, "application/json", head);
        System.out.println("海康完成请求-getKHPresets");
        try {
            String strResult = EntityUtils.toString(result.getEntity());
            System.out.println("海康返回结果-getKHPresets:" + strResult);
            HttpResponseResult responseResult = com.alibaba.fastjson.JSONObject.parseObject(strResult, HttpResponseResult.class);
            if ("0".equals(responseResult.getCode())) {
                com.alibaba.fastjson.JSONObject jsonObject = responseResult.getData();