From 16029115eda4aec88e5bb647474fda565afbbca9 Mon Sep 17 00:00:00 2001 From: mengff <1198151809@qq.com> Date: Wed, 9 Oct 2024 11:14:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=BE=E5=A4=87=E5=9C=A8?= =?UTF-8?q?=E7=BA=BF=E5=88=86=E6=9E=90=E4=B8=A2=E5=8C=85=E7=8E=87=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/controller/DcDeviceOnlineController.java | 7 +++++++ .../controller/queryParams/OnlineQueryParams.java | 10 ++++++++++ .../main/java/com/zc/business/domain/OnlineSum.java | 5 +++++ 3 files changed, 22 insertions(+) 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{" +