Files
group_fqcd_jr/app/model/risk_questionnaire.py
T
张胜宇 e239eb778b docs: 品牌全量口径统一为「南方基金」+ 作废文档清理
1) 客服 Agent 四份交付文档 + 构建脚手架:品牌由包装占位 XX科技 / 旧名 南方财富
   统一为南方基金(热线 400-889-8899 / 官网 nffund.com),系统名改为「智能服务系统」;
   同步追加 §0.4 修订记录行,工程记录行保留原占位字面以支撑硬编码扫描验收。
2) 开发文档:清理 28 份已作废/残留文档(14 份移出归档 + 14 份仓库副本),
   新增《文档规整方案与开发前待决事项-2026-09-17》。
3) 客服agent 四份交付文档首次纳入本分支。
2026-09-17 15:15:22 +08:00

40 lines
2.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""开户风险问卷画像的模型出口(re-export)。
⚠️ 2026-09-12 修复的**重复定义缺陷**
===================================
本模块原先**自己定义**了一个 `ProfileSnapshot` 类,映射的却是主干
`app/model/profile.py` 里已有的同名表 `profile_snapshots`。
SQLAlchemy 不允许两个类映射同一张表,因此**任何同时导入本模块与
`app.model.profile` 的进程都会抛**:
InvalidRequestError: Table 'profile_snapshots' is already defined
for this MetaData instance.
**实测影响(不是理论风险)**:
- 单独导入 `app.main` / `app.worker.runtime` 都正常;但
`profile_assembly_service` 与 `risk_questionnaire_service` **同时**导入即崩。
- Worker 在同一个进程里既要处理 `profile.rebuild_requested`(走 `app.model.profile`),
又要处理投顾风险问卷(走本模块)——因此这是**会打挂 Worker 的缺陷**。
- 库里已留痕:`memory_sync_outbox` 中 `target_store='neo4j'` 的行
`last_error='InvalidRequestError'` 就是这个原因,不是图库故障。
**修法**:本模块不再重复定义,改为从 `app.model.profile` 转出(re-export)。
因此 `from app.model.risk_questionnaire import ProfileSnapshot` 的既有调用点
**无需改动**(4 处:`risk_questionnaire_repository`、`profile_governance_service`、
`risk_questionnaire_service` 与对应单测)。
**字段等价性核查**:原定义比 `app.model.profile` 多映射了一个 `current_customer_id`。
经全仓核查**无人使用**该属性(投顾线只用到 `id` / `customer_id` / `version` / `is_current`),
且 `app.model.profile` 明确注明该列由数据库维护、**故意不映射**,故不保留。
`app.model.profile` 的列类型(`CHAR(36)` / `CHAR(64)` / `Boolean`)与库中实际 DDL 一致,
比原定义的 `String(36)` / `String(64)` 更准确。
"""
from app.model.fund import FundRiskAssessment as RiskAssessment
from app.model.profile import ProfileSnapshot
__all__ = ["ProfileSnapshot", "RiskAssessment"]