From b554a106bc1b06e0320b642d16c31554ae558301 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期二, 03 六月 2025 17:28:11 +0800
Subject: [PATCH] 新增加川标报警处理结果
---
ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/util/haikang/Artemis.java | 178 ++++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 139 insertions(+), 39 deletions(-)
diff --git a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/util/haikang/Artemis.java b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/util/haikang/Artemis.java
index d8614a1..1a4596b 100644
--- a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/util/haikang/Artemis.java
+++ b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/util/haikang/Artemis.java
@@ -1,22 +1,15 @@
package com.ruoyi.dataInterchange.util.haikang;
import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSONArray;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
-import com.ruoyi.dataInterchange.util.haikang.model.EventSubscriptionByEventTypesRequest;
-import com.ruoyi.dataInterchange.util.haikang.model.EventSubscriptionViewRequest;
-import com.ruoyi.dataInterchange.util.haikang.model.EventUnSubscriptionByEventTypesRequest;
-import com.ruoyi.dataInterchange.util.haikang.model.GetTopicInfoRequest;
+import com.ruoyi.dataInterchange.util.haikang.model.*;
import lombok.extern.slf4j.Slf4j;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-import javax.servlet.annotation.WebListener;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
/**
@@ -38,7 +31,7 @@
* appKey : 请填入appKey
* appSecret : 请填入appSecret
*/
- private static ArtemisConfig artemisConfig = new ArtemisConfig("https://112.18.106.230:443", "27273246", "vjvZA7X4hHUc0SbONht9");
+ private static ArtemisConfig artemisConfig = new ArtemisConfig("112.18.106.230:443", "27273246", "vjvZA7X4hHUc0SbONht9");
//按事件类型取消订阅
public static String eventUnSubscriptionByEventTypes(EventUnSubscriptionByEventTypesRequest eventUnSubscriptionByEventTypesRequest) throws Exception {
@@ -53,20 +46,145 @@
return result;
}
-
- //按事件类型获取事件订阅信息
- public static String getTopicInfo(GetTopicInfoRequest getTopicInfoRequest)throws Exception {
- String getTopicInfoDataApi = ARTEMIS_PATH +"/api/common/v1/event/getTopicInfo";
+ //查询事件订阅信息
+ public static String eventSubscriptionView(EventSubscriptionViewRequest eventSubscriptionViewRequest) throws Exception {
+ String eventSubscriptionViewDataApi = ARTEMIS_PATH +"/api/eventService/v1/eventSubscriptionView";
Map<String,String> path = new HashMap<String,String>(2){
{
- put("https://",getTopicInfoDataApi);
+ put("https://",eventSubscriptionViewDataApi);
}
};
- String body=JSON.toJSONString(getTopicInfoRequest);
+ String body=JSON.toJSONString(eventSubscriptionViewRequest);
String result =ArtemisHttpUtil.doPostStringArtemis(artemisConfig,path,body,null,null,"application/json");
return result;
}
+ //按事件类型订阅事件
+ public static String eventSubscriptionByEventTypes(EventSubscriptionByEventTypesRequest eventSubscriptionByEventTypesRequest) throws Exception {
+ String eventSubscriptionByEventTypesDataApi = ARTEMIS_PATH +"/api/eventService/v1/eventSubscriptionByEventTypes";
+ Map<String,String> path = new HashMap<String,String>(2){
+ {
+ put("https://",eventSubscriptionByEventTypesDataApi);
+ }
+ };
+ String body=JSON.toJSONString(eventSubscriptionByEventTypesRequest);
+ String result = ArtemisHttpUtil.doPostStringArtemis(artemisConfig,path,body,null,null,"application/json");
+ return result;
+ }
+
+ public static void main(String[] args) {
+ try {
+ FindVehicleByLicensePlateRequest findVehicleByLicensePlateRequest = new FindVehicleByLicensePlateRequest();
+ findVehicleByLicensePlateRequest.setVehicleLicensePlate("川J52303");
+ String vehicleByLicensePlate = Artemis.findVehicleByLicensePlate(findVehicleByLicensePlateRequest);
+ com.alibaba.fastjson2.JSONObject jsonObject = com.alibaba.fastjson2.JSONObject.parseObject(vehicleByLicensePlate);
+ String code = jsonObject.getString("code");
+ if(!"0".equals(code)){
+ return ;
+ }
+ com.alibaba.fastjson2.JSONObject data = jsonObject.getJSONObject("data");
+ //车辆编号
+ String indexCode = data.getString("indexCode");
+ //主设备编号
+ String primaryDeviceIndexCode = data.getString("primaryDeviceIndexCode");
+ //根据车辆编号和设备编号获取监控点信息列表
+ FindCameraPageRequest findCameraPageRequest = new FindCameraPageRequest();
+ findCameraPageRequest.setPageNo(1);
+ findCameraPageRequest.setPageSize(1000);
+ ExactCondition1 exactCondition = new ExactCondition1();
+ exactCondition.setDeviceIndexCodes(new ArrayList<String>(){{
+ add(primaryDeviceIndexCode);
+ }});
+ exactCondition.setVehicleIndexCodes(new ArrayList<String>(){{
+ add(indexCode);
+ }});
+ findCameraPageRequest.setExactCondition(exactCondition);
+ String cameraPage = Artemis.findCameraPage(findCameraPageRequest);
+ jsonObject = com.alibaba.fastjson2.JSONObject.parseObject(cameraPage);
+ code = jsonObject.getString("code");
+ if(!"0".equals(code)){
+ return;
+ }
+ data = jsonObject.getJSONObject("data");
+ JSONArray list = data.getJSONArray("list");
+ //监控点编号
+ String indexCode1 = "";
+ for (int i = 0; i < list.size(); i++) {
+ com.alibaba.fastjson2.JSONObject jsonObject1 = list.getJSONObject(i);
+ String cameraName = jsonObject1.getString("cameraName");
+ if("驾驶位".equals(cameraName)){
+ indexCode1 = jsonObject1.getString("indexCode");
+ }
+ }
+
+ //根据监控点编号获取监控预览url
+ PreviewURLsRequest previewURLsRequest = new PreviewURLsRequest();
+ previewURLsRequest.setCameraIndexCode(indexCode1);
+ String s = Artemis.previewURLs(previewURLsRequest);
+ jsonObject = com.alibaba.fastjson2.JSONObject.parseObject(s);
+ code = jsonObject.getString("code");
+ if(!"0".equals(code)){
+ return ;
+ }
+ data = jsonObject.getJSONObject("data");
+ String url = data.getString("url");
+ System.out.println(url);
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ //根据车牌号码获取车辆信息(含设备)
+ public static String findVehicleByLicensePlate(FindVehicleByLicensePlateRequest findVehicleByLicensePlateRequest)throws Exception{
+ String findVehicleByLicensePlateDataApi = ARTEMIS_PATH +"/api/rtsm/v1/resource/findVehicleByLicensePlate";
+ Map<String,String> path = new HashMap<String,String>(2){
+ {
+ put("https://",findVehicleByLicensePlateDataApi);
+ }
+ };
+ String body=JSON.toJSONString(findVehicleByLicensePlateRequest);
+ String result =ArtemisHttpUtil.doPostStringArtemis(artemisConfig,path,body,null,null,"application/json");
+ return result;
+ }
+
+ //根据车辆编号与设备编号获取监控点信息列表
+ public static String findCameraPage(FindCameraPageRequest findCameraPageRequest)throws Exception{
+ String findCameraPageDataApi = ARTEMIS_PATH +"/api/rtsm/v1/vehicle/findCameraPage";
+ Map<String,String> path = new HashMap<String,String>(2){
+ {
+ put("https://",findCameraPageDataApi);
+ }
+ };
+ String body=JSON.toJSONString(findCameraPageRequest);
+ String result =ArtemisHttpUtil.doPostStringArtemis(artemisConfig,path,body,null,null,"application/json");
+ return result;
+ }
+
+ //获取监控点预览取流URL
+ public static String previewURLs(PreviewURLsRequest previewURLsRequest)throws Exception{
+ String previewURLsDataApi = ARTEMIS_PATH +"/api/video/v1/cameras/previewURLs";
+ Map<String,String> path = new HashMap<String,String>(2){
+ {
+ put("https://",previewURLsDataApi);
+ }
+ };
+ String body=JSON.toJSONString(previewURLsRequest);
+ String result =ArtemisHttpUtil.doPostStringArtemis(artemisConfig,path,body,null,null,"application/json");
+ return result;
+ }
+
+ //分页查询车辆信息
+ public static String findVehiclePage(FindVehiclePageRequest findVehiclePageRequest)throws Exception{
+ String findVehiclePageDataApi = ARTEMIS_PATH +"/api/rtsm/v1/resource/findVehiclePage";
+ Map<String,String> path = new HashMap<String,String>(2){
+ {
+ put("https://",findVehiclePageDataApi);
+ }
+ };
+ String body=JSON.toJSONString(findVehiclePageRequest);
+ String result =ArtemisHttpUtil.doPostStringArtemis(artemisConfig,path,body,null,null,"application/json");
+ return result;
+ }
public static void run() {
try {
@@ -83,34 +201,16 @@
}
}
- //查询事件订阅信息
- public static String eventSubscriptionView(EventSubscriptionViewRequest eventSubscriptionViewRequest) throws Exception {
- String eventSubscriptionViewDataApi = ARTEMIS_PATH +"/api/eventService/v1/eventSubscriptionView";
+ //按事件类型获取事件订阅信息
+ public static String getTopicInfo(GetTopicInfoRequest getTopicInfoRequest)throws Exception {
+ String getTopicInfoDataApi = ARTEMIS_PATH +"/api/common/v1/event/getTopicInfo";
Map<String,String> path = new HashMap<String,String>(2){
{
- put("https://",eventSubscriptionViewDataApi);
+ put("https://",getTopicInfoDataApi);
}
};
- String body=JSON.toJSONString(eventSubscriptionViewRequest);
+ String body=JSON.toJSONString(getTopicInfoRequest);
String result =ArtemisHttpUtil.doPostStringArtemis(artemisConfig,path,body,null,null,"application/json");
return result;
- }
-
- //按事件类型订阅事件
- public static String eventSubscriptionByEventTypes(EventSubscriptionByEventTypesRequest eventSubscriptionByEventTypesRequest) throws Exception {
- String eventSubscriptionByEventTypesDataApi = ARTEMIS_PATH +"/api/eventService/v1/eventSubscriptionByEventTypes";
- Map<String,String> path = new HashMap<String,String>(2){
- {
- put("https://",eventSubscriptionByEventTypesDataApi);
- }
- };
- String body=JSON.toJSONString(eventSubscriptionByEventTypesRequest);
- String result = ArtemisHttpUtil.doPostStringArtemis(artemisConfig,path,body,null,null,"application/json");
- return result;
- }
-
-
- public static void main(String[] args) {
- Artemis.run();
}
}
--
Gitblit v1.7.1