From 10ae83cc8668671744912903316853c62723d316 Mon Sep 17 00:00:00 2001 From: wanghaomei <86whm@163.com> Date: Thu, 4 Jul 2024 14:04:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=85=B3=E8=81=94id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Event/BookingSyncSubscriber.cs | 9 ++++++--- .../BookingCustomerOrderService.cs | 16 ++++++++++------ .../Service/BookingCustomerOrder/Dto/Dtos.cs | 1 + 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Myshipping.Application/Event/BookingSyncSubscriber.cs b/Myshipping.Application/Event/BookingSyncSubscriber.cs index 309f3347..adc989b9 100644 --- a/Myshipping.Application/Event/BookingSyncSubscriber.cs +++ b/Myshipping.Application/Event/BookingSyncSubscriber.cs @@ -518,11 +518,14 @@ namespace Myshipping.Application.Event _logger.LogInformation($"根据客户订舱反馈数据 {custOrder.BSNO} 生成了相同的数据 {custOrder.Id}"); //插入订舱台账 - var ordId = await servCustOrder.CustomerToOrder(custOrder); - custOrder.BookingId = ordId; + var ord = await servCustOrder.CustomerToOrder(custOrder); + custOrder.BookingId = ord.Id; await repoCutomerOrder.AsUpdateable(custOrder).UpdateColumns(x => new { x.BookingId }).ExecuteCommandAsync(); - _logger.LogInformation($"生成了订舱台账数据 {ordId}"); + ord.BSNO = item.GetStringValue("OrderId"); + await repoOrder.AsUpdateable(ord).UpdateColumns(x => new { x.BSNO }).ExecuteCommandAsync(); + + _logger.LogInformation($"生成了订舱台账数据 {ord.Id}"); } } diff --git a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs index 310ba26b..a6eb8c1d 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs @@ -1180,7 +1180,8 @@ namespace Myshipping.Application //进入客户订舱系统的订舱台账 if (recModel.Accept) { - bookingId = await CustomerToOrder(model); + var ord = await CustomerToOrder(model); + bookingId = ord.Id; model.BookingId = bookingId; //客户订舱数据与订舱台账数据关联 await _rep.UpdateAsync(model); @@ -1673,10 +1674,13 @@ namespace Myshipping.Application _logger.LogInformation($"根据客户订舱 {recModel.Id} 生成了相同的数据 {model.Id}"); //插入订舱台账 - var ordId = await CustomerToOrder(model); - respDtO.OrderId = ordId; + var ord = await CustomerToOrder(model); + model.BookingId = ord.Id; + await _rep.AsUpdateable(model).UpdateColumns(x => new { x.BookingId }).ExecuteCommandAsync(); - _logger.LogInformation($"生成了订舱台账数据 {ordId}"); + respDtO.OrderId = ord.Id; + + _logger.LogInformation($"生成了订舱台账数据 {ord.Id}"); } @@ -1693,7 +1697,7 @@ namespace Myshipping.Application /// /// [NonAction] - public async Task CustomerToOrder(BookingCustomerOrder custOrd) + public async Task CustomerToOrder(BookingCustomerOrder custOrd) { var bkOrder = custOrd.Adapt(); bkOrder.Id = YitIdHelper.NextId(); @@ -1738,7 +1742,7 @@ namespace Myshipping.Application await _repFile.InsertAsync(file); } - return bkOrder.Id; + return bkOrder; } /// diff --git a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs index 116db433..0acd53b1 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs @@ -534,6 +534,7 @@ namespace Myshipping.Application /// /// 通知人联系人姓 /// + public string NotifypartLastName { get; set; } /// /// 通知人电话国家代码 From ce05375479a7dad199e09405561d48c3cd587ee9 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Thu, 4 Jul 2024 14:29:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=AE=A2=E8=88=B1=E6=8B=92=E7=BB=9D?= =?UTF-8?q?=EF=BC=9A=E8=BF=90=E8=90=A5=E7=AB=AF=E6=8E=A5=E6=94=B6=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E5=AE=A2=E6=88=B7=E7=AB=AF=EF=BC=8C=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E6=8E=A8=E9=80=81=E4=B8=9C=E8=83=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingCustomerOrderService.cs | 1 + .../BookingOrder/BookingOrderService.cs | 39 +++++++++++++++++-- .../Dto/ReceiveBookingRejectInputDto.cs | 7 ++++ .../Enum/BookingOrderSyncTypeEnum.cs | 8 +++- 4 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 Myshipping.Application/Service/BookingOrder/Dto/ReceiveBookingRejectInputDto.cs diff --git a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs index 310ba26b..03157da3 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs @@ -1360,6 +1360,7 @@ namespace Myshipping.Application { "BC" => BookingOrderSyncTypeEnum.BC, "CC" => BookingOrderSyncTypeEnum.CC, + "REJECT" => BookingOrderSyncTypeEnum.REJECT, //"FILE" => BookingOrderSyncTypeEnum.FILE, _ => null, }; diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 231b28f3..fdf6fbd2 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -10350,7 +10350,7 @@ namespace Myshipping.Application } } - + var ctn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == item.Id && x.IsDeleted == false).ToListAsync(); dto.ctnInputs = ctn.Adapt>(); foreach (var it in dto.ctnInputs) @@ -10368,7 +10368,7 @@ namespace Myshipping.Application if (item.SPLIT_OR_MERGE_FLAG.Value == 2) { //如果当前是主票 - if(dto.CUSTNO.Equals(dto.HBLNO,StringComparison.OrdinalIgnoreCase)) + if (dto.CUSTNO.Equals(dto.HBLNO, StringComparison.OrdinalIgnoreCase)) { var allOrderList = await _rep.AsQueryable().Filter(null, true).Where(x => dto.HBLNO == x.HBLNO && (x.SPLIT_OR_MERGE_FLAG != null && x.SPLIT_OR_MERGE_FLAG == 2) && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); @@ -10376,7 +10376,7 @@ namespace Myshipping.Application if (allOrderList.Count > 0) { var allOrderIds = allOrderList.Select(x => x.Id).ToList(); - var currCtn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID != null && allOrderIds.Contains(x.BILLID.Value) + var currCtn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID != null && allOrderIds.Contains(x.BILLID.Value) && x.IsDeleted == false).ToListAsync(); dto.ctnInputs = currCtn.Adapt>(); @@ -12892,6 +12892,39 @@ namespace Myshipping.Application /// 接收BC信息更新订舱 /// [AllowAnonymous] + [HttpPost("/BookingOrder/ReceiveBookingReject")] + [ApiUser(ApiCode = "ReceiveBookingReject")] + public async Task ReceiveBookingReject(ReceiveBookingRejectInputDto input) + { + // 客户订舱:运营端发送订舱数据给客户端 + if (App.Configuration["RunType"] == CommonConst.RUN_TYPE_DJY) + { + return new ReceiveBcInfoResultDto(false, "非运营端,接收失败"); + } + if (string.IsNullOrWhiteSpace(input.CUSTNO)) + { + return new ReceiveBcInfoResultDto(false, "CUSTNO不能为空"); + } + var list = await _rep.AsQueryable().Filter(null, true).Where(x => x.CUSTNO == input.CUSTNO) + .ToListAsync(); + + if (list.Count == 0) + { + string msg = $"通过CUSTNO查询订舱用于推送拒绝请求时,未查询到数据,CUSTNO:【{input.CUSTNO}】,结束"; + _logger.LogInformation(msg); + return new ReceiveBcInfoResultDto(false, msg); + } + _logger.LogInformation($"通过CUSTNO查询订舱用于推送拒绝请求时,查询到{list.Count}条数据,CUSTNO:【{input.CUSTNO}】,开始推送客户端"); + foreach (var item in list) + { + CustomerBookingSyncHelper.SendCustomerBookingSync(item.Id, BookingOrderSyncTypeEnum.REJECT.ToString()); + } + return new ReceiveBcInfoResultDto(true, $"接收成功,共匹配到{list.Count}条订舱记录"); + } + /// + /// 接收BC信息更新订舱 + /// + [AllowAnonymous] [HttpPost("/BookingOrder/ReceiveBcInfo")] [ApiUser(ApiCode = "ReceiveBcInfo")] public async Task ReceiveBcInfo(ReceiveBcInfoDto input) diff --git a/Myshipping.Application/Service/BookingOrder/Dto/ReceiveBookingRejectInputDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/ReceiveBookingRejectInputDto.cs new file mode 100644 index 00000000..0bb00638 --- /dev/null +++ b/Myshipping.Application/Service/BookingOrder/Dto/ReceiveBookingRejectInputDto.cs @@ -0,0 +1,7 @@ +namespace Myshipping.Application.Service.BookingOrder.Dto +{ + public class ReceiveBookingRejectInputDto + { + public string CUSTNO { get; set; } + } +} diff --git a/Myshipping.Core/Enum/BookingOrderSyncTypeEnum.cs b/Myshipping.Core/Enum/BookingOrderSyncTypeEnum.cs index 4ba54da2..052da67d 100644 --- a/Myshipping.Core/Enum/BookingOrderSyncTypeEnum.cs +++ b/Myshipping.Core/Enum/BookingOrderSyncTypeEnum.cs @@ -6,13 +6,17 @@ public enum BookingOrderSyncTypeEnum { /// - /// 只同步BC+文件相关字段 + /// 只用于同步BC及文件相关字段 /// BC = 1, /// - /// 只同步CC号 + /// 只用于同步CC号 /// CC = 2, + /// + /// 只用于推送订舱拒绝消息 + /// + REJECT = 3, ///// ///// 只同步文件相关字段 /////