|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|