From 2a8ca2e0b72ef3ed7a5ead3a071d43514b9b04f3 Mon Sep 17 00:00:00 2001 From: HuangXin Date: Thu, 24 Sep 2020 09:57:19 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E5=8C=BA=E5=9F=9F=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E7=BB=9F=E8=AE=A1=E6=8E=92=E9=99=A4=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E7=9A=84=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/AreaCodeManagerServiceImpl.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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()