TRX 1 anno fa
parent
commit
9641728734

+ 3 - 0
OneCardIotClient/src/main/java/com/zhongshu/iot/client/model/mqtt/DeviceInfoUpdateRemark.java

@@ -28,4 +28,7 @@ public class DeviceInfoUpdateRemark {
 
     @Schema(description = "所属项目code")
     private String projectCode;
+
+    @Schema(description = "设备ID")
+    private String deviceId;
 }

+ 1 - 1
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/controller/devices/DeviceController.java

@@ -83,7 +83,7 @@ public class DeviceController {
     @Operation(summary = "启用-禁用 设备")
     @RequestMapping(value = "updateDeviceState", method = {RequestMethod.POST})
     public ResultContent updateDeviceState(@RequestBody DeviceInfoUpdateRemark param) {
-        Assert.hasText(param.getId(), "ID不能为空");
+        Assert.hasText(param.getDeviceId(), "ID不能为空");
         if (param.getState() != null) {
             return ResultContent.buildFail("state不能为空");
         }

+ 2 - 2
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/device/DeviceInfoService.java

@@ -258,9 +258,9 @@ public class DeviceInfoService {
      * @return
      */
     public ResultContent updateDeviceState(DeviceInfoUpdateRemark param) {
-        DeviceInfo deviceInfo = deviceInfoDao.findTopById(param.getId());
+        DeviceInfo deviceInfo = deviceInfoDao.findTopByDeviceId(param.getDeviceId());
         if (ObjectUtils.isEmpty(deviceInfo)) {
-            return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getId()));
+            return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getDeviceId()));
         }
         if (deviceInfo.getState() == DeviceState.Cancel) {
             return ResultContent.buildFail("设备已注销");