fix 增加isError显示

This commit is contained in:
2025-03-17 12:05:31 +08:00
parent 57f111aaa7
commit e22672751c
2 changed files with 53 additions and 7 deletions

View File

@@ -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
/// 是否有效
/// </summary>
public bool Status { get; set; }
}
/// <summary>
/// 是否是异常记录
/// </summary>
public bool IsError
{
get
{
if (WorkGridInfo.IsEmpty())
{
return false;
}
var obj = WorkGridInfo.ToObject<WorkGridInfo2>();
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
/// 是否有效
/// </summary>
public bool Status { get; set; }
/// <summary>
/// 是否是异常记录
/// </summary>
public bool IsError
{
get
{
if (WorkGridInfo.IsEmpty())
{
return false;
}
var obj = WorkGridInfo.ToObject<WorkGridInfo2>();
return obj.IsError;
}
}
[JsonIgnore]
public string WorkGridInfo { get; set; }
}

View File

@@ -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<DeviceUploadLogUserResponse>
@@ -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<DeviceUploadLogResponse>