|
@@ -8,6 +8,7 @@ import com.hikvision.artemis.sdk.config.ArtemisConfig;
|
|
import com.hikvision.cms.api.common.util.Digests;
|
|
import com.hikvision.cms.api.common.util.Digests;
|
|
import com.huimv.admin.common.utils.HttpClientSSLUtils;
|
|
import com.huimv.admin.common.utils.HttpClientSSLUtils;
|
|
import com.huimv.admin.common.utils.Result;
|
|
import com.huimv.admin.common.utils.Result;
|
|
|
|
+import com.huimv.admin.common.utils.ResultCode;
|
|
import com.huimv.admin.entity.hkwsdto.*;
|
|
import com.huimv.admin.entity.hkwsdto.*;
|
|
import com.huimv.admin.service.ICameraAreaService;
|
|
import com.huimv.admin.service.ICameraAreaService;
|
|
import com.huimv.admin.service.ICameraBaseService;
|
|
import com.huimv.admin.service.ICameraBaseService;
|
|
@@ -93,6 +94,52 @@ public class CameraHKVSSync {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @PostMapping("/getVideo")
|
|
|
|
+ public Result getVideo(@RequestBody Map<String, String> params) throws Exception {
|
|
|
|
+ String cameraUuid = params.get("cameraUuid");
|
|
|
|
+ String callPostApiGetPreviewURLs = callPostApiGetPreviewURLs(cameraUuid);
|
|
|
|
+ HkvsPreviewDto hkvsPreviewDto = JSONUtil.toBean(callPostApiGetPreviewURLs, HkvsPreviewDto.class);
|
|
|
|
+ if (!hkvsPreviewDto.getCode().equals("0")) {
|
|
|
|
+ return new Result(10001,hkvsPreviewDto.getMsg(),false);
|
|
|
|
+ }else {
|
|
|
|
+ String url = hkvsPreviewDto.getData().getUrl();
|
|
|
|
+ if (ObjectUtil.isNotEmpty(url)){
|
|
|
|
+ return new Result(ResultCode.SUCCESS,url);
|
|
|
|
+ }else {
|
|
|
|
+ return Result.ERROR();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static final String PREVIEW_PATH = "/api/video/v2/cameras/previewURLs";
|
|
|
|
+
|
|
|
|
+ public static String callPostApiGetPreviewURLs(String cameraIndexCode) throws Exception {
|
|
|
|
+ /**
|
|
|
|
+ * https://ip:port/artemis/api/video/v2/cameras/previewURLs
|
|
|
|
+ * 根据指定的区域编号获取该区域下的监控点列表信息,返回结果分页展示。
|
|
|
|
+ * 注:返回的监控点不包括下级区域的。
|
|
|
|
+ */
|
|
|
|
+ ArtemisConfig config = new ArtemisConfig();
|
|
|
|
+ config.setHost(OPENAPI_IP); // 代理API网关nginx服务器ip端口
|
|
|
|
+ config.setAppKey(NEW_APPKEY); // 秘钥appkey
|
|
|
|
+ config.setAppSecret(NEW_SECRET);// 秘钥appSecret
|
|
|
|
+ final String getCamsApi = ARTEMIS_PATH + PREVIEW_PATH;
|
|
|
|
+ Map<String, Object> paramMap = new HashMap<String, Object>();// post请求Form表单参数
|
|
|
|
+ paramMap.put("cameraIndexCode",cameraIndexCode);
|
|
|
|
+ paramMap.put("streamType",1);
|
|
|
|
+ paramMap.put("protocol","rtsp");
|
|
|
|
+ paramMap.put("transmode",1);
|
|
|
|
+ String body = JSON.toJSON(paramMap).toString();
|
|
|
|
+ Map<String, String> path = new HashMap<String, String>(2) {
|
|
|
|
+ {
|
|
|
|
+ put("https://", getCamsApi);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ String s = ArtemisHttpUtil.doPostStringArtemis(config, path, body, null, null, "application/json");
|
|
|
|
+ System.out.println(s);
|
|
|
|
+
|
|
|
|
+ return s;
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* APPKEY需要到部署的平台服务器上生成。
|
|
* APPKEY需要到部署的平台服务器上生成。
|