|
|
@ -1,6 +1,6 @@ |
|
|
package com.dongjian.dashboard.back.service.common; |
|
|
package com.dongjian.dashboard.back.service.common; |
|
|
|
|
|
|
|
|
import com.dongjian.dashboard.back.vo.device.AccumulateLineData; |
|
|
import com.dongjian.dashboard.back.vo.device.SubLineData; |
|
|
import com.dongjian.dashboard.back.vo.device.LineData; |
|
|
import com.dongjian.dashboard.back.vo.device.LineData; |
|
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
import java.time.LocalDate; |
|
|
@ -219,14 +219,14 @@ public class LineDataAggregator { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* =============================== |
|
|
/* =============================== |
|
|
* AccumulateLineData -> LineData |
|
|
* SubLineData -> LineData |
|
|
* 半小时取最后一条 |
|
|
* 半小时取最后一条 |
|
|
* =============================== */ |
|
|
* =============================== */ |
|
|
public static void convertToLineDataHour(AccumulateLineData accumulate, LineData lineData) { |
|
|
public static void convertToLineDataHour(SubLineData accumulate, LineData lineData) { |
|
|
if (accumulate == null || accumulate.getSubData() == null) return; |
|
|
if (accumulate == null || accumulate.getSubData() == null) return; |
|
|
|
|
|
|
|
|
Map<String, HalfHourSeries> seriesMap = new LinkedHashMap<>(); |
|
|
Map<String, HalfHourSeries> seriesMap = new LinkedHashMap<>(); |
|
|
for (Map.Entry<String, AccumulateLineData.childLineData> entry : accumulate.getSubData().entrySet()) { |
|
|
for (Map.Entry<String, SubLineData.childLineData> entry : accumulate.getSubData().entrySet()) { |
|
|
seriesMap.put(entry.getKey(), aggregateLastByHalfHour(entry.getValue())); |
|
|
seriesMap.put(entry.getKey(), aggregateLastByHalfHour(entry.getValue())); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -250,7 +250,7 @@ public class LineDataAggregator { |
|
|
fillTo48HalfHour(lineData); |
|
|
fillTo48HalfHour(lineData); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private static HalfHourSeries aggregateLastByHalfHour(AccumulateLineData.childLineData child) { |
|
|
private static HalfHourSeries aggregateLastByHalfHour(SubLineData.childLineData child) { |
|
|
if (child == null || child.getXData() == null || child.getYData() == null) |
|
|
if (child == null || child.getXData() == null || child.getYData() == null) |
|
|
return new HalfHourSeries(null); |
|
|
return new HalfHourSeries(null); |
|
|
|
|
|
|
|
|
@ -307,19 +307,19 @@ public class LineDataAggregator { |
|
|
/* =============================== |
|
|
/* =============================== |
|
|
* 全量对齐 |
|
|
* 全量对齐 |
|
|
* =============================== */ |
|
|
* =============================== */ |
|
|
public static void convertToLineDataAll(AccumulateLineData accumulate, LineData lineData) { |
|
|
public static void convertToLineDataAll(SubLineData accumulate, LineData lineData) { |
|
|
if (accumulate == null || accumulate.getSubData() == null) return; |
|
|
if (accumulate == null || accumulate.getSubData() == null) return; |
|
|
|
|
|
|
|
|
LinkedHashSet<String> xSet = new LinkedHashSet<>(); |
|
|
LinkedHashSet<String> xSet = new LinkedHashSet<>(); |
|
|
for (AccumulateLineData.childLineData child : accumulate.getSubData().values()) { |
|
|
for (SubLineData.childLineData child : accumulate.getSubData().values()) { |
|
|
if (child.getXData() != null) xSet.addAll(child.getXData()); |
|
|
if (child.getXData() != null) xSet.addAll(child.getXData()); |
|
|
} |
|
|
} |
|
|
List<String> mergedX = new ArrayList<>(xSet); |
|
|
List<String> mergedX = new ArrayList<>(xSet); |
|
|
|
|
|
|
|
|
Map<String, Map<String, Object>> tmpMap = new LinkedHashMap<>(); |
|
|
Map<String, Map<String, Object>> tmpMap = new LinkedHashMap<>(); |
|
|
for (Map.Entry<String, AccumulateLineData.childLineData> entry : accumulate.getSubData().entrySet()) { |
|
|
for (Map.Entry<String, SubLineData.childLineData> entry : accumulate.getSubData().entrySet()) { |
|
|
Map<String, Object> map = new LinkedHashMap<>(); |
|
|
Map<String, Object> map = new LinkedHashMap<>(); |
|
|
AccumulateLineData.childLineData child = entry.getValue(); |
|
|
SubLineData.childLineData child = entry.getValue(); |
|
|
if (child.getXData() != null && child.getYData() != null) { |
|
|
if (child.getXData() != null && child.getYData() != null) { |
|
|
int size = Math.min(child.getXData().size(), child.getYData().size()); |
|
|
int size = Math.min(child.getXData().size(), child.getYData().size()); |
|
|
for (int i = 0; i < size; i++) map.put(child.getXData().get(i), child.getYData().get(i)); |
|
|
for (int i = 0; i < size; i++) map.put(child.getXData().get(i), child.getYData().get(i)); |
|
|
|