feat(shipping-notice): 增强订单抽取功能,添加进度事件和诊断运行管理,优化数据模型和访问控制

This commit is contained in:
hugo committed 2026-07-21 23:17:29 +08:00
1 parent ce26d6d0c4
commit c4095b08da
175 files changed
+13064 -1814

No files matched your search

@@ -918,6 +918,44 @@ def workspace_get_shipping_order_extraction_run(run_no: str):
return _ok(serialize_order_extraction_run(get_order_extraction_run(user_id=user.id, run_no=run_no)))
@workspace_shipping_notice_bp.route('/shipping-notice/order-extraction-runs/<run_no>/progress-events', methods=['GET'])
def workspace_list_shipping_order_extraction_progress_events(run_no: str):
"""返回当前用户展开状态卡时所需的脱敏业务阶段时间线。"""
user = _require_user()
from app.services.shipping_notice.order_extraction_run_service import list_user_order_extraction_progress_events
return _ok({'items': list_user_order_extraction_progress_events(user_id=user.id, run_no=run_no)})
@workspace_shipping_notice_bp.route('/shipping-notice/order-extraction-runs/<run_no>/seen', methods=['POST'])
def workspace_mark_shipping_order_extraction_run_seen(run_no: str):
"""确认当前用户已加载终态订单识别卡片;仅用于会话待查看提醒,不改变业务结果。"""
user = _require_user()
from app.services.shipping_notice.order_extraction_run_service import mark_order_extraction_run_seen
seen = mark_order_extraction_run_seen(user_id=user.id, run_no=run_no)
db.session.commit()
return _ok({'seen': seen})
@workspace_shipping_notice_bp.route('/shipping-notice/order-extraction-runs/<run_no>/retry', methods=['POST'])
def workspace_retry_shipping_order_extraction_run(run_no: str):
"""复用原附件与冻结快照,重新入队当前用户失败的订单抽取 Run。"""
user = _require_user()
from app.services.shipping_notice.order_extraction_run_service import (
retry_order_extraction_run,
serialize_order_extraction_run,
)
run, reused = retry_order_extraction_run(user_id=user.id, run_no=run_no)
db.session.commit()
return ok(
{'run': serialize_order_extraction_run(run), 'reused': reused},
request_id=getattr(g, 'request_id', None),
status=202,
)
@workspace_shipping_notice_bp.route('/shipping-notice/order-extraction-runs', methods=['GET'])
def workspace_list_shipping_order_extraction_runs():
"""列出当前用户订单抽取 Run,可按 HXOPS 会话过滤。"""