fix 通行记录数据处理isError

This commit is contained in:
2025-03-05 15:47:13 +08:00
parent 639432234f
commit 2c8007d40d
6 changed files with 66 additions and 16 deletions

View File

@@ -48,7 +48,12 @@ public class DeviceUploadLogService : IDeviceUploadLogService
var max = DateOnly.FromDateTime(requests.Max(x => x.RaiseDateTime));
var workGridUsers = await _dbContext.Queryable<WorkGridUserEntity>()
.LeftJoin<WorkGridEntity>((x, wg) => x.WorkGridCode == wg.Code)
.Where(x => userCodes2.Contains(x.UserCode))
.Select((x, wg) => new
{
x.WorkGridCode, x.UserCode, wg.LeaderUserCode, wg.Name
})
.ToListAsync();
var workGridSchedules = await _dbContext.Queryable<WorkGridScheduleEntity>()
@@ -101,10 +106,16 @@ public class DeviceUploadLogService : IDeviceUploadLogService
var workGridUser = workGridUsers.FirstOrDefault(x => x.UserCode == request.UserUniqueNo);
if (needUpload && currentWorkGridTimePeriods.Any() && workGridUser != null)
{
workGridInfo.TimeSetting = currentWorkGridTimePeriods;
workGridInfo.TimeSetting = currentWorkGridTimePeriods.Select(x => new
{
Type = x.Type.GetDescription(), x.Before, x.Start, x.End, x.After, x.TenantId
}).ToList();
workGridInfo.WorkGrid = new
{
workGridUser.WorkGridCode
workGridUser.WorkGridCode,
workGridUser.Name,
workGridUser.LeaderUserCode
};
var currentDate = request.RaiseDateTime.Date;
var currentDateOnly = DateOnly.FromDateTime(currentDate);
@@ -405,6 +416,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService
public class WorkGridInfo
{
public bool IsError => !PeriodType.HasValue;
public object WorkGrid { get; set; }
public WorkGridTimePeriodEnumType? PeriodType { get; set; }
public object TimeSetting { get; set; }