|
@@ -363,7 +363,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
if (CollUtil.isEmpty(mercDevices)) {
|
|
if (CollUtil.isEmpty(mercDevices)) {
|
|
return R.ok(mercHomeStatisticalVO);
|
|
return R.ok(mercHomeStatisticalVO);
|
|
}
|
|
}
|
|
- List<Long> deviceIds = mercDevices.stream().map(DeviceInfo::getMercId).collect(Collectors.toList());
|
|
|
|
|
|
+ List<Long> deviceIds = mercDevices.stream().map(DeviceInfo::getDeviceId).collect(Collectors.toList());
|
|
//在线、离线
|
|
//在线、离线
|
|
List<DeviceStatus> deviceStatuses = deviceStatusService.listByIds(deviceIds);
|
|
List<DeviceStatus> deviceStatuses = deviceStatusService.listByIds(deviceIds);
|
|
//分组统计
|
|
//分组统计
|
|
@@ -372,8 +372,10 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
Integer onlineDictValue = SysDictUtils.getValue(DictEnum.DEVICE_ONLINE_STATUS.getKey(), DictSonEnum.DEVICE_ONLINE_STATUS_CONNECTED.getKey(), Integer.class);
|
|
Integer onlineDictValue = SysDictUtils.getValue(DictEnum.DEVICE_ONLINE_STATUS.getKey(), DictSonEnum.DEVICE_ONLINE_STATUS_CONNECTED.getKey(), Integer.class);
|
|
Integer offlineDictValue = SysDictUtils.getValue(DictEnum.DEVICE_ONLINE_STATUS.getKey(), DictSonEnum.DEVICE_ONLINE_STATUS_DISCONNECT.getKey(), Integer.class);
|
|
Integer offlineDictValue = SysDictUtils.getValue(DictEnum.DEVICE_ONLINE_STATUS.getKey(), DictSonEnum.DEVICE_ONLINE_STATUS_DISCONNECT.getKey(), Integer.class);
|
|
|
|
|
|
- mercHomeStatisticalVO.setOnlineNum(countNetstateMap.get(onlineDictValue).intValue());
|
|
|
|
- mercHomeStatisticalVO.setOfflineNum(countNetstateMap.get(offlineDictValue).intValue());
|
|
|
|
|
|
+ int onlineNum = countNetstateMap.get(onlineDictValue) == null ? 0 : countNetstateMap.get(onlineDictValue).intValue();
|
|
|
|
+ int offlineNum = countNetstateMap.get(offlineDictValue) == null ? 0 : countNetstateMap.get(offlineDictValue).intValue();
|
|
|
|
+ mercHomeStatisticalVO.setOnlineNum(onlineNum);
|
|
|
|
+ mercHomeStatisticalVO.setOfflineNum(offlineNum);
|
|
|
|
|
|
|
|
|
|
//运营、停业
|
|
//运营、停业
|
|
@@ -381,8 +383,10 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
.groupingBy(DeviceInfo::getBusyState, Collectors.counting()));
|
|
.groupingBy(DeviceInfo::getBusyState, Collectors.counting()));
|
|
Integer busyState1 = SysDictUtils.getValue(DictEnum.DEVICE_BUSY_STATUS.getKey(), DictSonEnum.DEVICE_BUSY_STATUS1.getKey(), Integer.class);
|
|
Integer busyState1 = SysDictUtils.getValue(DictEnum.DEVICE_BUSY_STATUS.getKey(), DictSonEnum.DEVICE_BUSY_STATUS1.getKey(), Integer.class);
|
|
Integer busyState2 = SysDictUtils.getValue(DictEnum.DEVICE_BUSY_STATUS.getKey(), DictSonEnum.DEVICE_BUSY_STATUS2.getKey(), Integer.class);
|
|
Integer busyState2 = SysDictUtils.getValue(DictEnum.DEVICE_BUSY_STATUS.getKey(), DictSonEnum.DEVICE_BUSY_STATUS2.getKey(), Integer.class);
|
|
- mercHomeStatisticalVO.setOperatingNum(countBusyStateMap.get(busyState1).intValue());
|
|
|
|
- mercHomeStatisticalVO.setClosedNum(countBusyStateMap.get(busyState2).intValue());
|
|
|
|
|
|
+ int operatingNum = countBusyStateMap.get(busyState1) == null ? 0 : countBusyStateMap.get(busyState1).intValue();
|
|
|
|
+ int closedNum = countBusyStateMap.get(busyState2) == null ? 0 : countBusyStateMap.get(busyState2).intValue();
|
|
|
|
+ mercHomeStatisticalVO.setOperatingNum(operatingNum);
|
|
|
|
+ mercHomeStatisticalVO.setClosedNum(closedNum);
|
|
|
|
|
|
//待补货
|
|
//待补货
|
|
//TODO: 此逻辑需要确认
|
|
//TODO: 此逻辑需要确认
|