Commit e44231cc authored by zengtianlai3's avatar zengtianlai3

进一步完善添加设备黑名单功能

parent f8c19c8f
...@@ -48,14 +48,13 @@ public class DeviceBlackServiceImpl extends ServiceImpl<DeviceBlackMapper, Devic ...@@ -48,14 +48,13 @@ public class DeviceBlackServiceImpl extends ServiceImpl<DeviceBlackMapper, Devic
throw new IotLicenseException(ResultCode.FAILED.getCode(),ResultCode.FAILED.getMsg()); throw new IotLicenseException(ResultCode.FAILED.getCode(),ResultCode.FAILED.getMsg());
} }
Map<String, DeviceVo> allDevice = deviceManager.getAllDevice(); Map<String, DeviceVo> allDevice = deviceManager.getAllDevice();
int count = 0; boolean flag = false;
for (DeviceVo deviceVo : allDevice.values()) { for (DeviceVo deviceVo : allDevice.values()) {
if (deviceVo.getDeviceId() == deviceId){ if (deviceVo.getDeviceId() == deviceId){
break; flag = true;
} }
count++;
} }
if (count == allDevice.size()) { if (!flag) {
throw new IotLicenseException(ResultCode.FAILED.getCode(),ResultCode.FAILED.getMsg()); throw new IotLicenseException(ResultCode.FAILED.getCode(),ResultCode.FAILED.getMsg());
} }
boolean res = deviceBlackMapper.addDeviceBlack(deviceId); boolean res = deviceBlackMapper.addDeviceBlack(deviceId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment