diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceOnlineController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceOnlineController.java index 18d17428..38500090 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceOnlineController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceOnlineController.java @@ -77,6 +77,13 @@ public class DcDeviceOnlineController extends BaseController { } List sums = onlineSumService.queryByDeviceTypesOfToday(params); + if (params.getExportType() != null && params.getExportType().equals(UniversalEnum.ONE.getValue())) { + sums = sums.stream() + .filter(OnlineSum::isLossRatePositive) + .sorted(Comparator.comparing(OnlineSum::getLossRate).reversed()) + .collect(Collectors.toList()); + } + Map> sumsMap = sums.stream().collect(Collectors.groupingBy(OnlineSum::getDeviceType)); LinkedHashMap map = new LinkedHashMap<>(); for (String deviceType : params.getType()) { diff --git a/zc-business/src/main/java/com/zc/business/controller/queryParams/OnlineQueryParams.java b/zc-business/src/main/java/com/zc/business/controller/queryParams/OnlineQueryParams.java index 07015556..59df15ea 100644 --- a/zc-business/src/main/java/com/zc/business/controller/queryParams/OnlineQueryParams.java +++ b/zc-business/src/main/java/com/zc/business/controller/queryParams/OnlineQueryParams.java @@ -9,6 +9,16 @@ public class OnlineQueryParams { private String stakeMark; private String deviceState; + public String getExportType() { + return exportType; + } + + public void setExportType(String exportType) { + this.exportType = exportType; + } + + private String exportType; + public String[] getType() { return type; } diff --git a/zc-business/src/main/java/com/zc/business/domain/OnlineSum.java b/zc-business/src/main/java/com/zc/business/domain/OnlineSum.java index d31b0193..6bb01475 100644 --- a/zc-business/src/main/java/com/zc/business/domain/OnlineSum.java +++ b/zc-business/src/main/java/com/zc/business/domain/OnlineSum.java @@ -3,6 +3,7 @@ package com.zc.business.domain; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.Excel; import com.zc.business.enums.NetworkQuality; +import com.zc.business.enums.UniversalEnum; import org.springframework.format.annotation.DateTimeFormat; import java.math.BigDecimal; import java.math.RoundingMode; @@ -238,6 +239,10 @@ public class OnlineSum implements java.io.Serializable { this.totalOfflineCount = totalOfflineCount; } + public static boolean isLossRatePositive(OnlineSum onlineSum) { + return onlineSum.getLossRate() > UniversalEnum.ZERO.getNumber(); + } + @Override public String toString() { return "OnlineSum{" +