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

- 国家仅保留德国/英国/法国/意大利/西班牙,移除美国及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( 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) { private String normalizeCountryCode(String raw) {
String upper = normalizeExcelText(raw).toUpperCase(Locale.ROOT); String upper = normalizeExcelText(raw).toUpperCase(Locale.ROOT);
@@ -1144,16 +1144,11 @@ public class DedupeTotalDataService {
.replace("FRANCE", "FR") .replace("FRANCE", "FR")
.replace("ITALY", "IT") .replace("ITALY", "IT")
.replace("SPAIN", "ES") .replace("SPAIN", "ES")
.replace("USA", "US")
.replace("UNITED STATES", "US")
.replace("UNITEDSTATES", "US")
.replace("AMERICA", "US")
.replace("德国", "DE") .replace("德国", "DE")
.replace("英国", "UK") .replace("英国", "UK")
.replace("法国", "FR") .replace("法国", "FR")
.replace("意大利", "IT") .replace("意大利", "IT")
.replace("西班牙", "ES") .replace("西班牙", "ES");
.replace("美国", "US");
} }
/** 将国家列单元格内容解析为标准国家代码(去重后按出现顺序),无有效国家返回 null。 */ /** 将国家列单元格内容解析为标准国家代码(去重后按出现顺序),无有效国家返回 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()); assertEquals(1, result.getInsertedCount());
ArgumentCaptor<List<DedupeTotalDataEntity>> captor = ArgumentCaptor.forClass(List.class); ArgumentCaptor<List<DedupeTotalDataEntity>> captor = ArgumentCaptor.forClass(List.class);
verify(dedupeTotalDataMapper).insertBatchIgnore(captor.capture()); verify(dedupeTotalDataMapper).insertBatchIgnore(captor.capture());
assertEquals("DE,US,UK", captor.getValue().getFirst().getCountry()); // US 不在五国范围内,应被过滤掉
assertEquals("DE,UK", captor.getValue().getFirst().getCountry());
} }
@Test @Test
+1 -1
View File
@@ -2192,7 +2192,7 @@
} }
function getDedupeTotalDataCountryLabel(countryCodes) { function getDedupeTotalDataCountryLabel(countryCodes) {
var countryLabels = { var countryLabels = {
DE: '德国', UK: '英国', FR: '法国', IT: '意大利', ES: '西班牙', US: '美国' DE: '德国', UK: '英国', FR: '法国', IT: '意大利', ES: '西班牙'
}; };
if (Array.isArray(countryCodes)) { if (Array.isArray(countryCodes)) {
return countryCodes.map(function (code) { return countryLabels[code] || code; }).join('、'); return countryCodes.map(function (code) { return countryLabels[code] || code; }).join('、');
+24 -3
View File
@@ -182,6 +182,24 @@
white-space: nowrap; white-space: nowrap;
} }
.dedupe-filter-date-row {
display: flex;
gap: 12px;
align-items: flex-end;
flex-wrap: wrap;
margin-bottom: 16px;
}
.dedupe-filter-date-row .form-group {
flex: 0 0 200px;
min-width: 0;
margin-bottom: 0;
}
.dedupe-filter-date-row .dedupe-filter-actions {
margin-left: auto;
}
.btn { .btn {
padding: 10px 20px; padding: 10px 20px;
background: #667eea; background: #667eea;
@@ -2100,9 +2118,13 @@
<option value="FR">法国</option> <option value="FR">法国</option>
<option value="IT">意大利</option> <option value="IT">意大利</option>
<option value="ES">西班牙</option> <option value="ES">西班牙</option>
<option value="US">美国</option>
</select> </select>
</div> </div>
<div class="dedupe-filter-actions">
<button class="btn" id="btnSearchDedupeTotalData">查询</button>
</div>
</div>
<div class="dedupe-filter-date-row">
<div class="form-group"> <div class="form-group">
<label>开始日期</label> <label>开始日期</label>
<input type="date" id="exportDedupeTotalDataStartDate"> <input type="date" id="exportDedupeTotalDataStartDate">
@@ -2112,7 +2134,6 @@
<input type="date" id="exportDedupeTotalDataEndDate"> <input type="date" id="exportDedupeTotalDataEndDate">
</div> </div>
<div class="dedupe-filter-actions"> <div class="dedupe-filter-actions">
<button class="btn" id="btnSearchDedupeTotalData">查询</button>
<button class="btn btn-secondary" id="btnExportDedupeTotalData" type="button">导出 XLSX</button> <button class="btn btn-secondary" id="btnExportDedupeTotalData" type="button">导出 XLSX</button>
</div> </div>
</div> </div>
@@ -3188,7 +3209,7 @@
</div> </div>
</div> </div>
</div> </div>
<script src="/static/admin.js?v=dedupe-country-1"></script> <script src="/static/admin.js?v=dedupe-country-2"></script>
</body> </body>
</html> </html>