修复openai setProperty 设备编号不存在500异常

V0.5.x
mark 2024-03-19 13:55:29 +08:00
parent 050ddb6000
commit 6a0f4c91fb
1 changed files with 3 additions and 0 deletions

View File

@ -106,6 +106,9 @@ public class OpenDeviceServiceImpl implements OpenDeviceService {
@Override @Override
public String setProperty(String productKey, String deviceName, String args) { public String setProperty(String productKey, String deviceName, String args) {
DeviceInfo deviceRepetition = deviceInfoData.findByDeviceName(deviceName); DeviceInfo deviceRepetition = deviceInfoData.findByDeviceName(deviceName);
if (deviceRepetition == null){
throw new BizException(ErrCode.DEVICE_NOT_FOUND);
}
return deviceCtrlService.setProperty(deviceRepetition.getDeviceId(), JsonUtils.parseObject(args,Map.class), true); return deviceCtrlService.setProperty(deviceRepetition.getDeviceId(), JsonUtils.parseObject(args,Map.class), true);
} }