|
@@ -412,17 +412,20 @@ public class IotStaticController {
|
|
@Resource
|
|
@Resource
|
|
private DictDataService dictDataService;
|
|
private DictDataService dictDataService;
|
|
@GetMapping("/home/device/status")
|
|
@GetMapping("/home/device/status")
|
|
- public CommonResult<Map<String, Long>> getDeviceStatusStat() {
|
|
|
|
|
|
+ public CommonResult<List<Map<String, Object>>> getDeviceStatusStat() {
|
|
List<IotDeviceDO> iotDeviceDOS = iotDeviceMapper.selectList();
|
|
List<IotDeviceDO> iotDeviceDOS = iotDeviceMapper.selectList();
|
|
Map<String, Long> order = iotDeviceDOS.stream().collect(Collectors.groupingBy(IotDeviceDO::getDeviceStatus, Collectors.counting()));
|
|
Map<String, Long> order = iotDeviceDOS.stream().collect(Collectors.groupingBy(IotDeviceDO::getDeviceStatus, Collectors.counting()));
|
|
- Map<String, Long> resultMap = new HashMap<>(order.size());
|
|
|
|
|
|
+ List<Map<String, Object>> results = new ArrayList<>();
|
|
List<DictDataDO> pmsDeviceStatus = dictDataService.getDictDataListByDictType("pms_device_status");
|
|
List<DictDataDO> pmsDeviceStatus = dictDataService.getDictDataListByDictType("pms_device_status");
|
|
order.forEach((k,v)->{
|
|
order.forEach((k,v)->{
|
|
pmsDeviceStatus.stream().filter(e -> e.getValue().equals(k)).findFirst().ifPresent(e -> {
|
|
pmsDeviceStatus.stream().filter(e -> e.getValue().equals(k)).findFirst().ifPresent(e -> {
|
|
- resultMap.put(e.getLabel(), v);
|
|
|
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
+ resultMap.put("name", e.getLabel());
|
|
|
|
+ resultMap.put("value", v);
|
|
|
|
+ results.add(resultMap);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
- return CommonResult.success(resultMap);
|
|
|
|
|
|
+ return CommonResult.success(results);
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/home/device/type")
|
|
@GetMapping("/home/device/type")
|