- 后端:新增周任务视频推送服务与定时任务,新增模型迁移 fb26bc033d27 - 配置:WECOM_NOTIFY_EVENTS 追加 training_lean_video_push 事件(dev/test/prod/shared 同步) - 管理端:培训配置页新增定向目标弹窗 LeanTargetModal - 工作台:完成看板提醒按钮按 sent/failed 实发统计如实提示(部分成功/失败/未发送),避免企微发送失败误报成功 - 文档:更新功能清单与技术架构,新增精益管理周任务规则手册;四语言 i18n 同步补齐
32 lines
1.7 KiB
Python
32 lines
1.7 KiB
Python
"""
|
|
backend/app/services/schedule/lean_training_job.py
|
|
|
|
用途:将精益培训逾期提醒与每周视频推送接入平台排程契约。
|
|
依赖:ScheduleTask/ScheduleRun、lean_training_reminder_service、lean_training_push_service。
|
|
逻辑:平台调度器调用本入口;各入口执行对应扫描并返回标准七元组执行结果。
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from app.models import ScheduleRun, ScheduleTask
|
|
from app.services.lean_training_reminder_service import run_lean_training_reminders
|
|
from app.services.lean_training_push_service import run_lean_training_video_push
|
|
from app.services.schedule.job_registry import ScheduleExecuteResult
|
|
|
|
|
|
def run_lean_training_reminder_schedule(task: ScheduleTask, run: ScheduleRun) -> ScheduleExecuteResult:
|
|
"""执行精益培训提醒扫描并返回发送统计,供排程运行记录和运维页面展示。"""
|
|
_ = task, run
|
|
result = run_lean_training_reminders()
|
|
total = result["created"] + result["skipped"]
|
|
failed = result["failed"]
|
|
return total, result["sent"], failed, result["skipped"], [result], [], [{"step": "lean_training_reminder", "status": "success" if not failed else "partial", "detail": result}]
|
|
|
|
|
|
def run_lean_training_video_push_schedule(task: ScheduleTask, run: ScheduleRun) -> ScheduleExecuteResult:
|
|
"""执行每周一视频推送扫描(每任务按每周任务数量推进一批)并返回推送统计。"""
|
|
_ = task, run
|
|
result = run_lean_training_video_push()
|
|
failed = result["failed"]
|
|
return result["tasks"], result["sent"], failed, result["skipped"], [result], [], [{"step": "lean_training_video_push", "status": "success" if not failed else "partial", "detail": result}]
|