|
|
|
@ -850,200 +850,214 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
|
|
|
|
|
#region 实现接口,获取公共数据并缓存
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeCarrier>> GetAllCarrier()
|
|
|
|
|
public async Task GetAllCarrier()
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCarrierRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCarrier(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_CARRIER"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCarrierRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCarrier(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<MappingCarrier>> GetAllMappingCarrier()
|
|
|
|
|
public async Task GetAllMappingCarrier()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _mappingCarrierRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingCarrier(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CARRIER"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingCarrierRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingCarrier(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeVessel>> GetAllVessel()
|
|
|
|
|
public async Task GetAllVessel()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_VESSEL"))
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("缓存船名!");
|
|
|
|
|
var list = await _codeVesselRep.ToListAsync();
|
|
|
|
|
_logger.LogInformation(list.ToJsonString());
|
|
|
|
|
await _sysCacheService.SetAllCodeVessel(list);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("船名" + ex);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<MappingVessel>> GetAllMappingVessel()
|
|
|
|
|
public async Task GetAllMappingVessel()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _mappingVesselRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingVessel(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_MAPPING_VESSEL"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingVesselRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingVessel(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<MappingYard>> GetAllMappingYard()
|
|
|
|
|
public async Task GetAllMappingYard()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _mappingYardRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingYard(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_MAPPING_YARD"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingYardRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingYard(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeForwarder>> GetAllForwarder()
|
|
|
|
|
public async Task GetAllForwarder()
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeForwarderRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeForwarder(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_FORWARDER"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeForwarderRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeForwarder(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeYard>> GetAllYard()
|
|
|
|
|
public async Task GetAllYard()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _codeYardRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeYard(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_YARD"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeYardRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeYard(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodePortLoad>> GetAllPortload()
|
|
|
|
|
public async Task GetAllPortload()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _codePortLoadrRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodePortLoad(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_PORTLOAD"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codePortLoadrRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodePortLoad(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodePort>> GetAllPort()
|
|
|
|
|
public async Task GetAllPort()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _codePortRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodePort(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_PORT"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codePortRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodePort(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodePackage>> GetAllPackage()
|
|
|
|
|
public async Task GetAllPackage()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _codePackageRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodePackage(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_PACKAGE"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codePackageRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodePackage(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeService>> GetAllService()
|
|
|
|
|
public async Task GetAllService()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _codeServiceRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeService(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_SERVICE"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeServiceRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeService(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeCtn>> GetAllCtn()
|
|
|
|
|
public async Task GetAllCtn()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _codeCtnRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCtn(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_CTN"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCtnRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCtn(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<MappingCtn>> GetAllMappingCtn()
|
|
|
|
|
public async Task GetAllMappingCtn()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _mappingCtnRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingCtn(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CTN"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingCtnRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingCtn(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeFrt>> GetAllFrt()
|
|
|
|
|
public async Task GetAllFrt()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _codeFrtRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeFrt(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_FRT"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeFrtRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeFrt(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<MappingFrt>> GetAllMappingFrt()
|
|
|
|
|
public async Task GetAllMappingFrt()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _mappingFrtRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingFrt(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_MAPPING_FRT"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingFrtRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingFrt(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<MappingPortLoad>> GetAllMappingPortLoad()
|
|
|
|
|
public async Task GetAllMappingPortLoad()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _mappingPortLoadRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingPortLoad(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORTLOAD"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingPortLoadRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingPortLoad(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<MappingPort>> GetAllMappingPort()
|
|
|
|
|
public async Task GetAllMappingPort()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _mappingPortRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingPort(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORT"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingPortRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingPort(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<MappingPackage>> GetAllMappingPackage()
|
|
|
|
|
public async Task GetAllMappingPackage()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _mappingPackageRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingPackage(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PACKAGE"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingPackageRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingPackage(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<MappingService>> GetAllMappingService()
|
|
|
|
|
public async Task GetAllMappingService()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _mappingServiceRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingService(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_MAPPING_SERVICE"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingServiceRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingService(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeIssueType>> GetAllCodeIssueType()
|
|
|
|
|
public async Task GetAllCodeIssueType()
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeIssueTypeRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeIssueType(list);
|
|
|
|
|
return list;
|
|
|
|
|
if (!_sysCacheService.Exists("CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CODEISSUETYPE"))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeIssueTypeRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeIssueType(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|