fix(定时报告): 导出视图名称包含"/"报错

This commit is contained in:
fit2cloud-chenyw 2023-04-13 15:41:59 +08:00
parent a7c1769713
commit e1ae7dc7fb

View File

@ -8,6 +8,8 @@ import io.dataease.commons.model.excel.ExcelSheetModel;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -29,6 +31,9 @@ public class ExcelUtils {
List<List<String>> details = sheet.getData();
details.add(0, sheet.getHeads());
String sheetName = sheet.getSheetName();
Pattern pattern = Pattern.compile("[\\s\\\\/:\\*\\?\\\"<>\\|]");
Matcher matcher = pattern.matcher(sheetName);
sheetName = matcher.replaceAll("-");
Sheet curSheet = wb.createSheet(sheetName);
if (StringUtils.isBlank(fileName)) {
String cName = sheetName + suffix;