fix: 自动创建KPI时补全所有NOT NULL字段(formula/data_source/data_owner/unit/entity_id)

This commit is contained in:
Hermes CI Fix
2026-07-29 18:07:57 +08:00
parent 9b973ab9a8
commit 47ef861488
6 changed files with 626 additions and 1 deletions
+20
View File
@@ -435,6 +435,26 @@ class BudgetDeviationAlert(Base):
created_at = Column(DateTime, server_default=func.now())
class AnalysisResult(Base):
"""财务Bot分析结论 — 带置信度评分"""
__tablename__ = "analysis_results"
id = Column(Integer, primary_key=True, index=True)
period = Column(String(20), nullable=False, comment="期间 YYYY-MM")
conclusion = Column(String(1000), nullable=False, comment="分析结论")
confidence = Column(Integer, nullable=False, comment="置信度 0-100")
data_source = Column(String(500), nullable=True, comment="数据来源")
calculation_logic = Column(String(1000), nullable=True, comment="计算逻辑")
comparable_benchmark = Column(String(500), nullable=True, comment="可比基准")
limitations = Column(String(1000), nullable=True, comment="局限说明")
has_actual = Column(Integer, default=0, comment="有实际值")
has_target = Column(Integer, default=0, comment="有目标值")
has_trend = Column(Integer, default=0, comment="有历史趋势")
has_review = Column(Integer, default=0, comment="有人工复核")
kpi_code = Column(String(50), nullable=True, comment="关联KPI编码")
kpi_name = Column(String(200), nullable=True, comment="关联KPI名称")
created_at = Column(DateTime, server_default=func.now())
class ForecastAccuracy(Base):
"""预测准确率 — 上期预测 vs 本期实际"""
__tablename__ = "forecast_accuracy"