jianghaiqing 10 months ago
commit ab9294c703

@ -1,11 +1,4 @@
using Myshipping.Core; 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 namespace Myshipping.Application.Service.Fee.Dto
{ {
@ -105,7 +98,6 @@ namespace Myshipping.Application.Service.Fee.Dto
/// 默认是否开票 /// 默认是否开票
/// </summary> /// </summary>
public bool IsInvoice { get; set; } public bool IsInvoice { get; set; }
} }
/// <summary> /// <summary>
@ -140,4 +132,9 @@ namespace Myshipping.Application.Service.Fee.Dto
{ {
} }
public class FeeCodeCacheDto : FeeCodeDto
{
public long TenantId { get; set; }
}
} }

@ -101,6 +101,8 @@ namespace Myshipping.Application
await _repCode.UpdateAsync(entity); await _repCode.UpdateAsync(entity);
} }
await CacheFeeCode();
return entity.Adapt<FeeCodeSaveDto>(); return entity.Adapt<FeeCodeSaveDto>();
} }
@ -129,6 +131,43 @@ namespace Myshipping.Application
var list = await _repCode.AsQueryable().Filter(null, true).Where(x => ids.Contains(x.Id)).ToListAsync(); var list = await _repCode.AsQueryable().Filter(null, true).Where(x => ids.Contains(x.Id)).ToListAsync();
list.ForEach(x => x.IsDeleted = true); list.ForEach(x => x.IsDeleted = true);
await _repCode.AsUpdateable(list).ExecuteCommandAsync(); await _repCode.AsUpdateable(list).ExecuteCommandAsync();
await CacheFeeCode();
}
/// <summary>
/// 获取费用代码列表
/// </summary>
/// <returns></returns>
[HttpGet("/FeeCode/List")]
public async Task<List<FeeCodeCacheDto>> List()
{
var cacheList = await _cache.GetAsync<List<FeeCodeCacheDto>>(CommonConst.CACHE_KEY_FEE_CODE);
if (cacheList?.Any() == true)
{
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;
}
}
/// <summary>
/// 缓存费用代码列表
/// </summary>
[NonAction]
public async Task<List<FeeCodeCacheDto>> CacheFeeCode()
{
var allFeeCode = await _repCode.AsQueryable().Filter(null, true).ToListAsync();
var cacheFeeCode = allFeeCode.Adapt<List<FeeCodeCacheDto>>();
await _cache.SetAsync(CommonConst.CACHE_KEY_FEE_CODE, cacheFeeCode);
return cacheFeeCode;
} }
} }
} }

@ -231,4 +231,11 @@ public class CommonConst
/// </summary> /// </summary>
public const string SECRET_FEE_REVIEW = "SecretFeeReview"; public const string SECRET_FEE_REVIEW = "SecretFeeReview";
#endregion #endregion
#region 费用
/// <summary>
/// 费用编码缓存键
/// </summary>
public const string CACHE_KEY_FEE_CODE = "FeeCodeList";
#endregion
} }

@ -797,6 +797,11 @@
机密费用检阅角色 机密费用检阅角色
</summary> </summary>
</member> </member>
<member name="F:Myshipping.Core.CommonConst.CACHE_KEY_FEE_CODE">
<summary>
费用编码缓存键
</summary>
</member>
<member name="F:Myshipping.Core.Const.MenuConst.MenuBookingOrder"> <member name="F:Myshipping.Core.Const.MenuConst.MenuBookingOrder">
<summary> <summary>
订舱台账菜单 订舱台账菜单

Loading…
Cancel
Save