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

+2
View File
@@ -221,6 +221,7 @@ from app.models.user import LoginAudit, User, UserDefaultAgent, UserFavoriteAgen
from app.models.voucher_check import (
VoucherCheckFileResult,
VoucherCheckNotification,
VoucherCheckNotifyConfig,
VoucherCheckProfile,
VoucherCheckRun,
VoucherCheckSubject,
@@ -413,6 +414,7 @@ __all__ = [
'VoucherCheckSubject',
'VoucherCheckFileResult',
'VoucherCheckNotification',
'VoucherCheckNotifyConfig',
'ContractPaymentContract',
'ContractPaymentAttachment',
'ContractPaymentNode',
+27 -4
View File
@@ -1,9 +1,9 @@
"""
backend/app/models/voucher_check.py
用途:立账凭证检核 ORM(Profile / 批次 / 主体 / 单文件结果 / 企微通知)。
用途:立账凭证检核 ORM(Profile / 批次 / 主体 / 单文件结果 / 企微通知 / 按类型接收人)。
依赖:models.base.Base、schedule_runs。
逻辑:引擎写入 profiles/runs/subjects/file_results/notifications;工作台与查询服务只读这些表。
逻辑:引擎写入 profiles/runs/subjects/file_results/notifications;通知配置表供管理员维护文件类型接收人。
"""
from __future__ import annotations
@@ -17,6 +17,7 @@ from sqlalchemy import (
DateTime,
ForeignKey,
Index,
Integer,
JSON,
String,
Text,
@@ -158,13 +159,35 @@ class VoucherCheckFileResult(Base):
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, nullable=False)
class VoucherCheckNotifyConfig(Base):
"""按业务方保存文件类型 → 接收人;换人不改 Profile 版本。"""
__tablename__ = "voucher_check_notify_configs"
id: Mapped[int] = mapped_column(Integer, primary_key=True)
profile_code: Mapped[str] = mapped_column(String(32), nullable=False, unique=True)
recipients_json: Mapped[dict] = mapped_column(JSON, nullable=False, default=dict)
updated_by: Mapped[Optional[int]] = mapped_column(
Integer,
ForeignKey("users.id", ondelete="SET NULL"),
nullable=True,
)
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, nullable=False)
updated_at: Mapped[datetime] = mapped_column(
DateTime,
default=datetime.utcnow,
onupdate=datetime.utcnow,
nullable=False,
)
class VoucherCheckNotification(Base):
"""一个检核批次对应一条企微汇总通知审计。"""
"""一个检核批次对应一条企微缺件通知审计(可含多人分信摘要)。"""
__tablename__ = "voucher_check_notifications"
__table_args__ = (Index("ix_voucher_check_notifications_status", "send_status"),)
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
run_id: Mapped[int] = mapped_column(
BigInteger,
ForeignKey("voucher_check_runs.id", ondelete="CASCADE"),