64dc85bd14
- inventory业务层下沉(薄路由+service orchestration模式): - customer/supplier/warehouse -> master_data_service - material_routes(价格历史/趋势/供应商关联)-> material_service - product_routes(CRUD/BOM/from-task跨模块桥接)-> product_service - dashboard_routes(首页统计/低库存预警)-> dashboard_service - inventory侧新增service回归覆盖(dashboard 2 / master_data 10 / material 10 / product 14),含跨模块桥接测试种子 - Pydantic v2弃用清零:全仓14处 class Config 全部迁移到 model_config = ConfigDict(from_attributes=True)(含 shared auth) - datetime.utcnow() 弃用清零:auth_service 3处统一改 datetime.now(timezone.utc) - 同步文档:STATUS / ROADMAP / TECH_DEBT(D12清偿)/ AGENTS 代码地图 测试基线:126 passed, 4 skipped(无deprecation warning) Co-Authored-By: Claude Code <noreply@anthropic.com>
29 lines
969 B
Python
29 lines
969 B
Python
"""
|
|
仪表盘路由模块
|
|
|
|
提供进销存系统的仪表盘统计数据,包括:
|
|
- 基础数据统计(产品数、供应商数、客户数、仓库数)
|
|
- 库存统计(总库存量、库存总价值)
|
|
- 订单统计(待处理采购订单、待处理销售订单)
|
|
- 低库存产品预警(库存量低于最小库存的产品列表)
|
|
|
|
路由前缀: /api/dashboard
|
|
"""
|
|
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from shared.database.database import get_db_session
|
|
from shared.services.auth_service import get_current_active_user
|
|
from shared.models.identity import User
|
|
from ..services.dashboard_service import dashboard_service
|
|
|
|
router = APIRouter(prefix="/dashboard", tags=["仪表盘"])
|
|
|
|
|
|
@router.get("")
|
|
async def get_dashboard(
|
|
db_session: AsyncSession = Depends(get_db_session),
|
|
current_user: User = Depends(get_current_active_user)
|
|
):
|
|
return await dashboard_service.get_dashboard(db_session)
|