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 | 37 +++++-------------------------------- 1 files changed, 5 insertions(+), 32 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 a1899e8..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 @@ -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