fix(brand-label): 品牌标签清洗抽公共件,六模块读写两端统一过出口
PublishBrandLabel 从 publish 私有件搬入 common/util/BrandLabel(三条守卫尺子随迁: 唯一副本、实体写出不许绕过、解析端不许重复实现),品牌列的读入与出件两端都走这一处。 读入端接上:asincache 缓存落库、invalidasin 人工黑名单(先洗再判空——键对不上是静默失效, 比脏值出件更难发现)、appearancepatent resolveBrand(两条取值分支同一个串)、collectdata 入库、shopdatacrawl copyRow/sameRow/rowDedupKey(键与值分家会让同一行跨分片重复出件)、 撞款解析与 re-baseline、dedupe 按表头名只洗品牌列。 写出端接上:publish/similarasin×2/appearancepatent/collectdata/撞款 csv+xlsx/shopdatacrawl。 rows-snapshot golden 里品牌格去掉首尾空格:正本 strip 自 2026-10-08 就含 trim, Java/Python/MySQL 三处同形,不是这次新加的行为。 门禁:后端 mvn -o test 4594 例 0 红。BrandTaskService(含四张 sheet 出件与解析端匹配) 因同仓另一路在飞改动未动,见 docs/audit/BACKLOG.md B5。
This commit is contained in:
+11
-3
@@ -1,5 +1,6 @@
|
||||
package com.nanri.aiimage.modules.appearancepatent.service.support;
|
||||
|
||||
import com.nanri.aiimage.common.util.BrandLabel;
|
||||
import com.nanri.aiimage.modules.appearancepatent.model.dto.AppearancePatentResultRowDto;
|
||||
import com.nanri.aiimage.modules.appearancepatent.model.vo.AppearancePatentParsedRowVo;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
@@ -231,10 +232,17 @@ public final class AppearancePatentSheetBuilder {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 品牌列的唯一取值出口:回传行优先、退回用户上传表的原始列,两条来源都在这里过一遍
|
||||
* {@link BrandLabel}。清洗必须落在这处而不是 cell 那一行——亚马逊把卖家名渲染成
|
||||
* "Brand: XXX",用户复制进 Excel 或客户端原样回传就带着标签前缀,带着它去查品牌库会被
|
||||
* 当 Solr 字段限定符打成上游 500。回传值只剩标签("Brand:")时按"这一行没带品牌"处理,
|
||||
* 继续回退到源表的品牌列,而不是把一个空标签洗出来的空串当成有效值写进格子。
|
||||
*/
|
||||
public static String resolveBrand(AppearancePatentResultRowDto resultRow, AppearancePatentParsedRowVo parsedRow) {
|
||||
String pythonBrand = resultRow == null ? "" : resultRow.getBrand();
|
||||
String pythonBrand = resultRow == null ? "" : BrandLabel.strip(resultRow.getBrand());
|
||||
if (pythonBrand != null && !pythonBrand.isBlank()) {
|
||||
return pythonBrand.trim();
|
||||
return pythonBrand;
|
||||
}
|
||||
if (parsedRow == null || parsedRow.getValues() == null) {
|
||||
return "";
|
||||
@@ -242,7 +250,7 @@ public final class AppearancePatentSheetBuilder {
|
||||
for (Map.Entry<String, String> entry : parsedRow.getValues().entrySet()) {
|
||||
String header = entry.getKey() == null ? "" : entry.getKey().trim().toLowerCase(Locale.ROOT);
|
||||
if (header.contains("品牌") || header.contains("brand")) {
|
||||
return entry.getValue() == null ? "" : entry.getValue();
|
||||
return firstNonBlank(BrandLabel.strip(entry.getValue()), "");
|
||||
}
|
||||
}
|
||||
return "";
|
||||
|
||||
Reference in New Issue
Block a user