using Model; using Model.Dto.Inspection; using Model.Entity.Inspection; using SqlSugar; using System; using System.Collections.Generic; using System.Threading.Tasks; namespace Service.Interface { /// /// 告警通知配置服务接口(渠道/通知规则/推送日志/值班排班/跨网发件箱) /// public interface IAlertNotifyService { #region 通知渠道 /// 渠道列表 Task>> GetChannelsAsync(); /// 新增渠道 Task> AddChannelAsync(AlertNotifyChannelDto dto); /// 修改渠道(Secret 传空表示保持原值不覆盖) Task> UpdateChannelAsync(AlertNotifyChannelDto dto); /// 删除渠道(软删除) Task> DeleteChannelAsync(long id); /// 渠道测试推送(发送一条测试消息验证 Webhook 配置,结果写入推送日志) Task> TestSendAsync(long channelId); #endregion #region 通知规则 /// 规则列表 Task>> GetRulesAsync(); /// 新增规则 Task> AddRuleAsync(AlertNotifyRuleDto dto); /// 修改规则 Task> UpdateRuleAsync(AlertNotifyRuleDto dto); /// 删除规则(软删除) Task> DeleteRuleAsync(long id); /// 启用/停用规则 Task> SetRuleEnabledAsync(long id, bool enabled); #endregion #region 推送日志 /// 推送日志分页(可按成功状态/渠道筛选) Task>> GetLogsPagedAsync(int pageIndex, int pageSize, RefAsync total, bool? success, long channelId = 0); #endregion #region 值班排班 /// 值班排班列表(按日期范围) Task>> GetDutiesAsync(DateTime? startDate, DateTime? endDate); /// 新增排班 Task> AddDutyAsync(DutyRosterDto dto); /// 修改排班 Task> UpdateDutyAsync(DutyRosterDto dto); /// 删除排班(软删除) Task> DeleteDutyAsync(long id); /// 查询指定日期的值班人(通知规则关联值班人时使用) Task GetDutyByDateAsync(DateTime date); #endregion #region 跨网发件箱(AlertBridge 对接) /// /// 写入推送日志(供 AlertNotifyWorker 直连推送后复用) /// Task WriteLogAsync(long alertId, long channelId, string content, bool success, string? errorMsg, int retryCount); /// /// 写入跨网发件箱(供 AlertNotifyWorker 的 Outbox 模式复用) /// Task EnqueueOutboxAsync(long alertId, long channelId, AlertNotifyMessage message, List atMobiles); /// /// 拉取待推送发件箱(原子标记为已拉取,防止多实例重复推送) /// Task>> PullOutboxAsync(int batch); /// /// 回写发件箱推送结果(成功/失败,失败累加重试次数并写推送日志) /// Task> ReportOutboxResultAsync(long id, OutboxResultDto dto); #endregion } }