using System; using System.Threading.Tasks; using System.Collections.Generic; using ZhonTai.Admin.Core.Dto; using NPP.SmartSchedue.Api.Contracts.Services.Notification.Input; using NPP.SmartSchedue.Api.Contracts.Services.Notification.Output; using NPP.SmartSchedue.Api.Contracts.Core.Enums; namespace NPP.SmartSchedue.Api.Contracts.Services.Notification; /// /// 通知服务接口 /// 决策点6:定时任务,支持定时检查和触发通知 /// 决策点7:模板通知,支持通知内容模板,可替换变量 /// public interface INotificationService { #region 通知设置管理 /// /// 查询通知设置 /// /// /// Task GetNotificationSettingAsync(long id); /// /// 查询通知设置分页 /// /// /// Task> GetNotificationSettingPageAsync(PageInput input); /// /// 获取通知设置列表(可选过滤,含缓存) /// /// 是否启用(可选) /// 人员组ID(可选) /// Task> GetNotificationSettingListAsync(bool? isEnabled = null, long? personnelGroupId = null); /// /// 创建通知设置 /// /// /// Task CreateNotificationSettingAsync(NotificationSettingCreateInput input); /// /// 更新通知设置 /// /// /// Task UpdateNotificationSettingAsync(NotificationSettingUpdateInput input); /// /// 删除通知设置 /// /// /// Task DeleteNotificationSettingAsync(long id); /// /// 启用/禁用通知设置 /// /// /// /// Task ToggleNotificationSettingAsync(long id, bool enabled); #endregion #region 人员组管理 /// /// 查询人员组 /// /// /// Task GetPersonnelGroupAsync(long id); /// /// 查询人员组分页 /// /// /// Task> GetPersonnelGroupPageAsync(PageInput input); /// /// 创建人员组 /// /// /// Task CreatePersonnelGroupAsync(PersonnelGroupCreateInput input); /// /// 更新人员组 /// /// /// Task UpdatePersonnelGroupAsync(PersonnelGroupUpdateInput input); /// /// 删除人员组 /// /// /// Task DeletePersonnelGroupAsync(long id); /// /// 获取人员组的实际人员列表 /// 根据决策点4:混合人员组,支持静态+动态规则 /// /// /// Task> GetPersonnelGroupMembersAsync(long personnelGroupId); #endregion #region 通知发送 /// /// 发送通知 /// 决策点1:支持邮件和系统消息通知 /// /// /// Task SendNotificationAsync(SendNotificationInput input); /// /// 发送群组通知(邮件发送一封给所有人,系统消息仍然单独发送) /// /// /// Task SendGroupNotificationAsync(SendNotificationInput input); /// /// 批量发送通知 /// /// /// Task> BatchSendNotificationAsync(List inputs); /// /// 根据通知设置发送通知 /// /// 通知设置ID /// 业务类型 /// 业务ID /// 业务数据 /// 模板变量(用于替换模板中的占位符) /// Task SendNotificationBySettingAsync( long notificationSettingId, string businessType, long? businessId = null, string businessData = "", Dictionary templateVariables = null); #endregion #region 通知模板引擎(决策点7) /// /// 验证模板语法 /// /// 模板内容 /// Task ValidateTemplateAsync(string template); #endregion #region 通知历史记录(决策点8) /// /// 查询通知历史记录 /// /// /// Task GetNotificationHistoryAsync(long id); /// /// 查询通知历史记录分页 /// /// /// Task> GetNotificationHistoryPageAsync(PageInput input); /// /// 重试失败的通知 /// /// /// Task RetryFailedNotificationAsync(long notificationHistoryId); /// /// 批量重试失败的通知 /// /// /// Task BatchRetryFailedNotificationsAsync(List notificationHistoryIds); /// /// 取消通知 /// /// 通知历史记录ID /// Task CancelNotificationAsync(long notificationHistoryId); /// /// 批量取消通知 /// /// 通知历史记录ID列表 /// 成功取消的数量 Task BatchCancelNotificationsAsync(List notificationHistoryIds); #endregion #region 定时任务管理(决策点6) /// /// 创建定时通知任务 /// /// 通知设置ID /// 业务类型 /// 业务ID /// 业务数据 /// 计划执行时间 /// Cron表达式(可选) /// Task CreateScheduledNotificationTaskAsync( long notificationSettingId, string businessType, long? businessId = null, string businessData = "", DateTime? plannedExecutionTime = null, string cronExpression = ""); /// /// 执行定时通知任务 /// /// 任务ID /// Task ExecuteScheduledNotificationTaskAsync(long taskId); /// /// 获取待执行的定时任务列表 /// /// Task> GetPendingNotificationTasksAsync(); /// /// 启用/禁用定时任务 /// /// /// /// Task ToggleNotificationTaskAsync(long taskId, bool enabled); #endregion #region 通知统计 /// /// 获取通知发送统计信息 /// /// 开始时间 /// 结束时间 /// 通知设置ID(可选) /// Task> GetNotificationStatisticsAsync( DateTime startTime, DateTime endTime, long? notificationSettingId = null); #endregion }