2025-12-25 11:20:56 +08:00
|
|
|
|
namespace WebApi.Controllers.Dto;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 邮件消息DTO,包含额外的统计信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class EmailMessageDto
|
|
|
|
|
|
{
|
|
|
|
|
|
public long Id { get; set; }
|
2026-01-18 22:04:56 +08:00
|
|
|
|
|
2025-12-25 11:20:56 +08:00
|
|
|
|
public string Subject { get; set; } = string.Empty;
|
2026-01-18 22:04:56 +08:00
|
|
|
|
|
2025-12-25 11:20:56 +08:00
|
|
|
|
public string From { get; set; } = string.Empty;
|
2026-01-18 22:04:56 +08:00
|
|
|
|
|
2025-12-25 11:20:56 +08:00
|
|
|
|
public string Body { get; set; } = string.Empty;
|
2026-01-18 22:04:56 +08:00
|
|
|
|
|
2025-12-25 11:20:56 +08:00
|
|
|
|
public string HtmlBody { get; set; } = string.Empty;
|
2026-01-18 22:04:56 +08:00
|
|
|
|
|
2025-12-25 11:20:56 +08:00
|
|
|
|
public DateTime ReceivedDate { get; set; }
|
2026-01-18 22:04:56 +08:00
|
|
|
|
|
2025-12-25 11:20:56 +08:00
|
|
|
|
public DateTime CreateTime { get; set; }
|
2026-01-18 22:04:56 +08:00
|
|
|
|
|
2025-12-25 11:20:56 +08:00
|
|
|
|
public DateTime? UpdateTime { get; set; }
|
2026-01-18 22:04:56 +08:00
|
|
|
|
|
2025-12-25 11:20:56 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 已解析的账单数量
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public int TransactionCount { get; set; }
|
2025-12-27 16:54:08 +08:00
|
|
|
|
|
|
|
|
|
|
public string ToName { get; set; } = string.Empty;
|
2026-01-18 22:04:56 +08:00
|
|
|
|
|
2025-12-25 11:20:56 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 从实体转换为DTO
|
|
|
|
|
|
/// </summary>
|
2026-01-18 22:25:59 +08:00
|
|
|
|
public static EmailMessageDto FromEntity(EmailMessage entity, int transactionCount = 0)
|
2025-12-25 11:20:56 +08:00
|
|
|
|
{
|
|
|
|
|
|
return new EmailMessageDto
|
|
|
|
|
|
{
|
|
|
|
|
|
Id = entity.Id,
|
|
|
|
|
|
Subject = entity.Subject,
|
|
|
|
|
|
From = entity.From,
|
|
|
|
|
|
Body = entity.Body,
|
|
|
|
|
|
HtmlBody = entity.HtmlBody,
|
|
|
|
|
|
ReceivedDate = entity.ReceivedDate,
|
|
|
|
|
|
CreateTime = entity.CreateTime,
|
|
|
|
|
|
UpdateTime = entity.UpdateTime,
|
2025-12-27 16:54:08 +08:00
|
|
|
|
TransactionCount = transactionCount,
|
2026-01-18 22:25:59 +08:00
|
|
|
|
ToName = entity.To.Split('<').FirstOrDefault()?.Trim() ?? "未知"
|
2025-12-25 11:20:56 +08:00
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|