Merge pull request #2757 from dataease/pr@dev@fix_email_task_view_number

fix(系统管理-定时报告): 定时报告发送视图数据包含无效小数
This commit is contained in:
fit2cloud-chenyw 2022-08-02 09:06:55 +08:00 committed by GitHub
commit 885851f64c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,7 +104,7 @@ public class ViewExportExcel {
Object val = row.get(key);
if (ObjectUtils.isEmpty(val))
return StringUtils.EMPTY;
return val.toString();
return filterInvalidDecimal(val.toString());
}).collect(Collectors.toList())).collect(Collectors.toList());
result.setHeads(heads);
result.setDatas(details);
@ -112,4 +112,12 @@ public class ViewExportExcel {
result.setSheetName(title);
return result;
}
private String filterInvalidDecimal(String sourceNumberStr) {
if (StringUtils.isNotBlank(sourceNumberStr) && StringUtils.contains(sourceNumberStr, ".")) {
sourceNumberStr = sourceNumberStr.replaceAll("0+?$", "");
sourceNumberStr = sourceNumberStr.replaceAll("[.]$", "");
}
return sourceNumberStr;
}
}