涂鸦接口定义
This commit is contained in:
parent
c0efe9cea8
commit
08251256bc
1
.gitignore
vendored
1
.gitignore
vendored
@ -32,3 +32,4 @@ build/
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
/logs/
|
||||
|
||||
|
||||
3
iot-modules/iot-box-user-api/.gitignore
vendored
3
iot-modules/iot-box-user-api/.gitignore
vendored
@ -35,4 +35,5 @@ build/
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
/logs/
|
||||
|
||||
@ -9,7 +9,6 @@ import com.qiuguo.iot.data.resp.device.DeviceInfoResp;
|
||||
import com.qiuguo.iot.data.service.device.DeviceBatchService;
|
||||
import com.qiuguo.iot.data.service.device.DeviceInfoService;
|
||||
import com.qiuguo.iot.user.api.resp.device.DeviceInitResp;
|
||||
import com.qiuguo.iot.user.api.service.DeviceConnector;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.hswebframework.web.exception.BusinessException;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -37,15 +36,6 @@ public class DeviceController {
|
||||
@Resource
|
||||
private DeviceBatchService deviceBatchService;
|
||||
|
||||
@Resource
|
||||
private DeviceConnector deviceConnector;
|
||||
|
||||
@GetMapping("/getByid")
|
||||
public Mono<Void> getByid() {
|
||||
Object byid = deviceConnector.getByid("6c4a153095be2b7f8baofp");
|
||||
System.out.println("byid = " + byid);
|
||||
return Mono.empty();
|
||||
}
|
||||
|
||||
private static Long timeOut = 120000l;//2分钟
|
||||
// @GetMapping("/init")
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
package com.qiuguo.iot.user.api.controller.tuya;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* XXX
|
||||
*
|
||||
* @author weiyachao
|
||||
* @since 2023/9/18 17:52
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/tuya")
|
||||
public class TuyaDeviceController {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.qiuguo.iot.user.api.controller;
|
||||
package com.qiuguo.iot.user.api.controller.user;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import java.util.Objects;
|
||||
@ -1,18 +0,0 @@
|
||||
package com.qiuguo.iot.user.api.service;
|
||||
|
||||
import com.tuya.connector.api.annotations.GET;
|
||||
import com.tuya.connector.api.annotations.Path;
|
||||
|
||||
/**
|
||||
* XXX
|
||||
*
|
||||
* @author weiyachao
|
||||
* @since 2023/9/18 16:41
|
||||
*/
|
||||
public interface DeviceConnector {
|
||||
|
||||
@GET("/v2.0/cloud/thing/{device_id}")
|
||||
Object getByid(@Path("device_id") String deviceId);
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package com.qiuguo.iot.user.api.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tuya.connector.api.annotations.Body;
|
||||
import com.tuya.connector.api.annotations.DELETE;
|
||||
import com.tuya.connector.api.annotations.GET;
|
||||
import com.tuya.connector.api.annotations.POST;
|
||||
import com.tuya.connector.api.annotations.PUT;
|
||||
import com.tuya.connector.api.annotations.Path;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* XXX
|
||||
*
|
||||
* @author weiyachao
|
||||
* @since 2023/9/18 16:41
|
||||
*/
|
||||
public interface TuyaDeviceConnector {
|
||||
|
||||
// 查询设备信息,多个id使用,隔开
|
||||
@GET("/v2.0/cloud/thing/{device_id}")
|
||||
JSONObject getByid(@Path("device_id") String deviceId);
|
||||
|
||||
// 查询空间下设备列表
|
||||
@GET("/v2.0/cloud/thing/space/device")
|
||||
JSONObject getDevicesBySpaceIds(String spaces);
|
||||
|
||||
// 控制设备动作
|
||||
@POST("/v2.0/cloud/thing/{device_id}/shadow/actions")
|
||||
JSONObject controlDevice(@Path("device_id") String deviceId, @Body JSONObject commands);
|
||||
|
||||
// 创建空间
|
||||
@POST("/v2.0/cloud/space/creation")
|
||||
JSONObject creatSpace(@Body JSONObject jsonObject);
|
||||
|
||||
// 删除空间
|
||||
@DELETE("/v2.0/cloud/space/{space_id}")
|
||||
JSONObject deleteSpace(@Path("space_id") String spaceId);
|
||||
|
||||
// 查询空间
|
||||
@GET("/v2.0/cloud/space/{space_id}")
|
||||
JSONObject getSpaceInfo(@Path("space_id") String spaceId);
|
||||
|
||||
// 修改空间信息
|
||||
@PUT("/v2.0/cloud/space/{space_id}")
|
||||
JSONObject updateSpace(@Path("space_id") String spaceId, @Body JSONObject JSONObject);
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user