Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
1f4ea09bc6
|
|
@ -62,6 +62,7 @@
|
||||||
"SystemEmailSendConfig": {
|
"SystemEmailSendConfig": {
|
||||||
"Port": 465,
|
"Port": 465,
|
||||||
"Host": "smtp.qiye.aliyun.com",
|
"Host": "smtp.qiye.aliyun.com",
|
||||||
|
"Imap": "imap.qiye.aliyun.com",
|
||||||
"FromEmail": "uat@extimaging.com",
|
"FromEmail": "uat@extimaging.com",
|
||||||
"FromName": "UAT_IRC",
|
"FromName": "UAT_IRC",
|
||||||
"AuthorizationCode": "SHzyyl2021",
|
"AuthorizationCode": "SHzyyl2021",
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@
|
||||||
"SystemEmailSendConfig": {
|
"SystemEmailSendConfig": {
|
||||||
"Port": 465,
|
"Port": 465,
|
||||||
"Host": "smtp.qiye.aliyun.com",
|
"Host": "smtp.qiye.aliyun.com",
|
||||||
|
"Imap": "imap.qiye.aliyun.com",
|
||||||
"FromEmail": "irc@extimaging.com",
|
"FromEmail": "irc@extimaging.com",
|
||||||
"FromName": "IRC Imaging System",
|
"FromName": "IRC Imaging System",
|
||||||
"AuthorizationCode": "ExtImg@2022",
|
"AuthorizationCode": "ExtImg@2022",
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,8 @@
|
||||||
"Port": 465,
|
"Port": 465,
|
||||||
// 企业邮箱SMTP服务器地址
|
// 企业邮箱SMTP服务器地址
|
||||||
"Host": "smtp.qiye.aliyun.com",
|
"Host": "smtp.qiye.aliyun.com",
|
||||||
|
|
||||||
|
"Imap": "imap.qiye.aliyun.com",
|
||||||
// 发件人邮箱地址
|
// 发件人邮箱地址
|
||||||
"FromEmail": "test@extimaging.com",
|
"FromEmail": "test@extimaging.com",
|
||||||
// 发件人显示名称
|
// 发件人显示名称
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@
|
||||||
"SystemEmailSendConfig": {
|
"SystemEmailSendConfig": {
|
||||||
"Port": 465,
|
"Port": 465,
|
||||||
"Host": "smtp.qiye.aliyun.com",
|
"Host": "smtp.qiye.aliyun.com",
|
||||||
|
"Imap": "imap.qiye.aliyun.com",
|
||||||
"FromEmail": "test@extimaging.com",
|
"FromEmail": "test@extimaging.com",
|
||||||
"FromName": "Test_IRC",
|
"FromName": "Test_IRC",
|
||||||
"AuthorizationCode": "SHzyyl2021",
|
"AuthorizationCode": "SHzyyl2021",
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@
|
||||||
"SystemEmailSendConfig": {
|
"SystemEmailSendConfig": {
|
||||||
"Port": 587,
|
"Port": 587,
|
||||||
"Host": "smtp-mail.outlook.com",
|
"Host": "smtp-mail.outlook.com",
|
||||||
|
"Imap": "imap.qiye.aliyun.com",
|
||||||
"FromEmail": "donotreply@elevateimaging.ai",
|
"FromEmail": "donotreply@elevateimaging.ai",
|
||||||
"FromName": "LiLi System",
|
"FromName": "LiLi System",
|
||||||
"AuthorizationCode": "Q#669869497420ul",
|
"AuthorizationCode": "Q#669869497420ul",
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@
|
||||||
"SystemEmailSendConfig": {
|
"SystemEmailSendConfig": {
|
||||||
"Port": 587,
|
"Port": 587,
|
||||||
"Host": "smtp-mail.outlook.com",
|
"Host": "smtp-mail.outlook.com",
|
||||||
|
"Imap": "imap.qiye.aliyun.com",
|
||||||
"FromEmail": "donotreply@elevateimaging.ai",
|
"FromEmail": "donotreply@elevateimaging.ai",
|
||||||
"FromName": "LiLi System",
|
"FromName": "LiLi System",
|
||||||
"AuthorizationCode": "Q#669869497420ul",
|
"AuthorizationCode": "Q#669869497420ul",
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@
|
||||||
"SystemEmailSendConfig": {
|
"SystemEmailSendConfig": {
|
||||||
"Port": 587,
|
"Port": 587,
|
||||||
"Host": "smtp-mail.outlook.com",
|
"Host": "smtp-mail.outlook.com",
|
||||||
|
"Imap": "imap.qiye.aliyun.com",
|
||||||
"FromEmail": "donotreply@elevateimaging.ai",
|
"FromEmail": "donotreply@elevateimaging.ai",
|
||||||
"FromName": "LiLi System",
|
"FromName": "LiLi System",
|
||||||
"AuthorizationCode": "Q#669869497420ul",
|
"AuthorizationCode": "Q#669869497420ul",
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@
|
||||||
"SystemEmailSendConfig": {
|
"SystemEmailSendConfig": {
|
||||||
"Port": 465,
|
"Port": 465,
|
||||||
"Host": "smtp.qiye.aliyun.com",
|
"Host": "smtp.qiye.aliyun.com",
|
||||||
|
"Imap": "imap.qiye.aliyun.com",
|
||||||
"FromEmail": "uat@extimaging.com",
|
"FromEmail": "uat@extimaging.com",
|
||||||
"FromName": "Uat IRC Imaging System",
|
"FromName": "Uat IRC Imaging System",
|
||||||
"AuthorizationCode": "SHzyyl2021",
|
"AuthorizationCode": "SHzyyl2021",
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,8 @@ public class SystemEmailSendConfig
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
public string Host { get; set; } = string.Empty;
|
public string Host { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Imap { get; set; } = string.Empty;
|
||||||
public string FromEmail { get; set; } = string.Empty;
|
public string FromEmail { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string FromName { get; set; } = string.Empty;
|
public string FromName { get; set; } = string.Empty;
|
||||||
|
|
|
||||||
|
|
@ -16549,11 +16549,17 @@
|
||||||
系统邮件配置表
|
系统邮件配置表
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Contracts.EmailNoticeConfigService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeUserType},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
|
<member name="M:IRaCIS.Core.Application.Contracts.EmailNoticeConfigService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeUserType},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
|
||||||
<summary>
|
<summary>
|
||||||
系统邮件配置表
|
系统邮件配置表
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Contracts.EmailNoticeConfigService.GetEmailList">
|
||||||
|
<summary>
|
||||||
|
获取邮件列表
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Contracts.EmailNoticeConfigService.BatchUpdateEmail(System.Collections.Generic.List{IRaCIS.Core.Application.Contracts.BatchUpdateEmailTopicCommand})">
|
<member name="M:IRaCIS.Core.Application.Contracts.EmailNoticeConfigService.BatchUpdateEmail(System.Collections.Generic.List{IRaCIS.Core.Application.Contracts.BatchUpdateEmailTopicCommand})">
|
||||||
<summary>
|
<summary>
|
||||||
批量更新邮件主题中英文
|
批量更新邮件主题中英文
|
||||||
|
|
|
||||||
|
|
@ -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 string Attachments { get; set; }
|
||||||
|
|
||||||
|
public string 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 string ToRecipients { get; set; }
|
||||||
|
|
||||||
|
public string UniqueId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class EmailLogQuery:PageInput
|
||||||
|
{
|
||||||
|
public string Attachments { get; set; }
|
||||||
|
|
||||||
|
public string 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 string ToRecipients { get; set; }
|
||||||
|
|
||||||
|
public string? UniqueId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,116 @@
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// 此代码由liquid模板自动生成 byzhouhang 20240909
|
||||||
|
// 生成时间 2025-10-28 06:22:42Z
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
using IRaCIS.Core.Application.Interfaces;
|
||||||
|
using IRaCIS.Core.Application.ViewModel;
|
||||||
|
using IRaCIS.Core.Domain.Models;
|
||||||
|
using IRaCIS.Core.Infra.EFCore;
|
||||||
|
using IRaCIS.Core.Infrastructure.Extention;
|
||||||
|
using MailKit;
|
||||||
|
using MailKit.Net.Imap;
|
||||||
|
using MailKit.Search;
|
||||||
|
using MailKit.Security;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
namespace IRaCIS.Core.Application.Service;
|
||||||
|
|
||||||
|
[ ApiExplorerSettings(GroupName = "Test")]
|
||||||
|
public class EmailLogService(IRepository<EmailLog> _emailLogRepository,
|
||||||
|
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig,
|
||||||
|
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer): BaseService, IEmailLogService
|
||||||
|
{
|
||||||
|
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<PageOutput<EmailLogView>> GetEmailLogList(EmailLogQuery inQuery)
|
||||||
|
{
|
||||||
|
|
||||||
|
List<IMessageSummary> emailList = new List<IMessageSummary>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
using (var client = new ImapClient())
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 连接阿里邮箱 IMAP 服务器(使用 SSL)
|
||||||
|
client.Connect(_systemEmailConfig.Imap, 993, SecureSocketOptions.SslOnConnect);
|
||||||
|
|
||||||
|
// 登录
|
||||||
|
client.Authenticate(_systemEmailConfig.FromEmail, _systemEmailConfig.AuthorizationCode);
|
||||||
|
|
||||||
|
// 3. 获取发件箱文件夹 - 使用你找到的“已发送”
|
||||||
|
var sentFolder = client.GetFolder("已发送");
|
||||||
|
sentFolder.Open(FolderAccess.ReadOnly);
|
||||||
|
|
||||||
|
// 4. 搜索所有邮件(你可以在这里添加更精确的搜索条件)
|
||||||
|
var uids = sentFolder.Search(SearchQuery.All);
|
||||||
|
Console.WriteLine($"找到 {uids.Count} 封已发送邮件");
|
||||||
|
|
||||||
|
// 5. 遍历并处理邮件(示例中处理前10封)
|
||||||
|
foreach (var uid in uids.Take(10))
|
||||||
|
{
|
||||||
|
var message = sentFolder.GetMessage(uid);
|
||||||
|
|
||||||
|
// 输出邮件基本信息
|
||||||
|
Console.WriteLine($"主题: {message.Subject}");
|
||||||
|
Console.WriteLine($"收件人: {string.Join(", ", message.To.Mailboxes.Select(m => m.Address))}");
|
||||||
|
Console.WriteLine($"日期: {message.Date.LocalDateTime:yyyy-MM-dd HH:mm:ss}");
|
||||||
|
Console.WriteLine($"发件人: {message.From}");
|
||||||
|
Console.WriteLine("----------------------------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
sentFolder.Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"操作失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
client.Disconnect(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var emailLogQueryable =_emailLogRepository
|
||||||
|
.ProjectTo<EmailLogView>(_mapper.ConfigurationProvider);
|
||||||
|
|
||||||
|
var pageList= await emailLogQueryable.ToPagedListAsync(inQuery);
|
||||||
|
|
||||||
|
return pageList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<IResponseOutput> AddOrUpdateEmailLog(EmailLogAddOrEdit addOrEditEmailLog)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var entity = await _emailLogRepository.InsertOrUpdateAsync(addOrEditEmailLog, true);
|
||||||
|
|
||||||
|
return ResponseOutput.Ok(entity.Id.ToString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpDelete("{emailLogId:guid}")]
|
||||||
|
public async Task<IResponseOutput> DeleteEmailLog(Guid emailLogId)
|
||||||
|
{
|
||||||
|
var success = await _emailLogRepository.DeleteFromQueryAsync(t => t.Id == emailLogId,true);
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -4,9 +4,18 @@
|
||||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
|
using DocumentFormat.OpenXml.Spreadsheet;
|
||||||
using IRaCIS.Core.Application.Helper;
|
using IRaCIS.Core.Application.Helper;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
|
using MailKit;
|
||||||
|
using MailKit.Net.Imap;
|
||||||
|
using MailKit.Search;
|
||||||
|
using MailKit.Security;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
using NPOI.SS.Formula.Functions;
|
using NPOI.SS.Formula.Functions;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
|
@ -17,8 +26,75 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiExplorerSettings(GroupName = "Common")]
|
[ApiExplorerSettings(GroupName = "Common")]
|
||||||
public class EmailNoticeConfigService(IRepository<EmailNoticeConfig> _emailNoticeConfigrepository,
|
public class EmailNoticeConfigService(IRepository<EmailNoticeConfig> _emailNoticeConfigrepository,
|
||||||
IRepository<EmailNoticeUserType> _emailNoticeUserTypeRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IEmailNoticeConfigService
|
IRepository<EmailNoticeUserType> _emailNoticeUserTypeRepository,
|
||||||
|
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig,
|
||||||
|
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IEmailNoticeConfigService
|
||||||
{
|
{
|
||||||
|
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取邮件列表
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<object> GetEmailList()
|
||||||
|
{
|
||||||
|
|
||||||
|
List<IMessageSummary> emailList = new List<IMessageSummary>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
using (var client = new ImapClient())
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 连接阿里邮箱 IMAP 服务器(使用 SSL)
|
||||||
|
client.Connect(_systemEmailConfig.Imap, 993, SecureSocketOptions.SslOnConnect);
|
||||||
|
|
||||||
|
// 登录
|
||||||
|
client.Authenticate(_systemEmailConfig.FromEmail, _systemEmailConfig.AuthorizationCode);
|
||||||
|
|
||||||
|
// 3. 获取发件箱文件夹 - 使用你找到的“已发送”
|
||||||
|
var sentFolder = client.GetFolder("已发送");
|
||||||
|
sentFolder.Open(FolderAccess.ReadOnly);
|
||||||
|
|
||||||
|
// 4. 搜索所有邮件(你可以在这里添加更精确的搜索条件)
|
||||||
|
var uids = sentFolder.Search(SearchQuery.All);
|
||||||
|
Console.WriteLine($"找到 {uids.Count} 封已发送邮件");
|
||||||
|
|
||||||
|
// 5. 遍历并处理邮件(示例中处理前10封)
|
||||||
|
foreach (var uid in uids.Take(10))
|
||||||
|
{
|
||||||
|
var message = sentFolder.GetMessage(uid);
|
||||||
|
|
||||||
|
// 输出邮件基本信息
|
||||||
|
Console.WriteLine($"主题: {message.Subject}");
|
||||||
|
Console.WriteLine($"收件人: {string.Join(", ", message.To.Mailboxes.Select(m => m.Address))}");
|
||||||
|
Console.WriteLine($"日期: {message.Date.LocalDateTime:yyyy-MM-dd HH:mm:ss}");
|
||||||
|
Console.WriteLine($"发件人: {message.From}");
|
||||||
|
Console.WriteLine("----------------------------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
sentFolder.Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"操作失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
client.Disconnect(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<PageOutput<EmailNoticeConfigView>> GetEmailNoticeConfigList(EmailNoticeConfigQuery inQuery)
|
public async Task<PageOutput<EmailNoticeConfigView>> GetEmailNoticeConfigList(EmailNoticeConfigQuery inQuery)
|
||||||
|
|
|
||||||
|
|
@ -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<PageOutput<EmailLogView>> GetEmailLogList(EmailLogQuery inQuery);
|
||||||
|
|
||||||
|
Task<IResponseOutput> AddOrUpdateEmailLog(EmailLogAddOrEdit addOrEditEmailLog);
|
||||||
|
|
||||||
|
Task<IResponseOutput> DeleteEmailLog(Guid emailLogId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -5,9 +5,13 @@ using IRaCIS.Core.Domain.Models;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
using MailKit;
|
using MailKit;
|
||||||
|
using MailKit.Net.Imap;
|
||||||
|
using MailKit.Search;
|
||||||
|
using MailKit.Security;
|
||||||
using Medallion.Threading;
|
using Medallion.Threading;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using MimeKit;
|
using MimeKit;
|
||||||
using System.Net.Mail;
|
using System.Net.Mail;
|
||||||
|
|
@ -78,7 +82,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
Task SiteSuervyUpdateUser(Guid trialSiteId, string email, string name, string url);
|
Task SiteSuervyUpdateUser(Guid trialSiteId, string email, string name, string url);
|
||||||
}
|
}
|
||||||
|
[ApiExplorerSettings(GroupName = "Common")]
|
||||||
public class MailVerificationService(IRepository<VerificationCode> _verificationCodeRepository,
|
public class MailVerificationService(IRepository<VerificationCode> _verificationCodeRepository,
|
||||||
IRepository<SystemBasicData> _systemBasicDatarepository,
|
IRepository<SystemBasicData> _systemBasicDatarepository,
|
||||||
IRepository<VisitTask> _visitTaskRepository,
|
IRepository<VisitTask> _visitTaskRepository,
|
||||||
|
|
@ -93,16 +97,14 @@ namespace IRaCIS.Core.Application.Service
|
||||||
IRepository<UserType> _userTypeRepository,
|
IRepository<UserType> _userTypeRepository,
|
||||||
IRepository<Doctor> _doctorTypeRepository,
|
IRepository<Doctor> _doctorTypeRepository,
|
||||||
IRepository<Dictionary> _dictionaryRepository,
|
IRepository<Dictionary> _dictionaryRepository,
|
||||||
|
|
||||||
IRepository<EmailNoticeConfig> _emailNoticeConfigrepository,
|
IRepository<EmailNoticeConfig> _emailNoticeConfigrepository,
|
||||||
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig,
|
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig,
|
||||||
IDistributedLockProvider _distributedLockProvider, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IMailVerificationService
|
IDistributedLockProvider _distributedLockProvider, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IMailVerificationService
|
||||||
{
|
{
|
||||||
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
|
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
|
||||||
|
|
||||||
|
|
||||||
//public async Task<object> GetEmailList()
|
|
||||||
//{
|
|
||||||
//}
|
|
||||||
|
|
||||||
private async Task<EmailNoticeConfig> GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario scenario, MimeMessage messageToSend,
|
private async Task<EmailNoticeConfig> GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario scenario, MimeMessage messageToSend,
|
||||||
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailFunc)
|
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailFunc)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,10 @@ namespace IRaCIS.Core.Application.Service
|
||||||
{
|
{
|
||||||
public CommonConfig()
|
public CommonConfig()
|
||||||
{
|
{
|
||||||
|
// 在此处拷贝automapper 映射
|
||||||
|
|
||||||
|
CreateMap<EmailLog, EmailLogView>();
|
||||||
|
CreateMap<EmailLog, EmailLogAddOrEdit>().ReverseMap();
|
||||||
|
|
||||||
CreateMap<FrontAuditConfig, FrontAuditConfigAddOrEdit>().ReverseMap();
|
CreateMap<FrontAuditConfig, FrontAuditConfigAddOrEdit>().ReverseMap();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3767,7 +3767,8 @@ namespace IRaCIS.Core.Application.Service
|
||||||
await _readingTaskQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId);
|
await _readingTaskQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId);
|
||||||
await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId);
|
await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId);
|
||||||
await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId);
|
await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId);
|
||||||
|
await _readingNoneDicomMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId);
|
||||||
|
await _readingNoneDicomMarkBindingRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId);
|
||||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => x.Id == inDto.VisitTaskId, x => new VisitTask()
|
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => x.Id == inDto.VisitTaskId, x => new VisitTask()
|
||||||
{
|
{
|
||||||
ReadingTaskState = ReadingTaskState.WaitReading
|
ReadingTaskState = ReadingTaskState.WaitReading
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,24 @@ namespace IRaCIS.Core.Domain.Share
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public enum EmailState
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 成功
|
||||||
|
/// </summary>
|
||||||
|
Success = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 失败
|
||||||
|
/// </summary>
|
||||||
|
Error = 1,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum GenerateTaskCategory
|
public enum GenerateTaskCategory
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
using IRaCIS.Core.Domain.Share;
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Domain.Models;
|
||||||
|
|
||||||
|
[Comment("邮件日志")]
|
||||||
|
[Table("EmailLog")]
|
||||||
|
public class EmailLog : BaseFullAuditEntity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 邮件Id
|
||||||
|
/// </summary>
|
||||||
|
public string MessageId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 唯一Id
|
||||||
|
/// </summary>
|
||||||
|
public string UniqueId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 邮件主题
|
||||||
|
/// </summary>
|
||||||
|
public string EmailSubject { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 收件人
|
||||||
|
/// </summary>
|
||||||
|
public List<string> ToRecipients { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 抄送人
|
||||||
|
/// </summary>
|
||||||
|
public List<string> CcRecipients { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 附件
|
||||||
|
/// </summary>
|
||||||
|
public List<string> Attachments { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 日期
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? EmailDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 错误信息
|
||||||
|
/// </summary>
|
||||||
|
public string ErrorInfo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发件人地址
|
||||||
|
/// </summary>
|
||||||
|
public string SenderAddress { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 邮件状态
|
||||||
|
/// </summary>
|
||||||
|
public EmailState EmailStateEnum { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -555,6 +555,8 @@ public class IRaCISDBContext : DbContext
|
||||||
|
|
||||||
#region 未分类
|
#region 未分类
|
||||||
|
|
||||||
|
public virtual DbSet<EmailLog> EmailLog { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<ShortcutKey> ShortcutKey { get; set; }
|
public virtual DbSet<ShortcutKey> ShortcutKey { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<UserWLTemplate> UserWLTemplate { get; set; }
|
public virtual DbSet<UserWLTemplate> UserWLTemplate { get; set; }
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,59 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class EmailLog : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "EmailLog",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
MessageId = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
||||||
|
UniqueId = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
||||||
|
EmailSubject = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
||||||
|
ToRecipients = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
CcRecipients = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Attachments = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
EmailDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
ErrorInfo = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
||||||
|
SenderAddress = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
||||||
|
EmailStateEnum = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
UpdateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_EmailLog", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_EmailLog_User_CreateUserId",
|
||||||
|
column: x => x.CreateUserId,
|
||||||
|
principalTable: "User",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
},
|
||||||
|
comment: "邮件日志");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_EmailLog_CreateUserId",
|
||||||
|
table: "EmailLog",
|
||||||
|
column: "CreateUserId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "EmailLog");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2300,6 +2300,76 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailLog", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Attachments")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("CcRecipients")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("EmailDate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("EmailStateEnum")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("EmailSubject")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(400)
|
||||||
|
.HasColumnType("nvarchar(400)");
|
||||||
|
|
||||||
|
b.Property<string>("ErrorInfo")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(400)
|
||||||
|
.HasColumnType("nvarchar(400)");
|
||||||
|
|
||||||
|
b.Property<string>("MessageId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(400)
|
||||||
|
.HasColumnType("nvarchar(400)");
|
||||||
|
|
||||||
|
b.Property<string>("SenderAddress")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(400)
|
||||||
|
.HasColumnType("nvarchar(400)");
|
||||||
|
|
||||||
|
b.Property<string>("ToRecipients")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("UniqueId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(400)
|
||||||
|
.HasColumnType("nvarchar(400)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CreateUserId");
|
||||||
|
|
||||||
|
b.ToTable("EmailLog", t =>
|
||||||
|
{
|
||||||
|
t.HasComment("邮件日志");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailNoticeConfig", b =>
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailNoticeConfig", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
|
@ -16369,6 +16439,17 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
b.Navigation("CreateUserRole");
|
b.Navigation("CreateUserRole");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailLog", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CreateUserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("CreateUserRole");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailNoticeConfig", b =>
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailNoticeConfig", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue