fix (farm): 微信端设备统计接口
-
This commit is contained in:
@@ -20,8 +20,8 @@ public class DeviceStatisticsInfoRespVO {
|
|||||||
@Schema(description = "设备总数")
|
@Schema(description = "设备总数")
|
||||||
private int totalNum;
|
private int totalNum;
|
||||||
@Schema(description = "在线设备数")
|
@Schema(description = "在线设备数")
|
||||||
private int onlineNum;
|
private long onlineNum;
|
||||||
@Schema(description = "离线设备数")
|
@Schema(description = "离线设备数")
|
||||||
private int offlineNum;
|
private long offlineNum;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -395,15 +395,13 @@ public class DeviceInfoServiceImpl implements DeviceInfoService {
|
|||||||
|
|
||||||
List<DeviceInfoDO> list = entry.getValue();
|
List<DeviceInfoDO> list = entry.getValue();
|
||||||
|
|
||||||
int onlineCount = list.stream()
|
long onlineCount = list.stream()
|
||||||
.filter(device -> device.getDeviceState() == 1)
|
.filter(device -> device.getDeviceState() == 1)
|
||||||
.mapToInt(DeviceInfoDO::getDeviceState)
|
.collect(Collectors.counting());
|
||||||
.sum();
|
|
||||||
|
|
||||||
int offlineCount = list.stream()
|
long offlineCount = list.stream()
|
||||||
.filter(device -> device.getDeviceState() != 1)
|
.filter(device -> device.getDeviceState() != 1)
|
||||||
.mapToInt(DeviceInfoDO::getDeviceState)
|
.collect(Collectors.counting());
|
||||||
.sum();
|
|
||||||
|
|
||||||
res.add(new DeviceStatisticsInfoRespVO(keyName,list.size(),onlineCount,offlineCount));
|
res.add(new DeviceStatisticsInfoRespVO(keyName,list.size(),onlineCount,offlineCount));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user