| | |
| | | List<Map<String, Object>> exceptions = new ArrayList<>(); |
| | | if (receiving) |
| | | exceptions.addAll(sources.stream().filter(source -> !"COLLECTOR".equals(source.sourceType()) |
| | | && !"ONLINE".equals(source.deviceStatus()) |
| | | && !"WORKING".equals(source.deviceStatus()) && !"PAUSED".equals(source.deviceStatus())) |
| | | && "OFFLINE".equals(source.deviceStatus())) |
| | | .map(source -> Map.<String, Object>of("sourceType", source.sourceType(), "sourceId", source.sourceId(), |
| | | "batteryNo", source.batteryNo(), "status", source.deviceStatus(), "message", "数据来源当前不可观测")) |
| | | .toList()); |
| | |
| | | && Objects.equals(channel.identity().subdevid(), binding.getSubdevid()) |
| | | && Objects.equals(channel.identity().chlid(), binding.getChlid())) |
| | | return new LiveSource("CABINET_CHANNEL", binding.getChannelId(), battery.getBatteryNo(), |
| | | channel.online() ? channel.workStatus().name() : "OFFLINE", |
| | | channel.online() ? "ONLINE" : "OFFLINE", |
| | | channel.online() ? snapshot(channel) : Map.of()); |
| | | return new LiveSource("CABINET_CHANNEL", binding.getChannelId(), battery.getBatteryNo(), "UNKNOWN", Map.of()); |
| | | return new LiveSource("CABINET_CHANNEL", binding.getChannelId(), battery.getBatteryNo(), "OFFLINE", Map.of()); |
| | | } |
| | | |
| | | private Map<String, Object> snapshot(ChannelCandidate channel) |
| | |
| | | return new LiveSource("COLLECTOR", (long) collector.collectorId(), battery.getBatteryNo(), |
| | | collector.online() ? "ONLINE" : "OFFLINE", collector.online() ? value : Map.of()); |
| | | } |
| | | return new LiveSource("COLLECTOR", battery.getCollectorId(), battery.getBatteryNo(), "UNKNOWN", Map.of()); |
| | | return new LiveSource("COLLECTOR", battery.getCollectorId(), battery.getBatteryNo(), "OFFLINE", Map.of()); |
| | | } |
| | | |
| | | @PreDestroy void shutdown() { scheduler.shutdownNow(); } |