Merge pull request #7300 from ulleo/dev

fix: 区间条形图联动可能NPE
This commit is contained in:
ulleo 2023-12-22 18:28:43 +08:00 committed by GitHub
commit 15d449d30a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1412,8 +1412,14 @@ public class ChartDataBuild {
}
if (isDate) {
map.put("minTime", sdf.format(dates.stream().min(Date::compareTo).orElse(null)));
map.put("maxTime", sdf.format(dates.stream().max(Date::compareTo).orElse(null)));
Date minDate = dates.stream().min(Date::compareTo).orElse(null);
if (minDate != null) {
map.put("minTime", sdf.format(minDate));
}
Date maxDate = dates.stream().max(Date::compareTo).orElse(null);
if (maxDate != null) {
map.put("maxTime", sdf.format(maxDate));
}
} else {
map.put("min", numbers.stream().min(BigDecimal::compareTo).orElse(null));
map.put("max", numbers.stream().max(BigDecimal::compareTo).orElse(null));