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 Kurisu.AspNetCore.Utils.Extensions;
using Newtonsoft.Json; using Newtonsoft.Json;
@@ -103,12 +103,4 @@ public class WorkGridScheduleAttendancePageResponse
return "/"; return "/";
} }
} }
}
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 => log.WorkGridInfo.StartsWith(filterString))
.Where((log, d) => d.Type == DeviceTypeEnumType.Attendance || (d.Type == DeviceTypeEnumType.Door && d.AsAttendance)) .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 .Select((log, d, ga) => new WorkGridScheduleAttendancePageResponse
{ {
Id = log.Id, 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; using Newtonsoft.Json;
namespace Dlhis.ScheduledTask.DeviceUploadLog.Response; namespace Dlhis.ScheduledTask.DeviceUploadLog.Response;
@@ -90,7 +91,7 @@ public class DeviceUploadLogResponse
return false; return false;
} }
var obj = WorkGridInfo.ToObject<WorkGridInfo2>(); var obj = WorkGridInfo.ToObject<WorkGridInfo>();
return obj.IsError; return obj.IsError;
} }
} }
@@ -120,11 +121,6 @@ public class DeviceUploadLogResponse
} }
} }
public class WorkGridInfo2
{
public bool IsError { get; set; }
}
public class DeviceUploadLogUserResponse public class DeviceUploadLogUserResponse
{ {
public long Id { get; set; } public long Id { get; set; }
@@ -201,14 +197,40 @@ public class DeviceUploadLogUserResponse
return false; return false;
} }
var obj = WorkGridInfo.ToObject<WorkGridInfo2>(); return WorkGridInfoObj.IsError;
return obj.IsError; }
}
public string WorkGridName
{
get
{
if (WorkGridInfoObj != null)
{
return WorkGridInfoObj?.WorkGrid?.WorkGridName;
}
return string.Empty;
} }
} }
[JsonIgnore] [JsonIgnore]
public string WorkGridInfo { get; set; } public string WorkGridInfo { get; set; }
[JsonIgnore]
public WorkGridInfo WorkGridInfoObj
{
get
{
if (WorkGridInfo.IsPresent())
{
return WorkGridInfo.ToObject<WorkGridInfo>();
}
return null;
}
}
/// <summary> /// <summary>
/// 状态描述 /// 状态描述
/// </summary> /// </summary>

View File

@@ -5,6 +5,7 @@ using Dlhis.Entity.Basic.Entity;
using Dlhis.Entity.Basic.Enums; using Dlhis.Entity.Basic.Enums;
using Dlhis.Entity.Device.Entities; using Dlhis.Entity.Device.Entities;
using Dlhis.Entity.Device.Enums; using Dlhis.Entity.Device.Enums;
using Dlhis.Entity.Device.Models;
using Dlhis.Jip.Api; using Dlhis.Jip.Api;
using Dlhis.Jip.Api.Requests; using Dlhis.Jip.Api.Requests;
using Dlhis.ScheduledTask.DeviceUploadLog.Request; using Dlhis.ScheduledTask.DeviceUploadLog.Request;
@@ -219,7 +220,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService
needUpload = workGridInfo.PeriodType.HasValue; needUpload = workGridInfo.PeriodType.HasValue;
workGridInfo.IsError = workGridInfo.TimeSetting != null && workGridInfo.PeriodType.HasValue == false;
if (!needUpload) if (!needUpload)
{ {
try try
@@ -489,19 +490,4 @@ public class DeviceUploadLogService : IDeviceUploadLogService
Data = r 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; }
} }