| | |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.TreeMap; |
| | |
| | | List<Object> result = new ArrayList<>(); |
| | | |
| | | JSONObject info = new JSONObject(); |
| | | info.put("设备编号", device.getName()); |
| | | info.put("设备编号", device.getManufacturerNumber()); |
| | | |
| | | var errorCounts = deviceRes.root().getData().getTotalErrorCounts(); |
| | | info.put("一级隐患", errorCounts[0]); |
| | |
| | | List<Object> result = new ArrayList<>(); |
| | | |
| | | JSONObject info = new JSONObject(); |
| | | info.put("设备编号", device.getName()); |
| | | info.put("设备编号", device.getManufacturerNumber()); |
| | | |
| | | info.put("问题", buildDeviceErrorInfo(device)); |
| | | result.add(info); |
| | |
| | | * @return 设备记录 |
| | | */ |
| | | private List<ErrorRecord> buildDeviceRecords(Device device){ |
| | | return records.stream().filter(r -> r.getDevice().getId().equals(device.getId())).toList(); |
| | | return records.stream() |
| | | .filter(r -> r.getDevice().getId().equals(device.getId())) |
| | | .sorted(Comparator.comparing(r -> r.getLevel() != null ? r.getLevel().ordinal() : ErrorLevel.P4.ordinal())) |
| | | .toList(); |
| | | } |
| | | |
| | | |