- 新增多个 API 路由:`/api/customers`, `/api/products`, `/api/advisors`, `/api/compliance`, `/api/staff`,支持客户信息、产品详情、理财师客户列表、合规判定及员工上下文查询。 - 引入平台服务层,封装核心只读操作,支持数据脱敏功能。 - 更新依赖注入,确保各 API 路由的权限控制与数据访问一致性。 - 添加相应的单元测试,确保新接口的功能完整性与稳定性。 此更新为代销平台提供了基础的 REST API 支持,增强了系统的可扩展性与可维护性。
29 lines
845 B
Python
29 lines
845 B
Python
"""理财师归属客户列表(Platform Service)。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from app.repository.core_ro import CoreReadOnlyRepository
|
|
|
|
|
|
def list_advisor_customers(
|
|
advisor_id: str,
|
|
core_ro: CoreReadOnlyRepository | None = None,
|
|
) -> dict[str, Any]:
|
|
repo = core_ro or CoreReadOnlyRepository()
|
|
customer_ids = repo.list_customers_by_advisor(advisor_id)
|
|
items = []
|
|
for cid in customer_ids:
|
|
row = repo.get_customer_l0(cid)
|
|
if row:
|
|
items.append(
|
|
{
|
|
"customer_id": cid,
|
|
"display_name": row.get("display_name"),
|
|
}
|
|
)
|
|
else:
|
|
items.append({"customer_id": cid, "display_name": None})
|
|
return {"items": items, "total": len(items), "advisor_id": advisor_id}
|