升级版本
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询事件订阅详情
|
||||
|
||||
@@ -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<CloudEvents> 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<String> 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询事件模型列表
|
||||
|
||||
35
pom.xml
35
pom.xml
@@ -75,16 +75,17 @@
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <!– https://mvnrepository.com/artifact/com.huaweicloud.sdk/huaweicloud-sdk-eg –>-->
|
||||
<dependency>
|
||||
<groupId>com.huaweicloud.sdk</groupId>
|
||||
<artifactId>huaweicloud-sdk-eg</artifactId>
|
||||
<version>3.1.36</version>
|
||||
<version>3.1.151</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.huaweicloud.sdk/huaweicloud-sdk-core -->
|
||||
<dependency>
|
||||
<groupId>com.huaweicloud.sdk</groupId>
|
||||
<artifactId>huaweicloud-sdk-core</artifactId>
|
||||
<version>3.1.36</version>
|
||||
<version>3.1.151</version>
|
||||
</dependency>
|
||||
|
||||
<!-- cloudevents -->
|
||||
@@ -255,18 +256,18 @@
|
||||
<module>ai-analytic-center-api</module>
|
||||
<module>ai-analytic-center-biz</module>
|
||||
</modules>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>ronglian-releases</id>
|
||||
<name>ronglian releases</name>
|
||||
<url>https://devops.digitalvolvo.com/nexus/repository/newbie-ronglian-maven-releases/</url>
|
||||
<uniqueVersion>true</uniqueVersion>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>ronglian-snapshots</id>
|
||||
<name>ronglian snapshots</name>
|
||||
<url>https://devops.digitalvolvo.com/nexus/repository/newbie-ronglian-maven-snapshots/</url>
|
||||
<uniqueVersion>true</uniqueVersion>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<!-- <distributionManagement>-->
|
||||
<!-- <repository>-->
|
||||
<!-- <id>ronglian-releases</id>-->
|
||||
<!-- <name>ronglian releases</name>-->
|
||||
<!-- <url>https://artifactory.digitalvolvo.com/artifactory/newbie-ronglian-maven-releases/</url>-->
|
||||
<!-- <uniqueVersion>true</uniqueVersion>-->
|
||||
<!-- </repository>-->
|
||||
<!-- <snapshotRepository>-->
|
||||
<!-- <id>ronglian-snapshots</id>-->
|
||||
<!-- <name>ronglian snapshots</name>-->
|
||||
<!-- <url>https://artifactory.digitalvolvo.com/artifactory/newbie-ronglian-maven-snapshots/</url>-->
|
||||
<!-- <uniqueVersion>true</uniqueVersion>-->
|
||||
<!-- </snapshotRepository>-->
|
||||
<!-- </distributionManagement>-->
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user