feat: add review_scope field to distinguish cross-review vs standard documents
This commit is contained in:
@@ -31,6 +31,7 @@ class LeauditDocument(BaseModel):
|
|||||||
rootVersionId: Mapped[int | None] = mapped_column("root_version_id", BigInteger, comment="首版本文档ID")
|
rootVersionId: Mapped[int | None] = mapped_column("root_version_id", BigInteger, comment="首版本文档ID")
|
||||||
isLatestVersion: Mapped[bool] = mapped_column("is_latest_version", Boolean, default=True, comment="是否当前最新版本")
|
isLatestVersion: Mapped[bool] = mapped_column("is_latest_version", Boolean, default=True, comment="是否当前最新版本")
|
||||||
normalizedName: Mapped[str | None] = mapped_column("normalized_name", String(512), comment="归一化文件名(不含扩展名)")
|
normalizedName: Mapped[str | None] = mapped_column("normalized_name", String(512), comment="归一化文件名(不含扩展名)")
|
||||||
|
reviewScope: Mapped[str] = mapped_column("review_scope", String(32), default="standard", comment="评查范围: standard=个人评查 cross_review=交叉评查")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def create_new(cls, session: AsyncSession, **fields) -> "LeauditDocument":
|
async def create_new(cls, session: AsyncSession, **fields) -> "LeauditDocument":
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class IDocumentService(ABC):
|
|||||||
Attachments: list[tuple[str, bytes, str | None]] | None = None,
|
Attachments: list[tuple[str, bytes, str | None]] | None = None,
|
||||||
AutoRun: bool = False,
|
AutoRun: bool = False,
|
||||||
Speed: str = "normal",
|
Speed: str = "normal",
|
||||||
|
ReviewScope: str = "standard",
|
||||||
) -> DocumentUploadVO:
|
) -> DocumentUploadVO:
|
||||||
"""上传文档并建立 LeAudit document/file 记录。"""
|
"""上传文档并建立 LeAudit document/file 记录。"""
|
||||||
...
|
...
|
||||||
|
|||||||
@@ -891,6 +891,7 @@ class CrossReviewServiceImpl(ICrossReviewService):
|
|||||||
GroupId=resolvedGroupId,
|
GroupId=resolvedGroupId,
|
||||||
CreatedBy=CurrentUserId,
|
CreatedBy=CurrentUserId,
|
||||||
AutoRun=True,
|
AutoRun=True,
|
||||||
|
ReviewScope="cross_review",
|
||||||
)
|
)
|
||||||
|
|
||||||
async with GetAsyncSession() as session:
|
async with GetAsyncSession() as session:
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ class DocumentServiceImpl(IDocumentService):
|
|||||||
Attachments: list[tuple[str, bytes, str | None]] | None = None,
|
Attachments: list[tuple[str, bytes, str | None]] | None = None,
|
||||||
AutoRun: bool = False,
|
AutoRun: bool = False,
|
||||||
Speed: str = "normal",
|
Speed: str = "normal",
|
||||||
|
ReviewScope: str = "standard",
|
||||||
) -> DocumentUploadVO:
|
) -> DocumentUploadVO:
|
||||||
"""上传文档并建立 LeAudit document/file 记录。"""
|
"""上传文档并建立 LeAudit document/file 记录。"""
|
||||||
if not FileName:
|
if not FileName:
|
||||||
@@ -186,6 +187,7 @@ class DocumentServiceImpl(IDocumentService):
|
|||||||
rootVersionId=rootVersionId,
|
rootVersionId=rootVersionId,
|
||||||
isLatestVersion=True,
|
isLatestVersion=True,
|
||||||
normalizedName=normalizedName,
|
normalizedName=normalizedName,
|
||||||
|
reviewScope=ReviewScope,
|
||||||
)
|
)
|
||||||
if document.rootVersionId is None:
|
if document.rootVersionId is None:
|
||||||
document.rootVersionId = document.Id
|
document.rootVersionId = document.Id
|
||||||
@@ -355,12 +357,7 @@ class DocumentServiceImpl(IDocumentService):
|
|||||||
filters.append("d.created_at < (CAST(:date_to AS date) + INTERVAL '1 day')")
|
filters.append("d.created_at < (CAST(:date_to AS date) + INTERVAL '1 day')")
|
||||||
params["date_to"] = date_type.fromisoformat(DateTo.strip())
|
params["date_to"] = date_type.fromisoformat(DateTo.strip())
|
||||||
|
|
||||||
filters.append(
|
filters.append("COALESCE(d.review_scope, 'standard') != 'cross_review'")
|
||||||
"NOT EXISTS ("
|
|
||||||
"SELECT 1 FROM leaudit_cross_review_task_documents crtd"
|
|
||||||
" WHERE crtd.document_id = d.id AND crtd.delete_time IS NULL"
|
|
||||||
")"
|
|
||||||
)
|
|
||||||
|
|
||||||
where_clause = " AND ".join(filters)
|
where_clause = " AND ".join(filters)
|
||||||
|
|
||||||
|
|||||||
@@ -102,3 +102,8 @@ CREATE UNIQUE INDEX IF NOT EXISTS uq_lcr_votes_proposal_voter_active
|
|||||||
COMMENT ON TABLE leaudit_cross_review_votes IS '交叉评查投票表';
|
COMMENT ON TABLE leaudit_cross_review_votes IS '交叉评查投票表';
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
-- Add review_scope column
|
||||||
|
ALTER TABLE leaudit_documents ADD COLUMN IF NOT EXISTS review_scope VARCHAR(32) DEFAULT 'standard';
|
||||||
|
COMMENT ON COLUMN leaudit_documents.review_scope IS '评查范围: standard=个人评查 cross_review=交叉评查';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user