|
@@ -9,7 +9,9 @@ import com.ozs.common.utils.StringUtils;
|
|
|
import com.ozs.common.utils.bean.BeanUtils;
|
|
|
import com.ozs.common.utils.stateSecrets.SM4Utils;
|
|
|
import com.ozs.entity.MonitorSystem;
|
|
|
+import com.ozs.entity.SkynetHeartbeatLog;
|
|
|
import com.ozs.entity.SvcAddress;
|
|
|
+import com.ozs.entity.vo.AlarmHeartbeatLog;
|
|
|
import com.ozs.entity.vo.MonitorSystemVo;
|
|
|
import com.ozs.mapper.MonitorSystemMapper;
|
|
|
import com.ozs.mapper.SvcAddressMapper;
|
|
@@ -19,9 +21,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -178,9 +178,36 @@ public class MonitorSystemServiceImpl extends ServiceImpl<MonitorSystemMapper, M
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> monitorSystem() {
|
|
|
- Map<String, Object> mapCount = monitorSystemMapper.monitorSystemCount();
|
|
|
+ // Map<String, Object> mapCount = monitorSystemMapper.monitorSystemCount();
|
|
|
+ Map<String, Object> mapCount = new HashMap<>();
|
|
|
List<MonitorSystem> monitorSystemList = monitorSystemMapper.monitorSystemList();
|
|
|
+ int offlineMonitor = 0;
|
|
|
+ int onlineMonitor = 0;
|
|
|
+ for (MonitorSystem monitorSystem : monitorSystemList) {
|
|
|
+ if (!StringUtils.isEmptySunhh(monitorSystem) && !StringUtils.isEmptySunhh(monitorSystem.getClientId())) {
|
|
|
+ AlarmHeartbeatLog alarmHeartbeatLog = monitorSystemMapper.selectAlarmHeartbeatLogByClientId(monitorSystem.getClientId());
|
|
|
+ if (StringUtils.isEmptySunhh(alarmHeartbeatLog)) {
|
|
|
+ offlineMonitor++;
|
|
|
+ monitorSystem.setStatus(2);
|
|
|
+ } else {
|
|
|
+ long timeNow = new Date().getTime();
|
|
|
+ long createTime = alarmHeartbeatLog.getCreateTime().getTime();
|
|
|
+ long thereHourMillis = 60 * 60 * 1000 * 3;
|
|
|
+ long timeNew = timeNow - thereHourMillis;
|
|
|
+ if (timeNew <= createTime) {
|
|
|
+ onlineMonitor++;
|
|
|
+ monitorSystem.setStatus(1);
|
|
|
+ } else {
|
|
|
+ offlineMonitor++;
|
|
|
+ monitorSystem.setStatus(2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
mapCount.put("monitorSystemList", monitorSystemList);
|
|
|
+ mapCount.put("countAllMonitor", monitorSystemList.size());
|
|
|
+ mapCount.put("offlineMonitor", offlineMonitor);
|
|
|
+ mapCount.put("onlineMonitor", onlineMonitor);
|
|
|
return mapCount;
|
|
|
}
|
|
|
}
|