缓存处理

booking_auth_dev
wet 2 years ago
parent f324d30d0b
commit e7da66b958

@ -18,73 +18,73 @@ namespace Myshipping.Core.Job
Log.Information($"开始缓存公共库 {DateTime.Now}"); Log.Information($"开始缓存公共库 {DateTime.Now}");
//船公司 //船公司
await App.GetService<ICommonDBService>().GetAllCarrier(); await App.GetService<ICommonDBService>().GetAllCarrier(true);
//船公司映射 //船公司映射
await App.GetService<ICommonDBService>().GetAllMappingCarrier(); await App.GetService<ICommonDBService>().GetAllMappingCarrier(true);
//船名 //船名
await App.GetService<ICommonDBService>().GetAllVessel(); await App.GetService<ICommonDBService>().GetAllVessel(true);
//船名映射 //船名映射
await App.GetService<ICommonDBService>().GetAllMappingVessel(); await App.GetService<ICommonDBService>().GetAllMappingVessel(true);
//场站映射 //场站映射
await App.GetService<ICommonDBService>().GetAllMappingYard(); await App.GetService<ICommonDBService>().GetAllMappingYard(true);
//船代 //船代
await App.GetService<ICommonDBService>().GetAllForwarder(); await App.GetService<ICommonDBService>().GetAllForwarder(true);
//场站 //场站
await App.GetService<ICommonDBService>().GetAllYard(); await App.GetService<ICommonDBService>().GetAllYard(true);
//起始港 //起始港
await App.GetService<ICommonDBService>().GetAllPortload(); await App.GetService<ICommonDBService>().GetAllPortload(true);
//目的港 //目的港
await App.GetService<ICommonDBService>().GetAllPort(); await App.GetService<ICommonDBService>().GetAllPort(true);
//包装 //包装
await App.GetService<ICommonDBService>().GetAllPackage(); await App.GetService<ICommonDBService>().GetAllPackage(true);
//运输方式 //运输方式
await App.GetService<ICommonDBService>().GetAllService(); await App.GetService<ICommonDBService>().GetAllService(true);
//箱型 //箱型
await App.GetService<ICommonDBService>().GetAllCtn(); await App.GetService<ICommonDBService>().GetAllCtn(true);
//箱型映射 //箱型映射
await App.GetService<ICommonDBService>().GetAllMappingCtn(); await App.GetService<ICommonDBService>().GetAllMappingCtn(true);
//付费方式 //付费方式
await App.GetService<ICommonDBService>().GetAllFrt(); await App.GetService<ICommonDBService>().GetAllFrt(true);
//付费方式映射 //付费方式映射
await App.GetService<ICommonDBService>().GetAllMappingFrt(); await App.GetService<ICommonDBService>().GetAllMappingFrt(true);
//起始港映射 //起始港映射
await App.GetService<ICommonDBService>().GetAllMappingPortLoad(); await App.GetService<ICommonDBService>().GetAllMappingPortLoad(true);
//目的港映射 //目的港映射
await App.GetService<ICommonDBService>().GetAllMappingPort(); await App.GetService<ICommonDBService>().GetAllMappingPort(true);
//包装映射 //包装映射
await App.GetService<ICommonDBService>().GetAllMappingPackage(); await App.GetService<ICommonDBService>().GetAllMappingPackage(true);
//运输服务映射 //运输服务映射
await App.GetService<ICommonDBService>().GetAllMappingService(); await App.GetService<ICommonDBService>().GetAllMappingService(true);
//签单方式 //签单方式
await App.GetService<ICommonDBService>().GetAllCodeIssueType(); await App.GetService<ICommonDBService>().GetAllCodeIssueType(true);
//缓存EDI数据 //缓存EDI数据
await App.GetService<IDjyEdiSettingService>().CacheData(); await App.GetService<IDjyEdiSettingService>().CacheData(true);
//缓存字典数据 //缓存字典数据
await App.GetService<ISysDictDataService>().CacheData(); await App.GetService<ISysDictDataService>().CacheData(true);
//租户参数 //租户参数
await App.GetService<IDjyTenantParamService>().CacheData(); await App.GetService<IDjyTenantParamService>().CacheData(true);
//系统参数 //系统参数
await App.GetService<ISysConfigService>().CacheData(); await App.GetService<ISysConfigService>().CacheData();

@ -896,7 +896,9 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
#region 实现接口,获取公共数据并缓存 #region 实现接口,获取公共数据并缓存
[NonAction] [NonAction]
public async Task GetAllCarrier() public async Task GetAllCarrier(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CARRIER)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CARRIER))
{ {
@ -904,21 +906,38 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
await _sysCacheService.SetAllCodeCarrier(list); await _sysCacheService.SetAllCodeCarrier(list);
} }
} }
else
{
var list = await _codeCarrierRep.ToListAsync();
await _sysCacheService.SetAllCodeCarrier(list);
}
}
[NonAction] [NonAction]
public async Task GetAllMappingCarrier() public async Task GetAllMappingCarrier(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CARRIER)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CARRIER))
{ {
var list = await _mappingCarrierRep.ToListAsync(); var list = await _mappingCarrierRep.ToListAsync();
await _sysCacheService.SetAllMappingCarrier(list); await _sysCacheService.SetAllMappingCarrier(list);
} }
}
else
{
var list = await _mappingCarrierRep.ToListAsync();
await _sysCacheService.SetAllMappingCarrier(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllVessel() public async Task GetAllVessel(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_VESSEL)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_VESSEL))
{ {
@ -926,29 +945,58 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
await _sysCacheService.SetAllCodeVessel(list); await _sysCacheService.SetAllCodeVessel(list);
} }
} }
else
{
var list = await _codeVesselRep.ToListAsync();
await _sysCacheService.SetAllCodeVessel(list);
}
}
[NonAction] [NonAction]
public async Task GetAllMappingVessel() public async Task GetAllMappingVessel(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_VESSEL)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_VESSEL))
{ {
var list = await _mappingVesselRep.ToListAsync(); var list = await _mappingVesselRep.ToListAsync();
await _sysCacheService.SetAllMappingVessel(list); await _sysCacheService.SetAllMappingVessel(list);
} }
}
else
{
var list = await _mappingVesselRep.ToListAsync();
await _sysCacheService.SetAllMappingVessel(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllMappingYard() public async Task GetAllMappingYard(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_YARD)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_YARD))
{ {
var list = await _mappingYardRep.ToListAsync(); var list = await _mappingYardRep.ToListAsync();
await _sysCacheService.SetAllMappingYard(list); await _sysCacheService.SetAllMappingYard(list);
} }
}
else
{
var list = await _mappingYardRep.ToListAsync();
await _sysCacheService.SetAllMappingYard(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllForwarder() public async Task GetAllForwarder(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_FORWARDER)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_FORWARDER))
{ {
@ -956,147 +1004,273 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
await _sysCacheService.SetAllCodeForwarder(list); await _sysCacheService.SetAllCodeForwarder(list);
} }
} }
else
{
var list = await _codeForwarderRep.ToListAsync();
await _sysCacheService.SetAllCodeForwarder(list);
}
}
[NonAction] [NonAction]
public async Task GetAllYard() public async Task GetAllYard(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_YARD)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_YARD))
{ {
var list = await _codeYardRep.ToListAsync(); var list = await _codeYardRep.ToListAsync();
await _sysCacheService.SetAllCodeYard(list); await _sysCacheService.SetAllCodeYard(list);
} }
}
else
{
var list = await _codeYardRep.ToListAsync();
await _sysCacheService.SetAllCodeYard(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllPortload() public async Task GetAllPortload(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PORTLOAD)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PORTLOAD))
{ {
var list = await _codePortLoadrRep.ToListAsync(); var list = await _codePortLoadrRep.ToListAsync();
await _sysCacheService.SetAllCodePortLoad(list); await _sysCacheService.SetAllCodePortLoad(list);
} }
}
else
{
var list = await _codePortLoadrRep.ToListAsync();
await _sysCacheService.SetAllCodePortLoad(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllPort() public async Task GetAllPort(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PORT)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PORT))
{ {
var list = await _codePortRep.ToListAsync(); var list = await _codePortRep.ToListAsync();
await _sysCacheService.SetAllCodePort(list); await _sysCacheService.SetAllCodePort(list);
} }
}
else
{
var list = await _codePortRep.ToListAsync();
await _sysCacheService.SetAllCodePort(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllPackage() public async Task GetAllPackage(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PACKAGE)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PACKAGE))
{ {
var list = await _codePackageRep.ToListAsync(); var list = await _codePackageRep.ToListAsync();
await _sysCacheService.SetAllCodePackage(list); await _sysCacheService.SetAllCodePackage(list);
} }
}
else
{
var list = await _codePackageRep.ToListAsync();
await _sysCacheService.SetAllCodePackage(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllService() public async Task GetAllService(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_SERVICE)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_SERVICE))
{ {
var list = await _codeServiceRep.ToListAsync(); var list = await _codeServiceRep.ToListAsync();
await _sysCacheService.SetAllCodeService(list); await _sysCacheService.SetAllCodeService(list);
} }
}
else
{
var list = await _codeServiceRep.ToListAsync();
await _sysCacheService.SetAllCodeService(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllCtn() public async Task GetAllCtn(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CTN)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CTN))
{ {
var list = await _codeCtnRep.ToListAsync(); var list = await _codeCtnRep.ToListAsync();
await _sysCacheService.SetAllCodeCtn(list); await _sysCacheService.SetAllCodeCtn(list);
} }
}
else
{
var list = await _codeCtnRep.ToListAsync();
await _sysCacheService.SetAllCodeCtn(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllMappingCtn() public async Task GetAllMappingCtn(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CTN)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CTN))
{ {
var list = await _mappingCtnRep.ToListAsync(); var list = await _mappingCtnRep.ToListAsync();
await _sysCacheService.SetAllMappingCtn(list); await _sysCacheService.SetAllMappingCtn(list);
} }
}
else
{
var list = await _mappingCtnRep.ToListAsync();
await _sysCacheService.SetAllMappingCtn(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllFrt() public async Task GetAllFrt(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_FRT)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_FRT))
{ {
var list = await _codeFrtRep.ToListAsync(); var list = await _codeFrtRep.ToListAsync();
await _sysCacheService.SetAllCodeFrt(list); await _sysCacheService.SetAllCodeFrt(list);
} }
}
else
{
var list = await _codeFrtRep.ToListAsync();
await _sysCacheService.SetAllCodeFrt(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllMappingFrt() public async Task GetAllMappingFrt(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_FRT)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_FRT))
{ {
var list = await _mappingFrtRep.ToListAsync(); var list = await _mappingFrtRep.ToListAsync();
await _sysCacheService.SetAllMappingFrt(list); await _sysCacheService.SetAllMappingFrt(list);
} }
}
else
{
var list = await _mappingFrtRep.ToListAsync();
await _sysCacheService.SetAllMappingFrt(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllMappingPortLoad() public async Task GetAllMappingPortLoad(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORTLOAD)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORTLOAD))
{ {
var list = await _mappingPortLoadRep.ToListAsync(); var list = await _mappingPortLoadRep.ToListAsync();
await _sysCacheService.SetAllMappingPortLoad(list); await _sysCacheService.SetAllMappingPortLoad(list);
} }
}
else
{
var list = await _mappingPortLoadRep.ToListAsync();
await _sysCacheService.SetAllMappingPortLoad(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllMappingPort() public async Task GetAllMappingPort(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORT)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORT))
{ {
var list = await _mappingPortRep.ToListAsync(); var list = await _mappingPortRep.ToListAsync();
await _sysCacheService.SetAllMappingPort(list); await _sysCacheService.SetAllMappingPort(list);
} }
}
else
{
var list = await _mappingPortRep.ToListAsync();
await _sysCacheService.SetAllMappingPort(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllMappingPackage() public async Task GetAllMappingPackage(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PACKAGE)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PACKAGE))
{ {
var list = await _mappingPackageRep.ToListAsync(); var list = await _mappingPackageRep.ToListAsync();
await _sysCacheService.SetAllMappingPackage(list); await _sysCacheService.SetAllMappingPackage(list);
} }
}
else
{
var list = await _mappingPackageRep.ToListAsync();
await _sysCacheService.SetAllMappingPackage(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllMappingService() public async Task GetAllMappingService(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_SERVICE)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_SERVICE))
{ {
var list = await _mappingServiceRep.ToListAsync(); var list = await _mappingServiceRep.ToListAsync();
await _sysCacheService.SetAllMappingService(list); await _sysCacheService.SetAllMappingService(list);
} }
}
else
{
var list = await _mappingServiceRep.ToListAsync();
await _sysCacheService.SetAllMappingService(list);
}
} }
[NonAction] [NonAction]
public async Task GetAllCodeIssueType() public async Task GetAllCodeIssueType(bool flag = false)
{
if (flag)
{ {
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CODEISSUETYPE)) if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CODEISSUETYPE))
{ {
@ -1104,6 +1278,13 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
await _sysCacheService.SetAllCodeIssueType(list); await _sysCacheService.SetAllCodeIssueType(list);
} }
} }
else
{
var list = await _codeIssueTypeRep.ToListAsync();
await _sysCacheService.SetAllCodeIssueType(list);
}
}
#endregion #endregion

@ -12,111 +12,111 @@ public interface ICommonDBService
/// 获取船公司 /// 获取船公司
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task GetAllCarrier(); Task GetAllCarrier(bool flag);
/// <summary> /// <summary>
/// 获取船公司映射 /// 获取船公司映射
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task GetAllMappingCarrier(); Task GetAllMappingCarrier(bool flag);
/// <summary> /// <summary>
/// 获取船名 /// 获取船名
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task GetAllVessel(); Task GetAllVessel(bool flag);
/// <summary> /// <summary>
/// 获取船名映射 /// 获取船名映射
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task GetAllMappingVessel(); Task GetAllMappingVessel(bool flag);
/// <summary> /// <summary>
/// 获取船代 /// 获取船代
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task GetAllForwarder(); Task GetAllForwarder(bool flag);
/// <summary> /// <summary>
/// 获取场站 /// 获取场站
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task GetAllYard(); Task GetAllYard(bool flag);
/// <summary> /// <summary>
/// 获取场站映射 /// 获取场站映射
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task GetAllMappingYard(); Task GetAllMappingYard(bool flag);
/// <summary> /// <summary>
/// 获取起始港 /// 获取起始港
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task GetAllPortload(); Task GetAllPortload(bool flag);
/// <summary> /// <summary>
/// 获取目的港 /// 获取目的港
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task GetAllPort(); Task GetAllPort(bool flag);
/// <summary> /// <summary>
/// 获取包装 /// 获取包装
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task GetAllPackage(); Task GetAllPackage(bool flag);
/// <summary> /// <summary>
/// 获取运输方式 /// 获取运输方式
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task GetAllService(); Task GetAllService(bool flag);
/// <summary> /// <summary>
/// 获取箱型 /// 获取箱型
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task GetAllCtn(); Task GetAllCtn(bool flag);
/// <summary> /// <summary>
/// 获取箱型映射 /// 获取箱型映射
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task GetAllMappingCtn(); Task GetAllMappingCtn(bool flag);
/// <summary> /// <summary>
/// 付费方式 /// 付费方式
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task GetAllFrt(); Task GetAllFrt(bool flag);
/// <summary> /// <summary>
/// 付费方式映射 /// 付费方式映射
/// </summary> /// </summary>
Task GetAllMappingFrt(); Task GetAllMappingFrt(bool flag);
/// <summary> /// <summary>
/// 起始港映射 /// 起始港映射
/// </summary> /// </summary>
Task GetAllMappingPortLoad(); Task GetAllMappingPortLoad(bool flag);
/// <summary> /// <summary>
/// 目的港映射 /// 目的港映射
/// </summary> /// </summary>
Task GetAllMappingPort(); Task GetAllMappingPort(bool flag);
/// <summary> /// <summary>
/// 包装映射 /// 包装映射
/// </summary> /// </summary>
Task GetAllMappingPackage(); Task GetAllMappingPackage(bool flag);
/// <summary> /// <summary>
/// 运输服务映射 /// 运输服务映射
/// </summary> /// </summary>
Task GetAllMappingService(); Task GetAllMappingService(bool flag);
/// <summary> /// <summary>
/// 签单方式 /// 签单方式
/// </summary> /// </summary>
Task GetAllCodeIssueType(); Task GetAllCodeIssueType(bool flag);
} }

@ -18,5 +18,7 @@ public interface ISysDictDataService
Task UpdateDictData(UpdateDictDataInput input); Task UpdateDictData(UpdateDictDataInput input);
Task<List<SysDictData>> GetDictDataByCode(string code); Task<List<SysDictData>> GetDictDataByCode(string code);
Task CacheData(); Task CacheData(bool falg);
} }

@ -199,7 +199,9 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
/// <returns></returns> /// <returns></returns>
/// <exception cref="System.NotImplementedException"></exception> /// <exception cref="System.NotImplementedException"></exception>
[NonAction] [NonAction]
public async Task CacheData() public async Task CacheData(bool falg=false)
{
if (falg)
{ {
if (!_cache.Exists(CommonConst.CACHE_KEY_COMMON_DB_DICT_DATA)) if (!_cache.Exists(CommonConst.CACHE_KEY_COMMON_DB_DICT_DATA))
{ {
@ -216,6 +218,23 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
}).ToListAsync(); }).ToListAsync();
await _cache.SetAllDictData(list); await _cache.SetAllDictData(list);
} }
} else {
var list = await _sysDictDataRep.AsQueryable().InnerJoin<SysDictType>((d, t) => d.TypeId == t.Id).Filter(null, true).Where((d, t) => t.Status == CommonStatus.ENABLE && d.Status == CommonStatus.ENABLE).Select((d, t) => new DictDataDto
{
Id = d.Id,
TypeName = t.Name,
TypeCode = t.Code,
Value = d.Value,
Code = d.Code,
Sort = d.Sort,
Remark = d.Remark,
IsFront = t.IsFront
}).ToListAsync();
await _cache.SetAllDictData(list);
}
} }

@ -135,7 +135,9 @@ namespace Myshipping.Core.Service
/// <returns></returns> /// <returns></returns>
/// <exception cref="System.NotImplementedException"></exception> /// <exception cref="System.NotImplementedException"></exception>
[NonAction] [NonAction]
public async Task CacheData() public async Task CacheData(bool flag = false)
{
if (flag)
{ {
if (!_cacheService.Exists(CommonConst.CACHE_KEY_DJY_EDI_SETTING)) if (!_cacheService.Exists(CommonConst.CACHE_KEY_DJY_EDI_SETTING))
{ {
@ -143,6 +145,17 @@ namespace Myshipping.Core.Service
await _cacheService.SetAllEdiSetting(list); await _cacheService.SetAllEdiSetting(list);
} }
} }
else
{
var list = _rep.AsQueryable().Filter(null, true).ToList();
await _cacheService.SetAllEdiSetting(list);
}
}
///// <summary> ///// <summary>
///// 获取EDI参数设置列表 ///// 获取EDI参数设置列表

@ -14,6 +14,7 @@ namespace Myshipping.Core.Service
Task<DjyEdiSetting> Get([FromQuery] GetDjyEdiSettingInput input); Task<DjyEdiSetting> Get([FromQuery] GetDjyEdiSettingInput input);
//Task<dynamic> List([FromQuery] QueryDjyEdiSettingInput input); //Task<dynamic> List([FromQuery] QueryDjyEdiSettingInput input);
Task CacheData(); Task CacheData(bool flag);
} }
} }

@ -314,7 +314,9 @@ namespace Myshipping.Core.Service
} }
#endregion #endregion
public async Task CacheData() public async Task CacheData(bool flag = false)
{
if (flag)
{ {
if (!_cache.Exists(CommonConst.CACHE_KEY_COMMON_DB_TENANT_PARAM_VALUE)) if (!_cache.Exists(CommonConst.CACHE_KEY_COMMON_DB_TENANT_PARAM_VALUE))
{ {
@ -323,5 +325,13 @@ namespace Myshipping.Core.Service
await _cache.SetAllTenantParam(list); await _cache.SetAllTenantParam(list);
} }
} }
else
{
var list = await _valuerep.AsQueryable().Filter(null, true).ToListAsync();
await _cache.SetAllTenantParam(list);
}
}
} }
} }

@ -18,6 +18,8 @@ namespace Myshipping.Core.Service
Task UpdateParamItem(DjyTenantParamItem input); Task UpdateParamItem(DjyTenantParamItem input);
Task DeleteParamItem(long Id); Task DeleteParamItem(long Id);
Task CacheData(); Task CacheData(bool flag);
} }
} }
Loading…
Cancel
Save