From c64477652b8c8c484511366c5b0036a585d93560 Mon Sep 17 00:00:00 2001
From: zhangxiaofeng <1939543722@qq.com>
Date: Fri, 22 Mar 2024 13:53:26 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8F=B0=E8=B4=A6=E4=BF=9D=E5=AD=98=E6=97=B6?=
=?UTF-8?q?=EF=BC=8CSaveLog=E5=8F=AA=E8=AE=B0=E5=BD=95=E6=98=8E=E7=A1=AE?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9A=84=E5=AD=97=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Service/BookingOrder/BookingOrderService.cs | 12 +++++++++---
.../Service/BookingOrder/IBookingOrderService.cs | 4 +++-
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
index bd9f1bca..92e85883 100644
--- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
+++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
@@ -1957,7 +1957,7 @@ namespace Myshipping.Application
}
}
//记录日志
- await SaveLog(entity, mlist, "保存");
+ await SaveLog(entity, mlist, "保存", lstPropName);
if (!string.IsNullOrEmpty(entity.MBLNO) && !string.IsNullOrEmpty(entity.YARDID) && (entity.MBLNO != mlist.MBLNO || entity.YARDID != mlist.YARDID || entity.CARRIERID != mlist.CARRIERID))
{
_logger.LogInformation($"数据有变化,更新运踪订阅");
@@ -9694,7 +9694,7 @@ namespace Myshipping.Application
_logger.LogInformation($"开始{logTitle}");
var itemcode = App.Configuration["ITEMCODE"].ToString();
var BookingOrderMQUri = App.Configuration["SendBookingOrderMQUri"];
- _logger.LogInformation($"{logTitle}订舱数据回推地址:{BookingOrderMQUri},itemcode:{itemcode}" );
+ _logger.LogInformation($"{logTitle}订舱数据回推地址:{BookingOrderMQUri},itemcode:{itemcode}");
if (!string.IsNullOrEmpty(itemcode) && itemcode == "True")
{
if (ids.Count() == 0)
@@ -9714,6 +9714,7 @@ namespace Myshipping.Application
//2023-9-26,添加校验:推送前通过Cache判断一下待推送的数据是否正在走删除逻辑
if (await _cache.ExistsAsync($"DeletingBookingOrderId_{item.Id}"))
{
+ _logger.LogInformation($"Id:{item.Id},正在走删除逻辑,continue跳过");
continue;
}
@@ -10113,7 +10114,7 @@ namespace Myshipping.Application
///
///
[NonAction]
- public async Task SaveLog(BookingOrder newOrder, BookingOrder oldOrder, string fromFunc)
+ public async Task SaveLog(BookingOrder newOrder, BookingOrder oldOrder, string fromFunc, List updateFields = null)
{
bool flag = true;
long bid = 0;
@@ -10125,6 +10126,11 @@ namespace Myshipping.Application
{
continue;
}
+ // 如果已经明确了被修改的字段,且当前字段不在其中,则跳过
+ if (updateFields != null && !updateFields.Contains(name))
+ {
+ continue;
+ }
object value = descriptor.GetValue(newOrder);
var oldvalue = oldOrder.GetType().GetProperty(name).GetValue(oldOrder, null);
//数值类型转换比较
diff --git a/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs
index 5effc4df..54879701 100644
--- a/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs
+++ b/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs
@@ -78,8 +78,10 @@ namespace Myshipping.Application
///
///
///
+ /// 日志操作来源
+ /// 明确的被修改的字段
///
- Task SaveLog(BookingOrder newOrder, BookingOrder oldOrder, string fromFunc);
+ Task SaveLog(BookingOrder newOrder, BookingOrder oldOrder, string fromFunc, List updateFields = null);
Task AutoYardData(long bookId);