去重总数据国家限定五国并优化筛选布局

- 国家仅保留德国/英国/法国/意大利/西班牙,移除美国及US映射
- 保留服务器已有 V90 迁移,新增 V91 添加 country 列及索引
- ASIN列表筛选区改为两行布局:查询条件+按钮在上,日期+导出在下
This commit is contained in:
2026-08-24 00:03:28 +08:00
parent 8712df2645
commit a659132469
6 changed files with 80 additions and 13 deletions
@@ -1131,8 +1131,8 @@ public class DedupeTotalDataService {
}
private static final List<String> COUNTRY_CODE_MAP = List.of(
"DE", "UK", "FR", "IT", "ES", "US",
"美国", "德国", "英国", "法国", "意大利", "西班牙");
"DE", "UK", "FR", "IT", "ES",
"德国", "英国", "法国", "意大利", "西班牙");
private String normalizeCountryCode(String raw) {
String upper = normalizeExcelText(raw).toUpperCase(Locale.ROOT);
@@ -1144,16 +1144,11 @@ public class DedupeTotalDataService {
.replace("FRANCE", "FR")
.replace("ITALY", "IT")
.replace("SPAIN", "ES")
.replace("USA", "US")
.replace("UNITED STATES", "US")
.replace("UNITEDSTATES", "US")
.replace("AMERICA", "US")
.replace("德国", "DE")
.replace("英国", "UK")
.replace("法国", "FR")
.replace("意大利", "IT")
.replace("西班牙", "ES")
.replace("美国", "US");
.replace("西班牙", "ES");
}
/** 将国家列单元格内容解析为标准国家代码(去重后按出现顺序),无有效国家返回 null。 */
@@ -0,0 +1,17 @@
-- Register the existing legacy static page in the APP permission menu.
-- The route_path is the menu slug; the page URL is /web_source/variant-collection.html.
INSERT INTO `columns` (`name`, `column_key`, `menu_type`, `route_path`, `sort_order`, `parent_id`)
SELECT 'ASIN变体采集', 'variant-collection', 'app', 'variant-collection', 118,
(SELECT id FROM `columns` WHERE `column_key` = 'brand_front_tools' LIMIT 1)
WHERE NOT EXISTS (
SELECT 1 FROM `columns` WHERE `column_key` = 'variant-collection'
);
UPDATE `columns` AS child
JOIN `columns` AS parent ON parent.`column_key` = 'brand_front_tools'
SET child.`name` = 'ASIN变体采集',
child.`menu_type` = 'app',
child.`route_path` = 'variant-collection',
child.`sort_order` = 118,
child.`parent_id` = parent.`id`
WHERE child.`column_key` = 'variant-collection';
@@ -0,0 +1,33 @@
SET @country_col_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'biz_dedupe_total_data'
AND COLUMN_NAME = 'country'
);
SET @sql_add_country := IF(
@country_col_exists = 0,
'ALTER TABLE biz_dedupe_total_data ADD COLUMN country VARCHAR(64) DEFAULT NULL COMMENT ''国家代码,逗号分隔,如 DE,UK'' AFTER data_value',
'SELECT 1'
);
PREPARE stmt_add_country FROM @sql_add_country;
EXECUTE stmt_add_country;
DEALLOCATE PREPARE stmt_add_country;
SET @country_idx_exists := (
SELECT COUNT(*)
FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'biz_dedupe_total_data'
AND INDEX_NAME = 'idx_country'
);
SET @sql_add_country_idx := IF(
@country_idx_exists = 0,
'ALTER TABLE biz_dedupe_total_data ADD INDEX idx_country (country)',
'SELECT 1'
);
PREPARE stmt_add_country_idx FROM @sql_add_country_idx;
EXECUTE stmt_add_country_idx;
DEALLOCATE PREPARE stmt_add_country_idx;
@@ -202,7 +202,8 @@ class DedupeTotalDataServiceTest {
assertEquals(1, result.getInsertedCount());
ArgumentCaptor<List<DedupeTotalDataEntity>> captor = ArgumentCaptor.forClass(List.class);
verify(dedupeTotalDataMapper).insertBatchIgnore(captor.capture());
assertEquals("DE,US,UK", captor.getValue().getFirst().getCountry());
// US 不在五国范围内,应被过滤掉
assertEquals("DE,UK", captor.getValue().getFirst().getCountry());
}
@Test