feat(pl): allocate copy_seq_no on first driver plan share-to-group

Add ensure-copy-seq API and miniprogram clipboard prefix so each plan
gets a tenant-scoped fixed serial on first copy; cover allocation with
unit tests and refresh the backend graph.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-10-09 12:36:58 +08:00
1 parent 5357df1cc2
commit 811e6a129f
11 files changed
+21223 -13529

No files matched your search

+22
View File
@@ -82,6 +82,28 @@ def get_driver_plan_detail(
return success_response(page.model_dump(by_alias=True))
@router.post("/{plan_id}/ensure-copy-seq")
def ensure_driver_plan_copy_seq(
plan_id: str,
db: Session = Depends(get_db),
user: DbUserContext = Depends(get_db_current_user),
):
tenant_no = get_tenant_no(db, user.to_tenant_user_dict())
personnel = _resolve_personnel_or_empty(db, user, tenant_no)
if not personnel:
raise HTTPException(status_code=404, detail="未关联驾押人员,无法查看")
seq, err = drv_svc.ensure_copy_seq_for_driver(
db,
tenant_no=tenant_no,
plan_id=plan_id,
personnel_id=personnel.id,
)
if err or seq is None:
raise HTTPException(status_code=404, detail=err or "计划不存在")
db.commit()
return success_response({"copySeqNo": seq})
@router.post("/{plan_id}/feedback")
def save_driver_plan_feedback(
plan_id: str,