feat: update audit platform workspace

This commit is contained in:
wren
2026-05-25 09:50:01 +08:00
parent ba8e93c0d3
commit 68d0b4c878
73 changed files with 12196 additions and 367 deletions
@@ -101,6 +101,7 @@ class GovdocServiceImpl(IGovdocService):
self,
file: UploadFile,
typeId: int | None = None,
entryModuleId: int | None = None,
region: str | None = None,
tenantCode: str | None = None,
autoRun: bool = True,
@@ -229,11 +230,15 @@ class GovdocServiceImpl(IGovdocService):
text(
"""
UPDATE leaudit_documents
SET engine_type = 'govdoc'
SET engine_type = 'govdoc',
entry_module_id = COALESCE(:entry_module_id, entry_module_id)
WHERE id = :document_id
"""
),
{"document_id": document.Id},
{
"document_id": document.Id,
"entry_module_id": int(entryModuleId) if entryModuleId is not None and int(entryModuleId) > 0 else None,
},
)
await session.commit()
@@ -273,6 +278,8 @@ class GovdocServiceImpl(IGovdocService):
fileExt: str | None = None,
region: str | None = None,
tenantCode: str | None = None,
entryModuleId: int | None = None,
typeIds: list[int] | None = None,
status: str | None = None,
resultStatus: str | None = None,
createdBy: int | None = None,
@@ -327,6 +334,13 @@ class GovdocServiceImpl(IGovdocService):
if normalizedExt:
filters.append("LOWER(COALESCE(f.file_ext, '')) = :file_ext")
params["file_ext"] = normalizedExt
normalizedTypeIds = [int(typeId) for typeId in (typeIds or []) if int(typeId) > 0]
if normalizedTypeIds:
filters.append("d.type_id = ANY(:type_ids)")
params["type_ids"] = normalizedTypeIds
if entryModuleId is not None and int(entryModuleId) > 0:
filters.append("COALESCE(d.entry_module_id, dt.entry_module_id) = :entry_module_id")
params["entry_module_id"] = int(entryModuleId)
if status:
filters.append("COALESCE(d.processing_status, '') = :status")
params["status"] = status.strip()
@@ -420,6 +434,8 @@ class GovdocServiceImpl(IGovdocService):
AND f.deleted_at IS NULL
LEFT JOIN govdoc_runs gr
ON gr.id = d.current_run_id
LEFT JOIN leaudit_document_types dt
ON dt.id = d.type_id
LEFT JOIN (
SELECT
run_id,
@@ -1236,6 +1252,10 @@ class GovdocServiceImpl(IGovdocService):
""",
"""
ALTER TABLE leaudit_documents
ADD COLUMN IF NOT EXISTS entry_module_id BIGINT
""",
"""
ALTER TABLE leaudit_documents
ADD COLUMN IF NOT EXISTS engine_type VARCHAR(32) NOT NULL DEFAULT 'leaudit'
""",
"""