feat: update audit platform workspace
This commit is contained in:
@@ -8,6 +8,7 @@ from __future__ import annotations
|
||||
from typing import Any
|
||||
|
||||
from fastapi import Depends, File, Form, Query, UploadFile
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
from fastapi_common.fastapi_common_security.security import verify_access_token
|
||||
from fastapi_common.fastapi_common_web.controller import BaseController
|
||||
@@ -15,6 +16,8 @@ from fastapi_common.fastapi_common_web.domain.responses import Result
|
||||
|
||||
from fastapi_modules.fastapi_leaudit.services import IGovdocService
|
||||
from fastapi_modules.fastapi_leaudit.services.impl.govdocServiceImpl import GovdocServiceImpl
|
||||
from fastapi_modules.fastapi_leaudit.services.impl.permissionServiceImpl import PermissionServiceImpl
|
||||
from fastapi_modules.fastapi_leaudit.services.permissionService import IPermissionService
|
||||
|
||||
|
||||
class GovdocController(BaseController):
|
||||
@@ -23,6 +26,7 @@ class GovdocController(BaseController):
|
||||
def __init__(self):
|
||||
super().__init__(prefix="/govdoc", tags=["内部公文"])
|
||||
self.GovdocService: IGovdocService = GovdocServiceImpl()
|
||||
self.PermissionService: IPermissionService = PermissionServiceImpl()
|
||||
|
||||
# ── 文档 ──────────────────────────────────────────
|
||||
|
||||
@@ -30,6 +34,7 @@ class GovdocController(BaseController):
|
||||
async def UploadDocument(
|
||||
file: UploadFile = File(...),
|
||||
typeId: int | None = Form(default=None),
|
||||
entry_module_id: int | None = Form(default=None, description="入口模块ID"),
|
||||
region: str | None = Form(default=None, description="兼容保留字段:租户展示值/旧地区"),
|
||||
tenant_code: str | None = Form(default=None, description="租户编码"),
|
||||
autoRun: bool = Form(default=True),
|
||||
@@ -41,9 +46,12 @@ class GovdocController(BaseController):
|
||||
|
||||
创建文档主档记录,engine_type 标记为 govdoc,可选自动触发审查。
|
||||
"""
|
||||
if not await self.PermissionService.CheckPermission(int(payload["user_id"]), "govdoc:document:create"):
|
||||
return JSONResponse(status_code=403, content={"code": 403, "msg": "当前用户没有上传公文权限", "data": None})
|
||||
result = await self.GovdocService.UploadDocument(
|
||||
file=file,
|
||||
typeId=typeId,
|
||||
entryModuleId=entry_module_id,
|
||||
region=region,
|
||||
tenantCode=tenant_code,
|
||||
autoRun=autoRun,
|
||||
@@ -61,6 +69,9 @@ class GovdocController(BaseController):
|
||||
fileExt: str | None = Query(default=None),
|
||||
region: str | None = Query(default=None, description="兼容保留字段:租户展示值/旧地区"),
|
||||
tenant_code: str | None = Query(default=None, description="租户编码"),
|
||||
entry_module_id: int | None = Query(default=None, description="按入口模块ID过滤"),
|
||||
type_ids: str | None = Query(default=None, description="按文档类型ID列表过滤,逗号分隔"),
|
||||
document_type_id: int | None = Query(default=None, description="按单个文档类型ID过滤"),
|
||||
status: str | None = Query(default=None),
|
||||
resultStatus: str | None = Query(default=None),
|
||||
createdBy: int | None = Query(default=None),
|
||||
@@ -72,6 +83,18 @@ class GovdocController(BaseController):
|
||||
|
||||
后端自动附加 engine_type='govdoc' 过滤条件。
|
||||
"""
|
||||
if not await self.PermissionService.CheckPermission(int(payload["user_id"]), "govdoc:document:read"):
|
||||
return JSONResponse(status_code=403, content={"code": 403, "msg": "当前用户没有查看公文列表权限", "data": None})
|
||||
typeIdList: list[int] = []
|
||||
if type_ids:
|
||||
typeIdList = [
|
||||
int(item.strip())
|
||||
for item in type_ids.split(",")
|
||||
if item.strip().isdigit() and int(item.strip()) > 0
|
||||
]
|
||||
if document_type_id is not None and document_type_id > 0:
|
||||
typeIdList.append(document_type_id)
|
||||
|
||||
result = await self.GovdocService.ListDocuments(
|
||||
page=page,
|
||||
pageSize=pageSize,
|
||||
@@ -79,6 +102,8 @@ class GovdocController(BaseController):
|
||||
fileExt=fileExt,
|
||||
region=region,
|
||||
tenantCode=tenant_code,
|
||||
entryModuleId=entry_module_id,
|
||||
typeIds=typeIdList or None,
|
||||
status=status,
|
||||
resultStatus=resultStatus,
|
||||
createdBy=createdBy,
|
||||
|
||||
Reference in New Issue
Block a user