From 312f26c49124f355e9f78c6ddd69f71895aa73fc Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期一, 26 五月 2025 13:47:43 +0800
Subject: [PATCH] 修改公交公司的事件订阅功能

---
 ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/util/haikang/Artemis.java |   39 ++++++---------------------------------
 1 files changed, 6 insertions(+), 33 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..d8614a1 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
@@ -38,7 +38,7 @@
 	 * appKey : 请填入appKey
 	 * appSecret : 请填入appSecret
 	 */
-	private static ArtemisConfig artemisConfig = new ArtemisConfig("112.18.106.230:443", "27273246", "vjvZA7X4hHUc0SbONht9");
+	private static ArtemisConfig artemisConfig = new ArtemisConfig("https://112.18.106.230:443", "27273246", "vjvZA7X4hHUc0SbONht9");
 	
 	//按事件类型取消订阅
 	public static String eventUnSubscriptionByEventTypes(EventUnSubscriptionByEventTypesRequest eventUnSubscriptionByEventTypesRequest) throws Exception {
@@ -74,40 +74,10 @@
 			GetTopicInfoRequest getTopicInfoRequest = new GetTopicInfoRequest();
 			getTopicInfoRequest.setEventTypes(new ArrayList<Long>(){{
 				add(5201154049L);
+				add(5201301505L);
 			}});
 			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();
 		}
@@ -138,6 +108,9 @@
 		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