|  |  |  | 
|---|
|  |  |  | package com.dy.rtuMw.server.mqtt; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.dy.common.mw.protocol4Mqtt.status.DevRunSt; | 
|---|
|  |  |  | import com.dy.common.mw.protocol4Mqtt.status.DevRunInfo; | 
|---|
|  |  |  | import com.dy.rtuMw.server.forTcp.RtuLogDealer; | 
|---|
|  |  |  | import com.dy.rtuMw.server.local.localProtocol.RtuOnLineStateStatisticsVo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return rsMap ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static Boolean oneOnLine(String devId){ | 
|---|
|  |  |  | synchronized (map){ | 
|---|
|  |  |  | DevStatus st = map.get(devId) ; | 
|---|
|  |  |  | if(st != null){ | 
|---|
|  |  |  | return st.onLine ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return false ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 统计在线与不在线情况 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 
|---|
|  |  |  | Map.Entry<String, DevStatus> entry = null ; | 
|---|
|  |  |  | while(it.hasNext()){ | 
|---|
|  |  |  | entry = it.next() ; | 
|---|
|  |  |  | if(((DevStatus)entry).onLine != null && ((DevStatus)entry).onLine.booleanValue()){ | 
|---|
|  |  |  | if((entry.getValue()).onLine != null && (entry.getValue()).onLine.booleanValue()){ | 
|---|
|  |  |  | vo.onLineNum++ ; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | vo.offLineNum++ ; | 
|---|
|  |  |  | 
|---|
|  |  |  | if(st.onLine != null && st.onLine.booleanValue() && st.lastUpDataTime != null){ | 
|---|
|  |  |  | if(now - st.lastUpDataTime > MqttUnit.confVo.noSubThenOff.longValue()){ | 
|---|
|  |  |  | st.onLine = false ; | 
|---|
|  |  |  | RtuLogDealer.log4Mqtt(entry.getKey(), "因较长时间未收上行数据,认为设备离线"); | 
|---|
|  |  |  | RtuLogDealer.log4Mqtt(entry.getKey(), "因较长时间未收到上行数据,认为设备离线"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static void setStatus(String devId, DevRunSt st){ | 
|---|
|  |  |  | public static void setStatus(String devId, DevRunInfo st){ | 
|---|
|  |  |  | DevStatus vo = map.get(devId) ; | 
|---|
|  |  |  | if(vo != null) { | 
|---|
|  |  |  | if(st.stirRunning != null){ | 
|---|