fuliqi
2024-08-12 a03f002187c8f12b0b1d9e101acda538c4999515
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package com.ycl.feign;
 
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import com.ycl.platform.domain.param.HK.FaceDetectParam;
import com.ycl.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;
 
import java.util.HashMap;
import java.util.Map;
@Slf4j
public class HKApi {
 
    public static String GetCameraPreviewURL() {
 
        /**
         * STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
         */
        ArtemisConfig.host = "51.92.65.49"; // 平台的ip端口
        ArtemisConfig.appKey = "29555942";  // 密钥appkey
        ArtemisConfig.appSecret = "t9U7tCplCyYHzQPPL7cH";// 密钥appSecret
 
        /**
         * STEP2:设置OpenAPI接口的上下文
         */
        final String ARTEMIS_PATH = "/artemis";
 
        /**
         * STEP3:设置接口的URI地址
         */
        final String previewURLsApi = ARTEMIS_PATH + "/api/dqd/service/rs/v2/data/faceDetect/query";
        Map<String, String> path = new HashMap<String, String>(2) {
            {
                put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
            }
        };
 
        /**
         * STEP4:设置参数提交方式
         */
        String contentType = "application/json";
 
        /**
         * STEP5:组装请求参数
         */
        FaceDetectParam param = new FaceDetectParam();
        param.setDate(DateUtils.getDate());
        param.setPageNo(1);
        param.setPageSize(20);
        String body = JSON.toJSONString(param);
        log.info("请求参数:{}",body);
        /**
         * STEP6:调用接口
         */
        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , null);// post请求application/json类型参数
        return result;
    }
}