fix: 使用echarts地图符号功能模版报错#5918

This commit is contained in:
fit2cloud-chenyw 2023-09-08 14:33:54 +08:00
parent 4bcbcc2fec
commit 90bf3d0e85

View File

@ -604,12 +604,21 @@ public class ChartViewService {
List<ChartViewFieldDTO> viewFields = gson.fromJson(view.getViewFields(), tokenType); List<ChartViewFieldDTO> viewFields = gson.fromJson(view.getViewFields(), tokenType);
final Map<String, List<ChartViewFieldDTO>> extFieldsMap = new LinkedHashMap<>(); final Map<String, List<ChartViewFieldDTO>> extFieldsMap = new LinkedHashMap<>();
if (CollectionUtils.isNotEmpty(viewFields)) { if (CollectionUtils.isNotEmpty(viewFields)) {
viewFields.forEach(field -> { String[] busiFlagArray = new String[] {"daxis", "locationXaxis", "locationYaxis"};
Map<String, Boolean> flagMap = new HashMap<>();
for (String s : busiFlagArray) {
flagMap.put(s, false);
}
for (ChartViewFieldDTO field : viewFields) {
flagMap.put(field.getBusiType(), true);
String busiType = field.getBusiType(); String busiType = field.getBusiType();
List<ChartViewFieldDTO> list = extFieldsMap.containsKey(busiType) ? extFieldsMap.get(busiType) : new ArrayList<>(); List<ChartViewFieldDTO> list = extFieldsMap.containsKey(busiType) ? extFieldsMap.get(busiType) : new ArrayList<>();
list.add(field); list.add(field);
extFieldsMap.put(field.getBusiType(), list); extFieldsMap.put(field.getBusiType(), list);
}); }
if (flagMap.get("daxis") && (!flagMap.get("locationXaxis") || !flagMap.get("locationYaxis"))) {
viewFields = viewFields.stream().filter(field -> !StringUtils.equals("daxis", field.getBusiType())).collect(Collectors.toList());
}
} }
List<ChartViewFieldDTO> xAxisBase = gson.fromJson(view.getXAxis(), tokenType); List<ChartViewFieldDTO> xAxisBase = gson.fromJson(view.getXAxis(), tokenType);