feat: auto-queue submitted portal orders
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled

This commit is contained in:
Hermes Agent
2026-06-14 23:15:05 +08:00
parent 7fe4ddcbc4
commit 98b50893e2
4 changed files with 16 additions and 11 deletions

View File

@@ -284,11 +284,19 @@ def submit_order_info(
updates["candidate_interests"] = payload.candidate_interests
if payload.guardian_notes is not None:
updates["notes"] = payload.guardian_notes
if updates:
if updates or (payload.mode == "submit" and order.status == "paid"):
with OrdersDAO.connect(settings.orders_db_path) as dao:
dao.update(
order.id, updates, actor="portal", reason=f"portal_{record.status}"
)
if updates:
dao.update(
order.id, updates, actor="portal", reason=f"portal_{record.status}"
)
if payload.mode == "submit" and order.status == "paid":
dao.transition_status(
order.id,
"serving",
actor="portal",
reason="portal_submit_auto_queue",
)
refreshed_order = _resolve_order_from_token(token, settings)
refreshed_context = _build_portal_context(refreshed_order, settings)
return PortalIntakeResponse(

View File

@@ -86,11 +86,11 @@ def test_order_info_form_accepts_draft_and_submit(client, settings):
)
assert submit.status_code == 200, submit.text
assert submit.json()["intake_status"] == "submitted"
assert submit.json()["stage"] == "info_submitted"
assert submit.json()["stage"] == "processing"
status_page = client.get(f"/portal/{token}/status")
assert status_page.status_code == 200, status_page.text
assert "资料已提交" in status_page.text
assert "处理中" in status_page.text
def test_order_info_form_becomes_read_only_after_report_ready(

View File

@@ -93,13 +93,10 @@ def test_alipay_sim_public_user_e2e_flow(tmp_path, monkeypatch):
},
)
assert submit_info.status_code == 200, submit_info.text
assert submit_info.json()["stage"] == "info_submitted"
assert submit_info.json()["stage"] == "processing"
with OrdersDAO.connect(settings.orders_db_path) as dao:
order = dao.get(created["order_id"])
dao.transition_status(
order.id, "serving", actor="test", reason="processing"
)
report_path = tmp_path / "report.html"
pdf_path = tmp_path / "report.pdf"
report_path.write_text(

View File

@@ -69,7 +69,7 @@
未完成主链路包括:
- 真实支付接入与回调验签的线上 acceptance
- `info_submitted -> serving` 自动处理主链
- `info_submitted -> serving` 自动处理主链 +本地自动桥接 `info_submitted -> serving` 已落地;仍缺真实 worker/生成服务/线上调度收口
- 完整交付通知/发送器与调度
- 前台删除工单流程与更完整的产品化交互