fix 调整为调度执行
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.AspNetCore.EventBus.Abstractions;
|
||||
using Kurisu.AspNetCore.Scope;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -218,5 +220,4 @@ public class DevicesController : ControllerBase
|
||||
{
|
||||
return await _deviceService.BulkUploadsAsync(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Dlhis.Basic.Device.Dtos;
|
||||
using Dlhis.Basic.Device.EventBusHandler;
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
@@ -7,7 +6,6 @@ using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Kurisu.AspNetCore.EventBus.Abstractions;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.Core.DataAccess.Entity;
|
||||
@@ -20,13 +18,11 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly ICurrentUser _currentUser;
|
||||
private readonly IEventBus _eventBus;
|
||||
|
||||
public DevicePermissionService(IDbContext dbContext, ICurrentUser currentUser, IEventBus eventBus)
|
||||
public DevicePermissionService(IDbContext dbContext, ICurrentUser currentUser)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_currentUser = currentUser;
|
||||
_eventBus = eventBus;
|
||||
}
|
||||
|
||||
public async Task AssignAsync(DevicePermissionSaveReuqest reuqest)
|
||||
@@ -158,8 +154,6 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
{
|
||||
await _dbContext.InsertAsync(waitTasks);
|
||||
}
|
||||
|
||||
await _eventBus.PublishAsync(new CancelDuplicationTaskMessage());
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using Kurisu.AspNetCore.EventBus.Extensions;
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Startup;
|
||||
@@ -23,6 +22,5 @@ public class Startup : DefaultStartup
|
||||
{
|
||||
base.ConfigureServices(services);
|
||||
services.AddRedis();
|
||||
services.AddEventBus();
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,25 @@
|
||||
using System.Linq.Expressions;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.AspNetCore.EventBus.Abstractions;
|
||||
using Kurisu.AspNetCore.EventBus.Abstractions.Handler;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Entity;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using SqlSugar;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Dlhis.Basic.Device.EventBusHandler;
|
||||
namespace Dlhis.ScheduledTask.CommonJobs;
|
||||
|
||||
public class CancelDuplicationTaskHandler : IAsyncChannelHandler<CancelDuplicationTaskMessage>
|
||||
public class CancelDuplicationTaskJob
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ILogger<CancelDuplicationTaskHandler> _logger;
|
||||
private readonly ILogger<CancelDuplicationTaskJob> _logger;
|
||||
|
||||
public CancelDuplicationTaskHandler(IServiceProvider serviceProvider, ILogger<CancelDuplicationTaskHandler> logger)
|
||||
public CancelDuplicationTaskJob(IServiceProvider serviceProvider, ILogger<CancelDuplicationTaskJob> logger)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task InvokeAsync(CancelDuplicationTaskMessage message)
|
||||
public async Task RunAsync()
|
||||
{
|
||||
_logger.LogInformation("抵消任务开始处理");
|
||||
|
||||
@@ -156,15 +154,12 @@ public class CancelDuplicationTaskHandler : IAsyncChannelHandler<CancelDuplicati
|
||||
|
||||
_logger.LogInformation("抵消任务处理完成");
|
||||
}
|
||||
}
|
||||
|
||||
public class CancelDuplicationTaskMessage : IAsyncChannelMessage
|
||||
{
|
||||
class IdVersion
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public int Version { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class IdVersion
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public int Version { get; set; }
|
||||
}
|
||||
@@ -53,10 +53,16 @@ public class JobPack : BaseAppPack
|
||||
TimeZone = TimeZoneInfo.Local
|
||||
});
|
||||
|
||||
//处理重复下发任务
|
||||
RecurringJob.AddOrUpdate<CancelDuplicationTaskJob>("CancelDuplicationTask", s => s.RunAsync(), "0/15 * * * * ?", new RecurringJobOptions
|
||||
{
|
||||
TimeZone = TimeZoneInfo.Local
|
||||
});
|
||||
|
||||
|
||||
RecurringJob.AddOrUpdate<TempCreateUserJob>("TempCreateUser", s => s.RunAsync(), "0 0 5 * * ?", new RecurringJobOptions
|
||||
{
|
||||
TimeZone = TimeZoneInfo.Local
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user