fix(上架/去重): 结果工作表名净化 + 总数据表用户导入列放宽
1) 上架结果 Excel 的工作表名取自接口参数 publishCountry:用户填长文本/特殊 字符(Excel 工作表名上限 31 字符且禁 []:*?/\)时 createSheet 直接抛异常, 整体表现为「生成上架结果 Excel 失败」。改用项目既有的 uniqueSheetName (内部即 WorkbookUtil.createSafeSheetName,与 dedupe 同款);单元格里的 国家值仍按原口径写入,不改变数据语义。 2) V135:去重「总数据导入」importFromExcel 是用户上传 Excel 逐行写 biz_dedupe_total_data.data_value(varchar(128)),超长值同样 Data too long 致导入整体失败。data_value 带唯一索引 uk_data_value(去重判重核心), 不能改前缀索引(会把前 N 字符相同的不同值误判为重复),故扩到 varchar(512);country 同口径放宽。线上已于 2026-09-25 手工执行(0.01s, 主从已生效并实测 210 字符写入)。
This commit is contained in:
+5
-1
@@ -101,7 +101,11 @@ public class PublishWorkbookService {
|
||||
try (FileOutputStream output = new FileOutputStream(outputFile)) {
|
||||
CellStyle headerStyle = createHeaderStyle(workbook);
|
||||
String country = countrySheetName(publishCountry);
|
||||
Sheet sheet = workbook.createSheet(country);
|
||||
// 工作表名必须是 Excel 合法名(≤31 字符、不含 []:*?/\ ),而 country 来自接口参数,
|
||||
// 用户填了长文本/特殊字符时直接 createSheet 会抛异常导致"生成上架结果 Excel 失败"。
|
||||
// uniqueSheetName 是项目内已有的净化样板(dedupe 同款 WorkbookUtil.createSafeSheetName),
|
||||
// 此处只净化工作表名;单元格里的国家值仍按原口径写入。
|
||||
Sheet sheet = workbook.createSheet(uniqueSheetName(country, new LinkedHashSet<>()));
|
||||
writeSheet(sheet, rows, headerStyle, country);
|
||||
workbook.write(output);
|
||||
return outputFile;
|
||||
|
||||
Reference in New Issue
Block a user