feat(后端): 添加授权体系、系统监控与试用期计提

按 2026-11-02 需求补齐计划交付后端能力:
- 角色授权:权限目录化,接口统一准入校验,未登记默认拒绝;
  管理员判断改为按数据库角色重新判定,防止权限码持有者绕过
- 系统监控:单进程采集资源、请求与异常指标,分钟级聚合,
  阈值配置化;敏感配置增加 repr 保护,Redis 密码 URL 转义
- 试用期计提:按回款日判定并写入快照,年度结清与调整单联动;
  人员模型补试用期、离职日期与工资版本历史字段
- 计提模板:公式骨架受控,页面维护名称与参数绑定
- T+ 采集:自动化配置表与进度查询

内置角色禁停用保护对齐模块注释;核算规则版本提为常量并
补充批量核算失败堆栈日志。

影响范围:后端全部模块、数据库迁移 V22-V28
验证:uv run ruff check 通过;922 个单元测试全部通过;
集成测试因本机 MySQL 数据卷被其他容器锁定暂未运行
This commit is contained in:
liuwenxin committed 2026-11-03 11:20:55 +08:00
1 parent 02fb06e0af
commit 1461a8d113
149 files changed
+8736 -368

No files matched your search

+28
View File
@@ -60,6 +60,24 @@ class TPlusErrorQuery(PageQuery):
entity_type: EntityType | None = None
class TPlusEntityProgress(BaseModel):
entity_type: str
total_records: int | None = None
processed_records: int | None = None
status: str = "WAITING"
class TPlusProgressOut(BaseModel):
phase: str
total_records: int | None = None
processed_records: int = 0
percentage: float | None = None
active_entity: str | None = None
updated_at: datetime | None = None
elapsed_seconds: int = 0
entities: list[TPlusEntityProgress] = Field(default_factory=list)
class TPlusBatchOut(BaseModel):
"""批次列表不包含原始数据、源配置或数据库异常。"""
@@ -79,6 +97,7 @@ class TPlusBatchOut(BaseModel):
error_summary: str | None = None
trigger_type: str = "MANUAL"
automatic_attempt: int = 0
progress: TPlusProgressOut | None = None
class TPlusBatchDetailOut(TPlusBatchOut):
@@ -105,8 +124,16 @@ class TPlusAutomationAlert(BaseModel):
batch_no: str | None = None
class TPlusAutomationUpdate(BaseModel):
enabled: bool = Field(strict=True)
expected_version: int = Field(ge=0, strict=True)
class TPlusAutomationOverview(BaseModel):
enabled: bool = False
version: int = 0
editable: bool = False
configuration_origin: str = "ENVIRONMENT"
weekday: int = 0
time: str = "02:00"
timezone: str = "Asia/Shanghai"
@@ -125,6 +152,7 @@ class TPlusOverviewOut(BaseModel):
configuration_message: str
status_counts: dict[str, int]
total_staged_records: int = 0
current_batch: TPlusBatchOut | None = None
compatibility_status: str = "PENDING"
business_import_enabled: bool = False
latest_audit: dict | None = None