|
@@ -83,52 +83,6 @@ public class YtDeviceStatusServiceImpl extends AbstractCrudService<YtDeviceStatu
|
|
|
.eq("company_code",companyCode)
|
|
|
.groupBy("device_type");
|
|
|
List<Map<String, Object>> deviceStatusList = this.listMaps(queryWrapper);
|
|
|
- // 查询各类型设备的总数以及在线、离线设备数量
|
|
|
-// List<Map<String, Object>> statusCounts = ytDeviceStatusMapper.deviceList(companyCode);
|
|
|
-// Map<String, Map<String, Integer>> statusMap = new HashMap<>();
|
|
|
-// for (Map<String, Object> statusCount : statusCounts) {
|
|
|
-// String deviceType = (String) statusCount.get("deviceType");
|
|
|
-// Integer onlineCount = ((Number) statusCount.get("onlineCount")).intValue();
|
|
|
-// Integer offlineCount = ((Number) statusCount.get("offlineCount")).intValue();
|
|
|
-// statusMap.computeIfAbsent(deviceType, k -> new HashMap<>())
|
|
|
-// .put("onlineCount", onlineCount);
|
|
|
-// statusMap.computeIfAbsent(deviceType, k -> new HashMap<>())
|
|
|
-// .put("offlineCount", offlineCount);
|
|
|
-// int totalCount = ((Number) statusCount.get("deviceTypeCounts")).intValue();
|
|
|
-// statusMap.computeIfAbsent(deviceType, k -> new HashMap<>()).put("deviceTypeCounts", totalCount);
|
|
|
-// }
|
|
|
-// // 统计设备总数和在线、离线设备数
|
|
|
-// Map<String, Integer> deviceTypeCounts = new HashMap<>();
|
|
|
-// Map<String, Integer> onlineDeviceCount = new HashMap<>();
|
|
|
-// Map<String, Integer> offlineDeviceCount = new HashMap<>();
|
|
|
-//
|
|
|
-// // 设置设备状态并统计设备数量
|
|
|
-// List<Map<String, Object>> deviceList = ytDeviceStatusMapper.deviceList(companyCode);
|
|
|
-// for (Map<String, Object> device : deviceList) {
|
|
|
-// String deviceType = (String) device.get("deviceType");
|
|
|
-// deviceTypeCounts.merge(deviceType, (Integer) statusMap.getOrDefault(deviceType, Collections.emptyMap()).getOrDefault("deviceTypeCounts", 0), Integer::sum);
|
|
|
-//
|
|
|
-// Integer onlineCount = statusMap.getOrDefault(deviceType, Collections.emptyMap())
|
|
|
-// .getOrDefault("onlineCount", 0);
|
|
|
-// Integer offlineCount = statusMap.getOrDefault(deviceType, Collections.emptyMap())
|
|
|
-// .getOrDefault("offlineCount", 0);
|
|
|
-// Integer currentOnlineCount = onlineDeviceCount.getOrDefault(deviceType, 0);
|
|
|
-// Integer currentOfflineCount = offlineDeviceCount.getOrDefault(deviceType, 0);
|
|
|
-// onlineDeviceCount.put(deviceType, currentOnlineCount + onlineCount);
|
|
|
-// offlineDeviceCount.put(deviceType, currentOfflineCount + offlineCount);
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 添加设备类型、设备总数和在线、离线设备数到结果列表
|
|
|
-// List<Map<String, Object>> deviceStatusList = new ArrayList<>();
|
|
|
-// for (String deviceType : deviceTypeCounts.keySet()) {
|
|
|
-// Map<String, Object> deviceInfo = new HashMap<>();
|
|
|
-// deviceInfo.put("deviceType", deviceType);
|
|
|
-// deviceInfo.put("deviceTypeCounts", deviceTypeCounts.getOrDefault(deviceType, 0));
|
|
|
-// deviceInfo.put("onlineDeviceCount", onlineDeviceCount.getOrDefault(deviceType, 0));
|
|
|
-// deviceInfo.put("offlineDeviceCount", offlineDeviceCount.getOrDefault(deviceType, 0));
|
|
|
-// deviceStatusList.add(deviceInfo);
|
|
|
-// }
|
|
|
-
|
|
|
return deviceStatusList;
|
|
|
}
|
|
|
|