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 4bdbcafa00..80310e0ac4 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -545,9 +545,14 @@ public class ChartViewService { }.getType(); List viewFields = gson.fromJson(view.getViewFields(), tokenType); - Map> extFieldsMap = null; + final Map> extFieldsMap = new LinkedHashMap<>(); if (CollectionUtils.isNotEmpty(viewFields)) { - extFieldsMap = viewFields.stream().collect(Collectors.groupingBy(ChartViewFieldDTO::getBusiType)); + viewFields.forEach(field -> { + String busiType = field.getBusiType(); + List list = extFieldsMap.containsKey(busiType) ? extFieldsMap.get(busiType) : new ArrayList<>(); + list.add(field); + extFieldsMap.put(field.getBusiType(), list); + }); } @@ -775,12 +780,12 @@ public class ChartViewService { // 如果是插件视图 走插件内部的逻辑 if (ObjectUtils.isNotEmpty(view.getIsPlugin()) && view.getIsPlugin()) { - Map> fieldMap = ObjectUtils.isEmpty(extFieldsMap) ? new HashMap<>() : extFieldsMap; + Map> fieldMap = ObjectUtils.isEmpty(extFieldsMap) ? new LinkedHashMap<>() : extFieldsMap; - fieldMap.put("yAxis", yAxis); fieldMap.put("extStack", extStack); fieldMap.put("extBubble", extBubble); fieldMap.put("xAxis", xAxis); + fieldMap.put("yAxis", yAxis); PluginViewParam pluginViewParam = buildPluginParam(fieldMap, fieldCustomFilter, extFilterList, ds, table, view); String sql = pluginViewSql(pluginViewParam, view); if (StringUtils.isBlank(sql)) {