From b6294bd36b3023e18606c77553fe136e6500a4b2 Mon Sep 17 00:00:00 2001
From: rain <167982779@qq.com>
Date: Wed, 17 Apr 2024 15:42:34 +0800
Subject: [PATCH] 完善DB数据配置
---
src/main/java/com/dji/sample/manage/controller/DeviceController.java | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/dji/sample/manage/controller/DeviceController.java b/src/main/java/com/dji/sample/manage/controller/DeviceController.java
index 602e8c9..9e8870e 100644
--- a/src/main/java/com/dji/sample/manage/controller/DeviceController.java
+++ b/src/main/java/com/dji/sample/manage/controller/DeviceController.java
@@ -79,10 +79,24 @@
* @return
*/
@GetMapping("/{workspace_id}/devices")
- public ResponseResult<List<DeviceDTO>> getDevices(@PathVariable("workspace_id") String workspaceId) {
- List<DeviceDTO> devicesList = deviceService.getDevicesTopoForWeb(workspaceId);
+ public ResponseResult<List<DeviceDTO>> getDevices(@PathVariable("workspace_id") String workspaceId,String reserveId) {
+ List<DeviceDTO> devicesList = deviceService.getDevicesTopoForWeb(workspaceId,reserveId);
return ResponseResult.success(devicesList);
+ }
+
+ @GetMapping("/{device_sn}/subscribeTopic")
+ public ResponseResult<List<DeviceDTO>> testBinding(@PathVariable("device_sn") String deviceSn) {
+ deviceService.subscribeTopicOnline(deviceSn);
+
+ return ResponseResult.success();
+ }
+
+ @GetMapping("/{device_sn}/unsubscribeTopic")
+ public ResponseResult<List<DeviceDTO>> testUnBinding(@PathVariable("device_sn") String deviceSn) {
+ deviceService.unsubscribeTopicOffline(deviceSn);
+
+ return ResponseResult.success();
}
/**
@@ -108,7 +122,7 @@
public ResponseResult getDevice(@PathVariable("workspace_id") String workspaceId,
@PathVariable("device_sn") String deviceSn) {
Optional<DeviceDTO> deviceOpt = deviceService.getDeviceBySn(deviceSn);
- return deviceOpt.isEmpty() ? ResponseResult.error("device not found.") : ResponseResult.success(deviceOpt.get());
+ return deviceOpt.isEmpty() ? ResponseResult.error("设备未找到") : ResponseResult.success(deviceOpt.get());
}
/**
@@ -120,7 +134,7 @@
*/
@GetMapping("/{workspace_id}/devices/bound")
public ResponseResult<PaginationData<DeviceDTO>> getBoundDevicesWithDomain(
- @PathVariable("workspace_id") String workspaceId, String domain,
+ @PathVariable("workspace_id") String workspaceId, Integer domain,
@RequestParam(defaultValue = "1") Long page,
@RequestParam(value = "page_size", defaultValue = "50") Long pageSize) {
PaginationData<DeviceDTO> devices = deviceService.getBoundDevicesWithDomain(workspaceId, page, pageSize, domain);
@@ -189,4 +203,4 @@
deviceService.devicePropertySet(workspaceId, dockSn, propertyEnumOpt.get(), param.get(property));
return ResponseResult.success();
}
-}
\ No newline at end of file
+}
--
Gitblit v1.9.3