From 24f6f1f535544ace992c25d8078a9af55d7668e4 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Thu, 3 Apr 2025 11:43:11 +0800 Subject: [PATCH] =?UTF-8?q?fix=20model=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WorkGridScheduleAttendancePageResponse.cs | 10 +---- .../Implements/WorkGridScheduleService.cs | 2 +- .../Device/Models/WorkGridInfo.cs | 18 ++++++++ .../Response/DeviceUploadLogResponse.cs | 42 ++++++++++++++----- .../Implements/DeviceUploadLogService.cs | 18 +------- 5 files changed, 54 insertions(+), 36 deletions(-) create mode 100644 Src/Dlhis.Entity/Device/Models/WorkGridInfo.cs diff --git a/Src/Dlhis.Basic/WorkGrids/Response/WorkGridScheduleAttendancePageResponse.cs b/Src/Dlhis.Basic/WorkGrids/Response/WorkGridScheduleAttendancePageResponse.cs index 561afdde..dedfcd35 100644 --- a/Src/Dlhis.Basic/WorkGrids/Response/WorkGridScheduleAttendancePageResponse.cs +++ b/Src/Dlhis.Basic/WorkGrids/Response/WorkGridScheduleAttendancePageResponse.cs @@ -1,4 +1,4 @@ -using Dlhis.Entity.Basic.Enums; +using Dlhis.Entity.Device.Models; using Kurisu.AspNetCore.Utils.Extensions; using Newtonsoft.Json; @@ -103,12 +103,4 @@ public class WorkGridScheduleAttendancePageResponse return "/"; } } -} - -public class WorkGridInfo -{ - public bool IsError { get; set; } - public object WorkGrid { get; set; } - public WorkGridTimePeriodEnumType? PeriodType { get; set; } - public object TimeSetting { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridScheduleService.cs b/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridScheduleService.cs index d7b7abea..ae3553b4 100644 --- a/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridScheduleService.cs +++ b/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridScheduleService.cs @@ -313,7 +313,7 @@ public class WorkGridScheduleService : IWorkGridScheduleService ) .Where(log => log.WorkGridInfo.StartsWith(filterString)) .Where((log, d) => d.Type == DeviceTypeEnumType.Attendance || (d.Type == DeviceTypeEnumType.Door && d.AsAttendance)) - .OrderBy(log => log.RaiseDateTime) + .OrderBy(log => log.RaiseDateTime, OrderByType.Desc) .Select((log, d, ga) => new WorkGridScheduleAttendancePageResponse { Id = log.Id, diff --git a/Src/Dlhis.Entity/Device/Models/WorkGridInfo.cs b/Src/Dlhis.Entity/Device/Models/WorkGridInfo.cs new file mode 100644 index 00000000..2a51676f --- /dev/null +++ b/Src/Dlhis.Entity/Device/Models/WorkGridInfo.cs @@ -0,0 +1,18 @@ +using Dlhis.Entity.Basic.Enums; + +namespace Dlhis.Entity.Device.Models; + +public class WorkGridInfo +{ + public bool IsError { get; set; } + public WorkGridInfoDetail WorkGrid { get; set; } + public WorkGridTimePeriodEnumType? PeriodType { get; set; } + public object TimeSetting { get; set; } +} + +public class WorkGridInfoDetail +{ + public Guid WorkGridCode { get; set; } + public string WorkGridName { get; set; } + public string LeaderUserCode { get; set; } +} \ No newline at end of file diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs index ccb232dc..bd5b772c 100644 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Response/DeviceUploadLogResponse.cs @@ -1,4 +1,5 @@ -using Kurisu.AspNetCore.Utils.Extensions; +using Dlhis.Entity.Device.Models; +using Kurisu.AspNetCore.Utils.Extensions; using Newtonsoft.Json; namespace Dlhis.ScheduledTask.DeviceUploadLog.Response; @@ -90,7 +91,7 @@ public class DeviceUploadLogResponse return false; } - var obj = WorkGridInfo.ToObject(); + var obj = WorkGridInfo.ToObject(); return obj.IsError; } } @@ -120,11 +121,6 @@ public class DeviceUploadLogResponse } } -public class WorkGridInfo2 -{ - public bool IsError { get; set; } -} - public class DeviceUploadLogUserResponse { public long Id { get; set; } @@ -201,14 +197,40 @@ public class DeviceUploadLogUserResponse return false; } - var obj = WorkGridInfo.ToObject(); - return obj.IsError; + return WorkGridInfoObj.IsError; + } + } + + public string WorkGridName + { + get + { + if (WorkGridInfoObj != null) + { + return WorkGridInfoObj?.WorkGrid?.WorkGridName; + } + + return string.Empty; } } [JsonIgnore] public string WorkGridInfo { get; set; } - + + [JsonIgnore] + public WorkGridInfo WorkGridInfoObj + { + get + { + if (WorkGridInfo.IsPresent()) + { + return WorkGridInfo.ToObject(); + } + + return null; + } + } + /// /// 状态描述 /// diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs index abb174b5..1401c2f3 100644 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs @@ -5,6 +5,7 @@ using Dlhis.Entity.Basic.Entity; using Dlhis.Entity.Basic.Enums; using Dlhis.Entity.Device.Entities; using Dlhis.Entity.Device.Enums; +using Dlhis.Entity.Device.Models; using Dlhis.Jip.Api; using Dlhis.Jip.Api.Requests; using Dlhis.ScheduledTask.DeviceUploadLog.Request; @@ -219,7 +220,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService needUpload = workGridInfo.PeriodType.HasValue; - + workGridInfo.IsError = workGridInfo.TimeSetting != null && workGridInfo.PeriodType.HasValue == false; if (!needUpload) { try @@ -489,19 +490,4 @@ public class DeviceUploadLogService : IDeviceUploadLogService Data = r }; } -} - -public class WorkGridInfo -{ - public bool IsError => TimeSetting != null && PeriodType.HasValue == false; - public WorkGridInfoDetail WorkGrid { get; set; } - public WorkGridTimePeriodEnumType? PeriodType { get; set; } - public object TimeSetting { get; set; } -} - -public class WorkGridInfoDetail -{ - public Guid WorkGridCode { get; set; } - public string WorkGridName { get; set; } - public string LeaderUserCode { get; set; } } \ No newline at end of file