From e22672751ccbb64e7fa46b393589f58e3f5fb826 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Mon, 17 Mar 2025 12:05:31 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=A2=9E=E5=8A=A0isError=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Response/DeviceUploadLogResponse.cs | 50 ++++++++++++++++++- .../Implements/DeviceUploadLogService.cs | 10 ++-- 2 files changed, 53 insertions(+), 7 deletions(-) diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs index d432eac4..05efb01d 100644 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs @@ -1,4 +1,6 @@ -using Newtonsoft.Json; +using Dlhis.ScheduledTask.DeviceUploadLog.Services.Implements; +using Kurisu.AspNetCore.Utils.Extensions; +using Newtonsoft.Json; namespace Dlhis.ScheduledTask.DeviceUploadLog.Response; @@ -75,8 +77,32 @@ public class DeviceUploadLogResponse /// 是否有效 /// public bool Status { get; set; } -} + + + /// + /// 是否是异常记录 + /// + public bool IsError + { + get + { + if (WorkGridInfo.IsEmpty()) + { + return false; + } + var obj = WorkGridInfo.ToObject(); + return obj.IsError; + } + } + + [JsonIgnore] + public string WorkGridInfo { get; set; } +} +public class WorkGridInfo2 +{ + public bool IsError { get; set; } +} public class DeviceUploadLogUserResponse @@ -142,4 +168,24 @@ public class DeviceUploadLogUserResponse /// 是否有效 /// public bool Status { get; set; } + + /// + /// 是否是异常记录 + /// + public bool IsError + { + get + { + if (WorkGridInfo.IsEmpty()) + { + return false; + } + + var obj = WorkGridInfo.ToObject(); + return obj.IsError; + } + } + + [JsonIgnore] + public string WorkGridInfo { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs index 67d6eae1..73e9a614 100644 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs @@ -176,7 +176,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService { var startTime = nightTimePeriod.Start.AddMinutes(-nightTimePeriod.Before); var endTime = nightTimePeriod.End.AddMinutes(nightTimePeriod.After); - + if (currentNightWorkGridSchedules.Any(x => x.Date == currentDateOnly)) { var currentWorkGrid = workGrids.First(x => x.Code == currentNightWorkGridSchedules.First(p => p.Date == currentDateOnly).WorkGridCode); @@ -186,7 +186,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService WorkGridName = currentWorkGrid.Name, LeaderUserCode = currentWorkGrid.LeaderUserCode }; - + var start = currentDateOnly.ToDateTime(startTime); var end = currentDateOnly.ToDateTime(new TimeOnly(23, 59, 59, 999)); @@ -194,8 +194,6 @@ public class DeviceUploadLogService : IDeviceUploadLogService { workGridInfo.PeriodType = WorkGridTimePeriodEnumType.Night; } - - } if (currentNightWorkGridSchedules.Any(x => x.Date == currentDateOnly.AddDays(-1))) @@ -207,7 +205,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService WorkGridName = currentWorkGrid.Name, LeaderUserCode = currentWorkGrid.LeaderUserCode }; - + var start = currentDateOnly.AddDays(-1).ToDateTime(startTime); var end = currentDateOnly.ToDateTime(endTime); @@ -408,6 +406,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService NeedUpload = x.NeedUpload, Sync = x.Sync, Status = x.Status, + WorkGridInfo = x.WorkGridInfo }).ToPageListAsync(request.PageIndex, request.PageSize); return new Pagination @@ -473,6 +472,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService NeedUpload = x.NeedUpload, Sync = x.Sync, Status = x.Status, + WorkGridInfo = x.WorkGridInfo }).ToPageListAsync(request.PageIndex, request.PageSize); return new Pagination