feat: 账套模式全量接入 — 12个API entity_id统一走token解析链 + 前端登录选公司/切换器重签token

- 后端: kpis/bsc_layers/cash/predict/growth_quality/tax_compliance/data 的 entity_id 参数统一改为 Depends(get_entity_id)
- 前端: 拦截器删除自动附加X-Entity-Id/entity_id; 登录页公司选择器(按用户名授权过滤); 切换器改POST /auth/switch-entity重新签发token+整页刷新; ReportCenter同步改造
- 修复前后端不匹配: login-entities路由→/auth/entities; login响应entity_id取user.entity_id
This commit is contained in:
Hermes CI Fix
2026-08-11 11:29:39 +08:00
parent 12f9ae520b
commit 9986f38faa
11 changed files with 116 additions and 58 deletions
+3 -2
View File
@@ -10,6 +10,7 @@ from app.utils.cash_forecast_engine import (
calculate_accuracy, generate_scenario_suggestion,
)
from app.database import get_db
from app.deps import get_entity_id
from sqlalchemy.orm import Session
logger = logging.getLogger("cma.predict")
@@ -183,7 +184,7 @@ def api_cash_forecast(data: dict, db: Session = Depends(get_db)):
@router.get("/cash-forecast/history")
def api_cash_forecast_history(
entity_id: int = 1,
entity_id: int = Depends(get_entity_id),
days: int = 30,
db: Session = Depends(get_db),
):
@@ -206,7 +207,7 @@ def api_cash_forecast_history(
@router.get("/accuracy")
def api_forecast_accuracy(
entity_id: int = 1,
entity_id: int = Depends(get_entity_id),
db: Session = Depends(get_db),
):
"""预测准确率报表 — 上期预测 vs 本期实际"""