fix 考勤记录逻辑优化
This commit is contained in:
@@ -152,15 +152,14 @@ public class DeviceUploadLogService : IDeviceUploadLogService
|
||||
if (request.RaiseDateTime >= start && request.RaiseDateTime <= end)
|
||||
{
|
||||
workGridInfo.PeriodType = WorkGridTimePeriodEnumType.Day;
|
||||
var currentWorkGrid = workGrids.First(x => x.Code == currentDayWorkGridSchedule.WorkGridCode);
|
||||
workGridInfo.WorkGrid = new WorkGridInfoDetail
|
||||
{
|
||||
WorkGridCode = currentWorkGrid.Code,
|
||||
WorkGridName = currentWorkGrid.Name,
|
||||
LeaderUserCode = currentWorkGrid.LeaderUserCode
|
||||
};
|
||||
}
|
||||
|
||||
var currentWorkGrid = workGrids.First(x => x.Code == currentDayWorkGridSchedule.WorkGridCode);
|
||||
workGridInfo.WorkGrid = new WorkGridInfoDetail
|
||||
{
|
||||
WorkGridCode = currentWorkGrid.Code,
|
||||
WorkGridName = currentWorkGrid.Name,
|
||||
LeaderUserCode = currentWorkGrid.LeaderUserCode
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,47 +179,44 @@ public class DeviceUploadLogService : IDeviceUploadLogService
|
||||
|
||||
if (currentNightWorkGridSchedules.Any(x => x.Date == currentDateOnly))
|
||||
{
|
||||
var currentWorkGrid = workGrids.First(x => x.Code == currentNightWorkGridSchedules.First(p => p.Date == currentDateOnly).WorkGridCode);
|
||||
workGridInfo.WorkGrid = new WorkGridInfoDetail
|
||||
{
|
||||
WorkGridCode = currentWorkGrid.Code,
|
||||
WorkGridName = currentWorkGrid.Name,
|
||||
LeaderUserCode = currentWorkGrid.LeaderUserCode
|
||||
};
|
||||
|
||||
var start = currentDateOnly.ToDateTime(startTime);
|
||||
var end = currentDateOnly.ToDateTime(new TimeOnly(23, 59, 59, 999));
|
||||
|
||||
if (request.RaiseDateTime >= start && request.RaiseDateTime <= end)
|
||||
{
|
||||
workGridInfo.PeriodType = WorkGridTimePeriodEnumType.Night;
|
||||
var currentWorkGrid = workGrids.First(x => x.Code == currentNightWorkGridSchedules.First(p => p.Date == currentDateOnly).WorkGridCode);
|
||||
workGridInfo.WorkGrid = new WorkGridInfoDetail
|
||||
{
|
||||
WorkGridCode = currentWorkGrid.Code,
|
||||
WorkGridName = currentWorkGrid.Name,
|
||||
LeaderUserCode = currentWorkGrid.LeaderUserCode
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (currentNightWorkGridSchedules.Any(x => x.Date == currentDateOnly.AddDays(-1)))
|
||||
{
|
||||
var currentWorkGrid = workGrids.First(x => x.Code == currentNightWorkGridSchedules.First(p => p.Date == currentDateOnly.AddDays(-1)).WorkGridCode);
|
||||
workGridInfo.WorkGrid = new WorkGridInfoDetail
|
||||
{
|
||||
WorkGridCode = currentWorkGrid.Code,
|
||||
WorkGridName = currentWorkGrid.Name,
|
||||
LeaderUserCode = currentWorkGrid.LeaderUserCode
|
||||
};
|
||||
|
||||
var start = currentDateOnly.AddDays(-1).ToDateTime(startTime);
|
||||
var end = currentDateOnly.ToDateTime(endTime);
|
||||
|
||||
if (request.RaiseDateTime >= start && request.RaiseDateTime <= end)
|
||||
{
|
||||
workGridInfo.PeriodType = WorkGridTimePeriodEnumType.Night;
|
||||
var currentWorkGrid = workGrids.First(x => x.Code == currentNightWorkGridSchedules.First(p => p.Date == currentDateOnly.AddDays(-1)).WorkGridCode);
|
||||
workGridInfo.WorkGrid = new WorkGridInfoDetail
|
||||
{
|
||||
WorkGridCode = currentWorkGrid.Code,
|
||||
WorkGridName = currentWorkGrid.Name,
|
||||
LeaderUserCode = currentWorkGrid.LeaderUserCode
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
needUpload = workGridInfo.PeriodType.HasValue;
|
||||
workGridInfo.IsError = workGridInfo.TimeSetting != null && workGridInfo.PeriodType.HasValue == false;
|
||||
|
||||
needUpload = workGridInfo.WorkGrid == null || workGridInfo.PeriodType.HasValue;
|
||||
workGridInfo.IsError = !needUpload;
|
||||
if (!needUpload)
|
||||
{
|
||||
try
|
||||
@@ -375,15 +371,18 @@ public class DeviceUploadLogService : IDeviceUploadLogService
|
||||
{
|
||||
var before60Days = DateTime.Today.AddDays(-60).AddSeconds(1);
|
||||
var data = await _dbContext.Queryable<DeviceUploadLogEntity>().Where(x => x.RaiseDateTime < before60Days).OrderBy(x => x.Id).ToPageListAsync(1, 500);
|
||||
await _dbContext.DeleteReallyAsync(data);
|
||||
|
||||
const string tableName = "deviceuploadlog_20250107";
|
||||
foreach (var item in data)
|
||||
if (data.Any())
|
||||
{
|
||||
item.Id = 0;
|
||||
}
|
||||
await _dbContext.DeleteReallyAsync(data);
|
||||
|
||||
await _dbContext.Client.Insertable(data).AS(tableName).ExecuteCommandAsync();
|
||||
const string tableName = "deviceuploadlog_20250107";
|
||||
foreach (var item in data)
|
||||
{
|
||||
item.Id = 0;
|
||||
}
|
||||
|
||||
await _dbContext.Client.Insertable(data).AS(tableName).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<DateTimePeriod> GetDeviceUploadRecordSettingAsync(string deviceNo)
|
||||
|
||||
Reference in New Issue
Block a user