mirror of
https://github.com/dataease/dataease.git
synced 2026-05-15 21:42:32 +08:00
fix(图表): 修复分布图指标引用字段含空值-更新图表-数据异常的问题
This commit is contained in:
committed by
jianneng-fit2cloud
parent
0a25fa90ab
commit
2108b32a42
@@ -7,6 +7,7 @@ import org.springframework.stereotype.Component;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@@ -51,6 +52,7 @@ public class PieHandler extends YoyChartHandler {
|
||||
.stream()
|
||||
.filter(item -> {
|
||||
if (clazz == AxisChartDataAntVDTO.class) {
|
||||
if (Objects.isNull(((AxisChartDataAntVDTO) item).getValue())) return false;
|
||||
return ((AxisChartDataAntVDTO) item).getValue().compareTo(BigDecimal.ZERO) >= 0;
|
||||
} else if (clazz == Map.class) {
|
||||
return isPositive(((Map<String, Object>) item).get("value"));
|
||||
@@ -87,6 +89,7 @@ public class PieHandler extends YoyChartHandler {
|
||||
}
|
||||
|
||||
private boolean isPositive(Object value) {
|
||||
if (Objects.isNull(value)) return false;
|
||||
if (value instanceof String) {
|
||||
try {
|
||||
return new BigDecimal((String) value).compareTo(BigDecimal.ZERO) >= 0;
|
||||
|
||||
Reference in New Issue
Block a user