feat(file-check): 新增文件资产管理与清理功能,支持上传、查询、删除及下载

This commit is contained in:
hugo committed 2026-07-14 09:14:44 +08:00
1 parent 143e054d86
commit 729546a7b7
52 files changed
+3420 -34

No files matched your search

+45
View File
@@ -83,6 +83,12 @@ class ShippingTask(Base):
source_file_name: Mapped[Optional[str]] = mapped_column(String(255), nullable=True)
source_file_type: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
source_content_hash: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
source_asset_id: Mapped[Optional[int]] = mapped_column(ForeignKey('file_assets.id'), index=True, nullable=True)
source_intake_id: Mapped[Optional[int]] = mapped_column(
ForeignKey('shipping_notice_intakes.id'),
index=True,
nullable=True,
)
batch_index: Mapped[Optional[int]] = mapped_column(Integer, nullable=True)
batch_total: Mapped[Optional[int]] = mapped_column(Integer, nullable=True)
@@ -280,6 +286,45 @@ class ShippingTaskInventoryLink(Base):
)
class ShippingNoticeIntake(Base):
"""发货通知预解析接入记录(上传成功至正式建单前的异步解析阶段)。"""
__tablename__ = 'shipping_notice_intakes'
__table_args__ = (
UniqueConstraint('intake_no', name='uq_shipping_notice_intakes_intake_no'),
UniqueConstraint(
'asset_id',
'purpose',
'parser_version',
name='uq_shipping_notice_intakes_asset_purpose_parser',
),
Index('ix_shipping_notice_intakes_user_conversation_created', 'user_id', 'conversation_id', 'created_at'),
Index('ix_shipping_notice_intakes_parse_status_created', 'parse_status', 'created_at'),
Index('ix_shipping_notice_intakes_expires', 'expires_at'),
)
id: Mapped[int] = mapped_column(primary_key=True)
intake_no: Mapped[str] = mapped_column(String(64), nullable=False)
asset_id: Mapped[int] = mapped_column(ForeignKey('file_assets.id'), index=True, nullable=False)
user_id: Mapped[int] = mapped_column(ForeignKey('users.id'), index=True, nullable=False)
conversation_id: Mapped[Optional[str]] = mapped_column(String(100), nullable=True)
purpose: Mapped[str] = mapped_column(String(32), default='shipping_notice', nullable=False)
parse_status: Mapped[str] = mapped_column(String(32), default='created', nullable=False, index=True)
extracted_text: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
structured_result_json: Mapped[Optional[dict]] = mapped_column(JSON, nullable=True)
parse_warnings_json: Mapped[Optional[list]] = mapped_column(JSON, nullable=True)
parser_version: Mapped[str] = mapped_column(String(32), nullable=False)
parse_job_id: Mapped[Optional[int]] = mapped_column(nullable=True, index=True)
error_code: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
error_message: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
consumed_at: Mapped[Optional[datetime]] = mapped_column(DateTime, nullable=True)
consumed_batch_id: Mapped[Optional[int]] = mapped_column(ForeignKey('shipping_batches.id'), nullable=True)
consumed_task_id: Mapped[Optional[int]] = mapped_column(ForeignKey('shipping_tasks.id'), nullable=True)
expires_at: Mapped[Optional[datetime]] = mapped_column(DateTime, nullable=True)
created_at: Mapped[datetime] = mapped_column(default=datetime.utcnow, index=True)
updated_at: Mapped[datetime] = mapped_column(default=datetime.utcnow, onupdate=datetime.utcnow)
class ShippingInventoryMapping(Base):
"""客户库存 Excel 表头 → 标准字段的列映射缓存(按 customer_code + header_hash 去重)。"""