Browse Source

修复不重复计数导致的BUG

chenw 6 years ago
parent
commit
93f31d7b98

+ 4 - 0
bi-server/src/main/java/com/usoftchina/bi/server/service/chart/ShowHistogramService.java

@@ -119,6 +119,10 @@ public class ShowHistogramService {
                     + ("scale".equals(xColumnType) ? "nvl(" + xColumn + ",0)" : "nvl(" + xColumn + ",'空')")
                     + " as name ";
             String condition = screenToColumnS + " GROUP BY " + xColumn;
+            if (yAxisType.contains("distinct")) {
+                fieldName = fieldName.replace("distinct", "");
+                condition += "," + yColumn;
+            }
             if (CollectionUtils.isEmpty(groupBy)) {
                 List<HistogramData> histogramList = showChartsMapper.getHistogramValueWithoutGroup(fieldName, tableName, condition, sort, rule);
                 if (histogramList.size() > histogramConfigInfo.getMaxCount()) {

+ 7 - 0
bi-server/src/main/java/com/usoftchina/bi/server/service/chart/ShowLineService.java

@@ -92,6 +92,10 @@ public class ShowLineService {
             xColumn = TimeConverterUtil.convertToOracleDateStr(xColumn, xAxisType);         //X轴 -> 折线图X轴只能为日期类型
             String fieldName = yAxisType + "(nvl(" + yColumn + ",0)) as value,nvl(" + xColumn + ",'空') as name ";
             String condition = screenToColumnS + " GROUP BY " + xColumn;
+            if (yAxisType.contains("distinct")) {
+                fieldName = fieldName.replace("distinct", "");
+                condition += "," + yColumn;
+            }
             String sort = xColumn, rule = "ASC";
             if (CollectionUtils.isEmpty(groupBy)) {
                 /*List<LineSeriesMap> lineSeriesMapList = showChartsMapper.getLineValueWithoutGroup(fieldName, tableName, condition, sort, rule);
@@ -119,6 +123,9 @@ public class ShowLineService {
                 fieldName = fieldName + ", nvl(" + groupBy.get(0) + ",'空') as groupName ";
                 condition = screenToColumnS;
                 String groupCondition = xColumn + "," + groupBy.get(0);
+                if (yAxisType.contains("distinct")) {
+                    groupCondition += "," + yColumn;
+                }
                 /*List<LineSeriesGroupMap> lineSeriesGroupMapList = showChartsMapper.getLineValueWithGroup(fieldName, tableName, condition, groupCondition,sort, rule);
                 Map<String, List<LineSeriesGroupMap>> lineSeriesGroupMap = CollectionUtils.groupBy(lineSeriesGroupMapList, LineSeriesGroupMap::getGroupName);
                 Iterator<Map.Entry<String, List<LineSeriesGroupMap>>> it = lineSeriesGroupMap.entrySet().iterator();

+ 4 - 0
bi-server/src/main/java/com/usoftchina/bi/server/service/chart/ShowPieService.java

@@ -102,6 +102,10 @@ public class ShowPieService {
                     + ("scale".equals(xColumnType) ? "nvl(" + xColumn + ",0)" : "nvl(" + xColumn + ",'空')")
                     + " as name ";
             String condition = screenToColumnS + " GROUP BY " + xColumn;
+            if (yAxisType.contains("distinct")) {
+                fieldName = fieldName.replace("distinct", "");
+                condition += "," + yColumn;
+            }
             value = showChartsMapper.getPieValueWithoutGroup(fieldName, tableName, condition);
             xAxisData = value.stream().sorted(Comparator.comparing(PieSeriesMap::getValue)).map(PieSeriesMap::getName).collect(Collectors.toList());
             if (CollectionUtils.isEmpty(xAxisData)) {

+ 4 - 0
bi-server/src/main/java/com/usoftchina/bi/server/service/chart/ShowScatterService.java

@@ -103,6 +103,10 @@ public class ShowScatterService {
                     + ("scale".equals(xColumnType) ? "nvl(" + xColumn + ",0)" : "nvl(" + xColumn + ",'空')")
                     + " as \"date\" ";
             String condition = screenToColumnS + " GROUP BY " + xColumn;
+            if (yAxisType.contains("distinct")) {
+                fieldName = fieldName.replace("distinct", "");
+                condition += "," + yColumn;
+            }
             String sort = xColumn, rule = "ASC";
             if (CollectionUtils.isEmpty(groupBy)) {
                 List<LineSeriesMap> lineSeriesMapList = showChartsMapper.getLineValueWithoutGroup(fieldName, tableName, condition, sort, rule);