From 14603f8c3659067a484020c5e4e472eba1775102 Mon Sep 17 00:00:00 2001 From: zren25 Date: Fri, 6 Jun 2025 16:34:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EGEventSubscriptionController.java | 13 +------ .../center/service/HuaWeiEGService.java | 37 +++---------------- pom.xml | 35 +++++++++--------- 3 files changed, 24 insertions(+), 61 deletions(-) diff --git a/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/controller/EGEventSubscriptionController.java b/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/controller/EGEventSubscriptionController.java index dba8621..ca4e8a5 100644 --- a/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/controller/EGEventSubscriptionController.java +++ b/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/controller/EGEventSubscriptionController.java @@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON; import com.huaweicloud.sdk.eg.v1.model.*; import com.volvo.ai.analytic.center.dto.event.ListSubscriptionsRequestDto; import com.volvo.ai.analytic.center.dto.event.SubscriptionCreateReqDto; -import com.volvo.ai.analytic.center.dto.event.SubscriptionOperateReqDto; import com.volvo.ai.analytic.center.dto.resp.CompetingBrrandsDTO; import com.volvo.ai.analytic.center.dto.resp.ResultDTO; import com.volvo.ai.analytic.center.feign.CompetingBrandsClient; @@ -128,17 +127,7 @@ public class EGEventSubscriptionController { return ResultDTO.success(huaWeiService.listSubscriptions(req)); } - /** - * 启用禁用事件订阅 - * - * @param req req - * @return - */ - @PostMapping("/subscription/enabled") - public ResultDTO operateSubscription(@RequestBody SubscriptionOperateReqDto req) { - huaWeiService.operateSubscription(req); - return ResultDTO.success(); - } + /** * 查询事件订阅详情 diff --git a/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/HuaWeiEGService.java b/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/HuaWeiEGService.java index 0564811..3036f43 100644 --- a/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/HuaWeiEGService.java +++ b/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/HuaWeiEGService.java @@ -5,9 +5,9 @@ import com.huaweicloud.sdk.eg.v1.EgClient; import com.huaweicloud.sdk.eg.v1.model.*; import com.volvo.ai.analytic.center.dto.event.ListSubscriptionsRequestDto; import com.volvo.ai.analytic.center.dto.event.SubscriptionCreateReqDto; -import com.volvo.ai.analytic.center.dto.event.SubscriptionOperateReqDto; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -21,6 +21,9 @@ public class HuaWeiEGService { private static final String HA_WEI_REQUEST = "hwReq={}"; private static final String HA_WEI_RESPONSE = "hwRes={}"; + @Value("${huawei.cloud.EG.channel.ltoChannelId}") + private String sourceId; + @Resource EgClient egClient; @@ -36,11 +39,10 @@ public class HuaWeiEGService { * 发布事件到事件通道 sdk * * @param event event - * @param channel channel */ public PutEventsResponse sendEvent(CloudEvents event) { PutEventsRequest request = new PutEventsRequest(); - request.withChannelId("dd6be530-8d13-4e2b-8f41-43489c255ba1"); + request.withChannelId(sourceId); List eventsList = new ArrayList<>(); eventsList.add(event); @@ -122,24 +124,6 @@ public class HuaWeiEGService { return response; } - /** - * 操作事件订阅 - */ - public OperateSubscriptionResponse operateSubscription(SubscriptionOperateReqDto req) { - OperateSubscriptionRequest request = new OperateSubscriptionRequest(); - - SubscriptionOperateReq body = new SubscriptionOperateReq(); - List subscriptionIds = new ArrayList<>(); - subscriptionIds.add(req.getSubscriptionId()); - body.setSubscriptionIds(subscriptionIds); - body.setOperation(req.getStatus() == 1 ? SubscriptionOperateReq.OperationEnum.ENABLE : SubscriptionOperateReq.OperationEnum.DISABLE); - request.withBody(body); - - log.info(HA_WEI_REQUEST, JSON.toJSONString(request)); - OperateSubscriptionResponse response = egClient.operateSubscription(request); - log.info(HA_WEI_RESPONSE, JSON.toJSONString(response)); - return response; - } /** * 查询事件订阅详情 @@ -430,17 +414,6 @@ public class HuaWeiEGService { return response; } - /** - * 事件模型自动发现 - */ - public DiscoverEventSchemaFromDataResponse discoverEventSchemaFromData(DiscoverEventSchemaFromDataReq body) { - DiscoverEventSchemaFromDataRequest request = new DiscoverEventSchemaFromDataRequest(); - request.withBody(body); - log.info(HA_WEI_REQUEST, JSON.toJSONString(request)); - DiscoverEventSchemaFromDataResponse response = egClient.discoverEventSchemaFromData(request); - log.info(HA_WEI_RESPONSE, JSON.toJSONString(response)); - return response; - } /** * 查询事件模型列表 diff --git a/pom.xml b/pom.xml index b5802bd..a851f07 100644 --- a/pom.xml +++ b/pom.xml @@ -75,16 +75,17 @@ 1.8.0 + com.huaweicloud.sdk huaweicloud-sdk-eg - 3.1.36 + 3.1.151 - + com.huaweicloud.sdk huaweicloud-sdk-core - 3.1.36 + 3.1.151 @@ -255,18 +256,18 @@ ai-analytic-center-api ai-analytic-center-biz - - - ronglian-releases - ronglian releases - https://devops.digitalvolvo.com/nexus/repository/newbie-ronglian-maven-releases/ - true - - - ronglian-snapshots - ronglian snapshots - https://devops.digitalvolvo.com/nexus/repository/newbie-ronglian-maven-snapshots/ - true - - + + + + + + + + + + + + + +