diff --git a/Src/Dlhis.ScheduledTask/Jobs/ArchiveDeviceUploadLogJob.cs b/Src/Dlhis.ScheduledTask/Jobs/ArchiveDeviceUploadLogJob.cs index 271d3ca3..e5e2d0d9 100644 --- a/Src/Dlhis.ScheduledTask/Jobs/ArchiveDeviceUploadLogJob.cs +++ b/Src/Dlhis.ScheduledTask/Jobs/ArchiveDeviceUploadLogJob.cs @@ -1,51 +1,51 @@ -using Dlhis.Entity.Device.Entities; -using Dlhis.ScheduledTask.Attributes; - -namespace Dlhis.ScheduledTask.Jobs; - -/// -/// 归档设备通行记录 -/// -[RecurringJob(nameof(ArchiveDeviceUploadLogJob), "0 0/5 * * * ?", Name = "归档设备通行记录")] -public class ArchiveDeviceUploadLogJob : BaseJob -{ - public ArchiveDeviceUploadLogJob(IServiceProvider serviceProvider) : base(serviceProvider) - { - } - - protected override async Task RunAsync(IServiceProvider serviceProvider) - { - var before60Days = DateTime.Today.AddDays(-60).AddSeconds(1); - const int limit = 500; - const string tableName = "deviceuploadlog_20250107"; - - var data = await DbContext.Queryable().Where(x => x.RaiseDateTime < before60Days).OrderBy(x => x.Id).ToPageListAsync(1, limit); - - do - { - if (data.Any()) - { - await DbContext.Client.Ado.BeginTranAsync(); - try - { - await DbContext.DeleteReallyAsync(data); - - foreach (var item in data) - { - item.Id = 0; - } - - await DbContext.Client.Insertable(data).AS(tableName).ExecuteCommandAsync(); - await DbContext.Client.Ado.CommitTranAsync(); - } - catch (Exception) - { - await DbContext.Client.Ado.RollbackTranAsync(); - } - - data = await DbContext.Queryable().Where(x => x.RaiseDateTime < before60Days).OrderBy(x => x.Id).ToPageListAsync(1, limit); - } - - } while (data.Count == limit); - } -} \ No newline at end of file +// using Dlhis.Entity.Device.Entities; +// using Dlhis.ScheduledTask.Attributes; +// +// namespace Dlhis.ScheduledTask.Jobs; +// +// /// +// /// 归档设备通行记录 +// /// +// [RecurringJob(nameof(ArchiveDeviceUploadLogJob), "0 0/5 * * * ?", Name = "归档设备通行记录")] +// public class ArchiveDeviceUploadLogJob : BaseJob +// { +// public ArchiveDeviceUploadLogJob(IServiceProvider serviceProvider) : base(serviceProvider) +// { +// } +// +// protected override async Task RunAsync(IServiceProvider serviceProvider) +// { +// var before60Days = DateTime.Today.AddDays(-60).AddSeconds(1); +// const int limit = 500; +// const string tableName = "deviceuploadlog_20250107"; +// +// var data = await DbContext.Queryable().Where(x => x.RaiseDateTime < before60Days).OrderBy(x => x.Id).ToPageListAsync(1, limit); +// +// do +// { +// if (data.Any()) +// { +// await DbContext.Client.Ado.BeginTranAsync(); +// try +// { +// await DbContext.DeleteReallyAsync(data); +// +// foreach (var item in data) +// { +// item.Id = 0; +// } +// +// await DbContext.Client.Insertable(data).AS(tableName).ExecuteCommandAsync(); +// await DbContext.Client.Ado.CommitTranAsync(); +// } +// catch (Exception) +// { +// await DbContext.Client.Ado.RollbackTranAsync(); +// } +// +// data = await DbContext.Queryable().Where(x => x.RaiseDateTime < before60Days).OrderBy(x => x.Id).ToPageListAsync(1, limit); +// } +// +// } while (data.Count == limit); +// } +// } \ No newline at end of file