fix(filter): append 23:59:59 to end_date to resolve midnight truncation bug in date range queries
This commit is contained in:
@ -114,6 +114,12 @@ class InboundSummaryService:
|
||||
)
|
||||
query = query.filter(rule)
|
||||
|
||||
# 日期补全:解决零点截断问题
|
||||
if end_date and len(str(end_date).strip()) == 10:
|
||||
end_date = f"{str(end_date).strip()} 23:59:59"
|
||||
if start_date and len(str(start_date).strip()) == 10:
|
||||
start_date = f"{str(start_date).strip()} 00:00:00"
|
||||
|
||||
if start_date and end_date:
|
||||
query = query.filter(cte.c.inbound_date.between(start_date, end_date))
|
||||
|
||||
@ -286,6 +292,12 @@ class InboundSummaryService:
|
||||
)
|
||||
query = query.filter(rule)
|
||||
|
||||
# 日期补全:解决零点截断问题
|
||||
if end_date and len(str(end_date).strip()) == 10:
|
||||
end_date = f"{str(end_date).strip()} 23:59:59"
|
||||
if start_date and len(str(start_date).strip()) == 10:
|
||||
start_date = f"{str(start_date).strip()} 00:00:00"
|
||||
|
||||
if start_date and end_date:
|
||||
query = query.filter(cte.c.inbound_date.between(start_date, end_date))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user