feat: add document versioning and list API
This commit is contained in:
@@ -5,7 +5,7 @@ from fastapi import File, Form, UploadFile
|
||||
from fastapi_common.fastapi_common_web.controller import BaseController
|
||||
from fastapi_common.fastapi_common_web.domain.responses import Result
|
||||
|
||||
from fastapi_modules.fastapi_leaudit.domian.vo.documentVo import DocumentUploadVO
|
||||
from fastapi_modules.fastapi_leaudit.domian.vo.documentVo import DocumentListPageVO, DocumentUploadVO
|
||||
from fastapi_modules.fastapi_leaudit.services import IDocumentService
|
||||
from fastapi_modules.fastapi_leaudit.services.impl.documentServiceImpl import DocumentServiceImpl
|
||||
|
||||
@@ -22,11 +22,11 @@ class DocumentController(BaseController):
|
||||
file: UploadFile = File(..., description="上传文档"),
|
||||
typeId: int | None = Form(None, description="文档类型ID"),
|
||||
typeCode: str | None = Form(None, description="文档类型编码"),
|
||||
bizDocumentId: int | None = Form(None, description="业务文档ID"),
|
||||
region: str = Form("default", description="所属地区"),
|
||||
fileRole: str = Form("primary", description="文件角色"),
|
||||
createdBy: int | None = Form(None, description="上传用户ID"),
|
||||
autoRun: bool = Form(False, description="是否上传后自动触发评查"),
|
||||
speed: str = Form("normal", description="执行速度档位:urgent/normal"),
|
||||
):
|
||||
"""上传文档并建立评查输入。"""
|
||||
Content = await file.read()
|
||||
@@ -36,10 +36,32 @@ class DocumentController(BaseController):
|
||||
ContentType=file.content_type,
|
||||
TypeId=typeId,
|
||||
TypeCode=typeCode,
|
||||
BizDocumentId=bizDocumentId,
|
||||
Region=region,
|
||||
FileRole=fileRole,
|
||||
CreatedBy=createdBy,
|
||||
AutoRun=autoRun,
|
||||
Speed=speed,
|
||||
)
|
||||
return Result.success(data=Data)
|
||||
|
||||
@self.router.get("/documents/list", response_model=Result[DocumentListPageVO])
|
||||
async def ListDocuments(
|
||||
page: int = 1,
|
||||
pageSize: int = 20,
|
||||
keyword: str | None = None,
|
||||
typeCode: str | None = None,
|
||||
region: str | None = None,
|
||||
processingStatus: str | None = None,
|
||||
resultStatus: str | None = None,
|
||||
):
|
||||
"""获取文档列表(仅返回最新版本,附历史版本摘要)。"""
|
||||
Data = await self.DocumentService.ListDocuments(
|
||||
Page=page,
|
||||
PageSize=pageSize,
|
||||
Keyword=keyword,
|
||||
TypeCode=typeCode,
|
||||
Region=region,
|
||||
ProcessingStatus=processingStatus,
|
||||
ResultStatus=resultStatus,
|
||||
)
|
||||
return Result.success(data=Data)
|
||||
|
||||
Reference in New Issue
Block a user