feat(jd-collect): 进度/历史透传轮次游标 shopCatName/shopCatMerged——任务卡显示「正在采集分类」(多轮页码归 1 消歧,2026-11-21 方案 C 客户端侧配套)

客户端多选店内分类改逐分类轮次采集后,游标新增两键。HistoryItemVo/ProgressVo 加字段(注释与建单多选集合 shopCategoryNames 明确区分:这是「当前正在采的那一个」);BoardService#fillProgress 与 TaskService#queryProgress 读侧白名单逐键取(shopCatMerged 宽松布尔:true 字符串也认)。前端 toJdTaskView extraLines 加「正在采集分类:X(合并兜底时缀 等(页面筛选未生效,兜底翻页中))」。判据:JdCollectBoardServiceTest 游标键透传两支(selectList mock 必须 ArrayList 包 List.of——history 服务原地排序,不可变列表打爆)+jd-collect-progress.mount.test.ts 两支+jd-collect-tab.test.ts 源码绊线;门禁 mvn -o test-compile rc0+目标 49 绿、vue-tsc rc0、node --test 15 绿、vitest 24 绿。
This commit is contained in:
2026-11-21 12:07:05 +08:00
parent a2aeae9974
commit c59296da72
9 changed files with 143 additions and 0 deletions
@@ -231,6 +231,42 @@ describe('获取店铺数据:一键采集 + 任务面板', () => {
expect(w.find('.file-progress-meta').text()).toContain('已采集 30/100 个商品(30%)')
})
it('轮次采集时任务卡片显示「正在采集分类」,页码归 1 不再像重跑(2026-11-21 方案 C)', async () => {
api.fetchJdCollectTaskProgressBatch.mockResolvedValue(
batchOf(historyItem({ total: 15, itemsReceived: 8, rowCount: 8, page: 1,
shopCatName: '礼服/演出服', batches: 2 })),
)
const w = await mountPage()
await startCollect(w)
await flushPromises()
const text = w.find('.task-item').text()
expect(text).toContain('正在采集分类:礼服/演出服')
expect(text).toContain('断点游标:第 1 页')
expect(text).not.toContain('兜底翻页中')
})
it('合并兜底轮标注「页面筛选未生效」;非轮次任务不出现该行', async () => {
api.fetchJdCollectTaskProgressBatch.mockResolvedValue(
batchOf(historyItem({ total: 6, itemsReceived: 4, rowCount: 4, page: 1,
shopCatName: '工作制服', shopCatMerged: true, batches: 1 })),
)
const w = await mountPage()
await startCollect(w)
await flushPromises()
expect(w.find('.task-item').text())
.toContain('正在采集分类:工作制服 等(页面筛选未生效,兜底翻页中)')
// 非轮次任务(游标无 shopCatName):不出现该行,其余文案不受影响
api.fetchJdCollectTaskProgressBatch.mockResolvedValue(
batchOf(historyItem({ total: 300, itemsReceived: 30, rowCount: 30, page: 3, batches: 4 })),
)
const w2 = await mountPage()
await startCollect(w2)
await flushPromises()
expect(w2.find('.task-item').text()).not.toContain('正在采集分类')
})
it('没有分母(total 缺失)时只显示已采集行数,不编造百分比', async () => {
api.fetchJdCollectTaskProgressBatch.mockResolvedValue(
batchOf(historyItem({ total: null, page: null, itemsReceived: 30, rowCount: 30 })),