fix: 物模型消息,设备重复在线,离线过滤处理
parent
4bee56623d
commit
bdef7e045c
|
@ -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());
|
||||||
|
|
Loading…
Reference in New Issue