feat(shipping-notice): 收敛复核状态隔离、STP 重试幂等与 XFA 合成预览标注

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
hugoandCursor committed 2026-08-07 02:58:28 +08:00
1 parent 84a881b554
commit 74270adc22
149 files changed
+20111 -3871

No files matched your search

@@ -1,6 +1,6 @@
/**
* features/admin/api/shipping-order-document-profile.api.ts
* 用途:订单文档 Profile 管理、MinerU 样本选择、XFA 统一建议/视觉绑定与发布 API。
* 用途:订单文档 Profile 管理、MinerU 样本选择、XFA 统一建议/视觉绑定/合成预览与发布 API。
* 依赖:shared/api/client、auth headers、Profile DTO。
* 逻辑:页面只使用结构化接口;结构指纹和 HTML 始终由后端持有;XFA suggest/preview 零写 Draft。
*/
@@ -291,6 +291,78 @@ export const previewOrderProfileSampleXfaValue = (
{ method: 'POST', body: JSON.stringify({ path_id: pathId, reveal: Boolean(options?.reveal) }), ...jsonAuth() },
);
/** 生成或复用绑定冻结 Analysis 的 XFA 合成预览(身份 + 页元数据,不含大图)。 */
export const requestOrderProfileSampleXfaSyntheticPreview = (
documentId: number,
options?: { force?: boolean },
) => requestJson<import('../types/shipping-order-document-profile.types').XfaSyntheticPreviewResponse>(
`/api/admin/shipping-notice/order-document-profile-samples/${documentId}/xfa/preview`,
{ method: 'POST', body: JSON.stringify({ force: Boolean(options?.force) }), ...jsonAuth() },
);
/** 列出最新 ready 合成预览页并重新签发短时 token。 */
export const listOrderProfileSampleXfaSyntheticPreviewPages = (documentId: number) =>
requestJson<import('../types/shipping-order-document-profile.types').XfaSyntheticPreviewResponse>(
`/api/admin/shipping-notice/order-document-profile-samples/${documentId}/xfa/preview/pages`,
auth(),
);
/**
* 合成预览单页 PNG 的受控路径(配合 preview_token 用 fetch 拉取 blob)。
* @param documentId 样本文档 ID
* @param pageNo 1-based 页码
*/
export const orderProfileSampleXfaSyntheticPreviewPagePath = (documentId: number, pageNo: number) =>
`/api/admin/shipping-notice/order-document-profile-samples/${documentId}/xfa/preview/pages/${pageNo}`;
/** 入队 XFA OCR 自动标记 Job(须合成预览 ready)。 */
export const enqueueOrderProfileXfaOcrAutomark = (
profileId: number,
payload: { document_id: number; force?: boolean },
) => requestJson<{ job_id: number; status: string; preview_render_checksum?: string }>(
`/api/admin/shipping-notice/order-document-profiles/${profileId}/xfa/automark`,
{ method: 'POST', body: JSON.stringify(payload), ...jsonAuth() },
);
/** 轮询 OCR 自动标记 Job 状态与建议。 */
export const getOrderProfileXfaOcrAutomarkJob = (profileId: number, jobId: number) =>
requestJson<{
job_id: number;
status: string;
suggestions?: Array<Record<string, unknown>>;
error_code?: string | null;
preview_render_checksum?: string | null;
}>(
`/api/admin/shipping-notice/order-document-profiles/${profileId}/xfa/automark/jobs/${jobId}`,
auth(),
);
/** 接受自动标记建议(high→confirmed;medium/low→suggested)。 */
export const acceptOrderProfileXfaOcrAutomarkSuggestion = (
profileId: number,
suggestionId: string,
payload: {
job_id?: number;
preview_render_checksum: string;
render_mode?: string;
browser_session_id?: string;
lease_token?: string;
},
) => requestJson<Record<string, unknown>>(
`/api/admin/shipping-notice/order-document-profiles/${profileId}/xfa/automark/suggestions/${encodeURIComponent(suggestionId)}/accept`,
{ method: 'POST', body: JSON.stringify(payload), ...jsonAuth() },
);
/** 拒绝自动标记建议。 */
export const rejectOrderProfileXfaOcrAutomarkSuggestion = (
profileId: number,
suggestionId: string,
payload?: { job_id?: number; browser_session_id?: string; lease_token?: string },
) => requestJson<Record<string, unknown>>(
`/api/admin/shipping-notice/order-document-profiles/${profileId}/xfa/automark/suggestions/${encodeURIComponent(suggestionId)}/reject`,
{ method: 'POST', body: JSON.stringify(payload || {}), ...jsonAuth() },
);
/** 预览拆分规则并签发确认令牌;默认脱敏,reveal 需敏感读权限。 */
export const previewOrderProfileSampleXfaSplitRules = (
documentId: number,
@@ -347,7 +419,7 @@ export const suggestOrderProfileXfaVisualBindings = (
{ method: 'POST', body: JSON.stringify(payload), ...jsonAuth() },
);
/** 确认视觉绑定;须携带 Lease / operation_id。 */
/** 确认视觉绑定;须携带 Lease / operation_id / 合成预览证据。 */
export const confirmOrderProfileXfaVisualBinding = (
profileId: number,
bindingId: string,
@@ -357,6 +429,8 @@ export const confirmOrderProfileXfaVisualBinding = (
browser_session_id: string;
lease_token: string;
operation_id: string;
preview_render_checksum?: string | null;
render_mode?: string | null;
},
) => requestJson<import('../types/shipping-order-document-profile.types').XfaVisualBindingMutationResponse>(
`/api/admin/shipping-notice/order-document-profiles/${profileId}/xfa/visual-bindings/${encodeURIComponent(bindingId)}/confirm`,