refactor(core,ai): 调整模块导入路径并移除废弃文件

- 修复 scheduler.py 中的导入路径错误,将 reports.service
  改为 reports.services
- 移除废弃的 app/core/background/task_queue.py 文件
- 移除废弃的 app/modules/ai_agent/adapters.py 文件
- 修复 ai_memory/service.py 中的导入路径错误,将
  events.service 改为 events.services
```
This commit is contained in:
2026-07-09 18:50:52 +08:00
parent dc8605ce3f
commit bf309ecdf7
83 changed files with 4871 additions and 4153 deletions

View File

@@ -0,0 +1,67 @@
from decimal import Decimal
from sqlalchemy import Integer, Numeric, String, Text
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import Base
from app.modules.business.constants import (
AccountType,
RiskLevel,
StatusValue,
)
from app.modules.business.models.common import TimestampMixin
class Procurement(Base, TimestampMixin):
__tablename__ = "procurements"
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
code: Mapped[str] = mapped_column(String(64), unique=True, index=True)
name: Mapped[str] = mapped_column(String(255), index=True)
applicant: Mapped[str | None] = mapped_column(String(128), nullable=True)
project_code: Mapped[str | None] = mapped_column(String(64), nullable=True, index=True)
supplier_name: Mapped[str | None] = mapped_column(String(255), nullable=True)
budget_subject: Mapped[str | None] = mapped_column(String(128), nullable=True)
expected_amount: Mapped[Decimal] = mapped_column(Numeric(14, 2), default=0)
actual_amount: Mapped[Decimal] = mapped_column(Numeric(14, 2), default=0)
approval_status: Mapped[str] = mapped_column(String(64), default=StatusValue.DRAFT, index=True)
delivery_status: Mapped[str] = mapped_column(
String(64),
default=StatusValue.UNDELIVERED,
index=True,
)
payment_status: Mapped[str] = mapped_column(String(64), default=StatusValue.UNPAID, index=True)
comparison_summary: Mapped[str | None] = mapped_column(Text, nullable=True)
class Expense(Base, TimestampMixin):
__tablename__ = "expenses"
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
code: Mapped[str] = mapped_column(String(64), unique=True, index=True)
expense_type: Mapped[str] = mapped_column(String(128), index=True)
amount: Mapped[Decimal] = mapped_column(Numeric(14, 2), default=0)
applicant: Mapped[str | None] = mapped_column(String(128), nullable=True)
department: Mapped[str | None] = mapped_column(String(128), nullable=True, index=True)
project_code: Mapped[str | None] = mapped_column(String(64), nullable=True, index=True)
budget_subject: Mapped[str | None] = mapped_column(String(128), nullable=True)
payment_account: Mapped[str | None] = mapped_column(String(128), nullable=True)
invoice_status: Mapped[str] = mapped_column(
String(64),
default=StatusValue.INVOICE_NOT_RECEIVED,
)
approval_status: Mapped[str] = mapped_column(String(64), default=StatusValue.DRAFT, index=True)
payment_status: Mapped[str] = mapped_column(String(64), default=StatusValue.UNPAID, index=True)
class FundAccount(Base, TimestampMixin):
__tablename__ = "fund_accounts"
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
code: Mapped[str] = mapped_column(String(64), unique=True, index=True)
name: Mapped[str] = mapped_column(String(255), index=True)
account_type: Mapped[str] = mapped_column(String(64), default=AccountType.BANK)
current_balance: Mapped[Decimal] = mapped_column(Numeric(16, 2), default=0)
expected_receivable: Mapped[Decimal] = mapped_column(Numeric(16, 2), default=0)
expected_payable: Mapped[Decimal] = mapped_column(Numeric(16, 2), default=0)
safety_line: Mapped[Decimal] = mapped_column(Numeric(16, 2), default=0)
risk_level: Mapped[str] = mapped_column(String(32), default=RiskLevel.LOW, index=True)
note: Mapped[str | None] = mapped_column(Text, nullable=True)