Springboot实现CTWing接口对接

ctwing 配置

创建第三方应用

进入后添加版本

连接ctwing

下载 sdk 解压后将 lib 目录下的本地 jar 安装到 maven 仓库

Copy
mvn install:install-file -Dfile=./ag-sdk-biz-348700.tar.gz-20250109.153115-SNAPSHOT.jar -DgroupId=com.ctg.ag -DartifactId=ag-sdk-biz-348700.tar.gz -Dversion=20250109.153115-SNAPSHOT -Dpackaging=jar
mvn install:install-file -Dfile=./ctg-ag-sdk-core-2.8.0-20230508.100604-1.jar -DgroupId=com.ctg.ag -DartifactId=ctg-ag-sdk-core -Dversion=2.8.0-20230508.100604-1 -Dpackaging=jar

pom.xml也可以直接使用systemPath添加依赖本地

Copy
<dependency>
<groupId>com.ctg.ag</groupId>
<artifactId>ag-sdk-biz-348700.tar.gz</artifactId>
<version>20250109.153115-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${basedir}/lib/ag-sdk-biz-348700.tar.gz-20250109.153115-SNAPSHOT.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ctg.ag</groupId>
<artifactId>ctg-ag-sdk-core</artifactId>
<version>2.8.0-20230508.100604-1</version>
<scope>system</scope>
<systemPath>${basedir}/lib/ctg-ag-sdk-core-2.8.0-20230508.100604-1.jar</systemPath>
</dependency>

在产品概况页面获取MasterKey

实现

测试调用获取设备列表

Copy

@Value("${ctWing.APP_KEY}")
private String appkey;
@Value("${ctWing.APP_SECRET}")
private String appsecret;

@Test
void ctwingTest() throws Exception {
AepDeviceManagementClient client = AepDeviceManagementClient.newClient()
.appKey(appkey).appSecret(appsecret)
.build();

QueryDeviceListRequest request = new QueryDeviceListRequest();
// set your request params here
request.setParamMasterKey("MasterKey"); // 参数在产品概况中获取
request.setParamProductId("ProductId"); // 产品id
request.setParamSearchValue(""); // single value
request.setParamPageNow(""); // single value
request.setParamPageSize(""); // single value
System.out.println(client.QueryDeviceList(request));

// more requests

client.shutdown();
}