Merge pull request #11141 from dataease/pr@dev-v2@fix_report_export

fix(X-Pack): 定时报告导出excel包含ip地址最后的0字符串被忽略
This commit is contained in:
fit2cloud-chenyw 2024-07-24 13:16:39 +08:00 committed by GitHub
commit aa925c969e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -104,12 +104,21 @@ public class CoreVisualizationExportManage {
Object objectTableRow = chart.get("tableRow");
List<Map<String, Object>> tableRow = (List<Map<String, Object>>) objectTableRow;
List<List<String>> details = tableRow.stream().map(row -> headKeys.stream().map(key -> {
Object val = row.get(key);
if (ObjectUtils.isEmpty(val))
return StringUtils.EMPTY;
return filterInvalidDecimal(val.toString());
}).collect(Collectors.toList())).collect(Collectors.toList());
List<List<String>> details = tableRow.stream().map(row -> {
List<String> tempList = new ArrayList<>();
for (int i = 0; i < headKeys.size(); i++) {
String key = headKeys.get(i);
Object val = row.get(key);
if (ObjectUtils.isEmpty(val))
tempList.add(StringUtils.EMPTY);
if (fieldTypes.get(i) == 3) {
tempList.add(filterInvalidDecimal(val.toString()));
} else {
tempList.add(val.toString());
}
}
return tempList;
}).collect(Collectors.toList());
result.setHeads(heads);
result.setData(details);
result.setFiledTypes(fieldTypes);