fix 处理同步时间,调整到5点
This commit is contained in:
@@ -104,24 +104,12 @@ public class BalanceRecordUploadBackgroundService : BackgroundService
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (now is { Hour: 4, Minute: 1 }
|
if (now is { Hour: 5, Minute: 1 }
|
||||||
&& !_healthCheckService.GetIsOffline()
|
&& !_healthCheckService.GetIsOffline()
|
||||||
&& !await db.Queryable<LocalBalanceRecordEntity>().Where(x => !x.IsSync).AnyAsync())
|
&& !await db.Queryable<LocalBalanceRecordEntity>().Where(x => !x.IsSync).AnyAsync())
|
||||||
{
|
{
|
||||||
await ds.InitAsync(factories);
|
await ds.InitAsync(factories);
|
||||||
}
|
}
|
||||||
else if (now is { Hour: 15, Minute: 1 }
|
|
||||||
&& !_healthCheckService.GetIsOffline()
|
|
||||||
&& !await db.Queryable<LocalBalanceRecordEntity>().Where(x => !x.IsSync).AnyAsync())
|
|
||||||
{
|
|
||||||
await ds.InitAsync(factories);
|
|
||||||
}
|
|
||||||
else if (now is { Hour: 20, Minute: 1 }
|
|
||||||
&& !_healthCheckService.GetIsOffline()
|
|
||||||
&& !await db.Queryable<LocalBalanceRecordEntity>().Where(x => !x.IsSync).AnyAsync())
|
|
||||||
{
|
|
||||||
await ds.InitAsync(factories);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,20 +39,20 @@ public class Startup : DefaultStartup
|
|||||||
{
|
{
|
||||||
base.Configure(app, env);
|
base.Configure(app, env);
|
||||||
|
|
||||||
var healthCheckService = app.ApplicationServices.GetService<IHealthCheckService>();
|
// var healthCheckService = app.ApplicationServices.GetService<IHealthCheckService>();
|
||||||
if (healthCheckService.DoHealthCheckAsync().GetAwaiter().GetResult())
|
// if (healthCheckService.DoHealthCheckAsync().GetAwaiter().GetResult())
|
||||||
{
|
// {
|
||||||
using var scope = app.ApplicationServices.CreateScope();
|
// using var scope = app.ApplicationServices.CreateScope();
|
||||||
var db = scope.ServiceProvider.GetService<IDbContext>();
|
// var db = scope.ServiceProvider.GetService<IDbContext>();
|
||||||
|
//
|
||||||
db.Client.DbMaintenance.CreateDatabase();
|
// db.Client.DbMaintenance.CreateDatabase();
|
||||||
db.Client.CodeFirst.InitTables<LocalBalanceRecordEntity, LocalGainfoEntity, LocalGainfoMealEntity, LocalBusinessPlaceEntity>();
|
// db.Client.CodeFirst.InitTables<LocalBalanceRecordEntity, LocalGainfoEntity, LocalGainfoMealEntity, LocalBusinessPlaceEntity>();
|
||||||
db.Client.CodeFirst.InitTables<LocalBusinessShiftEntity, LocalDeviceRegistryEntity, LocalDeviceEntity, LocalBusinessPlaceShiftRelationshipEntity, LocalBusinessShiftMealRelationshipEntity>();
|
// db.Client.CodeFirst.InitTables<LocalBusinessShiftEntity, LocalDeviceRegistryEntity, LocalDeviceEntity, LocalBusinessPlaceShiftRelationshipEntity, LocalBusinessShiftMealRelationshipEntity>();
|
||||||
db.Client.CodeFirst.InitTables<LocalCanteenSettingEntity, LocalDepartmentEntity>();
|
// db.Client.CodeFirst.InitTables<LocalCanteenSettingEntity, LocalDepartmentEntity>();
|
||||||
|
//
|
||||||
var factories = scope.ServiceProvider.GetService<ISettingService>().GetFactories();
|
// var factories = scope.ServiceProvider.GetService<ISettingService>().GetFactories();
|
||||||
var ds = scope.ServiceProvider.GetService<IDataDownloadService>();
|
// var ds = scope.ServiceProvider.GetService<IDataDownloadService>();
|
||||||
ds.InitAsync(factories).Wait();
|
// ds.InitAsync(factories).Wait();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user