booking_auth_dev
wanghaomei 2 years ago
commit 2e3db1b997

@ -1,5 +1,6 @@
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
@ -447,8 +448,18 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
/// <returns></returns>
public Task SetAllCodeVessel(List<CodeVessel> list)
{
_logger.LogInformation("接收到缓存船名");
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_VESSEL, list.ToJsonString());
try
{
_logger.LogInformation("接收到缓存船名");
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_VESSEL, list.ToJsonString());
}
catch (Exception ex)
{
_logger.LogError("缓存船名异常:" + ex);
throw Oops.Oh(ex);
}
}
/// <summary>

@ -131,11 +131,14 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task<dynamic> MappingCarrierList([FromQuery] MappingQueryDto input)
{
var list = await _sysCacheService.GetAllMappingCarrier();
var queryList = list
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
throw Oops.Bah("参数过多,请传入模块查询");
}
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
}
@ -177,11 +180,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Name) || input.Name.Length < 2)
{
return new List<CodeVessel>();
throw Oops.Bah("参数过多,请传入船名查询");
}
List<CodeVessel> list = await _sysCacheService.GetAllCodeVessel();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
@ -210,12 +212,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
return new List<MappingVessel>();
throw Oops.Bah("参数过多,请传入模块查询");
}
List<MappingVessel> list = await _sysCacheService.GetAllMappingVessel();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module == input.Module)
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
@ -313,12 +315,14 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
return new List<MappingYard>();
throw Oops.Bah("参数过多,请传入模块查询");
}
List<MappingYard> list = await _sysCacheService.GetAllMappingYard();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module == input.Module)
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
@ -389,12 +393,14 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
return new List<MappingPortLoad>();
throw Oops.Bah("参数过多,请传入模块查询");
}
List<MappingPortLoad> list = await _sysCacheService.GetAllMappingPortLoad();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module == input.Module)
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
@ -434,12 +440,6 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
[HttpGet("/commondb/portlist")]
public async Task<dynamic> PortList([FromQuery] NameQueryDto input)
{
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Name) || input.Name.Length < 2)
{
return new List<CodePortLoad>();
}
List<CodePort> list = await _sysCacheService.GetAllCodePort();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.CnName.Contains(input.Name) || x.EnName.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase));
@ -470,12 +470,14 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
return new List<MappingPort>();
throw Oops.Bah("参数过多,请传入模块查询");
}
List<MappingPort> list = await _sysCacheService.GetAllMappingPort();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module == input.Module)
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
@ -541,12 +543,14 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
return new List<MappingPackage>();
throw Oops.Bah("参数过多,请传入模块查询");
}
List<MappingPackage> list = await _sysCacheService.GetAllMappingPackage();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module == input.Module)
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
@ -613,12 +617,14 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
return new List<MappingService>();
throw Oops.Bah("参数过多,请传入模块查询");
}
List<MappingService> list = await _sysCacheService.GetAllMappingService();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module == input.Module)
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
@ -685,12 +691,16 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
[HttpGet("/commondb/mappingctnlist")]
public async Task<dynamic> MappingCtnList([FromQuery] MappingQueryDto input)
{
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
throw Oops.Bah("参数过多,请传入模块查询");
}
var list = await _sysCacheService.GetAllMappingCtn();
var queryList = list
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
@ -757,13 +767,16 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
/// </summary>
[HttpGet("/commondb/mappingfrtlist")]
public async Task<dynamic> MappingFrtList([FromQuery] MappingQueryDto input)
{
{ //数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
throw Oops.Bah("参数过多,请传入模块查询");
}
var list = await _sysCacheService.GetAllMappingFrt();
var queryList = list
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
@ -858,11 +871,20 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
[NonAction]
public async Task<List<CodeVessel>> GetAllVessel()
{
_logger.LogInformation("缓存船名!");
var list = await _codeVesselRep.ToListAsync();
_logger.LogInformation(list.ToJsonString());
await _sysCacheService.SetAllCodeVessel(list);
return list;
try
{
_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]

@ -8,7 +8,7 @@
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>

Loading…
Cancel
Save