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