From 7a274357052080ffd099b83628f8275402df2124 Mon Sep 17 00:00:00 2001 From: tangfudong <280620913@qq.com> Date: Tue, 19 Mar 2024 16:52:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=E6=B7=BB=E5=8A=A0=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E7=AB=AF=E8=AE=BE=E7=BD=AE=E5=B1=9E=E6=80=A7=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E8=AE=BE=E5=A4=87vo=E6=B7=BB=E5=8A=A0=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SpaceDeviceController.java | 18 ++++++++++++++++++ .../dto/vo/deviceinfo/DeviceInfoVo.java | 3 +++ 2 files changed, 21 insertions(+) diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/SpaceDeviceController.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/SpaceDeviceController.java index 6e547a51..6be0e00d 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/SpaceDeviceController.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/SpaceDeviceController.java @@ -19,11 +19,14 @@ import cc.iotkit.common.utils.JsonUtils; import cc.iotkit.data.manager.ICategoryData; import cc.iotkit.data.manager.IDeviceInfoData; import cc.iotkit.data.manager.IUserInfoData; +import cc.iotkit.manager.dto.bo.device.ServiceInvokeBo; +import cc.iotkit.manager.dto.bo.device.SetDeviceServicePorpertyBo; import cc.iotkit.manager.dto.vo.product.ProductVo; import cc.iotkit.manager.dto.vo.thingmodel.ThingModelVo; import cc.iotkit.manager.model.vo.FindDeviceVo; import cc.iotkit.manager.model.vo.SpaceDeviceVo; import cc.iotkit.manager.service.*; +import cc.iotkit.model.InvokeResult; import cc.iotkit.model.UserInfo; import cc.iotkit.model.device.DeviceInfo; import cc.iotkit.model.product.Category; @@ -70,6 +73,9 @@ public class SpaceDeviceController { private IUserInfoData userInfoData; @Autowired private IDeviceManagerService deviceServiceImpl; + //赋予应用端设备的服务和属性设置,关于应用的接口及相关权限设计后续完善,先打通链路 + @Autowired + private DeviceCtrlService deviceCtrlService; /** * 我最近使用的设备列表 @@ -223,6 +229,18 @@ public class SpaceDeviceController { return deviceServiceImpl.getDetail(request.getData()); } + @ApiOperation("调用设备服务") + @PostMapping("/invokeService") + public InvokeResult invokeService(@RequestBody @Validated Request request) { + return new InvokeResult(deviceCtrlService.invokeService(request.getData().getDeviceId(), request.getData().getService(), request.getData().getArgs())); + } + + @ApiOperation(value = "设备属性设置") + @PostMapping("/setProperty") + public InvokeResult setProperty(@RequestBody @Validated Request request) { + return new InvokeResult(deviceCtrlService.setProperty(request.getData().getDeviceId(), request.getData().getArgs())); + } + /** * REMOVE_DEVICE * 往指定房间中添加设备 diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/vo/deviceinfo/DeviceInfoVo.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/vo/deviceinfo/DeviceInfoVo.java index 97684427..79c3142a 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/vo/deviceinfo/DeviceInfoVo.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/vo/deviceinfo/DeviceInfoVo.java @@ -79,4 +79,7 @@ public class DeviceInfoVo implements Serializable { @ApiModelProperty(value = "所属分组") private Map group; + @ApiModelProperty(value = "位置信息") + private DeviceInfo.Locate locate; + } From de49f494c0376fcf8a18b1ace2247a6b1b9b7081 Mon Sep 17 00:00:00 2001 From: tangfudong <280620913@qq.com> Date: Tue, 19 Mar 2024 18:40:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=E4=BC=98=E5=8C=96=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=A7=BB=E9=99=A4=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iotkit/manager/controller/SpaceDeviceController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/SpaceDeviceController.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/SpaceDeviceController.java index 6be0e00d..20a1efb0 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/SpaceDeviceController.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/SpaceDeviceController.java @@ -304,15 +304,15 @@ public class SpaceDeviceController { /** * 移除房间中的设备 */ - @DeleteMapping(Constants.API_SPACE.REMOVE_DEVICE) - public void removeDevice(String deviceId) { - SpaceDevice spaceDevice = spaceDeviceService.findByDeviceId(deviceId); + @PostMapping(Constants.API_SPACE.REMOVE_DEVICE) + public void removeDevice(@RequestBody @Validated Request request) { + SpaceDevice spaceDevice = spaceDeviceService.findByDeviceId(request.getData()); if (spaceDevice == null) { throw new BizException(ErrCode.SPACE_DEVICE_NOT_FOUND); } spaceDeviceService.deleteById(spaceDevice.getId()); - DeviceInfo deviceInfo = deviceInfoData.findByDeviceId(deviceId); + DeviceInfo deviceInfo = deviceInfoData.findByDeviceId(request.getData()); UserInfo userInfo = userInfoData.findById(LoginHelper.getUserId()); if (userInfo == null) { throw new BizException(ErrCode.USER_NOT_FOUND);