| | |
| | | // 完成或暂停后只保留历史异常事实,实时控制台不再展示开放预警。 |
| | | if (receiving && mapper != null) { |
| | | mapper.selectWarningExceptions(testId, "OPEN").forEach(item -> { |
| | | boolean offline = "DEVICE_OFFLINE".equals(item.getExceptionType()); |
| | | if (offline) offlineSources.add(item.getSourceType() + ":" + item.getSourceIdentity()); |
| | | // 离线异常没有测量值,必须允许空值,不能用 Map.of 构造响应。 |
| | | // 离线待办的处理状态不代表当前设备状态,实时提醒只由下方当前来源生成。 |
| | | if ("DEVICE_OFFLINE".equals(item.getExceptionType())) return; |
| | | Map<String, Object> warning = new LinkedHashMap<>(); |
| | | warning.put("exceptionId", item.getExceptionId()); |
| | | warning.put("exceptionType", item.getExceptionType()); |
| | |
| | | warning.put("value", item.getAbnormalValue()); |
| | | warning.put("unit", item.getUnit()); |
| | | warning.put("status", item.getExceptionStatus()); |
| | | warning.put("message", offline ? "接收期间设备离线,等待处理" : "测试预警异常"); |
| | | warning.put("message", "测试预警异常"); |
| | | exceptions.add(warning); |
| | | }); |
| | | } |