|
|
|
@ -49,6 +49,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
private readonly SqlSugarRepository<RelaPortCarrierLane> _relaPortCarrierLaneRep;
|
|
|
|
|
private readonly SqlSugarRepository<CodeCountry> _codeCountryRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingForwarder> _mappingForwarder;
|
|
|
|
|
private readonly SqlSugarRepository<CodeCity> _codeCityRep;
|
|
|
|
|
private readonly SqlSugarRepository<CodeProvince> _codeProvinceRep;
|
|
|
|
|
public CommonDBService(SqlSugarRepository<CodeCarrier> codeCarrierRep,
|
|
|
|
|
SqlSugarRepository<CodeVessel> codeVesselRep,
|
|
|
|
|
SqlSugarRepository<CodeForwarder> codeForwarderRep,
|
|
|
|
@ -65,19 +67,22 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
SqlSugarRepository<MappingFrt> mappingFrtRep,
|
|
|
|
|
SqlSugarRepository<MappingYard> mappingYardRep,
|
|
|
|
|
SqlSugarRepository<MappingPortLoad> mappingPortLoadRep,
|
|
|
|
|
SqlSugarRepository<MappingPort> mappingPortRep,
|
|
|
|
|
SqlSugarRepository<MappingPackage> mappingPackageRep,
|
|
|
|
|
SqlSugarRepository<MappingService> mappingServiceRep,
|
|
|
|
|
SqlSugarRepository<CodeIssueType> codeIssueTypeRep,
|
|
|
|
|
SqlSugarRepository<CommonModule> commonModuleRep,
|
|
|
|
|
ILogger<CommonDBService> logger,
|
|
|
|
|
ISysCacheService sysCacheService,
|
|
|
|
|
SqlSugarRepository<CodeLane> codeLaneRep,
|
|
|
|
|
SqlSugarRepository<RelaPortCarrierLane> relaPortCarrierLaneRep,
|
|
|
|
|
SqlSugarRepository<MappingIssueType> mappingIssueTypeRep,
|
|
|
|
|
SqlSugarRepository<CodeCountry> codeCountryRep,
|
|
|
|
|
SqlSugarRepository<MappingForwarder> mappingForwarder)
|
|
|
|
|
{
|
|
|
|
|
SqlSugarRepository<MappingPort> mappingPortRep,
|
|
|
|
|
SqlSugarRepository<MappingPackage> mappingPackageRep,
|
|
|
|
|
SqlSugarRepository<MappingService> mappingServiceRep,
|
|
|
|
|
SqlSugarRepository<CodeIssueType> codeIssueTypeRep,
|
|
|
|
|
SqlSugarRepository<CommonModule> commonModuleRep,
|
|
|
|
|
ILogger<CommonDBService> logger,
|
|
|
|
|
ISysCacheService sysCacheService,
|
|
|
|
|
SqlSugarRepository<CodeLane> codeLaneRep,
|
|
|
|
|
SqlSugarRepository<RelaPortCarrierLane> relaPortCarrierLaneRep,
|
|
|
|
|
SqlSugarRepository<MappingIssueType> mappingIssueTypeRep,
|
|
|
|
|
SqlSugarRepository<CodeCountry> codeCountryRep,
|
|
|
|
|
SqlSugarRepository<MappingForwarder> mappingForwarder,
|
|
|
|
|
SqlSugarRepository<CodeCity> codeCityRep,
|
|
|
|
|
SqlSugarRepository<CodeProvince> codeProvinceRep
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
_codeCarrierRep = codeCarrierRep;
|
|
|
|
|
_codeVesselRep = codeVesselRep;
|
|
|
|
|
_codeForwarderRep = codeForwarderRep;
|
|
|
|
@ -106,6 +111,9 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
_codeCountryRep = codeCountryRep;
|
|
|
|
|
_mappingIssueTypeRep = mappingIssueTypeRep;
|
|
|
|
|
_mappingForwarder = mappingForwarder;
|
|
|
|
|
_codeCityRep = codeCityRep;
|
|
|
|
|
_codeProvinceRep = codeProvinceRep;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
@ -1357,7 +1365,36 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取省市
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取城市信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/CodeCityList")]
|
|
|
|
|
public async Task<dynamic> CodeCityList(string Provincecode,string name)
|
|
|
|
|
{
|
|
|
|
|
List<CodeCity> list = await _sysCacheService.GetAllCodeCity();
|
|
|
|
|
|
|
|
|
|
var queryList = list.WhereIF(!string.IsNullOrEmpty(Provincecode), x => x.ProvinceCode == Provincecode).WhereIF(!string.IsNullOrEmpty(name), x => x.CNName.Contains(name)).ToList();
|
|
|
|
|
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取省份信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/CodeProvinceList")]
|
|
|
|
|
public async Task<dynamic> CodeProvinceList(string name)
|
|
|
|
|
{
|
|
|
|
|
List<CodeProvince> list = await _sysCacheService.GetAllCodeProvince();
|
|
|
|
|
|
|
|
|
|
var queryList = list.Where( x => x.Country == "CN").WhereIF(!string.IsNullOrEmpty(name), x => x.CNName.Contains(name)).ToList();
|
|
|
|
|
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
#region 模块列表
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -2100,6 +2137,57 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取城市信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="flag"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllCity(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CITY))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCityRep.AsQueryable().OrderBy(x => x.Sort).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCity(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCityRep.AsQueryable().OrderBy(x => x.Sort).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCity(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取省份信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="flag"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllProvince(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PROVINCE))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeProvinceRep.AsQueryable().OrderBy(x => x.Sort).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeProvince(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeProvinceRep.AsQueryable().OrderBy(x => x.Sort).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeProvince(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|