|
|
|
@ -32,6 +32,7 @@ using System.Runtime.InteropServices;
|
|
|
|
|
using System.Security.Cryptography;
|
|
|
|
|
using System.Security.Principal;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Xml;
|
|
|
|
@ -1456,8 +1457,12 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
string filePath = string.Empty;
|
|
|
|
|
|
|
|
|
|
SysUser opUserInfo = null;
|
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrWhiteSpace(bookingOrderEntity.OPID) && Regex.IsMatch(bookingOrderEntity.OPID,"[0-9]+"))
|
|
|
|
|
opUserInfo = _sysUserRepository.AsQueryable().First(u => u.Id == long.Parse(bookingOrderEntity.OPID));
|
|
|
|
|
//读取邮件模板并填充数据
|
|
|
|
|
string emailHtml = GenerateSendEmailHtml(taskBCInfo, UserManager.TENANT_NAME).GetAwaiter().GetResult();
|
|
|
|
|
string emailHtml = GenerateSendEmailHtml(taskBCInfo, opUserInfo,UserManager.TENANT_NAME).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"生成邮件BODY,结果:{emailHtml}");
|
|
|
|
|
|
|
|
|
@ -1522,9 +1527,10 @@ namespace Myshipping.Application
|
|
|
|
|
/// 通过邮件模板生成HTML
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="taskBCInfo">BC任务详情</param>
|
|
|
|
|
/// <param name="opUserInfo">订舱OP详情</param>
|
|
|
|
|
/// <param name="tenantName">当前租户全称</param>
|
|
|
|
|
/// <returns>返回生成的HTML</returns>
|
|
|
|
|
public async Task<string> GenerateSendEmailHtml(TaskBCInfo taskBCInfo,string tenantName)
|
|
|
|
|
public async Task<string> GenerateSendEmailHtml(TaskBCInfo taskBCInfo, SysUser opUserInfo, string tenantName)
|
|
|
|
|
{
|
|
|
|
|
string result = string.Empty;
|
|
|
|
|
|
|
|
|
@ -1550,6 +1556,33 @@ namespace Myshipping.Application
|
|
|
|
|
if (string.IsNullOrWhiteSpace(baseHtml))
|
|
|
|
|
throw Oops.Oh($"读取邮件模板失败");
|
|
|
|
|
|
|
|
|
|
if(opUserInfo != null && !string.IsNullOrWhiteSpace(opUserInfo.Name))
|
|
|
|
|
{
|
|
|
|
|
baseHtml = baseHtml.Replace("#opname#", opUserInfo.Name);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
baseHtml = baseHtml.Replace("#opname#", "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (opUserInfo != null && !string.IsNullOrWhiteSpace(opUserInfo.Email))
|
|
|
|
|
{
|
|
|
|
|
baseHtml = baseHtml.Replace("#opmail#", opUserInfo.Email);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
baseHtml = baseHtml.Replace("#opmail#", "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (opUserInfo != null && !string.IsNullOrWhiteSpace(opUserInfo.Tel))
|
|
|
|
|
{
|
|
|
|
|
baseHtml = baseHtml.Replace("#optel#", opUserInfo.Tel);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
baseHtml = baseHtml.Replace("#optel#", "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HtmlDocument html = new HtmlDocument();
|
|
|
|
|
html.LoadHtml(baseHtml);
|
|
|
|
|
|
|
|
|
|