feat: add recharge workflow models and schema statuses

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-09-26 20:55:15 +08:00
1 parent 94dd52832b
commit bdd67d44d9
7 files changed
+147 -26

No files matched your search

+19
View File
@@ -20,6 +20,10 @@ _DEFAULT_WORKFLOWS = {
"wf_name": "报销单审批流程",
"remark": "报销申请默认审批流程",
},
"vehicle_recharge": {
"wf_name": "ETC/加油充值审批流程",
"remark": "充值申请默认审批流程",
},
}
@@ -162,6 +166,18 @@ class WorkflowService:
if not workflow:
raise ValueError("工作流不存在")
disburse_count = 0
for node_data in nodes:
action = (
node_data.get("action_type")
or node_data.get("actionType")
or "approve"
)
if action == "disburse":
disburse_count += 1
if disburse_count > 1:
raise ValueError("发放登记节点至多一个")
db.query(BxWorkflowNode).filter(
BxWorkflowNode.wf_id == wf_id,
BxWorkflowNode.tenant_no == tenant_no,
@@ -170,6 +186,7 @@ class WorkflowService:
created: List[BxWorkflowNode] = []
for node_data in nodes:
data = dict(node_data)
data.pop("actionType", None)
data["id"] = generate_uuid()
data["wf_id"] = wf_id
data["tenant_no"] = tenant_no
@@ -177,6 +194,8 @@ class WorkflowService:
data["create_dept_id"] = user.dept_id or ""
if data.get("approver_id") is not None:
data["approver_id"] = str(data["approver_id"]).strip() or None
if not data.get("action_type"):
data["action_type"] = "approve"
node = BxWorkflowNode(**data)
db.add(node)
created.append(node)