修改邮件解析服务

optimize
jianghaiqing 11 months ago
parent 7716a3bb50
commit bd55f78c6a

@ -23,14 +23,17 @@ namespace Myshipping.Application.Service.EmailParserServerManage
public class EmailExcuteCodeInjectConfigService : IEmailExcuteCodeInjectConfigService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<EmailExcuteCodeInjectConfigInfo> _emailExcuteCodeInjectConfigInfoRepository;
private readonly SqlSugarRepository<EmailParserConfigInfo> _emailParserConfigInfoRepository;
private readonly ILogger<EmailExcuteCodeInjectConfigService> _logger;
public EmailExcuteCodeInjectConfigService(SqlSugarRepository<EmailExcuteCodeInjectConfigInfo> emailExcuteCodeInjectConfigInfoRepository,
ILogger<EmailExcuteCodeInjectConfigService> logger)
ILogger<EmailExcuteCodeInjectConfigService> logger,
SqlSugarRepository<EmailParserConfigInfo> emailParserConfigInfoRepository)
{
_emailExcuteCodeInjectConfigInfoRepository = emailExcuteCodeInjectConfigInfoRepository;
_logger = logger;
_emailParserConfigInfoRepository = emailParserConfigInfoRepository;
}
#region 保存邮件执行代码注入配置
@ -318,5 +321,36 @@ namespace Myshipping.Application.Service.EmailParserServerManage
return entities.Adapt<SqlSugarPagedList<EmailExcuteCodeInjectConfigPageDto>>();
}
#endregion
/// <summary>
/// 检索所有使用此执行代码注入的解析配置列表
/// </summary>
/// <param name="gid">邮件执行代码注入配置主键</param>
/// <returns>返回结果</returns>
[HttpGet("/EmailExcuteCodeInjectConfig/QueryUseParserConfigEmailList")]
public async Task<TaskManageOrderResultDto> QueryUseParserConfigEmailList(string gid)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
var accountList = _emailParserConfigInfoRepository.AsQueryable()
.Where(par => par.INJECT_ID == gid)
.ToList();
var list = accountList.Select(t =>
t.Adapt<EmailParserConfigDto>()).OrderBy(t => t.ParserName).ToList();
result.succ = true;
result.ext = list;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"检索所有使用此执行代码注入的解析配置列表异常,原因:{ex.Message}";
}
return result;
}
}
}

@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging;
using Myshipping.Application.Entity;
using Myshipping.Application.Helper;
using Myshipping.Core;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@ -398,5 +399,41 @@ namespace Myshipping.Application
return result;
}
#endregion
#region 检索所有使用此邮件解析配置邮箱列表
/// <summary>
/// 检索所有使用此邮件解析配置邮箱列表
/// </summary>
/// <param name="gid">邮件解析配置主键</param>
/// <returns></returns>
[HttpGet("/EmailParserConfig/QueryUseParserConfigEmailList")]
public async Task<TaskManageOrderResultDto> QueryUseParserConfigEmailList([FromQuery] string gid)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
var accountList = _emailParserConfigInfoRepository.AsQueryable()
.InnerJoin<EmailUserAccountParserRelationInfo>((par,rela)=> par.GID == rela.EMAIL_PARSER_ID)
.InnerJoin<EmailUserAccountInfo>((par, rela,acc) => rela.EMAIL_ACCOUNT_ID == acc.GID)
.Where(par=> par.GID == gid)
.Select((par, rela, acc)=>acc)
.ToList();
var list = accountList.Select(t =>
t.Adapt<EmailUserAccountDto>()).OrderBy(t=>t.EmailAccount).ToList();
result.succ = true;
result.ext = list;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"检索所有使用此邮件解析配置邮箱列表异常,原因:{ex.Message}";
}
return result;
}
#endregion
}
}

@ -39,5 +39,13 @@ namespace Myshipping.Application
/// <param name="QuerySearch">邮件执行代码注入配置台账查询请求</param>
/// <returns>返回结果</returns>
Task<SqlSugarPagedList<EmailExcuteCodeInjectConfigPageDto>> GetPageAsync(QueryEmailExcuteCodeInjectConfigDto QuerySearch);
/// <summary>
/// 检索所有使用此执行代码注入配置的解析配置列表
/// </summary>
/// <param name="gid">邮件执行代码注入配置主键</param>
/// <returns>返回结果</returns>
Task<TaskManageOrderResultDto> QueryUseParserConfigEmailList(string gid);
}
}

@ -45,5 +45,13 @@ namespace Myshipping.Application
/// <param name="topNum">返回记录最大条数(可以根据需要自助设定)</param>
/// <returns></returns>
Task<TaskManageOrderResultDto> QueryExcuteCodeInjectConfigList(string queryItem, int topNum = 10);
/// <summary>
/// 检索所有使用此邮件解析配置邮箱列表
/// </summary>
/// <param name="gid">邮件解析配置主键</param>
/// <returns>返回结果</returns>
Task<TaskManageOrderResultDto> QueryUseParserConfigEmailList(string gid);
}
}

Loading…
Cancel
Save