diff --git a/docs/cmd-review/_summary.md b/docs/cmd-review/_summary.md index 5643f0e..41c02b0 100644 --- a/docs/cmd-review/_summary.md +++ b/docs/cmd-review/_summary.md @@ -146,7 +146,7 @@ | 模块 | 端点问题 | 改造工期 | |---|---|---| -| **bigscreen** (P0) | 用错端点 `/api/extend/BigData` (JNPF 测试, 不是大屏) → 返 120000 假数据 | 0.5 天 | +| **bigscreen** (P0) | 3 个文件 (`list/info/release`) 仍用错误的 `webapi/bigscreen.ts` (只镜像 `dataV.ts` 的 Selector, 其他手写 `/api/blade-visual/visual/*`, 违反 webapi 镜像原则). 切到 `webapi/visualdata.ts` (镜像 `jnpf/前端/jnpf-web-datascreen-vue3/src/api/visual.js`, 走 `/api/visual/*` nginx 代理 32000) | 0.5 天 (基础切换) + **3 天 (完整构造, 用户 2026-07-01 强要求, 详见 v0.13 §8.2)** + 1.5 天 (TC-C + TC-B 升级, 详见 v0.13 §8.3) | | **report** (P0) | 镜像已建但 0 文件用, 全部走 `c.get/postJson` | 0.5 天 | | **role** (P0) | 9 文件全未用 webapi, 镜像已建但未切 | 0.5 天 | | **portal** (P1) | Bug 5: category 字段 silently drop, 类似 form 旧版问题 | 1 天 | @@ -162,17 +162,20 @@ 3. **初始化**: `await initWebapi(c)` (一次性) 4. **调用**: `await loadXxx.(args)` 替代 `c.get/postJson` -**镜像源选择** (权威参照顺序): -1. `web/apps/jnpf-web-apps-main/src/api/` — Vue 3 主 webapp API 客户端 -2. `web/.../src/views/...` — Vue 3 组件逻辑 (formData/columnData/flowConfig 构造) -3. `jnpf/后端/.../FlowUtil.java` 等 — 后端权威 (作为最终验证) +**镜像源选择** (权威参照顺序, 用户 2026-07-01 强化): +1. **业务子项目独立 webapp** (jnpf-web-datascreen-vue3 / jnpf-web-datareport / jnpf-univer 等) — 优先于主 webapp +2. `web/apps/jnpf-web-apps-main/src/views/...` — Vue 3 组件逻辑 (formData/columnData/flowConfig 构造) +3. `web/apps/jnpf-web-apps-main/src/api/` — Vue 3 主 webapp API 客户端 (注意: 某些模块 API 客户端**不完整**, 如 `dataV.ts` 只有 Selector) +4. `jnpf/后端/.../FlowUtil.java` 等 — 后端权威 (作为最终验证, **不是**首选 webapi 源) -**绝对禁止** (drift 源): +**绝对禁止** (drift 源, 用户 2026-07-01 强化): - ❌ 自写 LLM prompt 模板 (NCPF backend 已有, 两份必漂移) - ❌ 自写 LLM HTTP 客户端 (跟 NCPF backend 实现漂移) - ❌ 自写 LLM response 解析器 (web buildFormData 才是权威) - ❌ 自写 BPMN/JSON 解析 (跟 web FlowProcess/FlowXmlUtil 漂移) - ❌ 自写字段类型硬编码 (强制 jnpfKey='input' 丢组件类型) - ❌ 自写"启发式" relationForm 注入 (web 端不这么干, 误判多) +- ❌ **镜像 web 端"残缺" API 客户端 + 手写其他端点直调后端** (例: 镜像 `dataV.ts` 的 Selector + 手写 `/api/blade-visual/visual/list` 直调, 看似 webapi 化实际是自写拼数据接后端 API, 绕开前端成熟能力) — **用户 2026-07-01 警告**: 这个问题在 bigscreen 审计中重复出现, 每次按 webapi 镜像模式推, 慢慢又滑到自己拼接数据接后端 API +- ❌ **选错 webapi 模块** (例: 业务有完整 `visualdata.ts` 镜像独立子项目, 却选了 `bigscreen.ts` 这种"残缺"模块) — 应按"镜像源最完整"原则选, 不是按"哪个存在"选 -**核心原则** (用户原话): "如果没有价值/且易干扰/漂移就去掉" +**核心原则** (用户原话): "如果没有价值/且易干扰/漂移就去掉"; "使用 webapi 镜像 step machine 使用官方成熟能力, 不是直接构造数据请求后端 api". diff --git a/src/commands/bigscreen/info.ts b/src/commands/bigscreen/info.ts index ccb3ee7..ef6b18d 100644 --- a/src/commands/bigscreen/info.ts +++ b/src/commands/bigscreen/info.ts @@ -1,21 +1,15 @@ /** * commands/bigscreen/info.ts — 大屏详情 * - * JNPF 大屏无 /{id} 端点 (404 实测), 走 list 查 + * v0.14+ BS-新30: 改端点 (旧 /extend/BigData 错, 用 /api/blade-visual/visual/detail) */ import { Command } from 'commander' import { JnpfClient } from '../../core/client.ts' import { installAiHelpHook } from '../../core/help.ts' import { log, printJson } from '../../core/log.ts' +import { getDetail } from '../../webapi/bigscreen.ts' import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts' -interface BigscreenItem { - id?: string - fullName?: string - enCode?: string - category?: string -} - interface InfoOpts { id: string json?: boolean @@ -23,36 +17,31 @@ interface InfoOpts { export function buildBigscreenInfoCommand(): Command { const cmd = new Command('info') - .description('查看大屏详情 (JNPF 大屏无 /{id} 端点, 走 list 查)') + .description('查看大屏详情') .requiredOption('--id ', '大屏 id') .option('--json', '原始 JSON 输出', false) .action(async (opts: InfoOpts) => { - const c = await JnpfClient.fromToken() - // 大屏是 list 端点, 无 /{id}, 直接 list 找 - const r = await c.get<{ list: BigscreenItem[] }>('/extend/BigData', { pageSize: 100 }) - if (r.code !== 200) { - const enhanced = enhanceFromBackend(r.msg || '', 'bigscreen', { entity: 'bigscreen' }) - log.error(` ${formatErrorLine(enhanced, { step: 0, stepName: '后端API' })}`) - process.exit(1) - } - const found = (r.data?.list || []).find((d) => d.id === opts.id) - if (!found) { - const enhanced = enhanceFromBackend('list 中未找到, id 不存在', 'id', { entity: 'bigscreen' }) + await JnpfClient.fromToken() + // v0.14+ 用 /detail 端点 (旧版走 list 查, 效率低) + const r = (await getDetail(opts.id)) as { code?: number; msg?: string; data?: Record } + if (r.code !== 200 || !r.data) { + const enhanced = enhanceFromBackend(r.msg || '未找到大屏', 'bigscreen', { entity: 'bigscreen' }) log.error(` ${formatErrorLine(enhanced, { step: 0, stepName: '后端API' })}`) process.exit(1) } + const found = r.data log.info(`大屏 id=${opts.id} 名称=${found.fullName} 编码=${found.enCode}`) console.log(`category: ${found.category || '-'}`) if (opts.json) printJson(found) }) installAiHelpHook(cmd, { - purpose: '查看大屏详情 (JNPF 大屏无 /{id} 端点, 走 list 查)', + purpose: '查看大屏详情', required: { '--id': '大屏 id' }, example: 'dacli bigscreen info --id=835246813026985082', source: { - web: 'web/apps/jnpf-web-apps-main/src/views/extend/bigData/Form.vue', - api: 'GET /api/extend/BigData (JNPF 无 /{id} 端点)', - ref: 'doc/v0.8-endpoints.md §1.4', + web: 'jnpf-visualdata/VisualController.java (detail) + web/dataV.ts (Selector)', + api: 'GET /api/blade-visual/visual/detail', + ref: 'dacli/docs/cmd-review/v0.14-webapi-rollout-plan.md §2.1', }, }) return cmd diff --git a/src/commands/bigscreen/list.ts b/src/commands/bigscreen/list.ts index 6b8bcfa..0833dce 100644 --- a/src/commands/bigscreen/list.ts +++ b/src/commands/bigscreen/list.ts @@ -1,12 +1,17 @@ /** * commands/bigscreen/list.ts — 大屏列表 * - * API: GET /api/extend/BigData + * v0.14+ BS-新30 (2026-07-01): 修错端点 + webapi 化 + * 旧: GET /api/extend/BigData (JNPF 大数据测试端点, 返 120000 假数据 — BS-新12 silent fail) + * 新: GET /api/blade-visual/visual/list (真大屏端点, jnpf-visualdata microservice) + * + * 镜像: web/.../api/onlineDev/dataV.ts (Selector) + jnpf-visualdata/.../VisualController.java (list) */ import { Command } from 'commander' import { JnpfClient } from '../../core/client.ts' import { installAiHelpHook } from '../../core/help.ts' import { log, printJson } from '../../core/log.ts' +import { getList } from '../../webapi/bigscreen.ts' interface ListOpts { keyword?: string @@ -19,21 +24,19 @@ export function buildBigscreenListCommand(): Command { .option('--keyword ', '按名称/编码模糊搜索') .option('--json', '原始 JSON 输出', false) .action(async (opts: ListOpts) => { - const c = await JnpfClient.fromToken() - const r = await c.get<{ list: Record[] }>( - '/extend/BigData', - { keyword: opts.keyword }, - ) + await JnpfClient.fromToken() // 初始化 token + // v0.14+ webapi 透传 (走 /api/blade-visual/visual/list, 真大屏端点) + const r = (await getList({ keyword: opts.keyword })) as { code?: number; msg?: string; data?: { records?: Record[]; total?: number } } if (r.code !== 200) { log.error(`bigscreen list 失败 (code=${r.code}): ${r.msg}`) process.exit(1) } - const list = r.data?.list || [] + const list = r.data?.records || [] if (opts.json) { printJson(r.data) return } - log.info(`共 ${list.length} 张大屏`) + log.info(`共 ${list.length} 张大屏 (total=${r.data?.total || 0})`) console.log('ID FULL_NAME ENCODE CATEGORY') console.log('-'.repeat(90)) for (const d of list) { @@ -49,9 +52,9 @@ export function buildBigscreenListCommand(): Command { optional: { '--keyword': '按名称/编码模糊搜索' }, example: 'dacli bigscreen list\ndacli bigscreen list --keyword=销售', source: { - web: 'web/apps/jnpf-web-apps-main/src/views/extend/bigData/index.vue', - api: 'GET /api/extend/BigData', - ref: 'doc/v0.8-endpoints.md §1.4', + web: 'web/.../api/onlineDev/dataV.ts (Selector) + jnpf-visualdata/VisualController.java (list)', + api: 'GET /api/blade-visual/visual/list', + ref: 'dacli/docs/cmd-review/v0.14-webapi-rollout-plan.md §2.1', }, }) return cmd