feat(invoice-check): 立账凭证检核增加收件人配置并迁移到chat页面

This commit is contained in:
sophie committed 2026-09-17 13:17:37 +08:00
1 parent 18e957545c
commit 7b80b4c395
72 files changed
+2705 -263

No files matched your search

@@ -3,7 +3,7 @@ backend/app/services/voucher_check/engine_persistence.py
用途:新引擎批次、主体、单文件结果与通知审计的写入。
依赖:models.voucher_check 新表。
逻辑:runner 在扫描完成后一次性 persist;旧 invoice_states 不再写入。
逻辑:runner 在扫描完成后一次性 persist;旧 invoice_states 不再写入。SQLite 测试库的 BigInteger 主键不会自增,persist_notification 会补 id。
"""
from __future__ import annotations
@@ -131,7 +131,7 @@ def persist_notification(
summary: dict[str, Any],
sent_at: datetime | None,
) -> VoucherCheckNotification:
"""写入或覆盖本批次通知审计(一个 run 一条)。"""
"""写入或覆盖本批次通知审计(一个 run 一条)。SQLite 测试库需显式补 BigInteger 主键。"""
row = (
db.session.query(VoucherCheckNotification)
.filter_by(run_id=run_id)
@@ -139,6 +139,10 @@ def persist_notification(
)
if row is None:
row = VoucherCheckNotification(run_id=run_id, created_at=datetime.utcnow())
bind = db.session.get_bind()
if bind is not None and bind.dialect.name == "sqlite":
max_id = db.session.query(db.func.max(VoucherCheckNotification.id)).scalar() or 0
row.id = int(max_id) + 1
db.session.add(row)
row.excel_filename = excel_filename
row.recipient_user_ids_json = recipient_user_ids