包含多个会话的累积代码变更: - backend: AI 聊天服务、触发器调度、认证增强、WebSocket、调度器最小间隔 - admin-web: ETL 状态页、任务管理、调度配置、登录优化 - miniprogram: 看板页面、聊天集成、UI 组件、导航更新 - etl: DWS 新任务(finance_area_daily/board_cache)、连接器增强 - tenant-admin: 项目初始化 - db: 19 个迁移脚本(etl_feiqiu 11 + zqyy_app 8) - packages/shared: 枚举和工具函数更新 - tools: 数据库工具、报表生成、健康检查 - docs: PRD/架构/部署/合约文档更新 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
55 lines
1.8 KiB
Python
55 lines
1.8 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""
|
||
小程序绩效路由 —— 绩效概览、绩效明细。
|
||
|
||
端点清单:
|
||
- GET /api/xcx/performance — 绩效概览(PERF-1)
|
||
- GET /api/xcx/performance/records — 绩效明细(PERF-2)
|
||
|
||
所有端点均需 JWT(approved 状态)。
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from fastapi import APIRouter, Depends, Query
|
||
|
||
from app.auth.dependencies import CurrentUser
|
||
from app.middleware.permission import require_approved, require_permission
|
||
from app.schemas.xcx_performance import (
|
||
PerformanceOverviewResponse,
|
||
PerformanceRecordsResponse,
|
||
)
|
||
from app.services import performance_service
|
||
from app.trace.decorators import trace_service
|
||
|
||
router = APIRouter(prefix="/api/xcx/performance", tags=["小程序绩效"])
|
||
|
||
|
||
@router.get("", response_model=PerformanceOverviewResponse)
|
||
@trace_service("获取绩效概览", "Get performance overview")
|
||
async def get_performance_overview(
|
||
year: int = Query(...),
|
||
month: int = Query(..., ge=1, le=12),
|
||
# CHANGE 2026-03-27 | 权限改造 W4:绩效跟任务走
|
||
user: CurrentUser = Depends(require_permission("view_tasks")),
|
||
):
|
||
"""绩效概览(PERF-1)。"""
|
||
return await performance_service.get_overview(
|
||
user.user_id, user.site_id, year, month
|
||
)
|
||
|
||
|
||
@router.get("/records", response_model=PerformanceRecordsResponse)
|
||
@trace_service("获取绩效明细", "Get performance records")
|
||
async def get_performance_records(
|
||
year: int = Query(...),
|
||
month: int = Query(..., ge=1, le=12),
|
||
page: int = Query(1, ge=1),
|
||
page_size: int = Query(20, ge=1, le=100),
|
||
user: CurrentUser = Depends(require_permission("view_tasks")),
|
||
):
|
||
"""绩效明细(PERF-2)。"""
|
||
return await performance_service.get_records(
|
||
user.user_id, user.site_id, year, month, page, page_size
|
||
)
|