费用:币别列表查询接口

optimize
zhangxiaofeng 10 months ago
parent 993db6cdb5
commit cd3c251ebf

@ -1,11 +1,5 @@
using Myshipping.Core;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.Service.Fee.Dto
{
@ -14,7 +8,7 @@ namespace Myshipping.Application.Service.Fee.Dto
/// <summary>
/// ID
/// </summary>
public long Id { get; set; }
public long Id { get; set; }
/// <summary>
/// 币别代码
@ -51,7 +45,7 @@ namespace Myshipping.Application.Service.Fee.Dto
/// <summary>
/// 查询
/// </summary>
public class FeeCurrencyPageInput: PageInputBase
public class FeeCurrencyPageInput : PageInputBase
{
/// <summary>
@ -71,16 +65,24 @@ namespace Myshipping.Application.Service.Fee.Dto
/// <summary>
/// 台账列表
/// </summary>
public class FeeCurrencyPageOutput: FeeCurrencyDto
public class FeeCurrencyPageOutput : FeeCurrencyDto
{
}
/// <summary>
/// 保存
/// </summary>
public class FeeCurrencySaveDto: FeeCurrencyDto
public class FeeCurrencySaveDto : FeeCurrencyDto
{
}
/// <summary>
/// 币别列表查询
/// </summary>
public class FeeCurrencyCacheDto : FeeCurrencyDto
{
public long TenantId { get; set; }
}
}

@ -146,11 +146,11 @@ namespace Myshipping.Application
{
List<FeeCodeCacheDto> result = cacheList.Where(f => f.TenantId == UserManager.TENANT_ID).ToList();
return result;
}
}
else
{
var cacheFeeCode = await CacheFeeCode();
List<FeeCodeCacheDto> result = cacheFeeCode.Where(f => f.TenantId == UserManager.TENANT_ID).ToList();
return result;
}
@ -165,7 +165,7 @@ namespace Myshipping.Application
var allFeeCode = await _repCode.AsQueryable().Filter(null, true).ToListAsync();
var cacheFeeCode = allFeeCode.Adapt<List<FeeCodeCacheDto>>();
await _cache.SetAsync(CommonConst.CACHE_KEY_FEE_CODE, cacheFeeCode);
await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CODE, cacheFeeCode, new TimeSpan(6, 0, 0));
return cacheFeeCode;
}

@ -56,7 +56,7 @@ namespace Myshipping.Application
}
/// <summary>
/// 费用代码查询
/// 币别分页查询
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@ -101,6 +101,8 @@ namespace Myshipping.Application
await _repCode.UpdateAsync(entity);
}
await CacheFeeCurrency();
return entity.Adapt<FeeCurrencySaveDto>();
}
@ -129,6 +131,42 @@ namespace Myshipping.Application
var list = await _repCode.AsQueryable().Filter(null, true).Where(x => ids.Contains(x.Id)).ToListAsync();
list.ForEach(x => x.IsDeleted = true);
await _repCode.AsUpdateable(list).ExecuteCommandAsync();
await CacheFeeCurrency();
}
/// <summary>
/// 获取币别列表
/// </summary>
[HttpGet("/FeeCurrency/List")]
public async Task<List<FeeCurrencyCacheDto>> List()
{
var cacheList = await _cache.GetAsync<List<FeeCurrencyCacheDto>>(CommonConst.CACHE_KEY_FEE_CURRENCY);
if (cacheList?.Any() == true)
{
List<FeeCurrencyCacheDto> result = cacheList.Where(f => f.TenantId == UserManager.TENANT_ID).ToList();
return result;
}
else
{
var cacheFeeCode = await CacheFeeCurrency();
List<FeeCurrencyCacheDto> result = cacheFeeCode.Where(f => f.TenantId == UserManager.TENANT_ID).ToList();
return result;
}
}
/// <summary>
/// 缓存币别列表
/// </summary>
[NonAction]
public async Task<List<FeeCurrencyCacheDto>> CacheFeeCurrency()
{
var allFeeCurrency = await _repCode.AsQueryable().Filter(null, true).ToListAsync();
var cacheFeeCode = allFeeCurrency.Adapt<List<FeeCurrencyCacheDto>>();
await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CURRENCY, cacheFeeCode, new TimeSpan(6, 0, 0));
return cacheFeeCode;
}
}
}

@ -237,5 +237,9 @@ public class CommonConst
/// 费用编码缓存键
/// </summary>
public const string CACHE_KEY_FEE_CODE = "FeeCodeList";
/// <summary>
/// 币别缓存键
/// </summary>
public const string CACHE_KEY_FEE_CURRENCY = "FeeCurrencyList";
#endregion
}

@ -802,6 +802,11 @@
费用编码缓存键
</summary>
</member>
<member name="F:Myshipping.Core.CommonConst.CACHE_KEY_FEE_CURRENCY">
<summary>
币别缓存键
</summary>
</member>
<member name="F:Myshipping.Core.Const.MenuConst.MenuBookingOrder">
<summary>
订舱台账菜单

Loading…
Cancel
Save