feat: restore source parity and harden agent runtime

This commit is contained in:
2026-06-22 11:17:26 +08:00
parent e33f08277b
commit 0793eb82d6
596 changed files with 168879 additions and 290 deletions
@@ -0,0 +1,68 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
电子签章数据模型
"""
from sqlalchemy import Column, String, Text, Integer, Boolean, Index, JSON
from app.base_model import BaseModel
class ElectronicSeal(BaseModel):
"""电子签章配置"""
__tablename__ = "electronic_seal"
# 基础信息
name = Column(String(100), nullable=False, comment="签章名称")
seal_type = Column(String(20), nullable=False, comment="类型: company/department/personal/contract/finance")
description = Column(Text, default="", comment="描述")
# 签章图片
seal_image_id = Column(String(36), nullable=False, comment="签章图片文件ID")
# 使用权限
owner_type = Column(String(20), default="all", comment="所有者类型: all/dept/role/user")
owner_ids = Column(JSON, nullable=True, comment="所有者ID列表")
# 使用范围
scope = Column(String(20), default="all", comment="使用范围: all/specific")
allowed_template_ids = Column(JSON, nullable=True, comment="允许使用的模板ID列表")
# 签章属性
width = Column(Integer, default=120, comment="宽度(像素)")
height = Column(Integer, default=120, comment="高度(像素)")
# 状态
status = Column(String(20), default="active", comment="状态: active/disabled")
__table_args__ = (
Index("ix_electronic_seal_seal_type", "seal_type"),
Index("ix_electronic_seal_status", "status"),
)
class SealUsageLog(BaseModel):
"""签章使用记录"""
__tablename__ = "seal_usage_log"
# 关联签章
seal_id = Column(String(36), nullable=False, index=True, comment="签章ID")
seal_name = Column(String(100), nullable=True, comment="签章名称")
# 关联文档
document_id = Column(String(36), nullable=False, index=True, comment="文档ID")
document_name = Column(String(200), nullable=True, comment="文档名称")
# 使用信息
user_id = Column(String(36), nullable=False, comment="使用人ID")
user_name = Column(String(100), nullable=True, comment="使用人姓名")
# 位置信息
position_x = Column(Integer, default=0, comment="X坐标")
position_y = Column(Integer, default=0, comment="Y坐标")
page_number = Column(Integer, default=1, comment="页码")
__table_args__ = (
Index("ix_seal_usage_log_seal_id", "seal_id"),
Index("ix_seal_usage_log_document_id", "document_id"),
)