From 58336e4aef85e3c32e87343c84577e8baf2eda7a Mon Sep 17 00:00:00 2001 From: zren25 Date: Fri, 6 Jun 2025 16:42:55 +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 --- .../controller/EGEventSubscriptionController.java | 6 ++++-- .../ai/analytic/center/service/HuaWeiEGService.java | 7 ++----- .../service/impl/CorpusPortraitServiceImpl.java | 11 +++++++---- 3 files changed, 13 insertions(+), 11 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 ca4e8a5..217343b 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 @@ -11,6 +11,7 @@ import com.volvo.ai.analytic.center.service.HuaWeiEGService; import io.swagger.v3.oas.annotations.Operation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -30,7 +31,8 @@ public class EGEventSubscriptionController { @Autowired CompetingBrandsClient CompetingBrandsClient; - + @Value("${huawei.cloud.EG.channel.ltoChannelId}") + private String ltoChannelId; @GetMapping("/getBrand") public void getBrand(){ ResultDTO> result = CompetingBrandsClient.getBrand(); @@ -54,7 +56,7 @@ public class EGEventSubscriptionController { */ @PostMapping("/sendEvent") public ResultDTO sendEvent(@RequestBody CloudEvents req) throws ExecutionException { - return ResultDTO.success(huaWeiService.sendEvent(req)); + return ResultDTO.success(huaWeiService.sendEvent(req,ltoChannelId)); } // 创建目标连接 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 3036f43..0302899 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 @@ -7,7 +7,6 @@ import com.volvo.ai.analytic.center.dto.event.ListSubscriptionsRequestDto; import com.volvo.ai.analytic.center.dto.event.SubscriptionCreateReqDto; 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,8 +20,6 @@ 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; @@ -40,9 +37,9 @@ public class HuaWeiEGService { * * @param event event */ - public PutEventsResponse sendEvent(CloudEvents event) { + public PutEventsResponse sendEvent(CloudEvents event, String channelId) { PutEventsRequest request = new PutEventsRequest(); - request.withChannelId(sourceId); + request.withChannelId(channelId); List eventsList = new ArrayList<>(); eventsList.add(event); diff --git a/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/impl/CorpusPortraitServiceImpl.java b/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/impl/CorpusPortraitServiceImpl.java index e9de950..7760e9a 100644 --- a/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/impl/CorpusPortraitServiceImpl.java +++ b/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/impl/CorpusPortraitServiceImpl.java @@ -9,7 +9,6 @@ import com.volvo.ai.analytic.center.dto.corpus.CorpusReportDTO; import com.volvo.ai.analytic.center.dto.corpus.OdsVdqwMessageOTD; import com.volvo.ai.analytic.center.dto.req.DiFyReq; import com.volvo.ai.analytic.center.dto.req.RunMaskingRuleInput; -import com.volvo.ai.analytic.center.dto.resp.CarModelRespDTO; import com.volvo.ai.analytic.center.dto.resp.CompetingBrrandsDTO; import com.volvo.ai.analytic.center.dto.resp.ResultDTO; import com.volvo.ai.analytic.center.entity.*; @@ -23,6 +22,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.stereotype.Service; @@ -58,6 +58,9 @@ public class CorpusPortraitServiceImpl implements CorpusPortraitService { // @Value("${huawei.cloud.EG.channel.ltoSourceId}") private String sourceId; + + @Value("${huawei.cloud.EG.channel.ltoChannelId}") + private String ltoChannelId; @Autowired private DataMaskingRuleService dataMaskingRuleService; @Autowired @@ -121,7 +124,7 @@ public class CorpusPortraitServiceImpl implements CorpusPortraitService { if (null != execDifyFlow && execDifyFlow.get("status").equals("succeeded")) { JSONObject text = execDifyFlow.getJSONObject("outputs"); - huaWeiService.sendEvent(setCloudEvents(aiAnalysisRequestId, text.toJSONString())); + huaWeiService.sendEvent(setCloudEvents(aiAnalysisRequestId, text.toJSONString()), ltoChannelId); } try { @@ -221,7 +224,7 @@ public class CorpusPortraitServiceImpl implements CorpusPortraitService { if (null != execDifyFlow && execDifyFlow.get("status").equals("succeeded")) { JSONObject text = execDifyFlow.getJSONObject("outputs"); - huaWeiService.sendEvent(setCloudEvents(aiAnalysisRequestId, text.toJSONString())); + huaWeiService.sendEvent(setCloudEvents(aiAnalysisRequestId, text.toJSONString()),ltoChannelId); } try { @@ -271,7 +274,7 @@ public class CorpusPortraitServiceImpl implements CorpusPortraitService { if (null != execDifyFlow && execDifyFlow.get("status").equals("succeeded")) { JSONObject text = execDifyFlow.getJSONObject("outputs"); - huaWeiService.sendEvent(setCloudEvents(aiAnalysisRequestId, text.toJSONString())); + huaWeiService.sendEvent(setCloudEvents(aiAnalysisRequestId, text.toJSONString()),ltoChannelId); } } catch (Exception e) { log.error("nameplate processItem error {}", e.getMessage());