Explorar el Código

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

mark hace 1 año
padre
commit
6a0f4c91fb

+ 3 - 0
iot-module/iot-openapi/src/main/java/cc/iotkit/openapi/service/impl/OpenDeviceServiceImpl.java

@@ -106,6 +106,9 @@ public class OpenDeviceServiceImpl implements OpenDeviceService {
     @Override
     public String setProperty(String productKey, String deviceName, String args) {
         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);
     }