|
@@ -7,7 +7,12 @@ import org.apache.http.HttpEntity;
|
|
|
import org.apache.http.HttpResponse;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.io.BufferedReader;
|
|
|
import java.io.InputStream;
|
|
|
import java.io.InputStreamReader;
|
|
@@ -20,17 +25,21 @@ import java.util.Map;
|
|
|
* @date 2021-03-26 12:26
|
|
|
******************************/
|
|
|
|
|
|
+@Component
|
|
|
public class HikSubscription {
|
|
|
private static final Logger log = LoggerFactory.getLogger(HikSubscription.class);
|
|
|
|
|
|
- static {
|
|
|
+// static {
|
|
|
// ArtemisConfig.host = "218.27.1.154:54321";// 代理API网关nginx服务器ip端口
|
|
|
-// ArtemisConfig.appKey = "22654202";// 秘钥appkey
|
|
|
-// ArtemisConfig.appSecret = "d7HlmRIaiXp3MQBmsuUg";// 秘钥appSecret
|
|
|
- ArtemisConfig.host = "36.49.108.22:1443";// 代理API网关nginx服务器ip端口
|
|
|
- ArtemisConfig.appKey = "24699060";// 秘钥appkey
|
|
|
- ArtemisConfig.appSecret = "tt1pMbsrlwGZUWucdAPw";// 秘钥appSecret
|
|
|
- }
|
|
|
+// ArtemisConfig.appKey = "24699060";// 秘钥appkey
|
|
|
+// ArtemisConfig.appSecret = "tt1pMbsrlwGZUWucdAPw";// 秘钥appSecret
|
|
|
+ // 配置信息通过静态字段初始化,@Value不适用于静态字段
|
|
|
+// ArtemisConfig.host = "36.49.108.22:1443"; // 代理API网关nginx服务器ip端口
|
|
|
+// ArtemisConfig.appKey = "24699060"; // 秘钥appkey
|
|
|
+// ArtemisConfig.appSecret = "tt1pMbsrlwGZUWucdAPw"; // 秘钥appSecret
|
|
|
+// }
|
|
|
+ @Resource
|
|
|
+ private HikConfig hikConfig;
|
|
|
|
|
|
/**
|
|
|
* 能力开放平台的网站路径
|
|
@@ -289,6 +298,9 @@ public class HikSubscription {
|
|
|
Map<String, String> path = new HashMap<>();
|
|
|
path.put("https://", VechicleDataApi);//根据现场环境部署确认是http还是https
|
|
|
path.put("http://", VechicleDataApi);//根据现场环境部署确认是http还是https
|
|
|
+ System.out.println("ArtemisConfig.appKey: " + ArtemisConfig.appKey);
|
|
|
+ System.out.println("ArtemisConfig.appSecret: " + ArtemisConfig.appSecret);
|
|
|
+ System.out.println("ArtemisConfig.host: " + ArtemisConfig.host);
|
|
|
|
|
|
JSONObject jsonBody = new JSONObject();
|
|
|
jsonBody.put("cameraIndexCode", cameraId);
|