diff --git a/backend-java/src/main/java/com/nanri/aiimage/modules/jd/controller/JdCollectController.java b/backend-java/src/main/java/com/nanri/aiimage/modules/jd/controller/JdCollectController.java
index af9113980..a6f9bfe9b 100644
--- a/backend-java/src/main/java/com/nanri/aiimage/modules/jd/controller/JdCollectController.java
+++ b/backend-java/src/main/java/com/nanri/aiimage/modules/jd/controller/JdCollectController.java
@@ -13,8 +13,10 @@ import com.nanri.aiimage.modules.jd.model.vo.JdCollectTaskBatchVo;
import com.nanri.aiimage.modules.jd.model.vo.JdCollectTaskVo;
import com.nanri.aiimage.modules.jd.model.vo.JdIngestChunkVo;
import com.nanri.aiimage.modules.jd.model.vo.JdProductCategoryVo;
+import com.nanri.aiimage.modules.jd.model.vo.JdProductGroupVo;
import com.nanri.aiimage.modules.jd.service.JdCollectBoardService;
import com.nanri.aiimage.modules.jd.service.JdCollectTaskService;
+import com.nanri.aiimage.modules.jd.service.JdProductGroupService;
import com.nanri.aiimage.modules.jd.service.JdProductQueryService;
import com.nanri.aiimage.modules.jd.service.JdResultIngestService;
import com.nanri.aiimage.modules.task.model.dto.TaskHeartbeatRequest;
@@ -60,6 +62,7 @@ public class JdCollectController {
private final JdCollectBoardService boardService;
private final JdResultIngestService ingestService;
private final JdProductQueryService jdProductQueryService;
+ private final JdProductGroupService jdProductGroupService;
private final TaskHeartbeatService taskHeartbeatService;
private final TaskHeartbeatPositionService taskHeartbeatPositionService;
private final TaskProgressOwnershipSupport progressOwnershipSupport;
@@ -76,6 +79,18 @@ public class JdCollectController {
return ApiResponse.success(jdProductQueryService.categories(null));
}
+ @GetMapping("/groups")
+ @Operation(summary = "店铺分类列表(用户侧只读)", description = "2026-11-16 客户口径「管理员弄了多少"
+ + "店铺分类 普通账户都能看到」:「获取店铺数据」页把管理员在后管京东数据库建的分类展示出来"
+ + "(含组内商品数),普通账号登录即可见。与后管分组管理同一条读出口(JdProductGroupService.list,"
+ + "分组 2026-11-15 起全平台一份、无公司维度);只读不写——分类的增删改仍只在后管。"
+ + "「商品上架」未落地(jd-publish 占位),上架界面落地时消费同一端点。")
+ public ApiResponse> groups(HttpServletRequest httpRequest) {
+ // 登录用户即可读(公共库口径):解析不出会话身份就 401(fail-closed,与 categories 同口径)。
+ adminAuthSupport.requireOwnershipUserId(httpRequest, null);
+ return ApiResponse.success(jdProductGroupService.list());
+ }
+
@GetMapping("/dashboard")
@Operation(summary = "查询京东采集任务总览", description = "当前用户的运行中、成功、失败任务数。"
+ "任务面板统计卡数据源,页面进入时请求一次即可,不需要持续轮询。")
diff --git a/backend-java/src/test/java/com/nanri/aiimage/modules/jd/controller/JdCollectGroupsEndpointTest.java b/backend-java/src/test/java/com/nanri/aiimage/modules/jd/controller/JdCollectGroupsEndpointTest.java
new file mode 100644
index 000000000..522bfaece
--- /dev/null
+++ b/backend-java/src/test/java/com/nanri/aiimage/modules/jd/controller/JdCollectGroupsEndpointTest.java
@@ -0,0 +1,91 @@
+package com.nanri.aiimage.modules.jd.controller;
+
+import com.nanri.aiimage.common.api.ApiResponse;
+import com.nanri.aiimage.common.security.AdminAuthSupport;
+import com.nanri.aiimage.modules.jd.model.vo.JdProductGroupVo;
+import com.nanri.aiimage.modules.jd.service.JdCollectBoardService;
+import com.nanri.aiimage.modules.jd.service.JdCollectTaskService;
+import com.nanri.aiimage.modules.jd.service.JdProductGroupService;
+import com.nanri.aiimage.modules.jd.service.JdProductQueryService;
+import com.nanri.aiimage.modules.jd.service.JdResultIngestService;
+import com.nanri.aiimage.modules.task.service.TaskHeartbeatPositionService;
+import com.nanri.aiimage.modules.task.service.TaskHeartbeatService;
+import com.nanri.aiimage.modules.task.service.TaskProgressOwnershipSupport;
+import jakarta.servlet.http.HttpServletRequest;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.ArgumentMatchers.same;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+/**
+ * 用户侧「店铺分类」只读端点(2026-11-16 客户口径「管理员弄了多少店铺分类 普通账户都能看到」)。
+ *
+ * 「获取店铺数据」页把管理员在后管京东数据库建的分类展示给普通账号:GET /api/jd-collect/groups,
+ * 与 categories 端点同形(登录用户即可读、fail-closed 401;分组全平台一份、无公司维度)。
+ * 只读不写——分类的增删改仍只在后管 AdminJdProductGroupController。结构判据(照
+ * {@code AdminJdProductControllerTest} 双形态的第一半)+行为样本(200 信封装 list、鉴权先过)。
+ */
+class JdCollectGroupsEndpointTest {
+
+ private static final Path CONTROLLER = Path.of("").toAbsolutePath()
+ .resolve("src/main/java/com/nanri/aiimage/modules/jd/controller/JdCollectController.java");
+
+ @Test
+ void 结构判据_groups端点只读且复用分组服务公共口径() throws IOException {
+ assertTrue(Files.exists(CONTROLLER), "控制器必须落在 " + CONTROLLER);
+ String source = Files.readString(CONTROLLER);
+ assertTrue(source.contains("@GetMapping(\"/groups\")"),
+ "用户侧分类列表必须是 GET /groups(categories 同形)");
+ assertTrue(source.contains("jdProductGroupService.list()"),
+ "必须复用 JdProductGroupService.list()(与后管分组管理同一条读出口,不另造查询)");
+ assertTrue(source.contains("adminAuthSupport.requireOwnershipUserId(httpRequest, null)"),
+ "登录用户即可读但必须 fail-closed:解析不出会话身份就 401(与 categories 同口径)");
+ }
+
+ @Test
+ void 行为样本_鉴权先过且200信封装分组全量() {
+ JdProductGroupService groupService = mock(JdProductGroupService.class);
+ AdminAuthSupport authSupport = mock(AdminAuthSupport.class);
+ JdCollectController controller = new JdCollectController(
+ mock(JdCollectTaskService.class),
+ mock(JdCollectBoardService.class),
+ mock(JdResultIngestService.class),
+ mock(JdProductQueryService.class),
+ groupService,
+ mock(TaskHeartbeatService.class),
+ mock(TaskHeartbeatPositionService.class),
+ mock(TaskProgressOwnershipSupport.class),
+ authSupport);
+ HttpServletRequest request = mock(HttpServletRequest.class);
+
+ JdProductGroupVo vo = new JdProductGroupVo();
+ vo.setId(7L);
+ vo.setName("ASSS");
+ vo.setProductCount(20L);
+ when(authSupport.requireOwnershipUserId(same(request), isNull())).thenReturn(1L);
+ when(groupService.list()).thenReturn(List.of(vo));
+
+ ApiResponse> response = controller.groups(request);
+
+ assertNotNull(response);
+ assertTrue(response.isSuccess(), "成功信封 success=true(B80-03:判据只认响应体,不认 HTTP 状态码)");
+ assertNotNull(response.getData());
+ assertEquals(1, response.getData().size());
+ assertEquals("ASSS", response.getData().get(0).getName());
+ assertEquals(20L, response.getData().get(0).getProductCount());
+ // 鉴权闸先行:解析不出会话身份就 401,读不到任何数据。
+ verify(authSupport).requireOwnershipUserId(same(request), isNull());
+ verify(groupService).list();
+ }
+}
diff --git a/frontend-vue/src/pages/jd/JdCollectTab.vue b/frontend-vue/src/pages/jd/JdCollectTab.vue
index 1fcd3afe7..8bde6660c 100644
--- a/frontend-vue/src/pages/jd/JdCollectTab.vue
+++ b/frontend-vue/src/pages/jd/JdCollectTab.vue
@@ -9,10 +9,12 @@ import {
deleteJdCollectTask,
fetchJdCollectCategories,
fetchJdCollectDashboard,
+ fetchJdCollectGroups,
fetchJdCollectHistory,
fetchJdCollectTaskProgressBatch,
interruptJdCollectTask,
type JdCollectCategoryVo,
+ type JdCollectGroupVo,
type JdCollectHistoryItemVo,
type JdListTab,
} from '@/shared/api/types/modules/jd-collect'
@@ -37,6 +39,9 @@ import JdCategoryCascader from './JdCategoryCascader.vue'
* 卡片只显示已采集行数,不编造百分比;
* 4. 失败/中断任务「重试/继续」走通用原位复位(铁律 26,保留已收分片与断点游标),
* 复位后页面重新激活并推队列——同一份输入不再多出好几行结果。
+ *
+ * 2026-11-16 客户口径「管理员弄了多少店铺分类 普通账户都能看到」:左面板加只读「店铺分类」
+ * 块(GET /api/jd-collect/groups,管理员在后管京东数据库维护);「商品上架」落地后消费同一端点。
*/
/** 页面不再让用户填店铺名:店铺名称由客户端从京麦后台读,建单先按此占位记录。 */
@@ -76,6 +81,21 @@ function uidForStorage() {
return typeof window !== 'undefined' ? window.localStorage.getItem('uid') || '0' : '0'
}
+// ---- 店铺分类(管理员在后管「京东数据库」维护,本页只读展示;2026-11-16 客户口径
+// 「管理员弄了多少店铺分类 普通账户都能看到」——普通账号在「获取店铺数据」页就能看到
+// 分类全集与各组商品数。分类的增删改仍只在后管;「商品上架」落地后消费同一端点。)----
+const groupList = ref([])
+
+async function loadGroups() {
+ try {
+ groupList.value = await fetchJdCollectGroups()
+ } catch (err) {
+ // 分类只是展示项:拉不到就保持空态文案,不把采集主路堵死(同 loadCategoryOptions 口径)。
+ console.error('[jd-collect] 店铺分类拉取失败', err)
+ ElMessage.warning('店铺分类加载失败,不影响采集')
+ }
+}
+
// ---- 实时任务面板(与外观专利共用 useLiveTaskBoard 骨架;京东无结果文件,无下载层)----
const board = useLiveTaskBoard({
scope: 'jd-collect',
@@ -366,6 +386,7 @@ onMounted(async () => {
board.loadDashboard().catch(() => undefined),
board.loadHistory().catch(() => undefined),
loadCategoryOptions(),
+ loadGroups(),
])
board.seedRunningTasksFromHistory()
board.seedPendingFileTasksFromHistory()
@@ -420,6 +441,19 @@ onUnmounted(() => {
+
+
店铺分类(管理员维护,只读)
+
+
+ {{ group.name }}({{ group.productCount }})
+
+
+
+ 后台还没建店铺分类;管理员在「京东数据库 → 店铺分类」里建的会显示在这里。
+
+
+
@@ -671,6 +705,26 @@ onUnmounted(() => {
line-height: 1.6;
}
+/* 店铺分类只读块(2026-11-16 客户口径):label 复用 category-label,chips 深色卡片同色系。 */
+.group-chips {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ margin: 8px 0 0;
+}
+
+.group-chip {
+ display: inline-flex;
+ align-items: center;
+ padding: 4px 10px;
+ border: 1px solid #3e4a62;
+ border-radius: 6px;
+ background: #232b3d;
+ color: #c8d2e2;
+ font-size: 12px;
+ white-space: nowrap;
+}
+
.collect-btn:hover:not(:disabled) {
filter: brightness(1.1);
transform: translateY(-1px);
diff --git a/frontend-vue/src/shared/api/endpoints.ts b/frontend-vue/src/shared/api/endpoints.ts
index a276f5abf..b5c0f8f6d 100644
--- a/frontend-vue/src/shared/api/endpoints.ts
+++ b/frontend-vue/src/shared/api/endpoints.ts
@@ -209,6 +209,8 @@ export const API_ENDPOINTS = {
create: '/api/jd-collect/tasks',
/** 采集类目下拉数据源(公共库已落库 category_path 全集,建单页多选面板用) */
categories: '/api/jd-collect/categories',
+ /** 店铺分类只读列表(管理员在后管京东数据库建的分类+组内商品数;2026-11-16 客户口径「普通账户都能看到」) */
+ groups: '/api/jd-collect/groups',
/** 激活(PENDING→RUNNING):推客户端队列**之前**必须调用,否则分片被拒、心跳要求客户端收手 */
activate: '/api/jd-collect/tasks/{taskId}/activate',
/** 采集进度(用户端「获取店铺数据」进度条数据源) */
diff --git a/frontend-vue/src/shared/api/types/modules/jd-collect.ts b/frontend-vue/src/shared/api/types/modules/jd-collect.ts
index 40854bc8f..06b133502 100644
--- a/frontend-vue/src/shared/api/types/modules/jd-collect.ts
+++ b/frontend-vue/src/shared/api/types/modules/jd-collect.ts
@@ -80,6 +80,26 @@ export function fetchJdCollectCategories() {
);
}
+/** 店铺分类行(GET /api/jd-collect/groups:管理员在后管京东数据库建的分类+组内商品数)。
+ * 2026-11-16 客户口径「管理员弄了多少店铺分类 普通账户都能看到」:只读展示,分类的
+ * 增删改仍只在后管;分组 2026-11-15 起全平台一份,无公司维度。 */
+export interface JdCollectGroupVo {
+ id: number;
+ name: string;
+ sortOrder: number;
+ productCount: number;
+}
+
+/** 店铺分类只读列表(「获取店铺数据」页展示;「商品上架」落地后消费同一端点)。 */
+export function fetchJdCollectGroups() {
+ return unwrapJavaResponse(
+ get>(
+ buildJavaUrl(API_ENDPOINTS.jdCollect.groups),
+ { params: { user_id: getCurrentUserId() } },
+ ),
+ );
+}
+
export function createJdCollectTask(
shopName: string,
listTabs: JdListTab[],
diff --git a/frontend-vue/tests/catch-silence-ratchet.test.ts b/frontend-vue/tests/catch-silence-ratchet.test.ts
index 1f39ea254..687b5a81f 100644
--- a/frontend-vue/tests/catch-silence-ratchet.test.ts
+++ b/frontend-vue/tests/catch-silence-ratchet.test.ts
@@ -87,7 +87,11 @@ const BASELINE = {
// loadCategoryOptions catch——类目选项拉取失败不阻塞建单(不选类目=全店采集的
// 主路照常),失败 ElMessage.warning 当场说给用户、原文只进 console;非静默,
// silent 一格没涨,只进 blocks。
- blocks: 318,
+ // 319 = 318 + 1(2026-11-16 店铺分类只读块,客户口径「管理员弄了多少店铺分类 普通账户
+ // 都能看到」):JdCollectTab.vue 的 loadGroups catch——分类只是展示项,拉取失败
+ // ElMessage.warning 当场说给用户、原文只进 console,采集主路照常;非静默,
+ // silent 一格没涨,只进 blocks。
+ blocks: 319,
// 2026-10-30(ops Phase 6/可读棘轮):ApiSecretSettingsPanel.vue 1113→775 行,面板里那处
// 静默 catch(余额查询失败只 console.warn、界面留空)随 loadBalance 整块搬进
// useProxyPlan.ts。不是新增静默:面板 1→0、新文件记 1,silent 总数与 blocks 都一格没动,
diff --git a/frontend-vue/tests/endpoints.test.ts b/frontend-vue/tests/endpoints.test.ts
index d4d0ac643..83930f265 100644
--- a/frontend-vue/tests/endpoints.test.ts
+++ b/frontend-vue/tests/endpoints.test.ts
@@ -321,9 +321,12 @@ test('test_endpoints_frozen_snapshot', () => {
// deleteTask(连带清理京东数据库该任务的行与断点游标,铁律 32 数据面)。
// 2026-11-16 类目多选:categories(公共库已落库 category_path 全集,建单页多选面板选项源,
// 鉴权照建单 requireOwnershipUserId fail-closed;后端 8b4f7a3a 同轮落)。
+ // 2026-11-16 店铺分类只读:groups(管理员在后管京东数据库建的分类+组内商品数,「获取店铺数据」
+ // 页展示给普通账号——客户口径「普通账户都能看到」;鉴权照 categories 同口径)。
"jdCollect": {
"create": "/api/jd-collect/tasks",
"categories": "/api/jd-collect/categories",
+ "groups": "/api/jd-collect/groups",
// activate 补录(存量漂移):8d8c88a5「补激活这一步」只改了常量表,快照没跟上,
// 本次任务面板改版全量跑才暴露(快照测试此前没在全量档里红过)。
"activate": "/api/jd-collect/tasks/{taskId}/activate",
diff --git a/frontend-vue/tests/jd-collect-tab.test.ts b/frontend-vue/tests/jd-collect-tab.test.ts
index b99628a67..b0a9bbc55 100644
--- a/frontend-vue/tests/jd-collect-tab.test.ts
+++ b/frontend-vue/tests/jd-collect-tab.test.ts
@@ -48,6 +48,31 @@ test('endpoints 注册采集类目 categories 下拉端点', () => {
'endpoints.ts jdCollect 组缺 categories(建单页类目多选面板的选项源)')
})
+/** 2026-11-16 客户口径「管理员弄了多少店铺分类 普通账户都能看到」:普通账号在
+ * 「获取店铺数据」页就能看到管理员在后管京东数据库建的分类全集与各组商品数;
+ * 本页只读——分类的增删改仍只在后管。「商品上架」落地后消费同一端点。 */
+test('endpoints 注册店铺分类 groups 只读端点,页面加载并只读展示', () => {
+ const endpoints = readIfExists(ENDPOINTS, 'endpoints.ts')
+ assert.ok(endpoints.includes("groups: '/api/jd-collect/groups'"),
+ 'endpoints.ts jdCollect 组缺 groups(店铺分类只读列表的选项源)')
+
+ const api = readIfExists(
+ join(process.cwd(), 'src', 'shared', 'api', 'types', 'modules', 'jd-collect.ts'),
+ 'jd-collect.ts',
+ )
+ assert.ok(api.includes('export function fetchJdCollectGroups'),
+ 'jd-collect.ts 缺 fetchJdCollectGroups(页面取分类列表的发送口)')
+
+ const page = readIfExists(
+ join(process.cwd(), 'src', 'pages', 'jd', 'JdCollectTab.vue'),
+ 'JdCollectTab.vue',
+ )
+ assert.ok(page.includes('fetchJdCollectGroups'),
+ 'JdCollectTab.vue 必须调 fetchJdCollectGroups(普通账号在这里看到管理员建的分类)')
+ assert.ok(page.includes('店铺分类(管理员维护,只读)'),
+ 'JdCollectTab.vue 必须有「店铺分类」只读展示块(口径点名「管理员维护,只读」)')
+})
+
test('建单请求体与推送载荷都带 categoryPaths', () => {
const api = readIfExists(
join(process.cwd(), 'src', 'shared', 'api', 'types', 'modules', 'jd-collect.ts'),
diff --git a/frontend-vue/tests/mount/jd-collect-progress.mount.test.ts b/frontend-vue/tests/mount/jd-collect-progress.mount.test.ts
index a40bb7b6c..c86f5fe49 100644
--- a/frontend-vue/tests/mount/jd-collect-progress.mount.test.ts
+++ b/frontend-vue/tests/mount/jd-collect-progress.mount.test.ts
@@ -23,6 +23,7 @@ const api = vi.hoisted(() => ({
// undefined 调用、enqueue 永远不被调用(本文件当时没跟上,红在这里)。
activateJdCollectTask: vi.fn(),
fetchJdCollectCategories: vi.fn(),
+ fetchJdCollectGroups: vi.fn(),
fetchJdCollectDashboard: vi.fn(),
fetchJdCollectHistory: vi.fn(),
fetchJdCollectTaskProgressBatch: vi.fn(),
@@ -36,6 +37,7 @@ vi.mock('@/shared/api/types/modules/jd-collect', () => ({
createJdCollectTask: api.createJdCollectTask,
activateJdCollectTask: api.activateJdCollectTask,
fetchJdCollectCategories: api.fetchJdCollectCategories,
+ fetchJdCollectGroups: api.fetchJdCollectGroups,
fetchJdCollectProgress: vi.fn(),
fetchJdCollectDashboard: api.fetchJdCollectDashboard,
fetchJdCollectHistory: api.fetchJdCollectHistory,
@@ -125,6 +127,7 @@ beforeEach(() => {
api.createJdCollectTask.mockResolvedValue({ taskId: 88, taskNo: 'JD-1', collectChannel: 'LOCAL' })
api.activateJdCollectTask.mockResolvedValue(null)
api.fetchJdCollectCategories.mockResolvedValue([])
+ api.fetchJdCollectGroups.mockResolvedValue([])
api.enqueue.mockResolvedValue({ success: true })
api.fetchJdCollectDashboard.mockResolvedValue(EMPTY_DASHBOARD)
api.fetchJdCollectHistory.mockResolvedValue({ items: [] })
@@ -309,4 +312,36 @@ describe('获取店铺数据:一键采集 + 任务面板', () => {
categoryPaths: ['女装'],
})
})
+
+ it('店铺分类只读块:页面加载即拉取并把管理员建的分类与商品数展示出来', async () => {
+ // 2026-11-16 客户口径「管理员弄了多少店铺分类 普通账户都能看到」:普通账号在
+ // 「获取店铺数据」页就能看到后管京东数据库建的分类全集;本页只读,不提供增删改。
+ api.fetchJdCollectGroups.mockResolvedValue([
+ { id: 1, name: 'ASSS', sortOrder: 0, productCount: 20 },
+ { id: 2, name: '家居日用', sortOrder: 1, productCount: 7 },
+ ])
+ const w = await mountPage()
+
+ expect(api.fetchJdCollectGroups).toHaveBeenCalledTimes(1)
+ const block = w.findAll('.category-block').find((el) => el.text().includes('店铺分类'))
+ expect(block, '必须有「店铺分类」展示块').toBeTruthy()
+ expect(block!.text()).toContain('店铺分类(管理员维护,只读)')
+ const chips = block!.findAll('.group-chip')
+ expect(chips.length).toBe(2)
+ expect(chips[0].text()).toContain('ASSS(20)')
+ expect(chips[1].text()).toContain('家居日用(7)')
+ expect(chips[0].attributes('title')).toContain('ASSS:20 个商品')
+ })
+
+ it('后台还没建分类:只读块落空态提示,采集主路照常', async () => {
+ const w = await mountPage()
+
+ const block = w.findAll('.category-block').find((el) => el.text().includes('店铺分类'))
+ expect(block, '空态也要有「店铺分类」块(不能整块消失让用户以为没这功能)').toBeTruthy()
+ expect(block!.text()).toContain('后台还没建店铺分类')
+ expect(block!.text()).toContain('管理员在「京东数据库 → 店铺分类」里建的会显示在这里')
+ expect(block!.find('.group-chip').exists()).toBe(false)
+ // 拉取失败只 warning、不影响建单主路(catch 口径见 catch-silence-ratchet 319)
+ expect(w.find('.collect-btn').exists()).toBe(true)
+ })
})