using Admin.NET.Plugin.AiDOP.Entity.S8;
namespace Admin.NET.Plugin.AiDOP.Service.S8;
///
/// 监视规则轮询调度服务(首轮存根)。
/// 后续接入 Admin.NET 定时任务机制后,由调度器周期调用 ,
/// 按各规则的 PollIntervalSeconds 逐条评估并生成异常记录。
///
public class S8WatchSchedulerService : ITransient
{
private readonly SqlSugarRepository _ruleRep;
private readonly SqlSugarRepository _exceptionRep;
private readonly S8NotificationService _notificationService;
public S8WatchSchedulerService(
SqlSugarRepository ruleRep,
SqlSugarRepository exceptionRep,
S8NotificationService notificationService)
{
_ruleRep = ruleRep;
_exceptionRep = exceptionRep;
_notificationService = notificationService;
}
///
/// 单次轮询入口。当前为存根,返回已启用规则数量,不做实际数据采集。
///
public async Task RunOnceAsync()
{
var enabledRules = await _ruleRep.AsQueryable()
.Where(x => x.Enabled)
.CountAsync();
// TODO: 逐条评估规则、生成异常、触发通知
return enabledRules;
}
}