648540858
2022-10-24 ca891f367c5b23ea841695c50ddbb7f08ae23292
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
@@ -19,6 +19,7 @@
import com.genersoft.iot.vmp.storager.dao.PlatformChannelMapper;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.BaseTree;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -118,6 +119,7 @@
            }
            sync(device);
        }else {
            if(device.getOnline() == 0){
                device.setOnline(1);
                device.setCreateTime(now);
@@ -132,6 +134,11 @@
                sync(device);
                // TODO 如果设备下的通道级联到了其他平台,那么需要发送事件或者notify给上级平台
            }else {
                if (deviceChannelMapper.queryAllChannels(device.getDeviceId()).size() == 0) {
                    logger.info("[设备上线]: {},通道数为0,查询通道信息", device.getDeviceId());
                    sync(device);
                }
                deviceMapper.update(device);
                redisCatchStorage.updateDevice(device);
            }
@@ -614,4 +621,9 @@
        }
        return result;
    }
    @Override
    public ResourceBaceInfo getOverview() {
        return deviceMapper.getOverview();
    }
}