diff --git a/src/main/java/com/dispose/controller/DisposeInfoController.java b/src/main/java/com/dispose/controller/DisposeInfoController.java index 8d5c8268..8048107f 100644 --- a/src/main/java/com/dispose/controller/DisposeInfoController.java +++ b/src/main/java/com/dispose/controller/DisposeInfoController.java @@ -99,6 +99,7 @@ public class DisposeInfoController { .nodeId(areaCode.toString()) .totalNetflow(areaCodeManagerService.getAreaCodeGroupReserveNetflow(areaCode)) .onlineDevices(areaCodeManagerService.getAreaCodeOnlineDeviceNum(areaCode)) + .totalDevices(areaCodeManagerService.getAreaCodeTotalDeviceNum(areaCode)) .capacityType(Arrays.stream(areaCodeManagerService.getAreaCodeSupportCapacity(areaCode)) .map(DisposeCapacityType::getValue) .toArray(Integer[]::new)) diff --git a/src/main/java/com/dispose/pojo/dto/protocol/device/info/AreaInfoDetail.java b/src/main/java/com/dispose/pojo/dto/protocol/device/info/AreaInfoDetail.java index 4d20a3cf..f4d2d4ef 100644 --- a/src/main/java/com/dispose/pojo/dto/protocol/device/info/AreaInfoDetail.java +++ b/src/main/java/com/dispose/pojo/dto/protocol/device/info/AreaInfoDetail.java @@ -35,4 +35,8 @@ public class AreaInfoDetail { * The Online devices. */ private Integer onlineDevices; + /** + * The Total devices. + */ + private Integer totalDevices; } diff --git a/src/main/java/com/dispose/service/AreaCodeManagerService.java b/src/main/java/com/dispose/service/AreaCodeManagerService.java index fab7343c..22badfc5 100644 --- a/src/main/java/com/dispose/service/AreaCodeManagerService.java +++ b/src/main/java/com/dispose/service/AreaCodeManagerService.java @@ -35,6 +35,14 @@ public interface AreaCodeManagerService { */ int getAreaCodeOnlineDeviceNum(Integer areaCode); + /** + * Gets area code total device num. + * + * @param areaCode the area code + * @return the area code total device num + */ + int getAreaCodeTotalDeviceNum(Integer areaCode); + /** * Gets area code support capacity. * diff --git a/src/main/java/com/dispose/service/impl/AreaCodeManagerServiceImpl.java b/src/main/java/com/dispose/service/impl/AreaCodeManagerServiceImpl.java index bd0e3348..a43a8b29 100644 --- a/src/main/java/com/dispose/service/impl/AreaCodeManagerServiceImpl.java +++ b/src/main/java/com/dispose/service/impl/AreaCodeManagerServiceImpl.java @@ -82,6 +82,20 @@ public class AreaCodeManagerServiceImpl implements AreaCodeManagerService { .count(); } + /** + * Gets area code total device num. + * + * @param areaCode the area code + * @return the area code total device num + */ + @Override + public int getAreaCodeTotalDeviceNum(Integer areaCode) { + List disposeDevices = disposeDeviceManagerService.getAllDisposeDevice(); + return (int) disposeDevices.stream() + .filter(v -> v.getAreaCode().equals(areaCode)) + .count(); + } + /** * Get area code support capacity dispose capacity type [ ]. *