趋势图bug
This commit is contained in:
@@ -216,23 +216,53 @@ public class HistoryResultServiceImpl implements HistoryResultService {
|
||||
.map(temp -> BigDecimal.valueOf(temp.getAValue()).setScale(4, RoundingMode.HALF_UP).floatValue())
|
||||
.collect(Collectors.toList());
|
||||
//组装二维数组
|
||||
|
||||
boolean flagA = true,flagB = true,flagC =true;
|
||||
if(CollectionUtil.isEmpty(aValue)){
|
||||
flagA = false;
|
||||
}
|
||||
if(CollectionUtil.isEmpty(bValue)){
|
||||
flagB = false;
|
||||
}
|
||||
if(CollectionUtil.isEmpty(cValue)){
|
||||
flagC = false;
|
||||
}
|
||||
for (int i = 0; i < time.size(); i++) {
|
||||
List<Object> objects = new ArrayList<>();
|
||||
//指定
|
||||
objects.add(time.get(i));
|
||||
if(flagA){
|
||||
objects.add(aValue.get(i));
|
||||
}
|
||||
if(flagB) {
|
||||
objects.add(bValue.get(i));
|
||||
}
|
||||
if(flagC) {
|
||||
objects.add(cValue.get(i));
|
||||
}
|
||||
objectListData.add(objects);
|
||||
}
|
||||
Float aValueMin = Collections.min(aValue);
|
||||
Float bValueMin = Collections.min(bValue);
|
||||
Float cValueMin = Collections.min(cValue);
|
||||
Float aValueMax = Collections.max(aValue);
|
||||
Float bValueMax = Collections.max(bValue);
|
||||
Float cValueMax = Collections.max(cValue);
|
||||
historyDataResultVO.setMinValue((aValueMin < bValueMin) ? ((aValueMin < cValueMin) ? aValueMin : cValueMin) : ((bValueMin < cValueMin) ? bValueMin : cValueMin));
|
||||
historyDataResultVO.setMaxValue(aValueMax > bValueMax ? (aValueMax > cValueMax ? aValueMax : bValueMax) : (bValueMax > cValueMax ? bValueMax : cValueMax));
|
||||
Float aValueMin = CollectionUtil.isEmpty(aValue) ? null : Collections.min(aValue);
|
||||
Float bValueMin = CollectionUtil.isEmpty(bValue) ? null : Collections.min(bValue);
|
||||
Float cValueMin = CollectionUtil.isEmpty(cValue) ? null : Collections.min(cValue);
|
||||
Float aValueMax = CollectionUtil.isEmpty(aValue) ? null : Collections.max(aValue);
|
||||
Float bValueMax = CollectionUtil.isEmpty(bValue) ? null : Collections.max(bValue);
|
||||
Float cValueMax = CollectionUtil.isEmpty(cValue) ? null : Collections.max(cValue);
|
||||
List<Float> list = Arrays.asList(aValueMin, bValueMin, cValueMin, aValueMax, bValueMax, cValueMax);
|
||||
Optional<Float> min = list.stream()
|
||||
.filter(Objects::nonNull) // 过滤掉null值
|
||||
.min(Float::compareTo);
|
||||
if (min.isPresent()) {
|
||||
historyDataResultVO.setMinValue(min.get());
|
||||
}
|
||||
|
||||
Optional<Float> max = list.stream()
|
||||
.filter(Objects::nonNull) // 过滤掉null值
|
||||
.max(Float::compareTo);
|
||||
if (min.isPresent()) {
|
||||
historyDataResultVO.setMaxValue(max.get());
|
||||
}
|
||||
|
||||
historyDataResultVO.setTopLimit(queryResultLimitVO.getTopLimit());
|
||||
historyDataResultVO.setLowerLimit(queryResultLimitVO.getLowerLimit());
|
||||
historyDataResultVO.setValue(objectListData);
|
||||
|
||||
Reference in New Issue
Block a user