SendBookingOrder时,完善日志记录

master
zhangxiaofeng 8 months ago
parent 79c8fb0106
commit fd96bfcd31

@ -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;

Loading…
Cancel
Save