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] =?UTF-8?q?=E5=85=AC=E5=85=B1=E7=B1=BB=E7=BC=93=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(); /// /// 获取船名 ///