Springboot实现CTWing接口对接

ctwing配置

创建第三方应用

进入后添加版本

连接ctwing

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

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添加依赖本地

	<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

实现

测试调用获取设备列表

	
	@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();
	}

https://iot.ctwing.cn/ability/#/api-online-editor?apiId=10251&catId=234

https://www.ctwing.cn/sbjr/39#see

posted @ 2025-01-11 10:50  六花踏雪  阅读(181)  评论(0)    收藏  举报