feat(shipping-notice): 落地 XFA 统一视觉拆分确认门禁与处理投影收敛
闭合拆分预览令牌单次消费、样本 checksum 绑定与确认审计;正式提取改为 bindings-only。 同步统一标注工作台交互,并补齐进度投影/任务中心与迁移文档。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d2b3d74def
commit
84a881b554
195 files changed
+20269
-3463
No files matched your search
@@ -11,6 +11,8 @@ import type {
|
||||
ShippingOrderTaskSummary,
|
||||
ShippingProcessingProjection,
|
||||
ShippingProcessingStage,
|
||||
ShippingProcessingStageNode,
|
||||
ShippingProcessingStageNodeStatus,
|
||||
ShippingProcessingStatus,
|
||||
ShippingProcessingWorkItemType,
|
||||
} from '../types/shipping.api.types';
|
||||
@@ -76,6 +78,26 @@ function normalizeGate(raw: unknown): ProcessGateSummary | null {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 规范单个 stage_node(兼容 snake / camel)。
|
||||
*/
|
||||
function normalizeStageNode(raw: unknown): ShippingProcessingStageNode | null {
|
||||
if (!raw || typeof raw !== 'object') return null;
|
||||
const item = raw as Record<string, unknown>;
|
||||
const stage = readString(item, 'stage', 'stage') as ShippingProcessingStage;
|
||||
if (!stage) return null;
|
||||
const absoluteIndexRaw = item.absolute_index ?? item.absoluteIndex;
|
||||
const absoluteIndex = Number.isFinite(Number(absoluteIndexRaw))
|
||||
? Number(absoluteIndexRaw)
|
||||
: 0;
|
||||
const status = readString(item, 'status', 'status') as ShippingProcessingStageNodeStatus;
|
||||
return {
|
||||
stage,
|
||||
absoluteIndex,
|
||||
status: status || 'pending',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 将后端 / 混合字段投影规范为 ShippingProcessingProjection。
|
||||
* 核心逻辑:缺字段给安全默认值,保证四页面可渲染;非法输入返回 null。
|
||||
@@ -100,6 +122,10 @@ export function normalizeShippingProcessingProjection(
|
||||
const availableActions = Array.isArray(actionsRaw)
|
||||
? actionsRaw.map((action) => String(action || '').trim()).filter(Boolean)
|
||||
: [];
|
||||
const stageNodesRaw = item.stage_nodes ?? item.stageNodes;
|
||||
const stageNodes = Array.isArray(stageNodesRaw)
|
||||
? stageNodesRaw.map(normalizeStageNode).filter((row): row is ShippingProcessingStageNode => Boolean(row))
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
workItemType: (readString(item, 'work_item_type', 'workItemType') || 'order_task') as ShippingProcessingWorkItemType,
|
||||
@@ -107,6 +133,8 @@ export function normalizeShippingProcessingProjection(
|
||||
sourceType: (readNullableString(item, 'source_type', 'sourceType') || 'eml') as OrderIntakeSourceType,
|
||||
rootOrderTaskNo: readNullableString(item, 'root_order_task_no', 'rootOrderTaskNo'),
|
||||
shippingNoticeNo: readNullableString(item, 'shipping_notice_no', 'shippingNoticeNo'),
|
||||
runNo: readNullableString(item, 'run_no', 'runNo'),
|
||||
caseNo: readNullableString(item, 'case_no', 'caseNo'),
|
||||
conversationId: readNullableString(item, 'conversation_id', 'conversationId'),
|
||||
submissionNo: readString(item, 'submission_no', 'submissionNo'),
|
||||
intakeNo: readString(item, 'intake_no', 'intakeNo'),
|
||||
@@ -114,11 +142,13 @@ export function normalizeShippingProcessingProjection(
|
||||
stage: (readString(item, 'stage', 'stage') || 'upload_received') as ShippingProcessingStage,
|
||||
progressVersion: Number(item.progress_version ?? item.progressVersion ?? 0) || 0,
|
||||
lastActivityAt: readString(item, 'last_activity_at', 'lastActivityAt'),
|
||||
stageNodes: stageNodes?.length ? stageNodes : undefined,
|
||||
currentGate: normalizeGate(item.current_gate ?? item.currentGate),
|
||||
availableActions,
|
||||
sourceSummary: {
|
||||
emailSubject: readNullableString(summaryRaw, 'email_subject', 'emailSubject'),
|
||||
filename: readNullableString(summaryRaw, 'filename', 'filename'),
|
||||
documentId: Number(summaryRaw.document_id ?? summaryRaw.documentId ?? 0) || null,
|
||||
documentCount: Number(summaryRaw.document_count ?? summaryRaw.documentCount ?? 0) || 0,
|
||||
parsedDocumentCount: Number(summaryRaw.parsed_document_count ?? summaryRaw.parsedDocumentCount ?? 0) || 0,
|
||||
candidateCount: Number(summaryRaw.candidate_count ?? summaryRaw.candidateCount ?? 0) || 0,
|
||||
|
||||
Reference in new issue
Block a user