using Furion.DependencyInjection; using Furion.DynamicApiController; using Furion.FriendlyException; using Myshipping.Core.Entity; using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; using System.Linq; using System.Threading.Tasks; using System.Collections.Generic; using System; using Myshipping.Core.Service.CommonDB.Dto; using Microsoft.Extensions.Logging; using Myshipping.Core.Entity.CommonDB; namespace Myshipping.Core.Service; /// /// 公共库 /// [ApiDescriptionSettings(Name = "CommonDB", Order = 1000)] public class CommonDBService : ICommonDBService, IDynamicApiController, ITransient { #region private readonly SqlSugarRepository _codeCarrierRep; private readonly SqlSugarRepository _mappingCarrierRep; private readonly SqlSugarRepository _codeVesselRep; private readonly SqlSugarRepository _mappingVesselRep; private readonly SqlSugarRepository _codeForwarderRep; private readonly SqlSugarRepository _codeYardRep; private readonly SqlSugarRepository _mappingYardRep; private readonly SqlSugarRepository _codePortLoadrRep; private readonly SqlSugarRepository _codePortRep; private readonly SqlSugarRepository _codePackageRep; private readonly SqlSugarRepository _codeServiceRep; private readonly SqlSugarRepository _codeCtnRep; private readonly SqlSugarRepository _mappingCtnRep; private readonly SqlSugarRepository _codeFrtRep; private readonly SqlSugarRepository _mappingFrtRep; private readonly SqlSugarRepository _mappingPortLoadRep; private readonly SqlSugarRepository _mappingPortRep; private readonly SqlSugarRepository _mappingPackageRep; private readonly SqlSugarRepository _mappingServiceRep; private readonly ISysCacheService _sysCacheService; private readonly SqlSugarRepository _codeIssueTypeRep; private readonly SqlSugarRepository _commonModuleRep; private readonly ILogger _logger; private readonly SqlSugarRepository _codeLaneRep; private readonly SqlSugarRepository _relaPortCarrierLaneRep; public CommonDBService(SqlSugarRepository codeCarrierRep, SqlSugarRepository codeVesselRep, SqlSugarRepository codeForwarderRep, SqlSugarRepository codeYardRep, SqlSugarRepository codePortLoadrRep, SqlSugarRepository codePortRep, SqlSugarRepository codePackageRep, SqlSugarRepository codeServiceRep, SqlSugarRepository codeCtnRep, SqlSugarRepository codeFrtRep, SqlSugarRepository mappingCarrierRep, SqlSugarRepository mappingVesselRep, SqlSugarRepository mappingCtnRep, SqlSugarRepository mappingFrtRep, SqlSugarRepository mappingYardRep, SqlSugarRepository mappingPortLoadRep, SqlSugarRepository mappingPortRep, SqlSugarRepository mappingPackageRep, SqlSugarRepository mappingServiceRep, SqlSugarRepository codeIssueTypeRep, SqlSugarRepository commonModuleRep, ILogger logger, ISysCacheService sysCacheService, SqlSugarRepository codeLaneRep, SqlSugarRepository relaPortCarrierLaneRep) { _codeCarrierRep = codeCarrierRep; _codeVesselRep = codeVesselRep; _codeForwarderRep = codeForwarderRep; _codeYardRep = codeYardRep; _codePortLoadrRep = codePortLoadrRep; _codePortRep = codePortRep; _codePackageRep = codePackageRep; _codeServiceRep = codeServiceRep; _codeCtnRep = codeCtnRep; _codeFrtRep = codeFrtRep; _mappingCarrierRep = mappingCarrierRep; _mappingVesselRep = mappingVesselRep; _mappingCtnRep = mappingCtnRep; _mappingFrtRep = mappingFrtRep; _mappingYardRep = mappingYardRep; _sysCacheService = sysCacheService; _mappingPortLoadRep = mappingPortLoadRep; _mappingPortRep = mappingPortRep; _mappingPackageRep = mappingPackageRep; _mappingServiceRep = mappingServiceRep; _codeIssueTypeRep = codeIssueTypeRep; _commonModuleRep = commonModuleRep; _logger = logger; _codeLaneRep = codeLaneRep; _relaPortCarrierLaneRep = relaPortCarrierLaneRep; } #endregion #region 船公司 /// /// 获取船公司列表信息 /// [HttpGet("/commondb/carrierlist")] public async Task CarrierList([FromQuery] CodeCnEnQueryDto input) { var list = await _sysCacheService.GetAllCodeCarrier(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.CnName), x => x.CnName.Contains(input.CnName, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.EnName), x => x.EnName.Contains(input.EnName, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增船公司信息 /// [HttpPost("/commondb/addcarrier")] public async Task AddCarrier([FromBody] CodeCarrierDto dto) { var list = await _sysCacheService.GetAllCodeCarrier(); var count = list.Where(x => x.Code == dto.Code).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _codeCarrierRep.InsertAsync(entity); await GetAllCarrier(); } /// /// 获取船公司映射列表信息 /// [HttpGet("/commondb/mappingcarrierlist")] public async Task MappingCarrierList([FromQuery] MappingQueryDto input) { var list = await _sysCacheService.GetAllMappingCarrier(); //数量太多,不允许查询全部 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.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增编辑船公司映射信息 /// [HttpPost("/commondb/addorupdatemappingcarrier")] public async Task AddOrUpdateMappingCarrier([FromBody] MappingCarrierDto dto) { var list = await _sysCacheService.GetAllMappingCarrier(); var count = list.Where(x => x.Module == dto.Module && x.Code == dto.Code && x.GID != dto.GID).Count(); if (count>0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); if (string.IsNullOrWhiteSpace(dto.GID)) { entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _mappingCarrierRep.InsertAsync(entity); } else { entity.ModifyTime = DateTime.Now; entity.ModifyUser = UserManager.DjyUserId; await _mappingCarrierRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); } await GetAllMappingCarrier(); } #endregion #region 船名 /// /// 获取船名列表信息 /// [HttpGet("/commondb/vessellist")] public async Task VesselList([FromQuery] NameQueryDto input) { //数量太多,不允许查询全部 if (string.IsNullOrEmpty(input.Name) || input.Name.Length < 2) { throw Oops.Bah("参数过多,请传入船名查询"); } List list = await _sysCacheService.GetAllCodeVessel(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增船名信息 /// [HttpPost("/commondb/addvessel")] public async Task AddVessel([FromBody] CodeVesselDto dto) { var list = await _sysCacheService.GetAllCodeVessel(); var count = list.Where(x => x.Name.Trim() == dto.Name.Trim()).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _codeVesselRep.InsertAsync(entity); await GetAllVessel(); } /// /// 获取船名映射 /// [HttpGet("/commondb/mappingvessellist")] public async Task MappingVesselList([FromQuery] MappingQueryDto input) { //数量太多,不允许查询全部 if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1) { throw Oops.Bah("参数过多,请传入模块查询"); } List list = await _sysCacheService.GetAllMappingVessel(); 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.KeyWord), x => x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增编辑船名映射信息 /// [HttpPost("/commondb/addorupdatevessel")] public async Task AddOrUpdateMappingVessel([FromBody] MappingVesselDto dto) { var list = await _sysCacheService.GetAllMappingVessel(); var count = list.Where(x => x.Name.Trim() == dto.Name.Trim()&&x.Module==dto.Module && x.GID != dto.GID).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); if (string.IsNullOrWhiteSpace(dto.GID)) { entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _mappingVesselRep.InsertAsync(entity); } else { entity.ModifyTime = DateTime.Now; entity.ModifyUser = UserManager.DjyUserId; await _mappingVesselRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); } await GetAllMappingVessel(); } #endregion #region 船代 /// /// 获取船代列表信息 /// [HttpGet("/commondb/forwarderlist")] public async Task ForwarderList([FromQuery] NameQueryDto input) { List list = await _sysCacheService.GetAllCodeForwarder(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增船代信息 /// [HttpPost("/commondb/addforwarder")] public async Task AddForwarder([FromBody] CodeForwarderDto dto) { var list = await _sysCacheService.GetAllCodeForwarder(); var count = list.Where(x => x.Code == dto.Code).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _codeForwarderRep.InsertAsync(entity); await GetAllForwarder(); } #endregion #region 场站 /// /// 获取场站列表信息 /// [HttpGet("/commondb/yardlist")] public async Task YardList([FromQuery] NameQueryDto input) { List list = await _sysCacheService.GetAllCodeYard(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增场站信息 /// [HttpPost("/commondb/addyard")] public async Task AddYard([FromBody] CodeYardDto dto) { var list = await _sysCacheService.GetAllCodeYard(); var count = list.Where(x => x.Code == dto.Code).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _codeYardRep.InsertAsync(entity); await GetAllYard(); } /// /// 获取场站映射 /// [HttpGet("/commondb/mappingyardlist")] public async Task MappingYardList([FromQuery] MappingQueryDto input) { //数量太多,不允许查询全部 if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1) { throw Oops.Bah("参数过多,请传入模块查询"); } List list = await _sysCacheService.GetAllMappingYard(); 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.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增编辑场站映射信息 /// [HttpPost("/commondb/addorupdatemappingyard")] public async Task AddOrUpdateMappingYard([FromBody] MappingYardDto dto) { var list = await _sysCacheService.GetAllMappingYard(); var count = list.Where(x => x.Code == dto.Code&&x.Module==dto.Module && x.GID != dto.GID).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); if (string.IsNullOrWhiteSpace(dto.GID)) { entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _mappingYardRep.InsertAsync(entity); } else { entity.ModifyTime = DateTime.Now; entity.ModifyUser = UserManager.DjyUserId; await _mappingYardRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); } await GetAllMappingYard(); } #endregion #region 起始港 /// /// 获取起始港信息 /// [HttpGet("/commondb/portloadlist")] public async Task PortloadList([FromQuery] NameQueryDto input) { List list = await _sysCacheService.GetAllCodePortLoad(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.CnName.Contains(input.Name) || x.EnName.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增起始港信息 /// [HttpPost("/commondb/addportload")] public async Task AddPortload([FromBody] CodePortLoadDto dto) { var list = await _sysCacheService.GetAllCodePortLoad(); var count = list.Where(x => x.Code == dto.Code ).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _codePortLoadrRep.InsertAsync(entity); await GetAllPortload(); } /// /// 获取起始港映射 /// [HttpGet("/commondb/mappingportloadlist")] public async Task PortloadList([FromQuery] MappingQueryDto input) { //数量太多,不允许查询全部 if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1) { throw Oops.Bah("参数过多,请传入模块查询"); } List list = await _sysCacheService.GetAllMappingPortLoad(); 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.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增编辑起始港映射信息 /// [HttpPost("/commondb/addorupdatemappingportload")] public async Task AddOrUpdatePortload([FromBody] MappingPortLoadDto dto) { var list = await _sysCacheService.GetAllMappingPortLoad(); var count = list.Where(x => x.Code == dto.Code&&x.Module==dto.Module && x.GID != dto.GID).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); if (string.IsNullOrWhiteSpace(dto.GID)) { entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _mappingPortLoadRep.InsertAsync(entity); } else { entity.ModifyTime = DateTime.Now; entity.ModifyUser = UserManager.DjyUserId; await _mappingPortLoadRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); } await GetAllMappingPortLoad(); } #endregion #region 目的港 /// /// 获取目的港信息 /// [HttpGet("/commondb/portlist")] public async Task PortList([FromQuery] NameQueryDto input) { List 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)) .WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增目的港信息 /// [HttpPost("/commondb/addport")] public async Task AddPort([FromBody] CodePortDto dto) { var list = await _sysCacheService.GetAllCodePort(); var count = list.Where(x => x.Code == dto.Code ).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _codePortRep.InsertAsync(entity); await GetAllPort(); } /// /// 获取目的港映射 /// [HttpGet("/commondb/mappingportlist")] public async Task PortList([FromQuery] MappingQueryDto input) { //数量太多,不允许查询全部 if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1) { throw Oops.Bah("参数过多,请传入模块查询"); } List list = await _sysCacheService.GetAllMappingPort(); 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.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增编辑目的港映射信息 /// [HttpPost("/commondb/addorupdatemappingport")] public async Task AddOrUpdatePort([FromBody] MappingPortDto dto) { var list = await _sysCacheService.GetAllMappingPort(); var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.GID != dto.GID).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); if (string.IsNullOrWhiteSpace(dto.GID)) { entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _mappingPortRep.InsertAsync(entity); } else { entity.ModifyTime = DateTime.Now; entity.ModifyUser = UserManager.DjyUserId; await _mappingPortRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); } await GetAllMappingPort(); } #endregion #region 包装 /// /// 获取包装信息 /// [HttpGet("/commondb/package")] public async Task PackageList([FromQuery] NameQueryDto input) { List list = await _sysCacheService.GetAllCodePackage(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增包装信息 /// [HttpPost("/commondb/addpackage")] public async Task AddPackage([FromBody] CodePackageDto dto) { var list = await _sysCacheService.GetAllCodePackage(); var count = list.Where(x => x.Code == dto.Code ).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); entity.GID = Guid.NewGuid().ToString(); await _codePackageRep.InsertAsync(entity); await GetAllPackage(); } /// /// 获取包装映射 /// [HttpGet("/commondb/mappingpackage")] public async Task MappingPackageList([FromQuery] MappingQueryDto input) { //数量太多,不允许查询全部 if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1) { throw Oops.Bah("参数过多,请传入模块查询"); } List list = await _sysCacheService.GetAllMappingPackage(); 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.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增编辑包装映射信息 /// [HttpPost("/commondb/addorupdatemappingpackage")] public async Task AddOrUpdateMappingPackage([FromBody] MappingPackageDto dto) { var list = await _sysCacheService.GetAllMappingPackage(); var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.GID != dto.GID).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); if (string.IsNullOrWhiteSpace(dto.GID)) { entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _mappingPackageRep.InsertAsync(entity); } else { entity.ModifyTime = DateTime.Now; entity.ModifyUser = UserManager.DjyUserId; await _mappingPackageRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); } await GetAllMappingPackage(); } #endregion #region 运输条款 /// /// 获取运输条款信息 /// [HttpGet("/commondb/service")] public async Task ServiceList([FromQuery] NameQueryDto input) { List list = await _sysCacheService.GetAllCodeService(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增运输条款 /// [HttpPost("/commondb/addservice")] public async Task AddService([FromBody] CodeServiceDto dto) { var list = await _sysCacheService.GetAllCodeService(); var count = list.Where(x => x.Code == dto.Code ).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _codeServiceRep.InsertAsync(entity); await GetAllService(); } /// /// 获取运输条款映射 /// [HttpGet("/commondb/mappingservice")] public async Task MappingServiceList([FromQuery] MappingQueryDto input) { //数量太多,不允许查询全部 if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1) { throw Oops.Bah("参数过多,请传入模块查询"); } List list = await _sysCacheService.GetAllMappingService(); 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.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增编辑运输条款映射信息 /// [HttpPost("/commondb/addorupdatemappingservice")] public async Task AddOrUpdateMappingService([FromBody] MappingServiceDto dto) { var list = await _sysCacheService.GetAllMappingService(); var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.GID != dto.GID).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); if (string.IsNullOrWhiteSpace(dto.GID)) { entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _mappingServiceRep.InsertAsync(entity); } else { entity.ModifyTime = DateTime.Now; entity.ModifyUser = UserManager.DjyUserId; await _mappingServiceRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); } await GetAllMappingService(); } #endregion #region 箱型 /// /// 获取箱型信息 /// [HttpGet("/commondb/ctn")] public async Task CtnList([FromQuery] NameQueryDto input) { List list = await _sysCacheService.GetAllCodeCtn(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增箱型 /// [HttpPost("/commondb/addctn")] public async Task AddCtn([FromBody] CodeCtnDto dto) { var list = await _sysCacheService.GetAllCodeCtn(); var count = list.Where(x => x.Code == dto.Code ).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; entity.GID = Guid.NewGuid().ToString(); await _codeCtnRep.InsertAsync(entity); await GetAllCtn(); } /// /// 获取箱型映射列表信息 /// [HttpGet("/commondb/mappingctnlist")] public async Task MappingCtnList([FromQuery] MappingQueryDto input) { //数量太多,不允许查询全部 if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1) { throw Oops.Bah("参数过多,请传入模块查询"); } var list = await _sysCacheService.GetAllMappingCtn(); 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.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增编辑箱型映射信息 /// [HttpPost("/commondb/addmappingctn")] public async Task AddOrUpdateMappingCtn([FromBody] MappingCtnDto dto) { var list = await _sysCacheService.GetAllMappingCtn(); var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.GID != dto.GID).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); if (string.IsNullOrWhiteSpace(dto.GID)) { entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _mappingCtnRep.InsertAsync(entity); } else { entity.ModifyTime = DateTime.Now; entity.ModifyUser = UserManager.DjyUserId; await _mappingCtnRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); } await GetAllMappingCtn(); } #endregion #region 付费方式 /// /// 付费方式 /// [HttpGet("/commondb/frt")] public async Task FrtList([FromQuery] NameQueryDto input) { List list = await _sysCacheService.GetAllCodeFrt(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.CnName.Contains(input.Name) || x.EnName.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增付费方式 /// [HttpPost("/commondb/addfrt")] public async Task AddFrt([FromBody] CodeFrtDto dto) { var list = await _sysCacheService.GetAllCodeFrt(); var count = list.Where(x => x.Code == dto.Code ).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _codeFrtRep.InsertAsync(entity); await GetAllFrt(); } /// /// 获取付费映射列表信息 /// [HttpGet("/commondb/mappingfrtlist")] public async Task MappingFrtList([FromQuery] MappingQueryDto input) { //数量太多,不允许查询全部 if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1) { throw Oops.Bah("参数过多,请传入模块查询"); } var list = await _sysCacheService.GetAllMappingFrt(); 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.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增编辑付费映射信息 /// [HttpPost("/commondb/addmappingfrt")] public async Task AddOrUpdateMappingFrt([FromBody] MappingFrtDto dto) { var list = await _sysCacheService.GetAllMappingFrt(); var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module&&x.GID!=dto.GID).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); if (string.IsNullOrWhiteSpace(dto.GID)) { entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _mappingFrtRep.InsertAsync(entity); } else { entity.ModifyTime = DateTime.Now; entity.ModifyUser = UserManager.DjyUserId; await _mappingFrtRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); } await GetAllMappingFrt(); } #endregion #region 签单方式 /// /// 获取签单方式信息 /// [HttpGet("/commondb/codeissuetypelist")] public async Task CodeIssueTypeList([FromQuery] NameQueryDto input) { List list = await _sysCacheService.GetAllCodeIssueType(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.CnName.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } /// /// 新增签单方式 /// [HttpPost("/commondb/addcodeissuetype")] public async Task AddCodeIssueType([FromBody] CodeIssueTypeDto dto) { var list = await _sysCacheService.GetAllCodeIssueType(); var count = list.Where(x => x.Code == dto.Code ).Count(); if (count > 0) { throw Oops.Bah(ErrorCode.D1006); } var entity = dto.Adapt(); entity.GID = Guid.NewGuid().ToString(); entity.CreateTime = DateTime.Now; entity.CreateUser = UserManager.DjyUserId; await _codeIssueTypeRep.InsertAsync(entity); await GetAllCodeIssueType(); } #endregion #region 模块列表 /// /// 获取模块信息 /// [HttpGet("/commondb/modules")] public async Task ModuleList([FromQuery] NameQueryDto input) { return await _commonModuleRep.AsQueryable().OrderBy(x => x.Sort).Select(x => new { x.Code, x.Name, x.Sort }).ToListAsync(); } #endregion #region 实现接口,获取公共数据并缓存 [NonAction] public async Task GetAllCarrier(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CARRIER)) { var list = await _codeCarrierRep.ToListAsync(); await _sysCacheService.SetAllCodeCarrier(list); } } else { var list = await _codeCarrierRep.ToListAsync(); await _sysCacheService.SetAllCodeCarrier(list); } } [NonAction] public async Task GetAllMappingCarrier(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CARRIER)) { var list = await _mappingCarrierRep.ToListAsync(); await _sysCacheService.SetAllMappingCarrier(list); } } else { var list = await _mappingCarrierRep.ToListAsync(); await _sysCacheService.SetAllMappingCarrier(list); } } [NonAction] public async Task GetAllVessel(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_VESSEL)) { var list = await _codeVesselRep.ToListAsync(); await _sysCacheService.SetAllCodeVessel(list); } } else { var list = await _codeVesselRep.ToListAsync(); await _sysCacheService.SetAllCodeVessel(list); } } [NonAction] public async Task GetAllMappingVessel(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_VESSEL)) { var list = await _mappingVesselRep.ToListAsync(); await _sysCacheService.SetAllMappingVessel(list); } } else { var list = await _mappingVesselRep.ToListAsync(); await _sysCacheService.SetAllMappingVessel(list); } } [NonAction] public async Task GetAllMappingYard(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_YARD)) { var list = await _mappingYardRep.ToListAsync(); await _sysCacheService.SetAllMappingYard(list); } } else { var list = await _mappingYardRep.ToListAsync(); await _sysCacheService.SetAllMappingYard(list); } } [NonAction] public async Task GetAllForwarder(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_FORWARDER)) { var list = await _codeForwarderRep.ToListAsync(); await _sysCacheService.SetAllCodeForwarder(list); } } else { var list = await _codeForwarderRep.ToListAsync(); await _sysCacheService.SetAllCodeForwarder(list); } } [NonAction] public async Task GetAllYard(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_YARD)) { var list = await _codeYardRep.ToListAsync(); await _sysCacheService.SetAllCodeYard(list); } } else { var list = await _codeYardRep.ToListAsync(); await _sysCacheService.SetAllCodeYard(list); } } [NonAction] public async Task GetAllPortload(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PORTLOAD)) { var list = await _codePortLoadrRep.ToListAsync(); await _sysCacheService.SetAllCodePortLoad(list); } } else { var list = await _codePortLoadrRep.ToListAsync(); await _sysCacheService.SetAllCodePortLoad(list); } } [NonAction] public async Task GetAllPort(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PORT)) { var list = await _codePortRep.ToListAsync(); await _sysCacheService.SetAllCodePort(list); } } else { var list = await _codePortRep.ToListAsync(); await _sysCacheService.SetAllCodePort(list); } } [NonAction] public async Task GetAllPackage(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PACKAGE)) { var list = await _codePackageRep.ToListAsync(); await _sysCacheService.SetAllCodePackage(list); } } else { var list = await _codePackageRep.ToListAsync(); await _sysCacheService.SetAllCodePackage(list); } } [NonAction] public async Task GetAllService(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_SERVICE)) { var list = await _codeServiceRep.ToListAsync(); await _sysCacheService.SetAllCodeService(list); } } else { var list = await _codeServiceRep.ToListAsync(); await _sysCacheService.SetAllCodeService(list); } } [NonAction] public async Task GetAllCtn(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CTN)) { var list = await _codeCtnRep.ToListAsync(); await _sysCacheService.SetAllCodeCtn(list); } } else { var list = await _codeCtnRep.ToListAsync(); await _sysCacheService.SetAllCodeCtn(list); } } /// /// 获取航线信息 /// /// /// [NonAction] public async Task GetAllLane(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_LANE)) { var list = await _codeLaneRep.ToListAsync(); await _sysCacheService.SetAllCodeLane(list); } } else { var list = await _codeLaneRep.ToListAsync(); await _sysCacheService.SetAllCodeLane(list); } } [NonAction] public async Task GetAllRelaPortCarrierLane(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT)) { var list = await _relaPortCarrierLaneRep.ToListAsync(); await _sysCacheService.SetAllRelaPortCarrierLane(list); } } else { var list = await _relaPortCarrierLaneRep.ToListAsync(); await _sysCacheService.SetAllRelaPortCarrierLane(list); } } [NonAction] public async Task GetAllMappingCtn(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CTN)) { var list = await _mappingCtnRep.ToListAsync(); await _sysCacheService.SetAllMappingCtn(list); } } else { var list = await _mappingCtnRep.ToListAsync(); await _sysCacheService.SetAllMappingCtn(list); } } [NonAction] public async Task GetAllFrt(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_FRT)) { var list = await _codeFrtRep.ToListAsync(); await _sysCacheService.SetAllCodeFrt(list); } } else { var list = await _codeFrtRep.ToListAsync(); await _sysCacheService.SetAllCodeFrt(list); } } [NonAction] public async Task GetAllMappingFrt(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_FRT)) { var list = await _mappingFrtRep.ToListAsync(); await _sysCacheService.SetAllMappingFrt(list); } } else { var list = await _mappingFrtRep.ToListAsync(); await _sysCacheService.SetAllMappingFrt(list); } } [NonAction] public async Task GetAllMappingPortLoad(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORTLOAD)) { var list = await _mappingPortLoadRep.ToListAsync(); await _sysCacheService.SetAllMappingPortLoad(list); } } else { var list = await _mappingPortLoadRep.ToListAsync(); await _sysCacheService.SetAllMappingPortLoad(list); } } [NonAction] public async Task GetAllMappingPort(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORT)) { var list = await _mappingPortRep.ToListAsync(); await _sysCacheService.SetAllMappingPort(list); } } else { var list = await _mappingPortRep.ToListAsync(); await _sysCacheService.SetAllMappingPort(list); } } [NonAction] public async Task GetAllMappingPackage(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PACKAGE)) { var list = await _mappingPackageRep.ToListAsync(); await _sysCacheService.SetAllMappingPackage(list); } } else { var list = await _mappingPackageRep.ToListAsync(); await _sysCacheService.SetAllMappingPackage(list); } } [NonAction] public async Task GetAllMappingService(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_SERVICE)) { var list = await _mappingServiceRep.ToListAsync(); await _sysCacheService.SetAllMappingService(list); } } else { var list = await _mappingServiceRep.ToListAsync(); await _sysCacheService.SetAllMappingService(list); } } [NonAction] public async Task GetAllCodeIssueType(bool flag = false) { if (flag) { if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CODEISSUETYPE)) { var list = await _codeIssueTypeRep.ToListAsync(); await _sysCacheService.SetAllCodeIssueType(list); } } else { var list = await _codeIssueTypeRep.ToListAsync(); await _sysCacheService.SetAllCodeIssueType(list); } } #endregion }