公共库提示

booking_auth_dev
wet 2 years ago
parent 5955d722f4
commit 6de547d462

@ -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;
@ -446,10 +447,20 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
/// </summary>
/// <returns></returns>
public Task SetAllCodeVessel(List<CodeVessel> list)
{
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>
/// 设置公共库 船代

@ -128,11 +128,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.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
}
@ -174,11 +177,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();
@ -207,12 +209,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();
@ -310,12 +312,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();
@ -386,12 +390,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();
@ -431,12 +437,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));
@ -467,12 +467,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();
@ -538,12 +540,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();
@ -610,12 +614,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();
@ -682,12 +688,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.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
@ -754,13 +764,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.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
@ -844,6 +857,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
[NonAction]
public async Task<List<CodeVessel>> GetAllVessel()
{
try
{
_logger.LogInformation("缓存船名!");
var list = await _codeVesselRep.ToListAsync();
@ -851,6 +866,13 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
await _sysCacheService.SetAllCodeVessel(list);
return list;
}
catch (Exception ex)
{
_logger.LogError("船名" + ex);
throw;
}
}
[NonAction]
public async Task<List<MappingVessel>> GetAllMappingVessel()

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

Loading…
Cancel
Save