| | |
| | | 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.GetTopicInfoRequest; |
| | | 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; |
| | | |
| | | /** |
| | |
| | | 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) { |
| | | Artemis.run(); |
| | | } |
| | | |
| | | public static void run() { |
| | | try { |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | //查询事件订阅信息 |
| | | 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(); |
| | | } |
| | | } |