任总 2026-09-28 13:38 放行「4 和 5」→ 落笔最小实现: - 新表 quality_rule_config(39 项:37 规则级 + 2 全局)= 唯一配置源 - 三层解析:账套行 → 全账套模板(entity_id=0) → 代码内置默认(=清单 §7 建议值,零行为差异) - 端点 /api/cma/data-quality/rule-config(GET/PUT)+ /history + /meta:写入仅 ceo/it, platform 级仅 it,演示账套(functional)写禁,变更落 operation_logs 同事务 - 数据质量页新增「规则配置」只读 Tab(懒加载) - 唯一行为变更:污染判定去掉 sync —— 酣客 zxt-sync 系统迁入数据不再被误判(口径可配置) - 出厂默认落库脚本 scripts/seed_dq_rule_config.py(--check/--apply/--rollback,幂等 39/0) - 回归:新套件 35 例 + 存量 1508 passed(唯一 FAILED 为他人未完成 migrate_subjects_entity_id_20260923.py 改动所致,HEAD 干净树同例通过) 生产写(DDL/seed)与 push 均走审批门:DDL=54434656 push=3bd00774
This commit is contained in:
@@ -181,6 +181,36 @@ class OperationLog(Base):
|
||||
created_at = Column(DateTime, server_default=func.now())
|
||||
|
||||
|
||||
class QualityRuleConfig(Base):
|
||||
"""DAMA 数据质量治理规则可配置项(财务七规则)— ASK-20260928-05
|
||||
|
||||
逐 param 一行;`entity_id=0` = **全账套模板行**(不参与具体账套取数)。
|
||||
读取三层:账套行 → 模板行(0) → 代码内置默认(禁止跨账套回退);
|
||||
规格/默认值/边界/校验的**单一来源** = `app/dq_rule_config.py`(本模型只存行)。
|
||||
DDL 走部署链特权迁移步 `backend/scripts/db_migrate.py --apply`(生产写审批范围)。
|
||||
"""
|
||||
__tablename__ = "quality_rule_config"
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
entity_id = Column(Integer, nullable=False, default=0, index=True,
|
||||
comment="账套;0=全账套默认模板")
|
||||
rule_key = Column(String(50), nullable=False, comment="七规则 key 或 global(全局项)")
|
||||
param_key = Column(String(50), nullable=False, comment="参数名(见 dq_rule_config.SPEC)")
|
||||
param_value = Column(String(500), nullable=False, comment="值(JSON 序列化字符串)")
|
||||
value_type = Column(String(20), nullable=False, default="int",
|
||||
comment="int/float/bool/str/json/enum")
|
||||
open_level = Column(String(10), nullable=False, default="entity",
|
||||
comment="entity=账套级(ceo/it) / platform=平台级(仅it)")
|
||||
is_default = Column(Boolean, nullable=False, default=False,
|
||||
comment="1=出厂默认行(用于「恢复默认」与审计对照)")
|
||||
description = Column(String(500), nullable=True, comment="参数说明(面向使用者)")
|
||||
updated_by = Column(String(50), nullable=True, comment="最后修改人 users.username")
|
||||
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
|
||||
created_at = Column(DateTime, server_default=func.now())
|
||||
__table_args__ = (
|
||||
UniqueConstraint("entity_id", "rule_key", "param_key", name="uq_rule_param"),
|
||||
)
|
||||
|
||||
|
||||
class NotificationChannel(Base):
|
||||
"""通知渠道配置"""
|
||||
__tablename__ = "notification_channels"
|
||||
|
||||
Reference in New Issue
Block a user