fix: 物模型消息,设备重复在线,离线过滤处理

V0.5.x
gaoyoulong 2024-04-29 11:40:25 +08:00
parent 4bee56623d
commit bdef7e045c
1 changed files with 5 additions and 0 deletions

View File

@ -186,6 +186,11 @@ public class ThingServiceImpl implements IThingService {
private void deviceStateChange(DeviceInfo device, DeviceStateChange action) { private void deviceStateChange(DeviceInfo device, DeviceStateChange action) {
DeviceState state = action.getState(); DeviceState state = action.getState();
if ( (device.getState().isOnline() && state == DeviceState.ONLINE) ||
(!device.getState().isOnline() && state == DeviceState.OFFLINE) ) {
return;
}
if (state == DeviceState.ONLINE) { if (state == DeviceState.ONLINE) {
device.getState().setOnline(true); device.getState().setOnline(true);
device.getState().setOnlineTime(System.currentTimeMillis()); device.getState().setOnlineTime(System.currentTimeMillis());