Browse Source

增加设备在线分析丢包率导出功能

develop
mengff 2 months ago
parent
commit
16029115ed
  1. 7
      zc-business/src/main/java/com/zc/business/controller/DcDeviceOnlineController.java
  2. 10
      zc-business/src/main/java/com/zc/business/controller/queryParams/OnlineQueryParams.java
  3. 5
      zc-business/src/main/java/com/zc/business/domain/OnlineSum.java

7
zc-business/src/main/java/com/zc/business/controller/DcDeviceOnlineController.java

@ -77,6 +77,13 @@ public class DcDeviceOnlineController extends BaseController {
}
List<OnlineSum> 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<String, List<OnlineSum>> sumsMap = sums.stream().collect(Collectors.groupingBy(OnlineSum::getDeviceType));
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
for (String deviceType : params.getType()) {

10
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;
}

5
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{" +

Loading…
Cancel
Save