From 456793293ba32b1feb2b24af6c85468464e07e67 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 28 Oct 2025 14:32:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=9E=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Common/DTO/EmailLogViewModel.cs | 72 +++++++++++++++++++ .../Service/Common/EmailLogService.cs | 58 +++++++++++++++ .../Common/Interface/IEmailLogService.cs | 23 ++++++ .../Service/Common/_MapConfig.cs | 3 + 4 files changed, 156 insertions(+) create mode 100644 IRaCIS.Core.Application/Service/Common/DTO/EmailLogViewModel.cs create mode 100644 IRaCIS.Core.Application/Service/Common/EmailLogService.cs create mode 100644 IRaCIS.Core.Application/Service/Common/Interface/IEmailLogService.cs diff --git a/IRaCIS.Core.Application/Service/Common/DTO/EmailLogViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/EmailLogViewModel.cs new file mode 100644 index 000000000..3b2e63900 --- /dev/null +++ b/IRaCIS.Core.Application/Service/Common/DTO/EmailLogViewModel.cs @@ -0,0 +1,72 @@ + +//-------------------------------------------------------------------- +// 此代码由liquid模板自动生成 byzhouhang 20240909 +// 生成时间 2025-10-28 06:22:47Z +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +//-------------------------------------------------------------------- +using System; +using IRaCIS.Core.Domain.Share; +using System.Collections.Generic; +namespace IRaCIS.Core.Application.ViewModel; + +public class EmailLogView : EmailLogAddOrEdit +{ + + public DateTime CreateTime { get; set; } + + public DateTime UpdateTime { get; set; } + +} + + +public class EmailLogAddOrEdit +{ + public Guid? Id { get; set; } + + public List`1 Attachments { get; set; } + + public List`1 CcRecipients { get; set; } + + public DateTime? EmailDate { get; set; } + + public EmailState EmailStateEnum { get; set; } + + public string EmailSubject { get; set; } + + public string ErrorInfo { get; set; } + + public string MessageId { get; set; } + + public string SenderAddress { get; set; } + + public List`1 ToRecipients { get; set; } + + public string UniqueId { get; set; } + } + +public class EmailLogQuery:PageInput +{ + public List`1? Attachments { get; set; } + + public List`1? CcRecipients { get; set; } + + public DateTime? EmailDate { get; set; } + + public EmailState? EmailStateEnum { get; set; } + + public string? EmailSubject { get; set; } + + public string? ErrorInfo { get; set; } + + public string? MessageId { get; set; } + + public string? SenderAddress { get; set; } + + public List`1? ToRecipients { get; set; } + + public string? UniqueId { get; set; } + } + + + + diff --git a/IRaCIS.Core.Application/Service/Common/EmailLogService.cs b/IRaCIS.Core.Application/Service/Common/EmailLogService.cs new file mode 100644 index 000000000..f21753d42 --- /dev/null +++ b/IRaCIS.Core.Application/Service/Common/EmailLogService.cs @@ -0,0 +1,58 @@ + +//-------------------------------------------------------------------- +// 此代码由liquid模板自动生成 byzhouhang 20240909 +// 生成时间 2025-10-28 06:22:42Z +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +//-------------------------------------------------------------------- +using IRaCIS.Core.Domain.Models; +using Microsoft.AspNetCore.Mvc; +using IRaCIS.Core.Application.Interfaces; +using IRaCIS.Core.Application.ViewModel; +using IRaCIS.Core.Infrastructure.Extention; +using System.Threading.Tasks; +using IRaCIS.Core.Infra.EFCore; +namespace IRaCIS.Core.Application.Service; + +[ ApiExplorerSettings(GroupName = "Test")] +public class EmailLogService(IRepository _emailLogRepository, + IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer): BaseService, IEmailLogService +{ + + + [HttpPost] + public async Task> GetEmailLogList(EmailLogQuery inQuery) + { + + var emailLogQueryable =_emailLogRepository + .ProjectTo(_mapper.ConfigurationProvider); + + var pageList= await emailLogQueryable.ToPagedListAsync(inQuery); + + return pageList; + } + + + + public async Task AddOrUpdateEmailLog(EmailLogAddOrEdit addOrEditEmailLog) + { + + + + var entity = await _emailLogRepository.InsertOrUpdateAsync(addOrEditEmailLog, true); + + return ResponseOutput.Ok(entity.Id.ToString()); + + } + + + [HttpDelete("{emailLogId:guid}")] + public async Task DeleteEmailLog(Guid emailLogId) + { + var success = await _emailLogRepository.DeleteFromQueryAsync(t => t.Id == emailLogId,true); + return ResponseOutput.Ok(); + } + +} + + + diff --git a/IRaCIS.Core.Application/Service/Common/Interface/IEmailLogService.cs b/IRaCIS.Core.Application/Service/Common/Interface/IEmailLogService.cs new file mode 100644 index 000000000..a1af1a2e5 --- /dev/null +++ b/IRaCIS.Core.Application/Service/Common/Interface/IEmailLogService.cs @@ -0,0 +1,23 @@ + +//-------------------------------------------------------------------- +// 此代码由liquid模板自动生成 byzhouhang 20240909 +// 生成时间 2025-10-28 06:22:47Z +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +//-------------------------------------------------------------------- +using System; +using IRaCIS.Core.Infrastructure.Extention; +using System.Threading.Tasks; +using IRaCIS.Core.Application.ViewModel; +namespace IRaCIS.Core.Application.Interfaces; + +public interface IEmailLogService +{ + + Task> GetEmailLogList(EmailLogQuery inQuery); + + Task AddOrUpdateEmailLog(EmailLogAddOrEdit addOrEditEmailLog); + + Task DeleteEmailLog(Guid emailLogId); +} + + diff --git a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs index a1ae89f86..87414774d 100644 --- a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs @@ -10,7 +10,10 @@ namespace IRaCIS.Core.Application.Service { public CommonConfig() { + // 在此处拷贝automapper 映射 + CreateMap(); + CreateMap().ReverseMap(); CreateMap().ReverseMap();