fix(撞款): 存量迁移修复——①POI zip安全限制放宽(setMaxFileCount/minInflateRatio,旧文件条目数超限整店失败) ②明细批次唯一键放宽(V112 uk→普通索引,同店同日同国同ASIN允许多行) ③迁移失败日志补全堆栈

This commit is contained in:
2026-09-07 03:11:48 +08:00
parent 5f8c469b8e
commit 23e749c973
4 changed files with 10 additions and 1 deletions
File diff suppressed because one or more lines are too long
@@ -339,7 +339,7 @@ public class ShopDataDuplicateCheckScanService {
migrated++;
} catch (Exception ex) {
log.error("[shop-data-crawl-item] 存量迁移失败 shop={} date={} msg={}",
shopName, businessDate, ex.getMessage());
shopName, businessDate, ex.getMessage(), ex);
failed++;
}
}
@@ -21,6 +21,10 @@ public final class DuplicateCheckWorkbookParser {
}
public static List<RawRow> parse(byte[] bytes) throws Exception {
// 放宽 POI zip 安全限制(本地/自产结果文件,Excel 导出可能存在高压缩比与超多 zip 条目):
// 存量迁移曾因 InvalidFormatException 整店失败(魏振峰/柴迎中/小曾/郭煜晴)。
org.apache.poi.openxml4j.util.ZipSecureFile.setMinInflateRatio(0.001);
org.apache.poi.openxml4j.util.ZipSecureFile.setMaxFileCount(100_000);
Parser handler = new Parser();
ExcelStreamReader.readAllSheets(new ByteArrayInputStream(bytes), handler);
return handler.rows;
@@ -0,0 +1,4 @@
-- 明细批次唯一键放宽:同店×日×国家×ASIN 允许多行(同一 SKU 一天多次采集/价格变动),
-- 批次幂等由「先删同批再插」保证(V111 的 uk 过严导致存量迁移 DuplicateKey 失败)。
ALTER TABLE biz_shop_data_crawl_item DROP INDEX uk_shop_data_crawl_item_batch;
ALTER TABLE biz_shop_data_crawl_item ADD KEY idx_shop_data_crawl_item_batch (shop_name, business_date, country, asin);