|
|
|
@ -210,14 +210,15 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeCarrier>> GetAllCarrier()
|
|
|
|
|
{
|
|
|
|
|
if (_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CARRIER))
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeCarrier();
|
|
|
|
|
if (list != null && list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return await _sysCacheService.GetAsync<List<CodeCarrier>>(CommonConst.CACHE_KEY_COMMON_DB_CARRIER);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCarrierRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetTimeoutAsync(CommonConst.CACHE_KEY_COMMON_DB_CARRIER, list, TimeSpan.FromMinutes(5));
|
|
|
|
|
list = await _codeCarrierRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCarrier(list);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -225,14 +226,15 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeVessel>> GetAllVessel()
|
|
|
|
|
{
|
|
|
|
|
if (_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_VESSEL))
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeVessel();
|
|
|
|
|
if (list != null && list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return await _sysCacheService.GetAsync<List<CodeVessel>>(CommonConst.CACHE_KEY_COMMON_DB_VESSEL);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeVesselRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetTimeoutAsync(CommonConst.CACHE_KEY_COMMON_DB_VESSEL, list, TimeSpan.FromMinutes(5));
|
|
|
|
|
list = await _codeVesselRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeVessel(list);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -240,14 +242,15 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeForwarder>> GetAllForwarder()
|
|
|
|
|
{
|
|
|
|
|
if (_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_FORWARDER))
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeForwarder();
|
|
|
|
|
if (list != null && list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return await _sysCacheService.GetAsync<List<CodeForwarder>>(CommonConst.CACHE_KEY_COMMON_DB_FORWARDER);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeForwarderRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetTimeoutAsync(CommonConst.CACHE_KEY_COMMON_DB_FORWARDER, list, TimeSpan.FromMinutes(5));
|
|
|
|
|
list = await _codeForwarderRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeForwarder(list);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -255,14 +258,15 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeYard>> GetAllYard()
|
|
|
|
|
{
|
|
|
|
|
if (_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_YARD))
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeYard();
|
|
|
|
|
if (list != null && list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return await _sysCacheService.GetAsync<List<CodeYard>>(CommonConst.CACHE_KEY_COMMON_DB_YARD);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeYardRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetTimeoutAsync(CommonConst.CACHE_KEY_COMMON_DB_YARD, list, TimeSpan.FromMinutes(5));
|
|
|
|
|
list = await _codeYardRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeYard(list);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -270,14 +274,15 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodePortLoad>> GetAllPortload()
|
|
|
|
|
{
|
|
|
|
|
if (_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PORTLOAD))
|
|
|
|
|
var list = await _sysCacheService.GetAllCodePortLoad();
|
|
|
|
|
if (list != null && list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return await _sysCacheService.GetAsync<List<CodePortLoad>>(CommonConst.CACHE_KEY_COMMON_DB_PORTLOAD);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codePortLoadrRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetTimeoutAsync(CommonConst.CACHE_KEY_COMMON_DB_PORTLOAD, list, TimeSpan.FromMinutes(5));
|
|
|
|
|
list = await _codePortLoadrRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodePortLoad(list);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -285,14 +290,15 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodePort>> GetAllPort()
|
|
|
|
|
{
|
|
|
|
|
if (_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PORT))
|
|
|
|
|
var list = await _sysCacheService.GetAllCodePort();
|
|
|
|
|
if (list != null && list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return await _sysCacheService.GetAsync<List<CodePort>>(CommonConst.CACHE_KEY_COMMON_DB_PORT);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codePortRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetTimeoutAsync(CommonConst.CACHE_KEY_COMMON_DB_PORT, list, TimeSpan.FromMinutes(5));
|
|
|
|
|
list = await _codePortRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodePort(list);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -300,14 +306,15 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodePackage>> GetAllPackage()
|
|
|
|
|
{
|
|
|
|
|
if (_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PACKAGE))
|
|
|
|
|
var list = await _sysCacheService.GetAllCodePackage();
|
|
|
|
|
if (list != null && list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return await _sysCacheService.GetAsync<List<CodePackage>>(CommonConst.CACHE_KEY_COMMON_DB_PACKAGE);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codePackageRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetTimeoutAsync(CommonConst.CACHE_KEY_COMMON_DB_PACKAGE, list, TimeSpan.FromMinutes(5));
|
|
|
|
|
list = await _codePackageRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodePackage(list);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -315,14 +322,15 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeService>> GetAllService()
|
|
|
|
|
{
|
|
|
|
|
if (_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_SERVICE))
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeService();
|
|
|
|
|
if (list != null && list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return await _sysCacheService.GetAsync<List<CodeService>>(CommonConst.CACHE_KEY_COMMON_DB_SERVICE);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeServiceRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetTimeoutAsync(CommonConst.CACHE_KEY_COMMON_DB_SERVICE, list, TimeSpan.FromMinutes(5));
|
|
|
|
|
list = await _codeServiceRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeService(list);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -330,14 +338,16 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeCtn>> GetAllCtn()
|
|
|
|
|
{
|
|
|
|
|
if (_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CTN))
|
|
|
|
|
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeCtn();
|
|
|
|
|
if (list != null && list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return await _sysCacheService.GetAsync<List<CodeCtn>>(CommonConst.CACHE_KEY_COMMON_DB_CTN);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCtnRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetTimeoutAsync(CommonConst.CACHE_KEY_COMMON_DB_CTN, list, TimeSpan.FromMinutes(5));
|
|
|
|
|
list = await _codeCtnRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCtn(list);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -345,17 +355,22 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeFrt>> GetAllFrt()
|
|
|
|
|
{
|
|
|
|
|
if (_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_FRT))
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeFrt();
|
|
|
|
|
if (list != null && list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return await _sysCacheService.GetAsync<List<CodeFrt>>(CommonConst.CACHE_KEY_COMMON_DB_FRT);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeFrtRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetTimeoutAsync(CommonConst.CACHE_KEY_COMMON_DB_FRT, list, TimeSpan.FromMinutes(5));
|
|
|
|
|
list = await _codeFrtRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeFrt(list);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|