公共库提示

booking_auth_dev
wet 2 years ago
parent 5955d722f4
commit 6de547d462

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

@ -88,7 +88,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
_mappingServiceRep = mappingServiceRep; _mappingServiceRep = mappingServiceRep;
_codeIssueTypeRep = codeIssueTypeRep; _codeIssueTypeRep = codeIssueTypeRep;
_logger = logger; _logger = logger;
} }
@ -118,7 +118,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
entity.CreateUser = UserManager.DjyUserId; entity.CreateUser = UserManager.DjyUserId;
await _codeCarrierRep.InsertAsync(entity); await _codeCarrierRep.InsertAsync(entity);
await GetAllCarrier(); await GetAllCarrier();
} }
/// <summary> /// <summary>
@ -128,11 +128,14 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task<dynamic> MappingCarrierList([FromQuery] MappingQueryDto input) public async Task<dynamic> MappingCarrierList([FromQuery] MappingQueryDto input)
{ {
var list = await _sysCacheService.GetAllMappingCarrier(); 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.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.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)); .WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList(); return queryList.ToList();
} }
@ -148,7 +151,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
{ {
entity.GID = Guid.NewGuid().ToString(); entity.GID = Guid.NewGuid().ToString();
entity.CreateTime = DateTime.Now; entity.CreateTime = DateTime.Now;
entity.CreateUser =UserManager.DjyUserId; entity.CreateUser = UserManager.DjyUserId;
await _mappingCarrierRep.InsertAsync(entity); await _mappingCarrierRep.InsertAsync(entity);
} }
else else
@ -174,11 +177,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
//数量太多,不允许查询全部 //数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Name) || input.Name.Length < 2) if (string.IsNullOrEmpty(input.Name) || input.Name.Length < 2)
{ {
return new List<CodeVessel>(); throw Oops.Bah("参数过多,请传入船名查询");
} }
List<CodeVessel> list = await _sysCacheService.GetAllCodeVessel(); List<CodeVessel> list = await _sysCacheService.GetAllCodeVessel();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList(); return queryList.ToList();
@ -207,12 +209,12 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
//数量太多,不允许查询全部 //数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1) if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{ {
return new List<MappingVessel>(); throw Oops.Bah("参数过多,请传入模块查询");
} }
List<MappingVessel> list = await _sysCacheService.GetAllMappingVessel(); 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)); .WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList(); return queryList.ToList();
@ -310,12 +312,14 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
//数量太多,不允许查询全部 //数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1) if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{ {
return new List<MappingYard>(); throw Oops.Bah("参数过多,请传入模块查询");
} }
List<MappingYard> list = await _sysCacheService.GetAllMappingYard(); 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)); .WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList(); return queryList.ToList();
@ -386,12 +390,14 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
//数量太多,不允许查询全部 //数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1) if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{ {
return new List<MappingPortLoad>(); throw Oops.Bah("参数过多,请传入模块查询");
} }
List<MappingPortLoad> list = await _sysCacheService.GetAllMappingPortLoad(); 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)); .WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList(); return queryList.ToList();
@ -431,12 +437,6 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
[HttpGet("/commondb/portlist")] [HttpGet("/commondb/portlist")]
public async Task<dynamic> PortList([FromQuery] NameQueryDto input) 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(); 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)); 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) if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{ {
return new List<MappingPort>(); throw Oops.Bah("参数过多,请传入模块查询");
} }
List<MappingPort> list = await _sysCacheService.GetAllMappingPort(); 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)); .WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList(); return queryList.ToList();
@ -538,12 +540,14 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
//数量太多,不允许查询全部 //数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1) if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{ {
return new List<MappingPackage>(); throw Oops.Bah("参数过多,请传入模块查询");
} }
List<MappingPackage> list = await _sysCacheService.GetAllMappingPackage(); 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)); .WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList(); return queryList.ToList();
@ -610,12 +614,14 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
//数量太多,不允许查询全部 //数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1) if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{ {
return new List<MappingService>(); throw Oops.Bah("参数过多,请传入模块查询");
} }
List<MappingService> list = await _sysCacheService.GetAllMappingService(); 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)); .WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList(); return queryList.ToList();
@ -682,14 +688,18 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
[HttpGet("/commondb/mappingctnlist")] [HttpGet("/commondb/mappingctnlist")]
public async Task<dynamic> MappingCtnList([FromQuery] MappingQueryDto input) 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 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.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.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)); .WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList(); return queryList.ToList();
} }
@ -754,13 +764,16 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
/// </summary> /// </summary>
[HttpGet("/commondb/mappingfrtlist")] [HttpGet("/commondb/mappingfrtlist")]
public async Task<dynamic> MappingFrtList([FromQuery] MappingQueryDto input) 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 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.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.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)); .WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList(); return queryList.ToList();
@ -845,11 +858,20 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
[NonAction] [NonAction]
public async Task<List<CodeVessel>> GetAllVessel() public async Task<List<CodeVessel>> GetAllVessel()
{ {
_logger.LogInformation("缓存船名!"); try
var list = await _codeVesselRep.ToListAsync(); {
_logger.LogInformation(list.ToJsonString()); _logger.LogInformation("缓存船名!");
await _sysCacheService.SetAllCodeVessel(list); var list = await _codeVesselRep.ToListAsync();
return list; _logger.LogInformation(list.ToJsonString());
await _sysCacheService.SetAllCodeVessel(list);
return list;
}
catch (Exception ex)
{
_logger.LogError("船名" + ex);
throw;
}
} }
[NonAction] [NonAction]
@ -949,11 +971,11 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
[NonAction] [NonAction]
public async Task<List<CodeFrt>> GetAllFrt() public async Task<List<CodeFrt>> GetAllFrt()
{ {
var list = await _codeFrtRep.ToListAsync(); var list = await _codeFrtRep.ToListAsync();
await _sysCacheService.SetAllCodeFrt(list); await _sysCacheService.SetAllCodeFrt(list);
return list; return list;
} }
[NonAction] [NonAction]
public async Task<List<MappingFrt>> GetAllMappingFrt() public async Task<List<MappingFrt>> GetAllMappingFrt()

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

Loading…
Cancel
Save