升级版本
This commit is contained in:
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.huaweicloud.sdk.eg.v1.model.*;
|
import com.huaweicloud.sdk.eg.v1.model.*;
|
||||||
import com.volvo.ai.analytic.center.dto.event.ListSubscriptionsRequestDto;
|
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.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.CompetingBrrandsDTO;
|
||||||
import com.volvo.ai.analytic.center.dto.resp.ResultDTO;
|
import com.volvo.ai.analytic.center.dto.resp.ResultDTO;
|
||||||
import com.volvo.ai.analytic.center.feign.CompetingBrandsClient;
|
import com.volvo.ai.analytic.center.feign.CompetingBrandsClient;
|
||||||
@@ -128,17 +127,7 @@ public class EGEventSubscriptionController {
|
|||||||
return ResultDTO.success(huaWeiService.listSubscriptions(req));
|
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.huaweicloud.sdk.eg.v1.model.*;
|
||||||
import com.volvo.ai.analytic.center.dto.event.ListSubscriptionsRequestDto;
|
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.SubscriptionCreateReqDto;
|
||||||
import com.volvo.ai.analytic.center.dto.event.SubscriptionOperateReqDto;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
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_REQUEST = "hwReq={}";
|
||||||
private static final String HA_WEI_RESPONSE = "hwRes={}";
|
private static final String HA_WEI_RESPONSE = "hwRes={}";
|
||||||
|
|
||||||
|
@Value("${huawei.cloud.EG.channel.ltoChannelId}")
|
||||||
|
private String sourceId;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
EgClient egClient;
|
EgClient egClient;
|
||||||
|
|
||||||
@@ -36,11 +39,10 @@ public class HuaWeiEGService {
|
|||||||
* 发布事件到事件通道 sdk
|
* 发布事件到事件通道 sdk
|
||||||
*
|
*
|
||||||
* @param event event
|
* @param event event
|
||||||
* @param channel channel
|
|
||||||
*/
|
*/
|
||||||
public PutEventsResponse sendEvent(CloudEvents event) {
|
public PutEventsResponse sendEvent(CloudEvents event) {
|
||||||
PutEventsRequest request = new PutEventsRequest();
|
PutEventsRequest request = new PutEventsRequest();
|
||||||
request.withChannelId("dd6be530-8d13-4e2b-8f41-43489c255ba1");
|
request.withChannelId(sourceId);
|
||||||
|
|
||||||
List<CloudEvents> eventsList = new ArrayList<>();
|
List<CloudEvents> eventsList = new ArrayList<>();
|
||||||
eventsList.add(event);
|
eventsList.add(event);
|
||||||
@@ -122,24 +124,6 @@ public class HuaWeiEGService {
|
|||||||
return response;
|
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;
|
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>
|
<version>1.8.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- <!– https://mvnrepository.com/artifact/com.huaweicloud.sdk/huaweicloud-sdk-eg –>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.huaweicloud.sdk</groupId>
|
<groupId>com.huaweicloud.sdk</groupId>
|
||||||
<artifactId>huaweicloud-sdk-eg</artifactId>
|
<artifactId>huaweicloud-sdk-eg</artifactId>
|
||||||
<version>3.1.36</version>
|
<version>3.1.151</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.huaweicloud.sdk/huaweicloud-sdk-core -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.huaweicloud.sdk</groupId>
|
<groupId>com.huaweicloud.sdk</groupId>
|
||||||
<artifactId>huaweicloud-sdk-core</artifactId>
|
<artifactId>huaweicloud-sdk-core</artifactId>
|
||||||
<version>3.1.36</version>
|
<version>3.1.151</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- cloudevents -->
|
<!-- cloudevents -->
|
||||||
@@ -255,18 +256,18 @@
|
|||||||
<module>ai-analytic-center-api</module>
|
<module>ai-analytic-center-api</module>
|
||||||
<module>ai-analytic-center-biz</module>
|
<module>ai-analytic-center-biz</module>
|
||||||
</modules>
|
</modules>
|
||||||
<distributionManagement>
|
<!-- <distributionManagement>-->
|
||||||
<repository>
|
<!-- <repository>-->
|
||||||
<id>ronglian-releases</id>
|
<!-- <id>ronglian-releases</id>-->
|
||||||
<name>ronglian releases</name>
|
<!-- <name>ronglian releases</name>-->
|
||||||
<url>https://devops.digitalvolvo.com/nexus/repository/newbie-ronglian-maven-releases/</url>
|
<!-- <url>https://artifactory.digitalvolvo.com/artifactory/newbie-ronglian-maven-releases/</url>-->
|
||||||
<uniqueVersion>true</uniqueVersion>
|
<!-- <uniqueVersion>true</uniqueVersion>-->
|
||||||
</repository>
|
<!-- </repository>-->
|
||||||
<snapshotRepository>
|
<!-- <snapshotRepository>-->
|
||||||
<id>ronglian-snapshots</id>
|
<!-- <id>ronglian-snapshots</id>-->
|
||||||
<name>ronglian snapshots</name>
|
<!-- <name>ronglian snapshots</name>-->
|
||||||
<url>https://devops.digitalvolvo.com/nexus/repository/newbie-ronglian-maven-snapshots/</url>
|
<!-- <url>https://artifactory.digitalvolvo.com/artifactory/newbie-ronglian-maven-snapshots/</url>-->
|
||||||
<uniqueVersion>true</uniqueVersion>
|
<!-- <uniqueVersion>true</uniqueVersion>-->
|
||||||
</snapshotRepository>
|
<!-- </snapshotRepository>-->
|
||||||
</distributionManagement>
|
<!-- </distributionManagement>-->
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
Reference in New Issue
Block a user