fix model转换

This commit is contained in:
2025-04-03 11:43:11 +08:00
parent ef93e5bd66
commit 24f6f1f535
5 changed files with 54 additions and 36 deletions

View File

@@ -1,4 +1,4 @@
using Dlhis.Entity.Basic.Enums;
using Dlhis.Entity.Device.Models;
using Kurisu.AspNetCore.Utils.Extensions;
using Newtonsoft.Json;
@@ -104,11 +104,3 @@ public class WorkGridScheduleAttendancePageResponse
}
}
}
public class WorkGridInfo
{
public bool IsError { get; set; }
public object WorkGrid { get; set; }
public WorkGridTimePeriodEnumType? PeriodType { get; set; }
public object TimeSetting { get; set; }
}

View File

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

View File

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

View File

@@ -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<WorkGridInfo2>();
var obj = WorkGridInfo.ToObject<WorkGridInfo>();
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<WorkGridInfo2>();
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<WorkGridInfo>();
}
return null;
}
}
/// <summary>
/// 状态描述
/// </summary>

View File

@@ -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
@@ -490,18 +491,3 @@ public class DeviceUploadLogService : IDeviceUploadLogService
};
}
}
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; }
}