|
@@ -127,7 +127,11 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
|
|
|
@Override
|
|
|
public Integer updateDeviceState(Long id, int state){
|
|
|
- if (syncDeviceService.updateDeviceStatus(id, state) > 0){
|
|
|
+ DeviceVo deviceVo = deviceMapper.selectById(id);
|
|
|
+ if (deviceVo == null) {
|
|
|
+ throw BusinessException.builder(500, "同步设备信息为空");
|
|
|
+ }
|
|
|
+ if (syncDeviceService.updateDeviceStatus(deviceVo.getIotDeviceId(), state) > 0){
|
|
|
return deviceMapper.updateDeviceState(id, state);
|
|
|
}
|
|
|
throw BusinessException.builder(500, "同步更新物联网失败");
|