diff --git a/Myshipping.Application/Service/Fee/Dto/FeeCurrencyDto.cs b/Myshipping.Application/Service/Fee/Dto/FeeCurrencyDto.cs
index 16495aab..11efe9b8 100644
--- a/Myshipping.Application/Service/Fee/Dto/FeeCurrencyDto.cs
+++ b/Myshipping.Application/Service/Fee/Dto/FeeCurrencyDto.cs
@@ -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
///
/// ID
///
- public long Id { get; set; }
+ public long Id { get; set; }
///
/// 币别代码
@@ -51,7 +45,7 @@ namespace Myshipping.Application.Service.Fee.Dto
///
/// 查询
///
- public class FeeCurrencyPageInput: PageInputBase
+ public class FeeCurrencyPageInput : PageInputBase
{
///
@@ -71,16 +65,24 @@ namespace Myshipping.Application.Service.Fee.Dto
///
/// 台账列表
///
- public class FeeCurrencyPageOutput: FeeCurrencyDto
+ public class FeeCurrencyPageOutput : FeeCurrencyDto
{
-
+
}
///
/// 保存
///
- public class FeeCurrencySaveDto: FeeCurrencyDto
+ public class FeeCurrencySaveDto : FeeCurrencyDto
{
}
+
+ ///
+ /// 币别列表查询
+ ///
+ public class FeeCurrencyCacheDto : FeeCurrencyDto
+ {
+ public long TenantId { get; set; }
+ }
}
diff --git a/Myshipping.Application/Service/Fee/FeeCodeService.cs b/Myshipping.Application/Service/Fee/FeeCodeService.cs
index 7243871a..f8817271 100644
--- a/Myshipping.Application/Service/Fee/FeeCodeService.cs
+++ b/Myshipping.Application/Service/Fee/FeeCodeService.cs
@@ -146,11 +146,11 @@ namespace Myshipping.Application
{
List result = cacheList.Where(f => f.TenantId == UserManager.TENANT_ID).ToList();
return result;
- }
+ }
else
{
var cacheFeeCode = await CacheFeeCode();
-
+
List 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>();
- 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;
}
diff --git a/Myshipping.Application/Service/Fee/FeeCurrencyService.cs b/Myshipping.Application/Service/Fee/FeeCurrencyService.cs
index 9b136407..9fa58b45 100644
--- a/Myshipping.Application/Service/Fee/FeeCurrencyService.cs
+++ b/Myshipping.Application/Service/Fee/FeeCurrencyService.cs
@@ -56,7 +56,7 @@ namespace Myshipping.Application
}
///
- /// 费用代码查询
+ /// 币别分页查询
///
///
///
@@ -101,6 +101,8 @@ namespace Myshipping.Application
await _repCode.UpdateAsync(entity);
}
+ await CacheFeeCurrency();
+
return entity.Adapt();
}
@@ -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();
+ }
+
+ ///
+ /// 获取币别列表
+ ///
+ [HttpGet("/FeeCurrency/List")]
+ public async Task> List()
+ {
+ var cacheList = await _cache.GetAsync>(CommonConst.CACHE_KEY_FEE_CURRENCY);
+ if (cacheList?.Any() == true)
+ {
+ List result = cacheList.Where(f => f.TenantId == UserManager.TENANT_ID).ToList();
+ return result;
+ }
+ else
+ {
+ var cacheFeeCode = await CacheFeeCurrency();
+
+ List result = cacheFeeCode.Where(f => f.TenantId == UserManager.TENANT_ID).ToList();
+ return result;
+ }
+ }
+
+ ///
+ /// 缓存币别列表
+ ///
+ [NonAction]
+ public async Task> CacheFeeCurrency()
+ {
+ var allFeeCurrency = await _repCode.AsQueryable().Filter(null, true).ToListAsync();
+
+ var cacheFeeCode = allFeeCurrency.Adapt>();
+ await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CURRENCY, cacheFeeCode, new TimeSpan(6, 0, 0));
+
+ return cacheFeeCode;
}
}
}
diff --git a/Myshipping.Core/Const/CommonConst.cs b/Myshipping.Core/Const/CommonConst.cs
index 5050b331..f68b90d1 100644
--- a/Myshipping.Core/Const/CommonConst.cs
+++ b/Myshipping.Core/Const/CommonConst.cs
@@ -237,5 +237,9 @@ public class CommonConst
/// 费用编码缓存键
///
public const string CACHE_KEY_FEE_CODE = "FeeCodeList";
+ ///
+ /// 币别缓存键
+ ///
+ public const string CACHE_KEY_FEE_CURRENCY = "FeeCurrencyList";
#endregion
}
diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml
index d67722b1..c45b1cca 100644
--- a/Myshipping.Core/Myshipping.Core.xml
+++ b/Myshipping.Core/Myshipping.Core.xml
@@ -802,6 +802,11 @@
费用编码缓存键
+
+
+ 币别缓存键
+
+
订舱台账菜单