修改邮件解析服务

optimize
jianghaiqing 11 months ago
parent 1d9f15c8ee
commit cddc5fe4dd

@ -129,6 +129,26 @@ namespace Myshipping.Application
.Map(dest => dest.BODY_REGEX_PATTERN, src => src.BodyRegexPattern)
.Map(dest => dest.SENDER_REGEX_PATTERN, src => src.SenderRegexPattern)
.Map(dest => dest.ATTACH_REGEX_PATTERN, src => src.AttachRegexPattern);
config.ForType<EmailExcuteCodeInjectConfigInfo, EmailExcuteCodeInjectConfigPageDto>()
.Map(dest => dest.GID, src => src.GID)
.Map(dest => dest.InjectCode, src => src.INJECT_CODE)
.Map(dest => dest.InjectName, src => src.INJECT_NAME)
.Map(dest => dest.InjectFullName, src => src.INJECT_FULLNAME)
.Map(dest => dest.CreatedTime, src => src.CreatedTime)
.Map(dest => dest.CreatedUserName, src => src.CreatedUserName)
.Map(dest => dest.UpdatedTime, src => src.UpdatedTime)
.Map(dest => dest.UpdatedUserName, src => src.UpdatedUserName);
config.ForType<EmailExcuteCodeInjectConfigDto, EmailExcuteCodeInjectConfigInfo>()
.Map(dest => dest.GID, src => src.GID)
.Map(dest => dest.INJECT_CODE, src => src.InjectCode)
.Map(dest => dest.INJECT_NAME, src => src.InjectName)
.Map(dest => dest.INJECT_FULLNAME, src => src.InjectFullName)
.Map(dest => dest.CreatedTime, src => src.CreatedTime)
.Map(dest => dest.UpdatedTime, src => src.UpdatedTime);
}
}
}

@ -1,5 +1,6 @@
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Furion.EventBus;
using Furion.FriendlyException;
using Mapster;
using Microsoft.AspNetCore.Mvc;
@ -16,6 +17,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Channels;
using System.Threading;
using System.Threading.Tasks;
namespace Myshipping.Application
@ -29,10 +32,10 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<EmaiReceiveRecordInfo> _emaiReceiveRecordeInfoRepository;
private readonly SqlSugarRepository<EmaiReceiveRecordDetailInfo> _emaiReceiveRecordDetailInfoRepository;
private readonly ILogger<EmaiReceiveRecordService> _logger;
public EmaiReceiveRecordService(ILogger<EmaiReceiveRecordService> logger,
public EmaiReceiveRecordService(ILogger<EmaiReceiveRecordService> logger,
SqlSugarRepository<EmaiReceiveRecordInfo> emaiReceiveRecordeInfoRepository,
SqlSugarRepository<EmaiReceiveRecordDetailInfo> emaiReceiveRecordDetailInfoRepository)
{
@ -66,9 +69,9 @@ namespace Myshipping.Application
var showModel = model.Adapt<EmaiReceiveRecordDto>();
if(!string.IsNullOrWhiteSpace(model.MAIL_ATTACHMENTS))
if (!string.IsNullOrWhiteSpace(model.MAIL_ATTACHMENTS))
{
showModel.AttachmentList = model.MAIL_ATTACHMENTS.Split(new char[] { ';'}).Where(t=>!string.IsNullOrWhiteSpace(t)).Select(t=>t.Trim()).ToList();
showModel.AttachmentList = model.MAIL_ATTACHMENTS.Split(new char[] { ';' }).Where(t => !string.IsNullOrWhiteSpace(t)).Select(t => t.Trim()).ToList();
}
result.succ = true;
@ -196,7 +199,7 @@ namespace Myshipping.Application
query = query.Where(t => t.UpdatedTime < currDate);
}
if(!string.IsNullOrWhiteSpace(QuerySearch.MailSubject))
if (!string.IsNullOrWhiteSpace(QuerySearch.MailSubject))
{
query = query.Where(t => t.MAIL_SUBJECT.Contains(QuerySearch.MailSubject));
}
@ -280,7 +283,7 @@ namespace Myshipping.Application
{
showModel.detailList = detailList.OrderByDescending(a => a.CreatedTime)
.Select(a => new EmaiReceiveRecordDetailDto
{
{
GID = a.GID,
FileName = a.FILE_NAME,
Status = a.STATUS,
@ -329,7 +332,7 @@ namespace Myshipping.Application
if (model == null)
throw Oops.Oh($"邮件接收记录获取失败,邮件接收记录不存在或已作废", typeof(InvalidOperationException));
if(string.IsNullOrWhiteSpace(model.MAIL_FILEPATH))
if (string.IsNullOrWhiteSpace(model.MAIL_FILEPATH))
throw Oops.Oh($"邮件文件提取失败,请联系管理员", typeof(InvalidOperationException));
//读取邮件,解析邮件正文
@ -388,6 +391,8 @@ namespace Myshipping.Application
try
{
result.succ = true;
result.msg = "成功";
}

@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Myshipping.Application.Service.EmailParserServerManage
{
/// <summary>
/// 邮件解析配置
/// 邮件执行代码注入配置
/// </summary>
[ApiDescriptionSettings("Application", Name = "EmailExcuteCodeInjectConfigServices", Order = 9)]
public class EmailExcuteCodeInjectConfigService : IEmailExcuteCodeInjectConfigService, IDynamicApiController, ITransient
@ -39,6 +39,7 @@ namespace Myshipping.Application.Service.EmailParserServerManage
/// </summary>
/// <param name="info">邮件执行代码注入配置信息</param>
/// <returns>返回回执</returns>
[HttpPost("/EmailExcuteCodeInjectConfig/Save")]
public async Task<TaskManageOrderResultDto> Save(EmailExcuteCodeInjectConfigDto info)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -131,6 +132,7 @@ namespace Myshipping.Application.Service.EmailParserServerManage
/// </summary>
/// <param name="gid">邮件解析配置主键</param>
/// <returns>返回回执</returns>
[HttpGet("/EmailExcuteCodeInjectConfig/GetInfo")]
public async Task<TaskManageOrderResultDto> GetInfo(string gid)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -169,7 +171,8 @@ namespace Myshipping.Application.Service.EmailParserServerManage
/// </summary>
/// <param name="gIds">邮件执行代码注入配置主键数组</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> Delete(string[] gIds)
[HttpPost("/EmailExcuteCodeInjectConfig/Delete")]
public async Task<TaskManageOrderResultDto> Delete([FromBody] string[] gIds)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -220,6 +223,7 @@ namespace Myshipping.Application.Service.EmailParserServerManage
/// </summary>
/// <param name="QuerySearch">邮件执行代码注入配置查询请求</param>
/// <returns>返回结果</returns>
[HttpPost("/EmailExcuteCodeInjectConfig/GetPage")]
public async Task<SqlSugarPagedList<EmailExcuteCodeInjectConfigPageDto>> GetPageAsync(QueryEmailExcuteCodeInjectConfigDto QuerySearch)
{
var query = _emailExcuteCodeInjectConfigInfoRepository.AsQueryable();

Loading…
Cancel
Save