From fd74ab1958c336d1087037c516dfa3e8b8d3d61e Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 06 八月 2025 11:13:26 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/util/haikang/Artemis.java |  165 +++++++++++++++++++++++++++++++-----------------------
 1 files changed, 95 insertions(+), 70 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 5228e76..dc6afb3 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,14 @@
 package com.ruoyi.dataInterchange.util.haikang;
 
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 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;
 
 /**
@@ -53,66 +45,6 @@
 		return result;
 	}
 
-
-	//按事件类型获取事件订阅信息
-	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://",getTopicInfoDataApi);
-			}
-		};
-		String body=JSON.toJSONString(getTopicInfoRequest);
-		String result =ArtemisHttpUtil.doPostStringArtemis(artemisConfig,path,body,null,null,"application/json");
-		return result;
-	}
-
-	
-	public static void run() {
-		try {
-			//先查询是否订阅事件
-			GetTopicInfoRequest getTopicInfoRequest = new GetTopicInfoRequest();
-			getTopicInfoRequest.setEventTypes(new ArrayList<Long>(){{
-				add(5201154049L);
-			}});
-			String eventSubscriptionView = Artemis.getTopicInfo(getTopicInfoRequest);
-			JSONObject jsonObject = JSON.parseObject(eventSubscriptionView);
-			String code = jsonObject.getString("code");
-			if("0".equals(code)){
-				JSONArray jsonArray = jsonObject.getJSONObject("data").getJSONArray("detail");
-				List<String> list = new ArrayList<>();
-				for (int i = 0; i < jsonArray.size(); i++) {
-					JSONArray eventTypes = jsonArray.getJSONObject(i).getJSONArray("eventTypes");
-					eventTypes.forEach(eventType -> {
-						list.add(eventType.toString());
-					});
-				}
-				//告警事件类型
-				if(!list.contains("5201154049")){
-					//订阅事件
-					EventSubscriptionByEventTypesRequest eventSubscriptionByEventTypesRequest = new EventSubscriptionByEventTypesRequest();
-					eventSubscriptionByEventTypesRequest.setSubWay(1);
-					eventSubscriptionByEventTypesRequest.setEventDest("http://221.182.45.100:1000/dataInterchange/warnMsgAdptInfo/alarmNotice");
-					eventSubscriptionByEventTypesRequest.setEventTypes(new ArrayList<String>(){{
-						add("5201154049");
-					}});
-					String subscription = Artemis.eventSubscriptionByEventTypes(eventSubscriptionByEventTypesRequest);
-					jsonObject = JSON.parseObject(subscription);
-					code = jsonObject.getString("code");
-					if(!"0".equals(code)){
-						log.error("告警事件订阅失败");
-					}else {
-						log.info("告警事件订阅成功");
-					}
-				}
-			}else{
-				log.error("查询事件订阅信息失败");
-			}
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-	}
-	
 	//查询事件订阅信息
 	public static String eventSubscriptionView(EventSubscriptionViewRequest eventSubscriptionViewRequest) throws Exception {
 		String eventSubscriptionViewDataApi = ARTEMIS_PATH +"/api/eventService/v1/eventSubscriptionView";
@@ -125,7 +57,7 @@
 		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";
@@ -139,5 +71,98 @@
 		return result;
 	}
 	
+	
+	//根据车牌号码获取车辆信息(含设备)
+	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 {
+			//先查询是否订阅事件
+			GetTopicInfoRequest getTopicInfoRequest = new GetTopicInfoRequest();
+			getTopicInfoRequest.setEventTypes(new ArrayList<Long>(){{
+				add(5201154049L);
+				add(5201301505L);
+			}});
+			String eventSubscriptionView = Artemis.getTopicInfo(getTopicInfoRequest);
+			JSONObject jsonObject = JSON.parseObject(eventSubscriptionView);
+		}catch (Exception e){
+			e.printStackTrace();
+		}
+	}
+	
+	//按事件类型获取事件订阅信息
+	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://",getTopicInfoDataApi);
+			}
+		};
+		String body=JSON.toJSONString(getTopicInfoRequest);
+		String result =ArtemisHttpUtil.doPostStringArtemis(artemisConfig,path,body,null,null,"application/json");
+		return result;
+	}
+	
+	
+	//根据报警ID获取关联图片信息
+	public static String findPicturesByAlarmId(FindPicturesByAlarmIdRequest findPicturesByAlarmIdRequest) throws Exception {
+		String findPicturesByAlarmIdDataApi = ARTEMIS_PATH +"/api/rtsm/v1/multimedia/findPicturesByAlarmId";
+		Map<String,String> path = new HashMap<String,String>(2){
+			{
+				put("https://",findPicturesByAlarmIdDataApi);
+			}
+		};
+		String body=JSON.toJSONString(findPicturesByAlarmIdRequest);
+		String result =ArtemisHttpUtil.doPostStringArtemis(artemisConfig,path,body,null,null,"application/json");
+		return result;
+	}
 }

--
Gitblit v1.7.1