179 lines
5.6 KiB
Python
179 lines
5.6 KiB
Python
"""文档服务接口。"""
|
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
from fastapi_modules.fastapi_leaudit.domian.vo.documentVo import (
|
|
ContractTemplateUploadVO,
|
|
DocumentDetailVO,
|
|
DocumentListPageVO,
|
|
DocumentStatusItemVO,
|
|
DocumentTypeRootCreateDTO,
|
|
DocumentTypeRootItemVO,
|
|
DocumentTypeRootUpdateDTO,
|
|
DocumentUpdateDTO,
|
|
DocumentTypeCreateDTO,
|
|
DocumentTypeItemVO,
|
|
DocumentTypeUpdateDTO,
|
|
DocumentUploadVO,
|
|
)
|
|
from fastapi_modules.fastapi_leaudit.domian.vo.reviewPointVo import (
|
|
DocumentConfirmVO,
|
|
ReviewPointAuditVO,
|
|
ReviewPointsAggregateVO,
|
|
)
|
|
|
|
|
|
class IDocumentService(ABC):
|
|
"""文档服务接口。"""
|
|
|
|
@abstractmethod
|
|
async def Upload(
|
|
self,
|
|
FileName: str,
|
|
FileContent: bytes,
|
|
ContentType: str | None,
|
|
TypeId: int | None = None,
|
|
TypeCode: str | None = None,
|
|
GroupId: int | None = None,
|
|
Region: str = "default",
|
|
FileRole: str = "primary",
|
|
CreatedBy: int | None = None,
|
|
Attachments: list[tuple[str, bytes, str | None]] | None = None,
|
|
AutoRun: bool = False,
|
|
Speed: str = "normal",
|
|
ReviewScope: str = "standard",
|
|
) -> DocumentUploadVO:
|
|
"""上传文档并建立 LeAudit document/file 记录。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def ListDocuments(
|
|
self,
|
|
CurrentUserId: int,
|
|
Page: int = 1,
|
|
PageSize: int = 20,
|
|
Keyword: str | None = None,
|
|
DocumentNumber: str | None = None,
|
|
TypeCode: str | None = None,
|
|
TypeIds: list[int] | None = None,
|
|
EntryModuleId: int | None = None,
|
|
Region: str | None = None,
|
|
ProcessingStatus: str | None = None,
|
|
ResultStatus: str | None = None,
|
|
AuditStatus: int | None = None,
|
|
UserId: int | None = None,
|
|
DateFrom: str | None = None,
|
|
DateTo: str | None = None,
|
|
) -> DocumentListPageVO:
|
|
"""获取文档列表(仅最新版本,附历史版本摘要)。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def GetDocument(self, CurrentUserId: int, Id: int) -> DocumentDetailVO:
|
|
"""获取单个文档详情,并执行数据隔离校验。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def GetReviewPoints(self, CurrentUserId: int, DocumentId: int) -> ReviewPointsAggregateVO:
|
|
"""获取评查详情页所需的聚合数据。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def AuditReviewPoint(
|
|
self,
|
|
CurrentUserId: int,
|
|
ReviewPointResultId: int,
|
|
Result: str,
|
|
Message: str,
|
|
) -> ReviewPointAuditVO:
|
|
"""更新单个评查点的人工审核状态。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def ConfirmReviewResults(self, CurrentUserId: int, DocumentId: int) -> DocumentConfirmVO:
|
|
"""确认文档评查结果。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def GetDocumentsStatus(self, CurrentUserId: int, Ids: list[int]) -> list[DocumentStatusItemVO]:
|
|
"""批量获取文档状态,并执行数据隔离校验。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def UpdateDocument(self, CurrentUserId: int, Id: int, Body: DocumentUpdateDTO) -> DocumentDetailVO:
|
|
"""更新文档元数据,并执行数据隔离校验。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def DeleteDocument(self, CurrentUserId: int, Id: int) -> None:
|
|
"""软删除文档,并执行数据隔离校验。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def AppendAttachments(
|
|
self,
|
|
CurrentUserId: int,
|
|
Id: int,
|
|
Files: list[tuple[str, bytes, str | None]],
|
|
) -> DocumentDetailVO:
|
|
"""为现有文档追加附件,并执行数据隔离校验。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def UploadContractTemplate(
|
|
self,
|
|
CurrentUserId: int,
|
|
DocumentId: int,
|
|
FileName: str,
|
|
FileContent: bytes,
|
|
ContentType: str | None,
|
|
ComparisonId: int | None = None,
|
|
) -> ContractTemplateUploadVO:
|
|
"""为现有合同文档上传结构对比模板,并持久化记录。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def ListDocumentTypes(self, Ids: list[int] | None = None, EntryModuleId: int | None = None) -> list[DocumentTypeItemVO]:
|
|
"""获取文档类型列表。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def GetDocumentType(self, Id: int) -> DocumentTypeItemVO:
|
|
"""获取文档类型详情。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def CreateDocumentType(self, Body: DocumentTypeCreateDTO) -> DocumentTypeItemVO:
|
|
"""创建文档类型。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def UpdateDocumentType(self, Id: int, Body: DocumentTypeUpdateDTO) -> DocumentTypeItemVO:
|
|
"""更新文档类型。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def DeleteDocumentType(self, Id: int) -> None:
|
|
"""删除文档类型(软删除)。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def ListDocumentTypeRoots(self, EntryModuleId: int | None = None) -> list[DocumentTypeRootItemVO]:
|
|
"""获取一级文档类型(业务大类)列表。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def GetDocumentTypeRoot(self, Id: int) -> DocumentTypeRootItemVO:
|
|
"""获取单个一级文档类型(业务大类)。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def CreateDocumentTypeRoot(self, Body: DocumentTypeRootCreateDTO) -> DocumentTypeRootItemVO:
|
|
"""创建一级文档类型(业务大类)。"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def UpdateDocumentTypeRoot(self, Id: int, Body: DocumentTypeRootUpdateDTO) -> DocumentTypeRootItemVO:
|
|
"""更新一级文档类型(业务大类)。"""
|
|
...
|