
- 新增通知系统完整架构,包含通知设置、历史记录、任务管理等核心功能 - 实现工作任务分配服务,支持人员和设备的智能分配 - 添加人员分组管理功能,支持灵活的通知目标配置 - 完善相关枚举定义和数据传输对象 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
141 lines
4.1 KiB
C#
141 lines
4.1 KiB
C#
using System.Threading.Tasks;
|
||
using System.Collections.Generic;
|
||
using NPP.SmartSchedue.Api.Contracts.Core.Enums;
|
||
|
||
namespace NPP.SmartSchedue.Api.Contracts.Services.Notification;
|
||
|
||
/// <summary>
|
||
/// 邮件通知服务接口
|
||
/// 决策点1:基础通知方式 - 邮件通知
|
||
/// </summary>
|
||
public interface IEmailNotificationService
|
||
{
|
||
#region 单个邮件发送
|
||
|
||
/// <summary>
|
||
/// 发送邮件通知
|
||
/// </summary>
|
||
/// <param name="recipientEmail">接收人邮箱</param>
|
||
/// <param name="subject">邮件主题</param>
|
||
/// <param name="content">邮件内容</param>
|
||
/// <param name="isHtml">是否HTML格式</param>
|
||
/// <returns></returns>
|
||
Task<bool> SendEmailAsync(string recipientEmail, string subject, string content, bool isHtml = true);
|
||
|
||
/// <summary>
|
||
/// 发送邮件通知(带附件)
|
||
/// </summary>
|
||
/// <param name="recipientEmail">接收人邮箱</param>
|
||
/// <param name="subject">邮件主题</param>
|
||
/// <param name="content">邮件内容</param>
|
||
/// <param name="attachments">附件文件路径列表</param>
|
||
/// <param name="isHtml">是否HTML格式</param>
|
||
/// <returns></returns>
|
||
Task<bool> SendEmailWithAttachmentsAsync(
|
||
string recipientEmail,
|
||
string subject,
|
||
string content,
|
||
List<string> attachments,
|
||
bool isHtml = true);
|
||
|
||
#endregion
|
||
|
||
#region 批量邮件发送
|
||
|
||
/// <summary>
|
||
/// 批量发送邮件通知
|
||
/// </summary>
|
||
/// <param name="recipients">接收人邮箱列表</param>
|
||
/// <param name="subject">邮件主题</param>
|
||
/// <param name="content">邮件内容</param>
|
||
/// <param name="isHtml">是否HTML格式</param>
|
||
/// <returns>发送结果,Key为邮箱地址,Value为是否发送成功</returns>
|
||
Task<Dictionary<string, bool>> BatchSendEmailAsync(
|
||
List<string> recipients,
|
||
string subject,
|
||
string content,
|
||
bool isHtml = true);
|
||
|
||
/// <summary>
|
||
/// 个性化批量发送邮件通知
|
||
/// 每个收件人可以有不同的邮件内容
|
||
/// </summary>
|
||
/// <param name="emailItems">邮件项列表</param>
|
||
/// <returns>发送结果,Key为邮箱地址,Value为是否发送成功</returns>
|
||
Task<Dictionary<string, bool>> BatchSendPersonalizedEmailAsync(List<EmailItem> emailItems);
|
||
|
||
#endregion
|
||
|
||
#region 邮件模板
|
||
|
||
/// <summary>
|
||
/// 使用模板发送邮件
|
||
/// </summary>
|
||
/// <param name="recipientEmail">接收人邮箱</param>
|
||
/// <param name="subjectTemplate">邮件主题模板</param>
|
||
/// <param name="contentTemplate">邮件内容模板</param>
|
||
/// <param name="variables">模板变量</param>
|
||
/// <param name="isHtml">是否HTML格式</param>
|
||
/// <returns></returns>
|
||
Task<bool> SendEmailByTemplateAsync(
|
||
string recipientEmail,
|
||
string subjectTemplate,
|
||
string contentTemplate,
|
||
Dictionary<string, string> variables,
|
||
bool isHtml = true);
|
||
|
||
#endregion
|
||
|
||
#region 邮件发送状态检查
|
||
|
||
/// <summary>
|
||
/// 验证邮箱地址格式
|
||
/// </summary>
|
||
/// <param name="email">邮箱地址</param>
|
||
/// <returns></returns>
|
||
bool IsValidEmail(string email);
|
||
|
||
/// <summary>
|
||
/// 检查邮件服务器连接状态
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
Task<bool> CheckEmailServerConnectionAsync();
|
||
|
||
#endregion
|
||
}
|
||
|
||
/// <summary>
|
||
/// 邮件项
|
||
/// </summary>
|
||
public class EmailItem
|
||
{
|
||
/// <summary>
|
||
/// 接收人邮箱
|
||
/// </summary>
|
||
public string RecipientEmail { get; set; } = "";
|
||
|
||
/// <summary>
|
||
/// 邮件主题
|
||
/// </summary>
|
||
public string Subject { get; set; } = "";
|
||
|
||
/// <summary>
|
||
/// 邮件内容
|
||
/// </summary>
|
||
public string Content { get; set; } = "";
|
||
|
||
/// <summary>
|
||
/// 是否HTML格式
|
||
/// </summary>
|
||
public bool IsHtml { get; set; } = true;
|
||
|
||
/// <summary>
|
||
/// 附件文件路径列表
|
||
/// </summary>
|
||
public List<string> Attachments { get; set; } = new List<string>();
|
||
|
||
/// <summary>
|
||
/// 个性化变量
|
||
/// </summary>
|
||
public Dictionary<string, string> Variables { get; set; } = new Dictionary<string, string>();
|
||
} |