台账保存时,SaveLog只记录明确修改的字段

master
zhangxiaofeng 8 months ago
parent 42fae8dbc7
commit c64477652b

@ -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)) if (!string.IsNullOrEmpty(entity.MBLNO) && !string.IsNullOrEmpty(entity.YARDID) && (entity.MBLNO != mlist.MBLNO || entity.YARDID != mlist.YARDID || entity.CARRIERID != mlist.CARRIERID))
{ {
_logger.LogInformation($"数据有变化,更新运踪订阅"); _logger.LogInformation($"数据有变化,更新运踪订阅");
@ -9694,7 +9694,7 @@ namespace Myshipping.Application
_logger.LogInformation($"开始{logTitle}"); _logger.LogInformation($"开始{logTitle}");
var itemcode = App.Configuration["ITEMCODE"].ToString(); var itemcode = App.Configuration["ITEMCODE"].ToString();
var BookingOrderMQUri = App.Configuration["SendBookingOrderMQUri"]; var BookingOrderMQUri = App.Configuration["SendBookingOrderMQUri"];
_logger.LogInformation($"{logTitle}订舱数据回推地址:{BookingOrderMQUri}itemcode{itemcode}" ); _logger.LogInformation($"{logTitle}订舱数据回推地址:{BookingOrderMQUri}itemcode{itemcode}");
if (!string.IsNullOrEmpty(itemcode) && itemcode == "True") if (!string.IsNullOrEmpty(itemcode) && itemcode == "True")
{ {
if (ids.Count() == 0) if (ids.Count() == 0)
@ -9714,6 +9714,7 @@ namespace Myshipping.Application
//2023-9-26添加校验推送前通过Cache判断一下待推送的数据是否正在走删除逻辑 //2023-9-26添加校验推送前通过Cache判断一下待推送的数据是否正在走删除逻辑
if (await _cache.ExistsAsync($"DeletingBookingOrderId_{item.Id}")) if (await _cache.ExistsAsync($"DeletingBookingOrderId_{item.Id}"))
{ {
_logger.LogInformation($"Id:{item.Id}正在走删除逻辑continue跳过");
continue; continue;
} }
@ -10113,7 +10114,7 @@ namespace Myshipping.Application
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[NonAction] [NonAction]
public async Task SaveLog(BookingOrder newOrder, BookingOrder oldOrder, string fromFunc) public async Task SaveLog(BookingOrder newOrder, BookingOrder oldOrder, string fromFunc, List<string> updateFields = null)
{ {
bool flag = true; bool flag = true;
long bid = 0; long bid = 0;
@ -10125,6 +10126,11 @@ namespace Myshipping.Application
{ {
continue; continue;
} }
// 如果已经明确了被修改的字段,且当前字段不在其中,则跳过
if (updateFields != null && !updateFields.Contains(name))
{
continue;
}
object value = descriptor.GetValue(newOrder); object value = descriptor.GetValue(newOrder);
var oldvalue = oldOrder.GetType().GetProperty(name).GetValue(oldOrder, null); var oldvalue = oldOrder.GetType().GetProperty(name).GetValue(oldOrder, null);
//数值类型转换比较 //数值类型转换比较

@ -78,8 +78,10 @@ namespace Myshipping.Application
/// </summary> /// </summary>
/// <param name="newOrder"></param> /// <param name="newOrder"></param>
/// <param name="oldOrder"></param> /// <param name="oldOrder"></param>
/// <param name="fromFunc">日志操作来源</param>
/// <param name="updateFields">明确的被修改的字段</param>
/// <returns></returns> /// <returns></returns>
Task SaveLog(BookingOrder newOrder, BookingOrder oldOrder, string fromFunc); Task SaveLog(BookingOrder newOrder, BookingOrder oldOrder, string fromFunc, List<string> updateFields = null);
Task AutoYardData(long bookId); Task AutoYardData(long bookId);

Loading…
Cancel
Save