lzh 6b50254a96 feat(video): 适配多租户上下文透传 + 定时任务 TTL 装饰 + 生命周期收口
问题背景:
  - WVP 原生代码的 SIP / @Scheduled / Hook EventListener 都跑在没有
    TenantContextHolder / ProjectContextHolder 的线程上,接入多租户
    框架后会漏 tenant_id / project_id 过滤或抛 NPE。
  - 框架默认 @EnableAsync 走 JDK 动态代理,但 WVP 代码大量"按具体类
    注入 / 按具体类查方法",JDK 代理下会 cast/查方法失败。

本次改动:
  - VideoServerApplication 排除框架 ViewshAsyncAutoConfiguration,
    由 ThreadPoolTaskConfig 本地 @EnableAsync(proxyTargetClass=true)
    + TtlRunnable 装饰器接管(从框架抄一份 BeanPostProcessor)。
  - DynamicTask 的 scheduleAtFixedRate / schedule 入口都用 TtlRunnable
    包一层,把调用线程的 TTL 快照透传到调度线程;新增 @PreDestroy
    在容器关停时取消 future、shutdown scheduler、记录耗时,
    避免关停阶段调度线程继续借 DataSource 触发噪音日志。
  - 新增 VideoContextUtils.executeIgnoreTenantAndProject,
    统一封装 TenantUtils.executeIgnore(ProjectUtils.executeIgnore(…))
    的嵌套模板,覆盖启动初始化 / 定时任务 / Hook 事件 / Redis 消息
    四种场景共 8 个调用点。
  - MobilePositionServiceImpl 拆出 @Transactional persistPositions,
    通过 @Lazy self 代理调用,避免外层方法 this 自调用让事务失效;
    外层只做 Redis 拉队列 + 空队列短路,不再开空事务。
  - StreamProxyServiceImpl / StreamPushServiceImpl 的 @EventListener
    在业务体内包裹 executeIgnoreTenantAndProject,保证 ZLM Hook
    到来时仍能跨租户落库。
2026-04-23 15:03:26 +08:00
2025-12-31 11:48:19 +08:00
2025-12-31 11:48:19 +08:00
2025-12-31 11:48:19 +08:00
2025-12-31 11:48:19 +08:00
2025-12-31 11:48:19 +08:00
2025-12-31 11:48:19 +08:00
2025-12-31 11:48:19 +08:00
2025-12-31 11:48:19 +08:00
2025-12-31 11:48:19 +08:00
2025-12-31 11:48:19 +08:00
2025-12-31 11:48:19 +08:00
2025-12-31 11:48:19 +08:00
2025-12-31 11:48:19 +08:00
2026-04-16 15:28:49 +08:00
2025-12-31 11:48:19 +08:00
2025-12-31 11:48:19 +08:00
Description
aiot后端(微服务版)
MIT 20 MiB
Languages
Java 80.2%
PLpgSQL 12.7%
TSQL 6.7%
Python 0.2%