费用:添加接口 根据类型获取结算对象列表

optimize
zhangxiaofeng 10 months ago
parent 2693c7a902
commit aaf9d4b754

@ -133,8 +133,21 @@ namespace Myshipping.Application.Service.Fee.Dto
} }
/// <summary>
/// 费用代码列表查询
/// </summary>
public class FeeCodeCacheDto : FeeCodeDto public class FeeCodeCacheDto : FeeCodeDto
{ {
public long TenantId { get; set; } public long TenantId { get; set; }
} }
/// <summary>
/// 结算对象列表查询
/// </summary>
public class FeeCustomerDto
{
public string Code { get; set; }
public string Name { get; set; }
public string ShowName { get; set; }
}
} }

@ -1,5 +1,4 @@
using Furion.DatabaseAccessor; using Furion.DependencyInjection;
using Furion.DependencyInjection;
using Furion.DynamicApiController; using Furion.DynamicApiController;
using Furion.EventBus; using Furion.EventBus;
using Furion.FriendlyException; using Furion.FriendlyException;
@ -9,6 +8,7 @@ using Microsoft.Extensions.Logging;
using Myshipping.Application.Entity; using Myshipping.Application.Entity;
using Myshipping.Application.Service.Fee.Dto; using Myshipping.Application.Service.Fee.Dto;
using Myshipping.Core; using Myshipping.Core;
using Myshipping.Core.Entity;
using Myshipping.Core.Service; using Myshipping.Core.Service;
using SqlSugar; using SqlSugar;
using System.Collections.Generic; using System.Collections.Generic;
@ -30,6 +30,7 @@ namespace Myshipping.Application
private readonly ILogger<FeeRecordService> _logger; private readonly ILogger<FeeRecordService> _logger;
private readonly ISysCacheService _cache; private readonly ISysCacheService _cache;
private readonly ISysUserRoleService _sysUserRoleService; private readonly ISysUserRoleService _sysUserRoleService;
private readonly IDjyCustomerService _customerService;
private readonly IEventPublisher _publisher; private readonly IEventPublisher _publisher;
@ -37,11 +38,13 @@ namespace Myshipping.Application
ISysCacheService cache, ISysCacheService cache,
IEventPublisher publisher, IEventPublisher publisher,
SqlSugarRepository<FeeRecord> repRecord, SqlSugarRepository<FeeRecord> repRecord,
ISysUserRoleService sysUserRoleService) ISysUserRoleService sysUserRoleService,
IDjyCustomerService customerService)
{ {
_logger = logger; _logger = logger;
_cache = cache; _cache = cache;
_sysUserRoleService = sysUserRoleService; _sysUserRoleService = sysUserRoleService;
_customerService = customerService;
_publisher = publisher; _publisher = publisher;
@ -142,5 +145,58 @@ namespace Myshipping.Application
}).ExecuteCommandAsync(); }).ExecuteCommandAsync();
} }
} }
/// <summary>
/// 根据类型获取结算对象列表
/// </summary>
/// <returns></returns>
[HttpGet("/FeeRecord/GetFeeCustomerList")]
public async Task<List<FeeCustomerDto>> GetFeeCustomerList(string code)
{
List<FeeCustomerDto> result = new();
switch (code)
{
// 船司
case "carrier":
{
List<CodeCarrier> list = await _cache.GetAllCodeCarrier();
return list.Select(x => new FeeCustomerDto()
{
Code = x.Code,
Name = x.CnName
}).ToList();
}
// 船代
case "shipagency":
{
List<CodeForwarder> list = await _cache.GetAllCodeForwarder();
return list.Select(x => new FeeCustomerDto()
{
Code = x.Code,
Name = x.Name
}).ToList();
}
// 场站
case "yard":
{
List<CodeYard> 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();
}
}
}
} }
} }

@ -11424,6 +11424,12 @@
<param name="top">默认最大行数</param> <param name="top">默认最大行数</param>
<returns>返回回执</returns> <returns>返回回执</returns>
</member> </member>
<member name="M:Myshipping.Core.Service.IDjyCustomerService.QueryDjyCustomerByProp(System.String[])">
<summary>
根据客户属性查询客户列表
</summary>
<param name="propStringCodes">客户属性编码</param>
</member>
<member name="T:Myshipping.Core.Service.DjyDingtalkGroupConfigService"> <member name="T:Myshipping.Core.Service.DjyDingtalkGroupConfigService">
<summary> <summary>
钉钉客服通知群配置服务 钉钉客服通知群配置服务

@ -266,7 +266,7 @@ namespace Myshipping.Core.Service
var entityList = await _rep.AsQueryable() var entityList = await _rep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(queryItem), x => .WhereIF(!string.IsNullOrWhiteSpace(queryItem), x =>
x.CodeName.Contains(queryItem)|| x.ShortName.Contains(queryItem) || x.FullName.Contains(queryItem)) x.CodeName.Contains(queryItem) || x.ShortName.Contains(queryItem) || x.FullName.Contains(queryItem))
.WhereIF(queryType.Length > 0, x => .WhereIF(queryType.Length > 0, x =>
x.PropString.Contains(queryType.FirstOrDefault())) x.PropString.Contains(queryType.FirstOrDefault()))
.Take(top).OrderBy(a => a.FullName) .Take(top).OrderBy(a => a.FullName)
@ -294,7 +294,7 @@ namespace Myshipping.Core.Service
}).ToList(); }).ToList();
if(addrList.Count > 0) if (addrList.Count > 0)
{ {
list = list.GroupJoin(addrList, l => l.Id, r => r.CustomerId, (l, r) => list = list.GroupJoin(addrList, l => l.Id, r => r.CustomerId, (l, r) =>
{ {
@ -305,12 +305,13 @@ namespace Myshipping.Core.Service
l.Addrs = curList.Adapt<List<DjyCustomerAddrInput>>(); l.Addrs = curList.Adapt<List<DjyCustomerAddrInput>>();
} }
if(!string.IsNullOrWhiteSpace(l.Addr)) if (!string.IsNullOrWhiteSpace(l.Addr))
{ {
if(l.Addrs == null) if (l.Addrs == null)
l.Addrs = new List<DjyCustomerAddrInput>(); l.Addrs = new List<DjyCustomerAddrInput>();
l.Addrs.Add(new DjyCustomerAddrInput { l.Addrs.Add(new DjyCustomerAddrInput
{
CustomerId = l.Id, CustomerId = l.Id,
Addr = l.Addr, Addr = l.Addr,
}); });
@ -333,5 +334,16 @@ namespace Myshipping.Core.Service
return list; return list;
} }
public async Task<List<(string codeName, string shortName)>> 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<string, string>(x.code, x.name)).ToList();
}
} }
} }

@ -24,5 +24,11 @@ namespace Myshipping.Core.Service
/// <param name="top">默认最大行数</param> /// <param name="top">默认最大行数</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<List<DjyCustomerOutput>> QuerytDjyCustomerInfo(string queryItem, string[] queryType, int top = 40); Task<List<DjyCustomerOutput>> QuerytDjyCustomerInfo(string queryItem, string[] queryType, int top = 40);
/// <summary>
/// 根据客户属性查询客户列表
/// </summary>
/// <param name="propStringCodes">客户属性编码</param>
Task<List<(string codeName, string shortName)>> QueryDjyCustomerByProp(string[] propStringCodes);
} }
} }

Loading…
Cancel
Save