From 33b26cd540639df739c5e2db5cdab14a2add6f62 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Thu, 10 Nov 2022 14:34:32 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=85=AC=E5=85=B1=E7=B1=BB=E7=BC=93?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Myshipping.Application.xml | 2 +- .../BookingOrder/BookingOrderService.cs | 6 +- .../BookingOrder/Dto/BookingStatusLogDto.cs | 2 +- Myshipping.Core/Myshipping.Core.xml | 45 ++++++- .../Service/Cache/ISysCacheService.cs | 1 + .../Service/Cache/SysCacheService.cs | 5 +- .../Service/CommonDB/CommonDBService.cs | 127 +++++++++++++++--- .../Service/CommonDB/Dto/QueryDto.cs | 20 +++ .../Service/CommonDB/ICommonDBService.cs | 7 +- 9 files changed, 184 insertions(+), 31 deletions(-) diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml index 45c018fd..1fd8f20b 100644 --- a/Myshipping.Application/Myshipping.Application.xml +++ b/Myshipping.Application/Myshipping.Application.xml @@ -3245,7 +3245,7 @@ 状态 - + 状态时间 diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index b180966c..ad0eeb75 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -673,6 +673,7 @@ namespace Myshipping.Application /// [AllowAnonymous] [SqlSugarUnitOfWork] + [HttpPost("/BookingOrder/AddBookingStatusLog")] public async Task AddBookingStatusLog(List all) { @@ -691,7 +692,7 @@ namespace Myshipping.Application bookingStatusLog.Gategory = "ship"; bookingStatusLog.CreatedTime = DateTime.Now; bookingStatusLog.Status = item.Status; - bookingStatusLog.OpTiem = item.OpTiem; + bookingStatusLog.OpTiem = item.OPTime; bookingStatusLog.MBLNO = item.MBLNO; var id = await _statuslog.InsertReturnSnowflakeIdAsync(bookingStatusLog); if (item.detail != null && item.detail.Count > 0) @@ -704,11 +705,8 @@ namespace Myshipping.Application BookingStatusLogDetail.CNTRNO = dt.CNTRNO; BookingStatusLogDetail.OPTime = dt.OPTime; await _statuslogdetail.InsertAsync(BookingStatusLogDetail); - - } } - } } } diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingStatusLogDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingStatusLogDto.cs index 9aea8a33..4204002e 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/BookingStatusLogDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingStatusLogDto.cs @@ -22,7 +22,7 @@ namespace Myshipping.Application.Service.BookingOrder.Dto /// /// 状态时间 /// - public DateTime? OpTiem { get; set; } + public DateTime? OPTime { get; set; } /// /// 类别 /// diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index a803b2b8..9747f0f7 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -5779,13 +5779,13 @@ - 获取公共库 船司映射 + 获取公共库 箱型映射 - 获取公共库 箱型映射 + 获取公共库 船司映射 @@ -6435,11 +6435,31 @@ 获取船公司列表信息 + + + 新增船公司信息 + + + + + 获取船公司映射列表信息 + + + + + 新增编辑船公司映射信息 + + 获取船名列表信息 + + + 新增船公司信息 + + 获取船代列表信息 @@ -6480,12 +6500,33 @@ 付费方式 + + + 模块 + + + + + 映射代码 + + + + + 映射名称 + + 获取船公司 + + + 获取船公司映射 + + + 获取船名 diff --git a/Myshipping.Core/Service/Cache/ISysCacheService.cs b/Myshipping.Core/Service/Cache/ISysCacheService.cs index 82954bf3..8156676d 100644 --- a/Myshipping.Core/Service/Cache/ISysCacheService.cs +++ b/Myshipping.Core/Service/Cache/ISysCacheService.cs @@ -41,6 +41,7 @@ public interface ISysCacheService /// Task> GetAllCodeCarrier(); + /// /// 获取公共库 船名 /// diff --git a/Myshipping.Core/Service/Cache/SysCacheService.cs b/Myshipping.Core/Service/Cache/SysCacheService.cs index f630d58b..73c55db2 100644 --- a/Myshipping.Core/Service/Cache/SysCacheService.cs +++ b/Myshipping.Core/Service/Cache/SysCacheService.cs @@ -383,7 +383,7 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet } /// - /// 获取公共库 船司映射 + /// 获取公共库 箱型映射 /// /// public Task> GetAllMappingCtn() @@ -392,7 +392,7 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet } /// - /// 获取公共库 箱型映射 + /// 获取公共库 船司映射 /// /// public Task> GetAllMappingCarrier() @@ -610,5 +610,6 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet { return _cache.SetAsync(CommonConst.CACHE_KEY_DJY_EDI_SETTING, list); } + #endregion } diff --git a/Myshipping.Core/Service/CommonDB/CommonDBService.cs b/Myshipping.Core/Service/CommonDB/CommonDBService.cs index fced3472..32fffbf9 100644 --- a/Myshipping.Core/Service/CommonDB/CommonDBService.cs +++ b/Myshipping.Core/Service/CommonDB/CommonDBService.cs @@ -1,12 +1,9 @@ - - -using Furion.DependencyInjection; +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; @@ -14,7 +11,6 @@ using System.Collections.Generic; using System; namespace Myshipping.Core.Service; - /// /// 公共库 /// @@ -23,6 +19,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie { private readonly SqlSugarRepository _codeCarrierRep; + private readonly SqlSugarRepository _mappingCarrierRep; + private readonly SqlSugarRepository _codeVesselRep; private readonly SqlSugarRepository _codeForwarderRep; private readonly SqlSugarRepository _codeYardRep; @@ -44,7 +42,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie SqlSugarRepository codeServiceRep, SqlSugarRepository codeCtnRep, SqlSugarRepository codeFrtRep, - + SqlSugarRepository mappingCarrierRep, ISysCacheService sysCacheService) { _codeCarrierRep = codeCarrierRep; @@ -57,11 +55,13 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie _codeServiceRep = codeServiceRep; _codeCtnRep = codeCtnRep; _codeFrtRep = codeFrtRep; - + _mappingCarrierRep = mappingCarrierRep; _sysCacheService = sysCacheService; } + + #region 船公司 /// /// 获取船公司列表信息 /// @@ -69,14 +69,63 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie public async Task CarrierList([FromQuery] CodeCnEnQueryDto input) { var list = await GetAllCarrier(); - var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase)) .WhereIF(!string.IsNullOrEmpty(input.CnName), x => x.Code.Contains(input.CnName)) .WhereIF(!string.IsNullOrEmpty(input.EnName), x => x.Code.Contains(input.EnName, System.StringComparison.CurrentCultureIgnoreCase)); + return queryList.ToList(); + } + + /// + /// 新增船公司信息 + /// + [HttpPost("/commondb/addcarrier")] + public async Task AddCarrier(CodeCarrier dto) + { + var entity = dto.Adapt(); + await _codeCarrierRep.InsertAsync(entity); + await GetAllCarrier(); + } + + /// + /// 获取船公司映射列表信息 + /// + [HttpGet("/commondb/mappingcarrierlist")] + public async Task MappingCarrierList([FromQuery] MappingQueryDto input) + { + var list = await GetAllMappingCarrier(); + var queryList = list + .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.Code.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } + /// + /// 新增编辑船公司映射信息 + /// + [HttpPost("/commondb/addorupdatecarrier")] + public async Task AddOrUpdateCarrier(MappingCarrier dto) + { + var entity = dto.Adapt(); + if (string.IsNullOrWhiteSpace(dto.GID)) + { + await _mappingCarrierRep.InsertAsync(entity); + } + else + { + + await _mappingCarrierRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + + } + await GetAllMappingCarrier(); + } + + + #endregion + + #region 船名 /// /// 获取船名列表信息 /// @@ -96,6 +145,25 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie return queryList.ToList(); } + + /// + /// 新增船名信息 + /// + [HttpPost("/commondb/addvessel")] + public async Task AddVessel(CodeVessel dto) + { + var entity = dto.Adapt(); + await _codeVesselRep.InsertAsync(entity); + + } + + + + + + #endregion + + /// /// 获取船代列表信息 /// @@ -206,23 +274,38 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie return queryList.ToList(); } + + + + + + + #region 实现接口,获取公共数据并缓存 [NonAction] public async Task> GetAllCarrier() { - var list = await _sysCacheService.GetAllCodeCarrier(); - if (list != null && list.Count > 0) - { - return list; - } - else - { - list = await _codeCarrierRep.ToListAsync(); - await _sysCacheService.SetAllCodeCarrier(list); - return list; - } + var list = await _codeCarrierRep.ToListAsync(); + await _sysCacheService.SetAllCodeCarrier(list); + return list; } + + [NonAction] + public async Task> GetAllMappingCarrier() + { + + var list = await _mappingCarrierRep.ToListAsync(); + await _sysCacheService.SetAllMappingCarrier(list); + return list; + + } + [NonAction] + public async Task CacheMappingCarrier() + { + var list = await _mappingCarrierRep.ToListAsync(); + await _sysCacheService.SetAllMappingCarrier(list); + } [NonAction] public async Task> GetAllVessel() { @@ -238,7 +321,11 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie return list; } } - + public async Task CacheVessel() + { + var list = await _codeVesselRep.ToListAsync(); + await _sysCacheService.SetAllCodeVessel(list); + } [NonAction] public async Task> GetAllForwarder() { diff --git a/Myshipping.Core/Service/CommonDB/Dto/QueryDto.cs b/Myshipping.Core/Service/CommonDB/Dto/QueryDto.cs index 4a7b97ad..d9992462 100644 --- a/Myshipping.Core/Service/CommonDB/Dto/QueryDto.cs +++ b/Myshipping.Core/Service/CommonDB/Dto/QueryDto.cs @@ -19,4 +19,24 @@ namespace Myshipping.Core.Service { public string Name { get; set; } } + + public class MappingQueryDto + { + public string Code { get; set; } + + /// + /// 模块 + /// + public string Module { get; set; } + + /// + /// 映射代码 + /// + public string MapCode { get; set; } + + /// + /// 映射名称 + /// + public string MapName { get; set; } + } } diff --git a/Myshipping.Core/Service/CommonDB/ICommonDBService.cs b/Myshipping.Core/Service/CommonDB/ICommonDBService.cs index c8b5d095..9bd13766 100644 --- a/Myshipping.Core/Service/CommonDB/ICommonDBService.cs +++ b/Myshipping.Core/Service/CommonDB/ICommonDBService.cs @@ -12,7 +12,12 @@ public interface ICommonDBService /// /// Task> GetAllCarrier(); - + + /// + /// 获取船公司映射 + /// + /// + Task> GetAllMappingCarrier(); /// /// 获取船名 /// From d8cb5d6970319bae1d1252e05ac6bbc3c661f910 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Thu, 10 Nov 2022 14:42:09 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/BookingOrderService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 3a1a085d..2ac8d19f 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -597,7 +597,7 @@ namespace Myshipping.Application bookingStatusLog.Gategory = "ship"; bookingStatusLog.CreatedTime = DateTime.Now; bookingStatusLog.Status = item.Status; - bookingStatusLog.OpTiem = item.OpTiem; + bookingStatusLog.OpTiem = item.OPTime; bookingStatusLog.MBLNO = item.MBLNO; var id = await _statuslog.InsertReturnSnowflakeIdAsync(bookingStatusLog); if (item.detail != null && item.detail.Count > 0) From fd7e0c168235364a4f6680299809e35f854a54cb Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Thu, 10 Nov 2022 17:52:24 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.Core/Myshipping.Core.xml | 67 ++- .../Service/CommonDB/CommonDBService.cs | 440 +++++++++++++----- .../Service/CommonDB/ICommonDBService.cs | 25 +- .../DjyTenantParam/DjyTenantParamService.cs | 12 +- .../DjyTenantParam/IDjyTenantParamService.cs | 2 +- Myshipping.Web.Core/Startup.cs | 45 ++ 6 files changed, 457 insertions(+), 134 deletions(-) diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 416450be..bdfedaf9 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -6445,7 +6445,7 @@ 获取船公司映射列表信息 - + 新增编辑船公司映射信息 @@ -6457,7 +6457,17 @@ - 新增船公司信息 + 新增船名信息 + + + + + 获取船名映射 + + + + + 新增编辑船名映射信息 @@ -6465,36 +6475,81 @@ 获取船代列表信息 + + + 新增船代信息 + + 获取场站列表信息 + + + 新增场站信息 + + 获取起始港信息 + + + 新增起始港信息 + + 获取目的港信息 + + + 新增目的港信息 + + 获取包装信息 + + + 新增包装信息 + + 获取运输条款信息 + + + 新增运输条款 + + 获取箱型信息 + + + 新增箱型 + + + + + 获取箱型映射列表信息 + + + + + 新增编辑船公司映射信息 + + 付费方式 @@ -6533,6 +6588,12 @@ + + + 获取船名映射 + + + 获取船代 @@ -8128,7 +8189,7 @@ - + 获取租户参数类别 diff --git a/Myshipping.Core/Service/CommonDB/CommonDBService.cs b/Myshipping.Core/Service/CommonDB/CommonDBService.cs index 32fffbf9..864109aa 100644 --- a/Myshipping.Core/Service/CommonDB/CommonDBService.cs +++ b/Myshipping.Core/Service/CommonDB/CommonDBService.cs @@ -22,6 +22,9 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie private readonly SqlSugarRepository _mappingCarrierRep; private readonly SqlSugarRepository _codeVesselRep; + private readonly SqlSugarRepository _mappingVesselRep; + + private readonly SqlSugarRepository _codeForwarderRep; private readonly SqlSugarRepository _codeYardRep; private readonly SqlSugarRepository _codePortLoadrRep; @@ -29,7 +32,11 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie 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 ISysCacheService _sysCacheService; public CommonDBService(SqlSugarRepository codeCarrierRep, @@ -43,7 +50,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie SqlSugarRepository codeCtnRep, SqlSugarRepository codeFrtRep, SqlSugarRepository mappingCarrierRep, - ISysCacheService sysCacheService) + SqlSugarRepository mappingVesselRep, + SqlSugarRepository mappingCtnRep, + SqlSugarRepository mappingFrtRep, + ISysCacheService sysCacheService) { _codeCarrierRep = codeCarrierRep; _codeVesselRep = codeVesselRep; @@ -56,7 +66,11 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie _codeCtnRep = codeCtnRep; _codeFrtRep = codeFrtRep; _mappingCarrierRep = mappingCarrierRep; + _mappingVesselRep = mappingVesselRep; + _mappingCtnRep = mappingCtnRep; + _mappingFrtRep = mappingFrtRep; _sysCacheService = sysCacheService; + } @@ -68,7 +82,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie [HttpGet("/commondb/carrierlist")] public async Task CarrierList([FromQuery] CodeCnEnQueryDto input) { - var list = await GetAllCarrier(); + 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.Code.Contains(input.CnName)) .WhereIF(!string.IsNullOrEmpty(input.EnName), x => x.Code.Contains(input.EnName, System.StringComparison.CurrentCultureIgnoreCase)); @@ -79,7 +93,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie /// 新增船公司信息 /// [HttpPost("/commondb/addcarrier")] - public async Task AddCarrier(CodeCarrier dto) + public async Task AddCarrier([FromBody] CodeCarrier dto) { var entity = dto.Adapt(); await _codeCarrierRep.InsertAsync(entity); @@ -92,7 +106,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie [HttpGet("/commondb/mappingcarrierlist")] public async Task MappingCarrierList([FromQuery] MappingQueryDto input) { - var list = await GetAllMappingCarrier(); + var list = await _sysCacheService.GetAllMappingCarrier(); var queryList = list .WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase)) @@ -105,8 +119,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie /// /// 新增编辑船公司映射信息 /// - [HttpPost("/commondb/addorupdatecarrier")] - public async Task AddOrUpdateCarrier(MappingCarrier dto) + [HttpPost("/commondb/addorupdatemappingcarrier")] + public async Task AddOrUpdateMappingCarrier([FromBody] MappingCarrier dto) { var entity = dto.Adapt(); if (string.IsNullOrWhiteSpace(dto.GID)) @@ -138,7 +152,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie return new List(); } - List list = await GetAllVessel(); + List list = await _sysCacheService.GetAllCodeVessel(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)); @@ -150,59 +164,136 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie /// 新增船名信息 /// [HttpPost("/commondb/addvessel")] - public async Task AddVessel(CodeVessel dto) + public async Task AddVessel([FromBody] CodeVessel dto) { var entity = dto.Adapt(); 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) + { + return new List(); + } + + List list = await _sysCacheService.GetAllMappingVessel(); + + var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module == input.Module) + .WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.Name.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase)); + + return queryList.ToList(); + } + /// + /// 新增编辑船名映射信息 + /// + [HttpPost("/commondb/addorupdatevessel")] + public async Task AddOrUpdateMappingVessel([FromBody] MappingVessel dto) + { + var entity = dto.Adapt(); + if (string.IsNullOrWhiteSpace(dto.GID)) + { + await _mappingVesselRep.InsertAsync(entity); + } + else + { + 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 GetAllForwarder(); + List list = await _sysCacheService.GetAllCodeForwarder(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } + /// + /// 新增船代信息 + /// + [HttpPost("/commondb/addforwarder")] + public async Task AddForwarder([FromBody] CodeForwarder dto) + { + var entity = dto.Adapt(); + await _codeForwarderRep.InsertAsync(entity); + await GetAllForwarder(); + } + #endregion + + + #region 场站 + /// /// 获取场站列表信息 /// [HttpGet("/commondb/yardlist")] public async Task YardList([FromQuery] NameQueryDto input) { - List list = await GetAllYard(); + List list = await _sysCacheService.GetAllCodeYard(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } + /// + /// 新增场站信息 + /// + [HttpPost("/commondb/addyard")] + public async Task AddYard([FromBody] CodeYard dto) + { + var entity = dto.Adapt(); + await _codeYardRep.InsertAsync(entity); + await GetAllYard(); + } + #endregion + + #region 起始港 /// /// 获取起始港信息 /// [HttpGet("/commondb/portloadlist")] public async Task PortloadList([FromQuery] NameQueryDto input) { - List list = await GetAllPortload(); + 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)); return queryList.ToList(); } + /// + /// 新增起始港信息 + /// + [HttpPost("/commondb/addportload")] + public async Task AddPortload([FromBody] CodePortLoad dto) + { + var entity = dto.Adapt(); + await _codePortLoadrRep.InsertAsync(entity); + await GetAllPortload(); + } + #endregion + #region 目的港 /// /// 获取目的港信息 /// @@ -215,68 +306,209 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie return new List(); } - List list = await GetAllPort(); + 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)); return queryList.ToList(); } + + /// + /// 新增目的港信息 + /// + [HttpPost("/commondb/addport")] + public async Task AddPort([FromBody] CodePort dto) + { + var entity = dto.Adapt(); + await _codePortRep.InsertAsync(entity); + await GetAllPort(); + } + + + #endregion + + #region 包装 /// /// 获取包装信息 /// [HttpGet("/commondb/package")] public async Task PackageList([FromQuery] NameQueryDto input) { - List list = await GetAllPackage(); + List list = await _sysCacheService.GetAllCodePackage(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } + /// + /// 新增包装信息 + /// + [HttpPost("/commondb/addpackage")] + public async Task AddPackage([FromBody] CodePackage dto) + { + var entity = dto.Adapt(); + await _codePackageRep.InsertAsync(entity); + await GetAllPackage(); + } + + #endregion + #region 运输条款 /// /// 获取运输条款信息 /// [HttpGet("/commondb/service")] public async Task ServiceList([FromQuery] NameQueryDto input) { - List list = await GetAllService(); + List list = await _sysCacheService.GetAllCodeService(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } + /// + /// 新增运输条款 + /// + [HttpPost("/commondb/addservice")] + public async Task AddService([FromBody] CodeService dto) + { + var entity = dto.Adapt(); + await _codeServiceRep.InsertAsync(entity); + await GetAllService(); + } + + + #endregion + + #region 箱型 /// /// 获取箱型信息 /// [HttpGet("/commondb/ctn")] public async Task CtnList([FromQuery] NameQueryDto input) { - List list = await GetAllCtn(); + List list = await _sysCacheService.GetAllCodeCtn(); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase)); return queryList.ToList(); } + + /// + /// 新增箱型 + /// + [HttpPost("/commondb/addctn")] + public async Task AddCtn([FromBody] CodeCtn dto) + { + var entity = dto.Adapt(); + await _codeCtnRep.InsertAsync(entity); + await GetAllCtn(); + } + + + /// + /// 获取箱型映射列表信息 + /// + [HttpGet("/commondb/mappingctnlist")] + public async Task MappingCtnList([FromQuery] MappingQueryDto input) + { + var list = await _sysCacheService.GetAllMappingCtn(); + + var queryList = list + .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.Code.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase)); + + return queryList.ToList(); + } + + /// + /// 新增编辑箱型映射信息 + /// + [HttpPost("/commondb/addmappingctn")] + public async Task AddOrUpdateMappingCtn([FromBody] MappingCtn dto) + { + var entity = dto.Adapt(); + if (string.IsNullOrWhiteSpace(dto.GID)) + { + await _mappingCtnRep.InsertAsync(entity); + } + else + { + + 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 GetAllFrt(); + 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)); return queryList.ToList(); } + /// + /// 新增付费方式 + /// + [HttpPost("/commondb/addfrt")] + public async Task AddFrt([FromBody] CodeFrt dto) + { + var entity = dto.Adapt(); + await _codeFrtRep.InsertAsync(entity); + await GetAllFrt(); + } + /// + /// 获取付费映射列表信息 + /// + [HttpGet("/commondb/mappingfrtlist")] + public async Task MappingFrtList([FromQuery] MappingQueryDto input) + { + var list = await _sysCacheService.GetAllMappingFrt(); + var queryList = list + .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.Code.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase)); + + return queryList.ToList(); + } + /// + /// 新增编辑付费映射信息 + /// + [HttpPost("/commondb/addmappingfrt")] + public async Task AddOrUpdateMappingFrt([FromBody] MappingFrt dto) + { + var entity = dto.Adapt(); + if (string.IsNullOrWhiteSpace(dto.GID)) + { + await _mappingFrtRep.InsertAsync(entity); + } + else + { + await _mappingFrtRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + } + await GetAllMappingFrt(); + } + #endregion @@ -300,161 +532,119 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie return list; } - [NonAction] - public async Task CacheMappingCarrier() - { - var list = await _mappingCarrierRep.ToListAsync(); - await _sysCacheService.SetAllMappingCarrier(list); - } + [NonAction] public async Task> GetAllVessel() - { - var list = await _sysCacheService.GetAllCodeVessel(); - if (list != null && list.Count > 0) - { - return list; - } - else - { - list = await _codeVesselRep.ToListAsync(); - await _sysCacheService.SetAllCodeVessel(list); - return list; - } - } - public async Task CacheVessel() { var list = await _codeVesselRep.ToListAsync(); await _sysCacheService.SetAllCodeVessel(list); + return list; + } + + [NonAction] + public async Task> GetAllMappingVessel() + { + + var list = await _mappingVesselRep.ToListAsync(); + await _sysCacheService.SetAllMappingVessel(list); + return list; + } + [NonAction] public async Task> GetAllForwarder() { - var list = await _sysCacheService.GetAllCodeForwarder(); - if (list != null && list.Count > 0) - { - return list; - } - else - { - list = await _codeForwarderRep.ToListAsync(); - await _sysCacheService.SetAllCodeForwarder(list); - return list; - } + var list = await _codeForwarderRep.ToListAsync(); + await _sysCacheService.SetAllCodeForwarder(list); + return list; } [NonAction] public async Task> GetAllYard() { - var list = await _sysCacheService.GetAllCodeYard(); - if (list != null && list.Count > 0) - { - return list; - } - else - { - list = await _codeYardRep.ToListAsync(); - await _sysCacheService.SetAllCodeYard(list); - return list; - } + + var list = await _codeYardRep.ToListAsync(); + await _sysCacheService.SetAllCodeYard(list); + return list; + } [NonAction] public async Task> GetAllPortload() { - var list = await _sysCacheService.GetAllCodePortLoad(); - if (list != null && list.Count > 0) - { - return list; - } - else - { - list = await _codePortLoadrRep.ToListAsync(); - await _sysCacheService.SetAllCodePortLoad(list); - return list; - } + + var list = await _codePortLoadrRep.ToListAsync(); + await _sysCacheService.SetAllCodePortLoad(list); + return list; + } [NonAction] public async Task> GetAllPort() { - var list = await _sysCacheService.GetAllCodePort(); - if (list != null && list.Count > 0) - { - return list; - } - else - { - list = await _codePortRep.ToListAsync(); - await _sysCacheService.SetAllCodePort(list); - return list; - } + + var list = await _codePortRep.ToListAsync(); + await _sysCacheService.SetAllCodePort(list); + return list; + } [NonAction] public async Task> GetAllPackage() { - var list = await _sysCacheService.GetAllCodePackage(); - if (list != null && list.Count > 0) - { - return list; - } - else - { - list = await _codePackageRep.ToListAsync(); - await _sysCacheService.SetAllCodePackage(list); - return list; - } + + var list = await _codePackageRep.ToListAsync(); + await _sysCacheService.SetAllCodePackage(list); + return list; + } [NonAction] public async Task> GetAllService() { - var list = await _sysCacheService.GetAllCodeService(); - if (list != null && list.Count > 0) - { - return list; - } - else - { - list = await _codeServiceRep.ToListAsync(); - await _sysCacheService.SetAllCodeService(list); - return list; - } + + var list = await _codeServiceRep.ToListAsync(); + await _sysCacheService.SetAllCodeService(list); + return list; + } [NonAction] public async Task> GetAllCtn() { - var list = await _sysCacheService.GetAllCodeCtn(); - if (list != null && list.Count > 0) - { - return list; - } - else - { - list = await _codeCtnRep.ToListAsync(); - await _sysCacheService.SetAllCodeCtn(list); - return list; - } + var list = await _codeCtnRep.ToListAsync(); + await _sysCacheService.SetAllCodeCtn(list); + return list; + } + [NonAction] + public async Task> GetAllMappingCtn() + { + var list = await _mappingCtnRep.ToListAsync(); + await _sysCacheService.SetAllMappingCtn(list); + return list; + + } [NonAction] public async Task> GetAllFrt() { - var list = await _sysCacheService.GetAllCodeFrt(); - if (list != null && list.Count > 0) - { - return list; - } - else - { - list = await _codeFrtRep.ToListAsync(); - await _sysCacheService.SetAllCodeFrt(list); - return list; - } + + var list = await _codeFrtRep.ToListAsync(); + await _sysCacheService.SetAllCodeFrt(list); + return list; + } + [NonAction] + public async Task> GetAllMappingFrt() + { + var list = await _mappingFrtRep.ToListAsync(); + await _sysCacheService.SetAllMappingFrt(list); + return list; + + } #endregion diff --git a/Myshipping.Core/Service/CommonDB/ICommonDBService.cs b/Myshipping.Core/Service/CommonDB/ICommonDBService.cs index 9bd13766..b015ba4a 100644 --- a/Myshipping.Core/Service/CommonDB/ICommonDBService.cs +++ b/Myshipping.Core/Service/CommonDB/ICommonDBService.cs @@ -12,7 +12,7 @@ public interface ICommonDBService /// /// Task> GetAllCarrier(); - + /// /// 获取船公司映射 /// @@ -24,6 +24,12 @@ public interface ICommonDBService /// Task> GetAllVessel(); + + /// + /// 获取船名映射 + /// + /// + Task> GetAllMappingVessel(); /// /// 获取船代 /// @@ -66,4 +72,21 @@ public interface ICommonDBService /// Task> GetAllCtn(); + /// + /// 获取箱型映射 + /// + /// + Task> GetAllMappingCtn(); + + + /// + /// 付费方式 + /// + /// + Task> GetAllFrt(); + + /// + /// 付费方式映射 + /// + Task> GetAllMappingFrt(); } diff --git a/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs b/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs index 561c7858..95a4f459 100644 --- a/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs +++ b/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.Logging; using System.Collections.Generic; using Myshipping.Core.Entity; +using System; namespace Myshipping.Core.Service { @@ -73,10 +74,10 @@ namespace Myshipping.Core.Service /// 获取租户参数类别 /// /// - [HttpGet("/DJYTenantParam/get")] - public async Task> Get(string Type) + [HttpGet("/DJYTenantParam/list")] + public async Task> List(string Type) { - return await _rep.AsQueryable().Where(x => x.Type == Type).OrderBy(x => x.Sort).ToListAsync(); + return await _rep.AsQueryable().WhereIF(!string.IsNullOrEmpty(Type),x => x.Type == Type).OrderBy(x => x.Sort).ToListAsync(); } /// @@ -86,7 +87,7 @@ namespace Myshipping.Core.Service [HttpGet("/DJYTenantParam/getParamItem")] public async Task> GetParamItem(string ParaCode) { - return await _itemrep.AsQueryable().Where(x => x.ParaCode == ParaCode).OrderBy(x => x.Sort).ToListAsync(); + return await _itemrep.AsQueryable().WhereIF(!string.IsNullOrEmpty(ParaCode), x => x.ParaCode == ParaCode).OrderBy(x => x.Sort).ToListAsync(); } @@ -139,6 +140,9 @@ namespace Myshipping.Core.Service [HttpGet("/DJYTenantParam/getParamValue")] public async Task> GetParamValue(long tenantId) { + if (tenantId==0) { + tenantId = Convert.ToInt64(UserManager.TENANT_ID); + } return await _valuerep.AsQueryable().Where(x => x.TenantId == tenantId).OrderBy(x => x.Sort).ToListAsync(); } diff --git a/Myshipping.Core/Service/DjyTenantParam/IDjyTenantParamService.cs b/Myshipping.Core/Service/DjyTenantParam/IDjyTenantParamService.cs index a5053375..467e192d 100644 --- a/Myshipping.Core/Service/DjyTenantParam/IDjyTenantParamService.cs +++ b/Myshipping.Core/Service/DjyTenantParam/IDjyTenantParamService.cs @@ -11,7 +11,7 @@ namespace Myshipping.Core.Service Task Add(AddDJYTenantParamInput input); Task Update(UpdateDJYTenantParamInput input); Task Delete(long Id); - Task> Get(string Type); + Task> List(string Type); Task> GetParamItem(string ParaCode); Task AddParamItem(DjyTenantParamItem input); diff --git a/Myshipping.Web.Core/Startup.cs b/Myshipping.Web.Core/Startup.cs index 6c468f0b..d45ca384 100644 --- a/Myshipping.Web.Core/Startup.cs +++ b/Myshipping.Web.Core/Startup.cs @@ -110,6 +110,7 @@ public class Startup : AppStartup // 注册 Log 日志订阅者 builder.AddSubscriber(); }); + #region 缓存 //缓存EDI数据 App.GetService().CacheData(); @@ -119,6 +120,50 @@ public class Startup : AppStartup //租户参数 App.GetService().CacheData(); + + //船公司 + App.GetService().GetAllCarrier(); + + //船公司映射 + App.GetService().GetAllMappingCarrier(); + + //船名 + App.GetService().GetAllVessel(); + + //船名映射 + App.GetService().GetAllMappingVessel(); + + //船代 + App.GetService().GetAllForwarder(); + + //场站 + App.GetService().GetAllYard(); + + //起始港 + App.GetService().GetAllPortload(); + + //目的港 + App.GetService().GetAllPort(); + + //包装 + App.GetService().GetAllPackage(); + + //运输方式 + App.GetService().GetAllService(); + + //箱型 + App.GetService().GetAllCtn(); + + //箱型映射 + App.GetService().GetAllMappingCtn(); + + //付费方式 + App.GetService().GetAllFrt(); + + //付费方式映射 + App.GetService().GetAllMappingFrt(); + + #endregion } public void Configure(IApplicationBuilder app, IWebHostEnvironment env)