| | |
| | | /** 发现失败或返回空拓扑时,清除该适配器下已登记设备的过期运行事实。 */ |
| | | public void markUnavailable(String adapterCode) |
| | | { |
| | | Instant failedAt = Instant.now(); |
| | | // 失败立即撤下旧测量,但保留来源身份,不能等候选 TTL 到期才停止展示成功值。 |
| | | candidateStore.recordCabinets(candidateStore.snapshot(failedAt).cabinets().stream() |
| | | .filter(item -> item.adapterCode().equals(adapterCode)) |
| | | .map(item -> new CabinetCandidate(item.adapterCode(), item.adapterId(), item.deviceCode(), |
| | | item.devtype(), item.devid(), item.ip(), item.mac(), item.name(), item.manufacturer(), item.model(), |
| | | item.channels().stream().map(channel -> new ChannelCandidate(channel.identity(), false, |
| | | DeviceWorkStatus.UNOBSERVABLE, failedAt)).toList(), failedAt, item.expiresAt())) |
| | | .toList()); |
| | | detectionCabinetMapper.markRegisteredFactsUnobservable(adapterCode); |
| | | detectionCabinetMapper.markRegisteredCabinetsOffline(adapterCode); |
| | | } |