diff --git a/Myshipping.Application/Service/EmailParserServerManage/EmailExcuteCodeInjectConfigService.cs b/Myshipping.Application/Service/EmailParserServerManage/EmailExcuteCodeInjectConfigService.cs index aed01100..6e1e7ff8 100644 --- a/Myshipping.Application/Service/EmailParserServerManage/EmailExcuteCodeInjectConfigService.cs +++ b/Myshipping.Application/Service/EmailParserServerManage/EmailExcuteCodeInjectConfigService.cs @@ -23,14 +23,17 @@ namespace Myshipping.Application.Service.EmailParserServerManage public class EmailExcuteCodeInjectConfigService : IEmailExcuteCodeInjectConfigService, IDynamicApiController, ITransient { private readonly SqlSugarRepository _emailExcuteCodeInjectConfigInfoRepository; + private readonly SqlSugarRepository _emailParserConfigInfoRepository; private readonly ILogger _logger; public EmailExcuteCodeInjectConfigService(SqlSugarRepository emailExcuteCodeInjectConfigInfoRepository, - ILogger logger) + ILogger logger, + SqlSugarRepository emailParserConfigInfoRepository) { _emailExcuteCodeInjectConfigInfoRepository = emailExcuteCodeInjectConfigInfoRepository; _logger = logger; + _emailParserConfigInfoRepository = emailParserConfigInfoRepository; } #region 保存邮件执行代码注入配置 @@ -318,5 +321,36 @@ namespace Myshipping.Application.Service.EmailParserServerManage return entities.Adapt>(); } #endregion + + /// + /// 检索所有使用此执行代码注入的解析配置列表 + /// + /// 邮件执行代码注入配置主键 + /// 返回结果 + [HttpGet("/EmailExcuteCodeInjectConfig/QueryUseParserConfigEmailList")] + public async Task 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()).OrderBy(t => t.ParserName).ToList(); + + result.succ = true; + result.ext = list; + } + catch (Exception ex) + { + result.succ = false; + result.msg = $"检索所有使用此执行代码注入的解析配置列表异常,原因:{ex.Message}"; + } + + return result; + } } } diff --git a/Myshipping.Application/Service/EmailParserServerManage/EmailParserConfigService.cs b/Myshipping.Application/Service/EmailParserServerManage/EmailParserConfigService.cs index 884d3dda..4d1424bc 100644 --- a/Myshipping.Application/Service/EmailParserServerManage/EmailParserConfigService.cs +++ b/Myshipping.Application/Service/EmailParserServerManage/EmailParserConfigService.cs @@ -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 检索所有使用此邮件解析配置邮箱列表 + /// + /// 检索所有使用此邮件解析配置邮箱列表 + /// + /// 邮件解析配置主键 + /// + [HttpGet("/EmailParserConfig/QueryUseParserConfigEmailList")] + public async Task QueryUseParserConfigEmailList([FromQuery] string gid) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + try + { + var accountList = _emailParserConfigInfoRepository.AsQueryable() + .InnerJoin((par,rela)=> par.GID == rela.EMAIL_PARSER_ID) + .InnerJoin((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()).OrderBy(t=>t.EmailAccount).ToList(); + + result.succ = true; + result.ext = list; + } + catch (Exception ex) + { + result.succ = false; + result.msg = $"检索所有使用此邮件解析配置邮箱列表异常,原因:{ex.Message}"; + } + + return result; + } + #endregion } } diff --git a/Myshipping.Application/Service/EmailParserServerManage/Interface/IEmailExcuteCodeInjectConfigService.cs b/Myshipping.Application/Service/EmailParserServerManage/Interface/IEmailExcuteCodeInjectConfigService.cs index 3b6d0bd3..f2cfddde 100644 --- a/Myshipping.Application/Service/EmailParserServerManage/Interface/IEmailExcuteCodeInjectConfigService.cs +++ b/Myshipping.Application/Service/EmailParserServerManage/Interface/IEmailExcuteCodeInjectConfigService.cs @@ -39,5 +39,13 @@ namespace Myshipping.Application /// 邮件执行代码注入配置台账查询请求 /// 返回结果 Task> GetPageAsync(QueryEmailExcuteCodeInjectConfigDto QuerySearch); + + + /// + /// 检索所有使用此执行代码注入配置的解析配置列表 + /// + /// 邮件执行代码注入配置主键 + /// 返回结果 + Task QueryUseParserConfigEmailList(string gid); } } diff --git a/Myshipping.Application/Service/EmailParserServerManage/Interface/IEmailParserConfigService.cs b/Myshipping.Application/Service/EmailParserServerManage/Interface/IEmailParserConfigService.cs index 34dd7c53..35a091c1 100644 --- a/Myshipping.Application/Service/EmailParserServerManage/Interface/IEmailParserConfigService.cs +++ b/Myshipping.Application/Service/EmailParserServerManage/Interface/IEmailParserConfigService.cs @@ -45,5 +45,13 @@ namespace Myshipping.Application /// 返回记录最大条数(可以根据需要自助设定) /// Task QueryExcuteCodeInjectConfigList(string queryItem, int topNum = 10); + + + /// + /// 检索所有使用此邮件解析配置邮箱列表 + /// + /// 邮件解析配置主键 + /// 返回结果 + Task QueryUseParserConfigEmailList(string gid); } }