parent
2e93985685
commit
2a8ca2e0b7
|
@ -1,6 +1,7 @@
|
|||
package com.dispose.service.impl;
|
||||
|
||||
import com.dispose.common.DisposeCapacityType;
|
||||
import com.dispose.common.ObjectStatus;
|
||||
import com.dispose.pojo.entity.DisposeCapacity;
|
||||
import com.dispose.pojo.entity.DisposeDevice;
|
||||
import com.dispose.service.AreaCodeManagerService;
|
||||
|
@ -44,7 +45,9 @@ public class AreaCodeManagerServiceImpl implements AreaCodeManagerService {
|
|||
@Override
|
||||
public Map<Integer, List<DisposeDevice>> getAreaCodeGroup() {
|
||||
List<DisposeDevice> disposeDevices = disposeDeviceManagerService.getAllDisposeDevice();
|
||||
return disposeDevices.stream().collect(Collectors.groupingBy(DisposeDevice::getAreaCode));
|
||||
return disposeDevices.stream()
|
||||
.filter(k -> k.getStatus() == ObjectStatus.NORMAL)
|
||||
.collect(Collectors.groupingBy(DisposeDevice::getAreaCode));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,7 +60,7 @@ public class AreaCodeManagerServiceImpl implements AreaCodeManagerService {
|
|||
public int getAreaCodeGroupReserveNetflow(Integer areaCode) {
|
||||
List<DisposeDevice> disposeDevices = disposeDeviceManagerService.getAllDisposeDevice();
|
||||
return disposeDevices.stream()
|
||||
.filter(v -> v.getAreaCode().equals(areaCode))
|
||||
.filter(v -> v.getAreaCode().equals(areaCode) && v.getStatus() == ObjectStatus.NORMAL)
|
||||
.mapToInt(v -> v.getDevCapacity().stream()
|
||||
.filter(k -> k.getCapacityType() == DisposeCapacityType.CLEANUP)
|
||||
.mapToInt(m -> Optional.ofNullable(m.getReserveNetflow()).orElse(0))
|
||||
|
@ -75,7 +78,7 @@ public class AreaCodeManagerServiceImpl implements AreaCodeManagerService {
|
|||
public int getAreaCodeOnlineDeviceNum(Integer areaCode) {
|
||||
List<DisposeDevice> disposeDevices = disposeDeviceManagerService.getAllDisposeDevice();
|
||||
return (int) disposeDevices.stream()
|
||||
.filter(v -> v.getAreaCode().equals(areaCode))
|
||||
.filter(v -> v.getAreaCode().equals(areaCode) && v.getStatus() == ObjectStatus.NORMAL)
|
||||
.filter(k -> disposeAbilityRouterService.getAbilityDevice(k.getId())
|
||||
.getDb()
|
||||
.getDeviceLinkStatus())
|
||||
|
@ -92,8 +95,8 @@ public class AreaCodeManagerServiceImpl implements AreaCodeManagerService {
|
|||
public int getAreaCodeTotalDeviceNum(Integer areaCode) {
|
||||
List<DisposeDevice> disposeDevices = disposeDeviceManagerService.getAllDisposeDevice();
|
||||
return (int) disposeDevices.stream()
|
||||
.filter(v -> v.getAreaCode().equals(areaCode))
|
||||
.count();
|
||||
.filter(v -> v.getAreaCode().equals(areaCode) && v.getStatus() == ObjectStatus.NORMAL)
|
||||
.count();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,7 +109,7 @@ public class AreaCodeManagerServiceImpl implements AreaCodeManagerService {
|
|||
public DisposeCapacityType[] getAreaCodeSupportCapacity(Integer areaCode) {
|
||||
List<DisposeDevice> disposeDevices = disposeDeviceManagerService.getAllDisposeDevice();
|
||||
return disposeDevices.stream()
|
||||
.filter(v -> v.getAreaCode().equals(areaCode))
|
||||
.filter(v -> v.getAreaCode().equals(areaCode) && v.getStatus() == ObjectStatus.NORMAL)
|
||||
.flatMap(k -> k.getDevCapacity().stream()
|
||||
.map(DisposeCapacity::getCapacityType))
|
||||
.distinct()
|
||||
|
|
Loading…
Reference in New Issue