Merge branch 'dev' into picture-feedback
This commit is contained in:
commit
34ad40778b
180 files changed
+13262
-5333
No files matched your search
@@ -3,7 +3,7 @@ backend/app/services/voucher_check/query_service.py
|
||||
|
||||
用途:查询检核批次列表、最近一次检核、批次明细、企微发送记录,以及工作台强制重检入队。
|
||||
依赖:models.voucher_check、ScheduleRun、aggregator、schedule.queue_service、schedule_seed。
|
||||
逻辑:只读引擎表;列表 period 支持 YYYY 或 YYYY-MM;GET latest 不跟筛选;明细同时返回 invoice 行与 by_file_type;强制重检写入 run_options.mode=force_all。
|
||||
逻辑:只读引擎表;列表 period 支持 YYYY 或 YYYY-MM;GET latest 不跟筛选;明细可按状态和 invoice 号筛选行,by_file_type 仍是整批;强制重检写入 run_options.mode=force_all。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -545,10 +545,14 @@ def list_run_items(
|
||||
*,
|
||||
run_id: int,
|
||||
result: str | None = None,
|
||||
invoice_no: str | None = None,
|
||||
page: int = 1,
|
||||
page_size: int = 50,
|
||||
) -> dict[str, Any]:
|
||||
"""分页查询批次明细;返回引擎按 invoice 聚合行,并附带按文件类型汇总。"""
|
||||
"""分页查询批次明细;返回引擎按 invoice 聚合行,并附带按文件类型汇总。
|
||||
|
||||
核心逻辑:result 精确匹配状态;invoice_no 按包含、忽略大小写筛行。文件类型汇总不跟着这两个条件缩。
|
||||
"""
|
||||
run = ScheduleRun.query.get(run_id)
|
||||
if not run:
|
||||
raise NotFoundError("批次不存在", code="VOUCHER_CHECK.RUN_NOT_FOUND")
|
||||
@@ -574,6 +578,12 @@ def list_run_items(
|
||||
result_filter = str(result).strip() if result else ""
|
||||
if result_filter:
|
||||
items = [row for row in items if row.get("result") == result_filter]
|
||||
invoice_filter = str(invoice_no).strip().casefold() if invoice_no else ""
|
||||
if invoice_filter:
|
||||
items = [
|
||||
row for row in items
|
||||
if invoice_filter in str(row.get("invoice_no") or "").casefold()
|
||||
]
|
||||
total = len(items)
|
||||
sliced = items[(page - 1) * page_size : page * page_size]
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user