diff --git a/Myshipping.Application/Service/Fee/Dto/FeeCodeDto.cs b/Myshipping.Application/Service/Fee/Dto/FeeCodeDto.cs index bd8a85de..b419689f 100644 --- a/Myshipping.Application/Service/Fee/Dto/FeeCodeDto.cs +++ b/Myshipping.Application/Service/Fee/Dto/FeeCodeDto.cs @@ -133,8 +133,21 @@ namespace Myshipping.Application.Service.Fee.Dto } + /// + /// 费用代码列表查询 + /// public class FeeCodeCacheDto : FeeCodeDto { public long TenantId { get; set; } } + + /// + /// 结算对象列表查询 + /// + public class FeeCustomerDto + { + public string Code { get; set; } + public string Name { get; set; } + public string ShowName { get; set; } + } } diff --git a/Myshipping.Application/Service/Fee/FeeRecordService.cs b/Myshipping.Application/Service/Fee/FeeRecordService.cs index 44c0de20..cb91bc92 100644 --- a/Myshipping.Application/Service/Fee/FeeRecordService.cs +++ b/Myshipping.Application/Service/Fee/FeeRecordService.cs @@ -1,5 +1,4 @@ -using Furion.DatabaseAccessor; -using Furion.DependencyInjection; +using Furion.DependencyInjection; using Furion.DynamicApiController; using Furion.EventBus; using Furion.FriendlyException; @@ -9,6 +8,7 @@ using Microsoft.Extensions.Logging; using Myshipping.Application.Entity; using Myshipping.Application.Service.Fee.Dto; using Myshipping.Core; +using Myshipping.Core.Entity; using Myshipping.Core.Service; using SqlSugar; using System.Collections.Generic; @@ -30,6 +30,7 @@ namespace Myshipping.Application private readonly ILogger _logger; private readonly ISysCacheService _cache; private readonly ISysUserRoleService _sysUserRoleService; + private readonly IDjyCustomerService _customerService; private readonly IEventPublisher _publisher; @@ -37,11 +38,13 @@ namespace Myshipping.Application ISysCacheService cache, IEventPublisher publisher, SqlSugarRepository repRecord, - ISysUserRoleService sysUserRoleService) + ISysUserRoleService sysUserRoleService, + IDjyCustomerService customerService) { _logger = logger; _cache = cache; _sysUserRoleService = sysUserRoleService; + _customerService = customerService; _publisher = publisher; @@ -142,5 +145,58 @@ namespace Myshipping.Application }).ExecuteCommandAsync(); } } + + /// + /// 根据类型获取结算对象列表 + /// + /// + [HttpGet("/FeeRecord/GetFeeCustomerList")] + public async Task> GetFeeCustomerList(string code) + { + List result = new(); + switch (code) + { + // 船司 + case "carrier": + { + List list = await _cache.GetAllCodeCarrier(); + return list.Select(x => new FeeCustomerDto() + { + Code = x.Code, + Name = x.CnName + }).ToList(); + } + // 船代 + case "shipagency": + { + List list = await _cache.GetAllCodeForwarder(); + return list.Select(x => new FeeCustomerDto() + { + Code = x.Code, + Name = x.Name + }).ToList(); + } + // 场站 + case "yard": + { + List list = await _cache.GetAllCodeYard(); + return list.Select(x => new FeeCustomerDto() + { + Code = x.Code, + Name = x.Name + }).ToList(); + } + // 往来单位 + default: + { + List<(string codeName, string shortName)> list = await _customerService.QueryDjyCustomerByProp(new string[] { code }); + return list.Select(x => new FeeCustomerDto() + { + Code = x.codeName, + Name = x.shortName + }).ToList(); + } + } + } } } diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index b8387769..d67722b1 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -11424,6 +11424,12 @@ 默认最大行数 返回回执 + + + 根据客户属性查询客户列表 + + 客户属性编码 + 钉钉客服通知群配置服务 diff --git a/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs b/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs index 77ce137b..825ebf18 100644 --- a/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs +++ b/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs @@ -265,8 +265,8 @@ namespace Myshipping.Core.Service { var entityList = await _rep.AsQueryable() - .WhereIF(!string.IsNullOrWhiteSpace(queryItem), x => - x.CodeName.Contains(queryItem)|| x.ShortName.Contains(queryItem) || x.FullName.Contains(queryItem)) + .WhereIF(!string.IsNullOrWhiteSpace(queryItem), x => + x.CodeName.Contains(queryItem) || x.ShortName.Contains(queryItem) || x.FullName.Contains(queryItem)) .WhereIF(queryType.Length > 0, x => x.PropString.Contains(queryType.FirstOrDefault())) .Take(top).OrderBy(a => a.FullName) @@ -294,7 +294,7 @@ namespace Myshipping.Core.Service }).ToList(); - if(addrList.Count > 0) + if (addrList.Count > 0) { list = list.GroupJoin(addrList, l => l.Id, r => r.CustomerId, (l, r) => { @@ -304,13 +304,14 @@ namespace Myshipping.Core.Service { l.Addrs = curList.Adapt>(); } - - if(!string.IsNullOrWhiteSpace(l.Addr)) + + if (!string.IsNullOrWhiteSpace(l.Addr)) { - if(l.Addrs == null) + if (l.Addrs == null) l.Addrs = new List(); - l.Addrs.Add(new DjyCustomerAddrInput { + l.Addrs.Add(new DjyCustomerAddrInput + { CustomerId = l.Id, Addr = l.Addr, }); @@ -320,7 +321,7 @@ namespace Myshipping.Core.Service }).ToList(); } - + } } @@ -333,5 +334,16 @@ namespace Myshipping.Core.Service return list; } + + public async Task> QueryDjyCustomerByProp(string[] propStringCodes) + { + string propStringStr = string.Concat('[', string.Join("][", propStringCodes), ']'); + var entityList = await _rep.AsQueryable() + .Where(x => x.PropString.Contains(propStringStr)) + .Select(x => new { code = x.CodeName, name = x.ShortName }) + .ToListAsync(); + + return entityList.Select(x => new ValueTuple(x.code, x.name)).ToList(); + } } } diff --git a/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs b/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs index 15cb8117..3452611d 100644 --- a/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs +++ b/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs @@ -24,5 +24,11 @@ namespace Myshipping.Core.Service /// 默认最大行数 /// 返回回执 Task> QuerytDjyCustomerInfo(string queryItem, string[] queryType, int top = 40); + + /// + /// 根据客户属性查询客户列表 + /// + /// 客户属性编码 + Task> QueryDjyCustomerByProp(string[] propStringCodes); } }