|
@@ -86,7 +86,9 @@ public class MqttCallbackHandler {
|
|
|
//创建新的设备
|
|
|
DeviceBase device = new DeviceBase();
|
|
|
//saveOrUpdate根据主键ID来判断
|
|
|
- device.setId(dbData.getId());
|
|
|
+ if (dbData != null) {
|
|
|
+ device.setId(dbData.getId());
|
|
|
+ }
|
|
|
device.setOpenNum(openNum);
|
|
|
device.setGroupId(mqttDTO.getString("group"));
|
|
|
device.setUsername(Constant.PREF.RABBIT_MQ_USERNAME + openNum);
|