From fd96bfcd314d06c5f3496817e776209c67e14a62 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Thu, 21 Mar 2024 18:26:18 +0800 Subject: [PATCH] =?UTF-8?q?SendBookingOrder=E6=97=B6=EF=BC=8C=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingOrderService.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 239d2ee4..bd9f1bca 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -9689,15 +9689,17 @@ namespace Myshipping.Application { return null; } + var logTitle = $"同步订舱数据,SyncTypeEnum:{syncTypeEnum},ids:{string.Join(',', ids.ToList())},"; - _logger.LogInformation("开始同步订舱数据"); + _logger.LogInformation($"开始{logTitle}"); var itemcode = App.Configuration["ITEMCODE"].ToString(); var BookingOrderMQUri = App.Configuration["SendBookingOrderMQUri"]; - _logger.LogInformation("订舱数据回推地址:" + BookingOrderMQUri + itemcode); + _logger.LogInformation($"{logTitle}订舱数据回推地址:{BookingOrderMQUri},itemcode:{itemcode}" ); if (!string.IsNullOrEmpty(itemcode) && itemcode == "True") { if (ids.Count() == 0) { + _logger.LogInformation($"{logTitle}请上传正确数据,结束"); throw Oops.Bah("请上传正确数据"); } var order = await _rep.AsQueryable().Filter(null, true).Where(x => ids.Contains(x.Id) && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); @@ -9706,6 +9708,7 @@ namespace Myshipping.Application //2023-9-8,增加校验,分单不能单独推送东胜,只能随主单推送 if (item.ParentId > 0) { + _logger.LogInformation($"Id:{item.Id},分单不能单独推送东胜,只能随主单推送,continue跳过"); continue; } //2023-9-26,添加校验:推送前通过Cache判断一下待推送的数据是否正在走删除逻辑 @@ -9823,7 +9826,7 @@ namespace Myshipping.Application var json = dto.ToJsonString(); json = $"[{json}]"; - _logger.LogInformation("订舱数据回推:" + json); + _logger.LogInformation($"Id:{item.Id},订舱数据回推,消息内容:{json}"); try { const string MqActionExchangeName = "djy.output.dingcang.ds6"; @@ -9843,17 +9846,21 @@ namespace Myshipping.Application props.DeliveryMode = 2; mqModel.BasicPublish(MqActionExchangeName, queueName, props, messageBodyBytes); conn.Close(); - _logger.LogInformation($"订舱数据回推,已发送数据到消息队列【{BookingOrderMQUri}】,数据内容:【{json}】"); + _logger.LogInformation($"Id:{item.Id},订舱数据回推,已发送数据到消息队列【{BookingOrderMQUri}】"); } } catch (Exception ex) { - _logger.LogError(ex.Message); - _logger.LogError(ex.StackTrace); + _logger.LogError(ex.Message, $"Id:{item.Id},订舱数据回推推送过程中出现异常"); + _logger.LogError($"Id:{item.Id},订舱数据回推推送过程中出现异常,ex.StackTrace:{ex.StackTrace}"); } await SendLetterYard(item.Id); } + if (order.Count == 0) + { + _logger.LogInformation($"{logTitle}未查到订舱数据,结束"); + } return order; } return null;