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

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 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.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<FeeRecordService> _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<FeeRecord> 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();
}
}
/// <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>
<returns>返回回执</returns>
</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">
<summary>
钉钉客服通知群配置服务

@ -310,7 +310,8 @@ namespace Myshipping.Core.Service
if (l.Addrs == null)
l.Addrs = new List<DjyCustomerAddrInput>();
l.Addrs.Add(new DjyCustomerAddrInput {
l.Addrs.Add(new DjyCustomerAddrInput
{
CustomerId = l.Id,
Addr = l.Addr,
});
@ -333,5 +334,16 @@ namespace Myshipping.Core.Service
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>
/// <returns>返回回执</returns>
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