diff --git a/src/main/java/com/dispose/service/impl/AreaCodeManagerServiceImpl.java b/src/main/java/com/dispose/service/impl/AreaCodeManagerServiceImpl.java index a43a8b29..c72587d7 100644 --- a/src/main/java/com/dispose/service/impl/AreaCodeManagerServiceImpl.java +++ b/src/main/java/com/dispose/service/impl/AreaCodeManagerServiceImpl.java @@ -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> getAreaCodeGroup() { List 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 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 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 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 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()