diff --git a/iot-modules/iot-box-user-api/pom.xml b/iot-modules/iot-box-user-api/pom.xml index 935641f..8921e80 100644 --- a/iot-modules/iot-box-user-api/pom.xml +++ b/iot-modules/iot-box-user-api/pom.xml @@ -33,36 +33,35 @@ org.springframework.boot spring-boot-starter-webflux + + + + + + org.springframework.boot + spring-boot-starter-data-redis-reactive + + org.hswebframework.web hsweb-commons-crud ${hswebframework.version} + org.hswebframework.web hsweb-system-authorization-default ${hswebframework.version} - - - org.hswebframework - hsweb-easy-orm-rdb - 4.1.1 - - - - org.springframework.boot - spring-boot-starter-data-redis-reactive - - + org.hswebframework.web hsweb-starter ${hswebframework.version} - + io.projectreactor reactor-test @@ -84,13 +83,20 @@ 0.0.1-SNAPSHOT compile - + org.springframework.boot spring-boot-starter-data-r2dbc ${spring.boot.version} + + + org.hswebframework + hsweb-easy-orm-rdb + 4.1.1 + + dev.miku r2dbc-mysql @@ -104,6 +110,7 @@ pom compile + cn.hutool hutool-all diff --git a/iot-modules/iot-box-user-api/src/test/java/UserTest.java b/iot-modules/iot-box-user-api/src/test/java/UserTest.java deleted file mode 100644 index 54ce71d..0000000 --- a/iot-modules/iot-box-user-api/src/test/java/UserTest.java +++ /dev/null @@ -1,110 +0,0 @@ -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.qiuguo.iot.user.api.IotBoxUserApiApplication; -import com.qiuguo.iot.user.api.service.TuyaDeviceConnector; -import java.util.Arrays; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; - -/** - * XXX - * - * @author weiyachao - * @since 2023/9/5 16:03 - */ -@SpringBootTest(classes = IotBoxUserApiApplication.class) -@Slf4j -public class UserTest { - - public String deviceId = "6cae26f5512eee7c12aqd9"; - - public String spaceId = "163257138"; - - @Autowired - private TuyaDeviceConnector tuyaDeviceConnector; - - @Test - public void 查询所有分类() { - JSONArray aa = tuyaDeviceConnector.categories(); - aa.forEach(System.out::println); - } - - @Test - public void 转移设备() { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("space_id", "163257138"); - Boolean aBoolean = tuyaDeviceConnector.transferDevice(deviceId, jsonObject); - System.out.println(aBoolean); - } - - @Test - public void 获取设备支持的指令集() { - Object functions = tuyaDeviceConnector.getFunctions(deviceId); - System.out.println(functions); - } - - @Test - public void 修改空间() { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("name", "testname"); - Boolean jsonObject1 = tuyaDeviceConnector.updateSpace(spaceId, jsonObject); - System.out.println(jsonObject1); - } - - @Test - public void 查询空间() { - //40001900 - JSONObject spaceInfo = tuyaDeviceConnector.getSpaceInfo("163257138"); - System.out.println(spaceInfo); - } - - @Test - public void 删除空间() { - //40001900 - Boolean jsonObject = tuyaDeviceConnector.deleteSpace("163258893"); - System.out.println(jsonObject); - } - - @Test - public void 创建空间() { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("name", "space1_2"); - jsonObject.put("description", "space1_2的空间描述"); - Long jsonObject1 = tuyaDeviceConnector.creatSpace(jsonObject); - System.out.println(jsonObject1); - } - - @Test - public void 控制设备动作() { - JSONObject commands = new JSONObject(); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("code", "switch_led"); - jsonObject.put("value", true); - JSONObject js2 = new JSONObject(); - js2.put("code", "work_mode"); - js2.put("value", "colour"); - JSONObject js3 = new JSONObject(); - js3.put("code", "bright_value_v2"); - js3.put("value", 10); - commands.put("commands", Arrays.asList(jsonObject)); - - Object controlDevice = tuyaDeviceConnector.controlDevice(deviceId,commands); - System.out.println(controlDevice); - - } - - @Test - public void 查询空间下设备列表() { - JSONArray devicesBySpaceIds = tuyaDeviceConnector.getDevicesBySpaceIds("163257138", 20); - System.out.println(devicesBySpaceIds); - } - - @Test - public void 查询设备信息() { - JSONArray byid = tuyaDeviceConnector.getByid(deviceId); - System.out.println(byid); - } - -} diff --git a/iot-modules/pom.xml b/iot-modules/pom.xml index ecdd473..362951f 100644 --- a/iot-modules/pom.xml +++ b/iot-modules/pom.xml @@ -21,7 +21,19 @@ + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + 2021.0.1.0 + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + 2021.0.1.0 +