jianghaiqing 10 months ago
commit ab9294c703

@ -1,11 +1,4 @@
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
{
@ -105,13 +98,12 @@ namespace Myshipping.Application.Service.Fee.Dto
/// 默认是否开票
/// </summary>
public bool IsInvoice { get; set; }
}
/// <summary>
/// 查询
/// </summary>
public class FeeCodePageInput: PageInputBase
public class FeeCodePageInput : PageInputBase
{
/// <summary>
/// 费用代码,录入费用是作为检索
@ -128,7 +120,7 @@ namespace Myshipping.Application.Service.Fee.Dto
/// <summary>
/// 台账列表
/// </summary>
public class FeeCodePageOutput: FeeCodeDto
public class FeeCodePageOutput : FeeCodeDto
{
}
@ -136,8 +128,13 @@ namespace Myshipping.Application.Service.Fee.Dto
/// <summary>
/// 保存
/// </summary>
public class FeeCodeSaveDto: FeeCodeDto
public class FeeCodeSaveDto : FeeCodeDto
{
}
public class FeeCodeCacheDto : FeeCodeDto
{
public long TenantId { get; set; }
}
}

@ -101,6 +101,8 @@ namespace Myshipping.Application
await _repCode.UpdateAsync(entity);
}
await CacheFeeCode();
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();
list.ForEach(x => x.IsDeleted = true);
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>
public const string SECRET_FEE_REVIEW = "SecretFeeReview";
#endregion
#region 费用
/// <summary>
/// 费用编码缓存键
/// </summary>
public const string CACHE_KEY_FEE_CODE = "FeeCodeList";
#endregion
}

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

Loading…
Cancel
Save