Merge branch 'test' into S06
This commit is contained in:
commit
c11615775b
@ -22,6 +22,13 @@ namespace SJZY.Track.Application.Services.TimerTaskss;
|
||||
[ApiExplorerSettings(GroupName = "定时任务")]
|
||||
public class TrackPullTask : ApplicationService, ISingletonDependency
|
||||
{
|
||||
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||
|
||||
public TrackPullTask(IServiceScopeFactory serviceScopeFactory)
|
||||
{
|
||||
_serviceScopeFactory = serviceScopeFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 定时任务刷新轨迹
|
||||
/// </summary>
|
||||
@ -30,7 +37,7 @@ public class TrackPullTask : ApplicationService, ISingletonDependency
|
||||
[HttpPost("/TimerTask/Refresh")]
|
||||
public async Task<bool> RefreshForTaskAsync()
|
||||
{
|
||||
using var serviceScope = LazyServiceProvider.CreateScope();
|
||||
using var serviceScope = _serviceScopeFactory.CreateScope();
|
||||
|
||||
var provideQueries = serviceScope.ServiceProvider.GetRequiredService<IProvideQueries>();
|
||||
var configs = await provideQueries.GetAllPullConfigsAsync();
|
||||
|
||||
@ -13,6 +13,13 @@ namespace SJZY.Track.Application.Services.TimerTaskss;
|
||||
[ApiExplorerSettings(GroupName = "定时任务")]
|
||||
public class TrackPushTask : ApplicationService
|
||||
{
|
||||
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||
|
||||
public TrackPushTask(IServiceScopeFactory serviceScopeFactory)
|
||||
{
|
||||
_serviceScopeFactory = serviceScopeFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 定时任务推送预警(》12小时没有推送的)
|
||||
/// </summary>
|
||||
@ -21,7 +28,7 @@ public class TrackPushTask : ApplicationService
|
||||
[HttpPost("/TimerTask/PushWarn")]
|
||||
public async Task<string> PushWarnForTaskAsync()
|
||||
{
|
||||
using var serviceScope = LazyServiceProvider.CreateScope();
|
||||
using var serviceScope = _serviceScopeFactory.CreateScope();
|
||||
|
||||
var configs = serviceScope.ServiceProvider.GetRequiredService<IOptionsSnapshot<Track2InterfaceRelayOptions>>()
|
||||
.Value;
|
||||
|
||||
@ -5,6 +5,7 @@ using SJZY.Expand.ABP.Core.Logger;
|
||||
using SJZY.Track.Application.Contract.Services;
|
||||
using SJZY.Track.Application.Track2InterfaceRelay;
|
||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
namespace SJZY.Track.Application.Services.TimerTaskss;
|
||||
|
||||
@ -12,15 +13,18 @@ namespace SJZY.Track.Application.Services.TimerTaskss;
|
||||
/// 轨迹运输时效预警定时任务
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "定时任务")]
|
||||
public class TrackWarningTask : ApplicationService
|
||||
public class TrackWarningTask : ApplicationService, ISingletonDependency
|
||||
{
|
||||
private readonly IOptionsSnapshot<Track2InterfaceRelayOptions> _options;
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||
|
||||
public TrackWarningTask(IOrderRepository orderRepository, IOptionsSnapshot<Track2InterfaceRelayOptions> options)
|
||||
public TrackWarningTask(IOrderRepository orderRepository, IOptionsSnapshot<Track2InterfaceRelayOptions> options,
|
||||
IServiceScopeFactory serviceScopeFactory)
|
||||
{
|
||||
_orderRepository = orderRepository;
|
||||
_options = options;
|
||||
_serviceScopeFactory = serviceScopeFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -63,7 +67,7 @@ public class TrackWarningTask : ApplicationService
|
||||
{
|
||||
try
|
||||
{
|
||||
using var serviceScope = LazyServiceProvider.CreateScope();
|
||||
using var serviceScope = _serviceScopeFactory.CreateScope();
|
||||
|
||||
var forewarningNotifyService =
|
||||
serviceScope.ServiceProvider.GetRequiredService<IForewarningNotifyService>();
|
||||
|
||||
@ -8,6 +8,7 @@ using SJZY.Track.Application.Localization;
|
||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||
using SJZY.Track.Domain.Dtos.Common;
|
||||
using SJZY.Track.Domain.Dtos.TrackPush;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
namespace SJZY.Track.Application.Services.TrackPush;
|
||||
|
||||
@ -16,7 +17,7 @@ namespace SJZY.Track.Application.Services.TrackPush;
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "轨迹推送")]
|
||||
[Route("/Track/PushConfig")]
|
||||
public class TrackPushService : ApplicationService
|
||||
public class TrackPushService : ApplicationService, ISingletonDependency
|
||||
{
|
||||
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
||||
private readonly ITrackPushCacheService _trackPushCacheService;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user