|
|
@ -367,9 +367,15 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
String FAIL_RATE = "failRate";//离线率
|
|
|
|
String SUM_USE_STATE = "sumUseState";//在用数
|
|
|
|
String SUM = "sum";//总数
|
|
|
|
Map<String, Object> returnMap = new HashMap<>(); |
|
|
|
Map<String, Object> returnMap = new LinkedHashMap<>(); |
|
|
|
List<DcDevice> dcDeviceList = dcDeviceService.list(); |
|
|
|
List<DcRoadSection> dcRoadSections = dcRoadSectionService.selectDcRoadSectionList(new DcRoadSection()); |
|
|
|
|
|
|
|
// 创建一个映射存储roadId到sectionName
|
|
|
|
Map<String, String> roadIdToSectionNameMap = new HashMap<>(); |
|
|
|
for (DcRoadSection dcRoadSection : dcRoadSections) { |
|
|
|
roadIdToSectionNameMap.put(dcRoadSection.getId().toString(), dcRoadSection.getSectionName()); |
|
|
|
} |
|
|
|
/* // 去重设备列表
|
|
|
|
dcDeviceList = dcDeviceList.stream() |
|
|
|
.distinct() |
|
|
@ -417,6 +423,7 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
devicesInRoad.forEach(device -> System.out.println("Device ID: " + device.getId() + ", Stake Mark: " + device.getStakeMark())); |
|
|
|
}*/ |
|
|
|
} |
|
|
|
List<Map.Entry<String, Object>> sortedEntries = new ArrayList<>(); |
|
|
|
for (DcRoadSection dcRoadSection : dcRoadSections) { |
|
|
|
Map<String, Object> itemMap = new HashMap<>(); |
|
|
|
String roadId = dcRoadSection.getId().toString(); |
|
|
@ -445,8 +452,15 @@ public class DcDeviceOnlineController extends BaseController { |
|
|
|
|
|
|
|
// 丢包率暂时设置为空
|
|
|
|
itemMap.put(LOST_RATE, ""); |
|
|
|
// 添加到列表中
|
|
|
|
sortedEntries.add(new AbstractMap.SimpleEntry<>(roadId, itemMap)); |
|
|
|
// 将排序后的条目添加到returnMap中,使用sectionName作为键
|
|
|
|
for (Map.Entry<String, Object> entry : sortedEntries) { |
|
|
|
String Id = entry.getKey(); |
|
|
|
String sectionName = roadIdToSectionNameMap.get(Id); |
|
|
|
returnMap.put(sectionName, entry.getValue()); |
|
|
|
} |
|
|
|
|
|
|
|
returnMap.put(dcRoadSection.getSectionName(), itemMap); |
|
|
|
} |
|
|
|
|
|
|
|
return AjaxResult.success(returnMap); |
|
|
|