|
@@ -7,7 +7,6 @@ import com.usoftchina.bi.core.utils.CollectionUtils;
|
|
|
import com.usoftchina.bi.core.utils.EncryUtil;
|
|
import com.usoftchina.bi.core.utils.EncryUtil;
|
|
|
import com.usoftchina.bi.server.dao.chart.ChartsConfigMapper;
|
|
import com.usoftchina.bi.server.dao.chart.ChartsConfigMapper;
|
|
|
import com.usoftchina.bi.server.dao.chart.ShowChartsMapper;
|
|
import com.usoftchina.bi.server.dao.chart.ShowChartsMapper;
|
|
|
-import com.usoftchina.bi.server.dao.dashboard.DashboardsMapper;
|
|
|
|
|
import com.usoftchina.bi.server.dao.dataSource.DataConnectorMapper;
|
|
import com.usoftchina.bi.server.dao.dataSource.DataConnectorMapper;
|
|
|
import com.usoftchina.bi.server.model.bo.*;
|
|
import com.usoftchina.bi.server.model.bo.*;
|
|
|
import com.usoftchina.bi.server.model.po.User;
|
|
import com.usoftchina.bi.server.model.po.User;
|
|
@@ -142,11 +141,19 @@ public class ShowPieService {
|
|
|
}
|
|
}
|
|
|
if (CollectionUtils.isEmpty(groupBy)) {
|
|
if (CollectionUtils.isEmpty(groupBy)) {
|
|
|
value = showChartsMapper.getPieValueWithoutOutGroup(fieldName, tableName, condition, sort, rule);
|
|
value = showChartsMapper.getPieValueWithoutOutGroup(fieldName, tableName, condition, sort, rule);
|
|
|
- if (value.size() > pieConfigInfo.getMaxCount()) {
|
|
|
|
|
|
|
+ xAxisData = value.stream().map(PieSeriesMap::getName).collect(Collectors.toList());
|
|
|
|
|
+ Optional<Double> total = value.stream().map(PieSeriesMap::getValue).reduce(Double::sum);
|
|
|
|
|
+ if (xAxisData.size() > pieConfigInfo.getMaxCount()) {
|
|
|
|
|
+ xAxisData = new ArrayList<>(xAxisData.subList(0, pieConfigInfo.getMaxCount()));
|
|
|
|
|
+ xAxisData.add("其它");
|
|
|
|
|
+ //有其他的时候 tooMany 为 true
|
|
|
chartsDataInfo.setTooMany(true);
|
|
chartsDataInfo.setTooMany(true);
|
|
|
- value = value.subList(0, pieConfigInfo.getMaxCount());
|
|
|
|
|
|
|
+ value = new ArrayList<>(value.stream().collect(Collectors.toList()).subList(0, pieConfigInfo.getMaxCount()));
|
|
|
|
|
+ Optional<Double> part = value.stream().map(PieSeriesMap::getValue).reduce(Double::sum);
|
|
|
|
|
+ if (total.isPresent() && part.isPresent()) {
|
|
|
|
|
+ value.add(new PieSeriesMap(total.get() - part.get(), "其它"));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- xAxisData = value.stream().map(PieSeriesMap::getName).collect(Collectors.toList());
|
|
|
|
|
chartsDataInfo.setxAxis(xAxisData);
|
|
chartsDataInfo.setxAxis(xAxisData);
|
|
|
series.setName(pieConfigInfo.getSeries().getColumnName());
|
|
series.setName(pieConfigInfo.getSeries().getColumnName());
|
|
|
series.setValue(value);
|
|
series.setValue(value);
|
|
@@ -171,7 +178,7 @@ public class ShowPieService {
|
|
|
xAxisData.add("其它");
|
|
xAxisData.add("其它");
|
|
|
//有其他的时候 tooMany 为 true
|
|
//有其他的时候 tooMany 为 true
|
|
|
chartsDataInfo.setTooMany(true);
|
|
chartsDataInfo.setTooMany(true);
|
|
|
- value = new ArrayList<>(value.stream().sorted((p1, p2) -> p2.getValue().compareTo(p1.getValue())).collect(Collectors.toList()).subList(0, pieConfigInfo.getMaxCount()));
|
|
|
|
|
|
|
+ value = new ArrayList<>(value.stream().collect(Collectors.toList()).subList(0, pieConfigInfo.getMaxCount()));
|
|
|
Optional<Double> part = value.stream().map(PieSeriesMap::getValue).reduce(Double::sum);
|
|
Optional<Double> part = value.stream().map(PieSeriesMap::getValue).reduce(Double::sum);
|
|
|
if (total.isPresent() && part.isPresent()) {
|
|
if (total.isPresent() && part.isPresent()) {
|
|
|
value.add(new PieSeriesMap(total.get() - part.get(), "其它"));
|
|
value.add(new PieSeriesMap(total.get() - part.get(), "其它"));
|