feat(equipment-acceptance): 预警扫描发送改异步并错开合同付款排程
手动扫描/发送入队由 schedule worker 执行,避免 Nginx 504;默认扫描 06:30、周五发送 18:30。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
2e8405e2f0
commit
537e3e18f0
16 files changed
+334
-73
No files matched your search
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
backend/app/services/equipment_acceptance/schedule_seed.py
|
||||
|
||||
用途:设备验收预警的默认排程:每日扫描和周五 18:00 发送。
|
||||
用途:设备验收预警的默认排程:每日 06:30 扫描和周五 18:30 发送。
|
||||
依赖:ScheduleTask、permission_roles.service.first_schedule_owner_user、timezone_util。
|
||||
逻辑:应用启动时幂等创建。已有同编号或同任务键时不覆盖管理员改过的 Cron。
|
||||
"""
|
||||
@@ -17,8 +17,10 @@ from app.services.schedule.timezone_util import compute_next_run_at
|
||||
|
||||
|
||||
_DEFAULTS = (
|
||||
("SCH-EQUIPMENT-ACCEPTANCE-SCAN", "equipment-acceptance-alert-scan", "设备验收预警扫描(日批)", "0 6 * * *"),
|
||||
("SCH-EQUIPMENT-ACCEPTANCE-WEEKLY", "equipment-acceptance-alert-weekly", "设备验收预警发送(周五 18:00)", "0 18 * * 5"),
|
||||
# 每天 06:30,错开合同付款预警扫描的 06:00
|
||||
("SCH-EQUIPMENT-ACCEPTANCE-SCAN", "equipment-acceptance-alert-scan", "设备验收预警扫描(日批 06:30)", "30 6 * * *"),
|
||||
# 周五 18:30,错开合同付款预警的周五 18:00
|
||||
("SCH-EQUIPMENT-ACCEPTANCE-WEEKLY", "equipment-acceptance-alert-weekly", "设备验收预警发送(周五 18:30)", "30 18 * * 5"),
|
||||
)
|
||||
|
||||
|
||||
@@ -26,7 +28,7 @@ def ensure_default_equipment_acceptance_schedules(*, commit: bool = True):
|
||||
"""
|
||||
幂等创建设备验收每日扫描和周五发送两个排程。
|
||||
|
||||
核心逻辑:发送时刻不在预警配置表。默认与合同付款一样,周五 18:00,时区 Asia/Shanghai。
|
||||
核心逻辑:发送时刻不在预警配置表。默认每天 06:30、周五 18:30(错开合同付款 06:00 / 18:00),时区 Asia/Shanghai。
|
||||
Args:
|
||||
commit: 为 False 时只 flush,交给外层事务提交。
|
||||
Returns:
|
||||
|
||||
Reference in new issue
Block a user