Merge branch 'feature-BOX一期' of http://47.99.132.106:10081/wulin/qiuguo-iot into feature-BOX一期
This commit is contained in:
commit
59e73613a7
1
.gitignore
vendored
1
.gitignore
vendored
@ -32,3 +32,4 @@ build/
|
|||||||
### VS Code ###
|
### VS Code ###
|
||||||
.vscode/
|
.vscode/
|
||||||
/logs/
|
/logs/
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ package com.qiuguo.iot.base.enums;
|
|||||||
// 1000秋果box android配置App 1001秋果Box iOS配置App
|
// 1000秋果box android配置App 1001秋果Box iOS配置App
|
||||||
public enum DeviceTypeEnum {
|
public enum DeviceTypeEnum {
|
||||||
GUO_BOX(0, "果box", "BOX"),
|
GUO_BOX(0, "果box", "BOX"),
|
||||||
ELECTRIC_SOCKET(1, "智能插座", "SOC"),
|
ELECTRIC_SOCKET(1, "涂鸦设备", "tuya"),
|
||||||
BIG_LIGHT(2, "智能大灯", "BIL"),
|
BIG_LIGHT(2, "智能大灯", "BIL"),
|
||||||
CURTAIN_DRIVE(3, "智能窗帘驱动", "CUR"),
|
CURTAIN_DRIVE(3, "智能窗帘驱动", "CUR"),
|
||||||
WINDOW_DRIVE(4, "智能窗户关闭", "WIN"),
|
WINDOW_DRIVE(4, "智能窗户关闭", "WIN"),
|
||||||
|
|||||||
@ -41,6 +41,10 @@ public class DeviceUserBindEntity extends GenericEntity<Long> {
|
|||||||
@Column(name = "device_id", nullable = false)
|
@Column(name = "device_id", nullable = false)
|
||||||
private Long deviceId;
|
private Long deviceId;
|
||||||
|
|
||||||
|
@Comment("三方设备id")
|
||||||
|
@Column(name = "other_device_id", nullable = true)
|
||||||
|
private String otherDeviceId;
|
||||||
|
|
||||||
@Comment("设备类型:0 果Box 1智能插座 2智能大灯 3智能窗帘驱动 4智能窗户关闭 5智能台灯 6智能桌子 7智能椅子 8智能风扇 9智能空调(遥控器) 10智能冰箱 11智能洗碗机 12智能电热水器 13温度传感器 14空气质量传感器 15光线传感器 16雨量传感器 17闭门器")
|
@Comment("设备类型:0 果Box 1智能插座 2智能大灯 3智能窗帘驱动 4智能窗户关闭 5智能台灯 6智能桌子 7智能椅子 8智能风扇 9智能空调(遥控器) 10智能冰箱 11智能洗碗机 12智能电热水器 13温度传感器 14空气质量传感器 15光线传感器 16雨量传感器 17闭门器")
|
||||||
@Column(name = "device_type", nullable = false)
|
@Column(name = "device_type", nullable = false)
|
||||||
private Integer deviceType;
|
private Integer deviceType;
|
||||||
|
|||||||
1
iot-modules/iot-box-user-api/.gitignore
vendored
1
iot-modules/iot-box-user-api/.gitignore
vendored
@ -36,3 +36,4 @@ build/
|
|||||||
|
|
||||||
### Mac OS ###
|
### 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.DeviceBatchService;
|
||||||
import com.qiuguo.iot.data.service.device.DeviceInfoService;
|
import com.qiuguo.iot.data.service.device.DeviceInfoService;
|
||||||
import com.qiuguo.iot.user.api.resp.device.DeviceInitResp;
|
import com.qiuguo.iot.user.api.resp.device.DeviceInitResp;
|
||||||
import com.qiuguo.iot.user.api.service.DeviceConnector;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.hswebframework.web.exception.BusinessException;
|
import org.hswebframework.web.exception.BusinessException;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@ -37,15 +36,6 @@ public class DeviceController {
|
|||||||
@Resource
|
@Resource
|
||||||
private DeviceBatchService deviceBatchService;
|
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分钟
|
private static Long timeOut = 120000l;//2分钟
|
||||||
@GetMapping("/init")
|
@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 com.alibaba.fastjson.JSONObject;
|
||||||
import java.util.Objects;
|
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