|
@@ -21,6 +21,7 @@ namespace OASystem.API.OAMethodLib.Quartz.Business
|
|
|
private static readonly IDeepSeekService _deepSeekService = AutofacIocManager.Instance.GetService<IDeepSeekService>();
|
|
private static readonly IDeepSeekService _deepSeekService = AutofacIocManager.Instance.GetService<IDeepSeekService>();
|
|
|
private static readonly Microsoft.Extensions.Logging.ILogger _logger =AutofacIocManager.Instance.GetService<ILoggerFactory>().CreateLogger("ProcessAndNotifySummary");
|
|
private static readonly Microsoft.Extensions.Logging.ILogger _logger =AutofacIocManager.Instance.GetService<ILoggerFactory>().CreateLogger("ProcessAndNotifySummary");
|
|
|
|
|
|
|
|
|
|
+ private static List<string> _defaultEmails = new List<string>() { "johnny.yang@pan-american-intl.com", "ellisa.wang@pan-american-intl.com" };
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// hotmail 邮件 汇总 发送企微邮件
|
|
/// hotmail 邮件 汇总 发送企微邮件
|
|
|
/// 时间范围 昨天
|
|
/// 时间范围 昨天
|
|
@@ -41,7 +42,6 @@ namespace OASystem.API.OAMethodLib.Quartz.Business
|
|
|
var yesterdayStart = nowInCst.Date.AddDays(-1);
|
|
var yesterdayStart = nowInCst.Date.AddDays(-1);
|
|
|
var yesterdayEnd = yesterdayStart.AddDays(1).AddTicks(-1);
|
|
var yesterdayEnd = yesterdayStart.AddDays(1).AddTicks(-1);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
_logger.LogInformation("Hotmail 定时发送邮件 -> 获取Hotmail邮件信息 -> 开始");
|
|
_logger.LogInformation("Hotmail 定时发送邮件 -> 获取Hotmail邮件信息 -> 开始");
|
|
|
// 获取邮件信息
|
|
// 获取邮件信息
|
|
|
var emailInfos = await _hotmailService.GetMergedMessagesAsync(hotmails, yesterdayStart, yesterdayEnd);
|
|
var emailInfos = await _hotmailService.GetMergedMessagesAsync(hotmails, yesterdayStart, yesterdayEnd);
|
|
@@ -112,18 +112,13 @@ namespace OASystem.API.OAMethodLib.Quartz.Business
|
|
|
finalBody = summary.TextBody;
|
|
finalBody = summary.TextBody;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 默认发送 至 杨俊z霄、王鸽 邮件
|
|
|
|
|
- string defualtEmail_yanjunxiao = "johnny.yang@pan-american-intl.com";
|
|
|
|
|
- string defualtEmail_wangge = "ellisa.wang@pan-american-intl.com";
|
|
|
|
|
-
|
|
|
|
|
_logger.LogInformation("Hotmail 定时发送邮件 -> DeepSeek AI 分析汇总邮件 -> 解析AI返回的json -> 发送腾讯邮件 -> {email} 开始", qwEmail);
|
|
_logger.LogInformation("Hotmail 定时发送邮件 -> DeepSeek AI 分析汇总邮件 -> 解析AI返回的json -> 发送腾讯邮件 -> {email} 开始", qwEmail);
|
|
|
|
|
+
|
|
|
|
|
+ var toEmails = new List<string>() { qwEmail };
|
|
|
|
|
+ toEmails.AddRange(_defaultEmails);
|
|
|
var seedRes = await _qiYeWeChatApiService.EmailSendAsync(new EmailRequestDto
|
|
var seedRes = await _qiYeWeChatApiService.EmailSendAsync(new EmailRequestDto
|
|
|
{
|
|
{
|
|
|
- ToEmails = new List<string> {
|
|
|
|
|
- qwEmail,
|
|
|
|
|
- defualtEmail_yanjunxiao,
|
|
|
|
|
- defualtEmail_wangge
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ ToEmails = toEmails,
|
|
|
Subject = finalSubject,
|
|
Subject = finalSubject,
|
|
|
Body = finalBody,
|
|
Body = finalBody,
|
|
|
});
|
|
});
|
|
@@ -211,15 +206,26 @@ Now, output the JSON array based on the logic above. No prose, no chat, just the
|
|
|
|
|
|
|
|
private static async Task NotifyEmptyEmails(List<int> userIds)
|
|
private static async Task NotifyEmptyEmails(List<int> userIds)
|
|
|
{
|
|
{
|
|
|
- var userEmails = await _sqlSugar.Queryable<Sys_Users>().Where(x => x.IsDel == 0 && userIds.Contains(x.Id)).Select(x => x.Email).ToListAsync();
|
|
|
|
|
|
|
+ var userEmails = await _sqlSugar.Queryable<Sys_Users>().Where(x => x.IsDel == 0 && userIds.Contains(x.Id)).Select(x => x.Email.Trim()).ToListAsync();
|
|
|
if (userEmails.Any())
|
|
if (userEmails.Any())
|
|
|
{
|
|
{
|
|
|
- await _qiYeWeChatApiService.EmailSendAsync(new EmailRequestDto
|
|
|
|
|
|
|
+ try
|
|
|
{
|
|
{
|
|
|
- ToEmails = userEmails,
|
|
|
|
|
- Subject = $"{DateTime.Now:yyyy-MM-dd} - 邮件汇总",
|
|
|
|
|
- Body = "昨日暂未收到有效邮件。"
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ userEmails.AddRange(_defaultEmails);
|
|
|
|
|
+
|
|
|
|
|
+ await _qiYeWeChatApiService.EmailSendAsync(new EmailRequestDto
|
|
|
|
|
+ {
|
|
|
|
|
+ ToEmails = userEmails,
|
|
|
|
|
+ Subject = $"{DateTime.Now:yyyy-MM-dd} - 邮件汇总",
|
|
|
|
|
+ Body = "昨日暂未收到有效邮件。"
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (Exception ex)
|
|
|
|
|
+ {
|
|
|
|
|
+ _logger.LogInformation("Microsoft Hotmail 定时发送邮件 -> 获取Hotmail邮件信息 -> 发送无邮件情况 -> 发送失败!【MSG:{ErrorMsg}】", ex.Message);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ _logger.LogInformation("Microsoft Hotmail 定时发送邮件 -> 获取Hotmail邮件信息 -> 发送无邮件情况 -> 发送成功!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|