feat(platform): close AI expense value loop
Add tenant-safe value, telemetry, connector, commercial, and production-readiness foundations.
This commit is contained in:
@@ -17,6 +17,7 @@ from app.models.approval_task import ApprovalTask, ApprovalTaskEvent
|
||||
from app.models.employee import Employee
|
||||
from app.models.financial_record import ExpenseClaim
|
||||
from app.models.role import Role
|
||||
from app.models.tenant import Tenant
|
||||
from app.schemas.approval_task import ApprovalTaskAssignmentAction
|
||||
from app.services.approval_task_actions import ApprovalTaskActionService
|
||||
from app.services.approval_task_lifecycle import ApprovalTaskLifecycleService
|
||||
@@ -138,6 +139,16 @@ def _seed_case(
|
||||
delegates: int,
|
||||
) -> tuple[str, CurrentUserContext, list[str]]:
|
||||
with factory() as db:
|
||||
if db.get(Tenant, TENANT_ID) is None:
|
||||
db.add(
|
||||
Tenant(
|
||||
tenant_id=TENANT_ID,
|
||||
tenant_code=TENANT_ID,
|
||||
name="审批任务并发探针租户",
|
||||
status="active",
|
||||
)
|
||||
)
|
||||
db.flush()
|
||||
role = db.scalar(select(Role).where(Role.role_code == "manager"))
|
||||
if role is None:
|
||||
role = Role(
|
||||
@@ -147,6 +158,7 @@ def _seed_case(
|
||||
)
|
||||
manager = Employee(
|
||||
id=f"manager-{suffix}",
|
||||
tenant_id=TENANT_ID,
|
||||
employee_no=f"M-{suffix}",
|
||||
name="并发审批经理",
|
||||
email=f"manager-{suffix}@example.com",
|
||||
@@ -155,6 +167,7 @@ def _seed_case(
|
||||
delegate_rows = [
|
||||
Employee(
|
||||
id=f"delegate-{suffix}-{index}",
|
||||
tenant_id=TENANT_ID,
|
||||
employee_no=f"D-{suffix}-{index}",
|
||||
name=f"委托审批人{index + 1}",
|
||||
email=f"delegate-{suffix}-{index}@example.com",
|
||||
@@ -164,6 +177,7 @@ def _seed_case(
|
||||
]
|
||||
claimant = Employee(
|
||||
id=f"claimant-{suffix}",
|
||||
tenant_id=TENANT_ID,
|
||||
employee_no=f"E-{suffix}",
|
||||
name="并发报销申请人",
|
||||
email=f"claimant-{suffix}@example.com",
|
||||
@@ -172,6 +186,7 @@ def _seed_case(
|
||||
occurred_at = datetime.now(UTC) - timedelta(hours=1)
|
||||
claim = ExpenseClaim(
|
||||
id=f"claim-{suffix}",
|
||||
tenant_id=TENANT_ID,
|
||||
claim_no=f"RE-CONCURRENT-{suffix}",
|
||||
employee=claimant,
|
||||
employee_name=claimant.name,
|
||||
|
||||
Reference in New Issue
Block a user