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