diff --git a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index 25190fb6c8..d5d2bb2e6b 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -787,7 +787,7 @@ public class ChartViewService { data = datasourceProvider.getData(datasourceRequest); Map mapChart = pluginViewResult(pluginViewParam, view, data, isDrill); - Map mapTableNormal = ChartDataBuild.transTableNormal(xAxis, yAxis, view, data, extStack, desensitizationList); + Map mapTableNormal = ChartDataBuild.transTableNormal(fieldMap, view, data, desensitizationList); return uniteViewResult(datasourceRequest.getQuery(), mapChart, mapTableNormal, view, isDrill, drillFilters); // 如果是插件到此结束 diff --git a/backend/src/main/java/io/dataease/service/chart/util/ChartDataBuild.java b/backend/src/main/java/io/dataease/service/chart/util/ChartDataBuild.java index 6fa1d9a3f0..4daf0ce137 100644 --- a/backend/src/main/java/io/dataease/service/chart/util/ChartDataBuild.java +++ b/backend/src/main/java/io/dataease/service/chart/util/ChartDataBuild.java @@ -859,9 +859,7 @@ public class ChartDataBuild { // 表格 public static Map transTableNormal(List xAxis, List yAxis, ChartViewWithBLOBs view, List data, List extStack, List desensitizationList) { - Map map = new TreeMap<>(); List fields = new ArrayList<>(); - List> tableRow = new ArrayList<>(); if (ObjectUtils.isNotEmpty(xAxis)) { fields.addAll(xAxis); } @@ -871,6 +869,18 @@ public class ChartDataBuild { } } fields.addAll(yAxis); + return transTableNormal(fields, view, data, desensitizationList); + } + + // 表格 + public static Map transTableNormal(Map> fieldMap, ChartViewWithBLOBs view, List data, List desensitizationList) { + List fields = fieldMap.entrySet().stream().map(Map.Entry::getValue).flatMap(List::stream).collect(Collectors.toList()); + return transTableNormal(fields, view, data, desensitizationList); + } + + private static Map transTableNormal(List fields, ChartViewWithBLOBs view, List data, List desensitizationList) { + Map map = new TreeMap<>(); + List> tableRow = new ArrayList<>(); data.forEach(ele -> { Map d = new HashMap<>(); for (int i = 0; i < fields.size(); i++) { @@ -880,7 +890,7 @@ public class ChartDataBuild { } ChartViewFieldDTO chartViewFieldDTO = fields.get(i); - if (chartViewFieldDTO.getDeType() == 0 || chartViewFieldDTO.getDeType() == 1) { + if (chartViewFieldDTO.getDeType() == 0 || chartViewFieldDTO.getDeType() == 1 || chartViewFieldDTO.getDeType() == 5) { d.put(fields.get(i).getDataeaseName(), StringUtils.isEmpty(ele[i]) ? "" : ele[i]); } else if (chartViewFieldDTO.getDeType() == 2 || chartViewFieldDTO.getDeType() == 3) { d.put(fields.get(i).getDataeaseName(), StringUtils.isEmpty(ele[i]) ? null : new BigDecimal(ele[i]).setScale(2, RoundingMode.HALF_UP));