定时任务
This commit is contained in:
parent
308903dfa6
commit
cf2b758fd5
@ -1,4 +1,5 @@
|
|||||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
|
using SJZY.Track.Application.Contract.Dtos.TrackOrder;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
|
|
||||||
@ -20,4 +21,11 @@ public interface ITrackPushService : IRemoteService
|
|||||||
/// <param name="subSystemId">子系统id</param>
|
/// <param name="subSystemId">子系统id</param>
|
||||||
/// <param name="customerId">客户id</param>
|
/// <param name="customerId">客户id</param>
|
||||||
public Task<List<TrackPushContentDto>> GetTrackPushContentListAsync(int subSystemId, int customerId);
|
public Task<List<TrackPushContentDto>> GetTrackPushContentListAsync(int subSystemId, int customerId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取轨迹推送记录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Task<List<TrackPushRecordOutput>> GetTrackPushRecordsAsync(OrderNoInfo input);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,39 +0,0 @@
|
|||||||
using System.Diagnostics;
|
|
||||||
using Microsoft.Extensions.Hosting;
|
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
using SJZY.Expand.ABP.Core.Logger;
|
|
||||||
using SJZY.Track.Application.Options;
|
|
||||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
|
||||||
|
|
||||||
namespace SJZY.Track.Application.BackgroundServices;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 订单拉取状态扫描
|
|
||||||
/// </summary>
|
|
||||||
public class OrderPullStatusScanner : BackgroundService
|
|
||||||
{
|
|
||||||
private readonly IOptionsMonitor<TrackAppOptions> _options;
|
|
||||||
private readonly IOrderRepository _orderRepository;
|
|
||||||
|
|
||||||
public OrderPullStatusScanner(IOrderRepository orderRepository, IOptionsMonitor<TrackAppOptions> options)
|
|
||||||
{
|
|
||||||
_orderRepository = orderRepository;
|
|
||||||
_options = options;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
await Task.Delay(TimeSpan.FromSeconds(_options.CurrentValue.OrderPullStatusScanInterval), stoppingToken);
|
|
||||||
|
|
||||||
var stopwatch = Stopwatch.StartNew();
|
|
||||||
var count1 = await _orderRepository.UpdatePullStatusBySilenceAsync();
|
|
||||||
// real del
|
|
||||||
var count2 = await _orderRepository.ClearPullStatusAsync();
|
|
||||||
stopwatch.Stop();
|
|
||||||
LogHelper.Info(
|
|
||||||
$"{nameof(OrderPullStatusScanner)}本次扫描更新了{count1}条,删除了{count2}条订单拉取状态,耗时{stopwatch.ElapsedMilliseconds}ms");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,16 +1,13 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using SJZY.Expand.ABP.Core;
|
|
||||||
using SJZY.Expand.ABP.Core.Logger;
|
using SJZY.Expand.ABP.Core.Logger;
|
||||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||||
using SJZY.InterfaceRelay.Application.Contracts;
|
using SJZY.InterfaceRelay.Application.Contracts;
|
||||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackPull;
|
using SJZY.Track.Application.Contract.Dtos.TrackPull;
|
||||||
using SJZY.Track.Application.Contract.Services;
|
|
||||||
using SJZY.Track.Application.Contract.Services.ProvideServices;
|
using SJZY.Track.Application.Contract.Services.ProvideServices;
|
||||||
using SJZY.Track.Application.Helpers;
|
using SJZY.Track.Application.Helpers;
|
||||||
using SJZY.Track.Application.Rabbit;
|
using SJZY.Track.Application.Rabbit;
|
||||||
using SJZY.Track.Application.Track2InterfaceRelay;
|
using SJZY.Track.Application.Track2InterfaceRelay;
|
||||||
using SJZY.Track.Domain.Dtos.TrackPull;
|
|
||||||
using SJZY.Track.Domain.Queries;
|
using SJZY.Track.Domain.Queries;
|
||||||
using Volo.Abp.Http.Client.DynamicProxying;
|
using Volo.Abp.Http.Client.DynamicProxying;
|
||||||
|
|
||||||
@ -25,15 +22,13 @@ public class TrackPullService : ApplicationService, ITrackPullService
|
|||||||
{
|
{
|
||||||
private readonly IHttpClientProxy<IInterfaceForwardServiceV2> _httpClientProxy;
|
private readonly IHttpClientProxy<IInterfaceForwardServiceV2> _httpClientProxy;
|
||||||
private readonly IProvideQueries _provideQueries;
|
private readonly IProvideQueries _provideQueries;
|
||||||
private readonly ITrackPullCacheService _trackPullCacheService;
|
|
||||||
|
|
||||||
public TrackPullService(IProvideQueries provideQueries,
|
public TrackPullService(IProvideQueries provideQueries,
|
||||||
IHttpClientProxy<IInterfaceForwardServiceV2> httpClientProxy,
|
IHttpClientProxy<IInterfaceForwardServiceV2> httpClientProxy)
|
||||||
ITrackPullCacheService trackPullCacheService)
|
|
||||||
{
|
{
|
||||||
_provideQueries = provideQueries;
|
_provideQueries = provideQueries;
|
||||||
_httpClientProxy = httpClientProxy;
|
_httpClientProxy = httpClientProxy;
|
||||||
_trackPullCacheService = trackPullCacheService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -93,23 +88,6 @@ public class TrackPullService : ApplicationService, ITrackPullService
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 定时任务刷新轨迹
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[AllowAnonymous]
|
|
||||||
[HttpPost("Track/RefreshForTask")]
|
|
||||||
public async Task<bool> RefreshForTaskAsync()
|
|
||||||
{
|
|
||||||
var configs = await _provideQueries.GetAllPullConfigsAsync();
|
|
||||||
|
|
||||||
foreach (var config in configs)
|
|
||||||
{
|
|
||||||
await RefreshForConfigAsync(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹刷新测试
|
/// 轨迹刷新测试
|
||||||
@ -128,60 +106,4 @@ public class TrackPullService : ApplicationService, ITrackPullService
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RefreshForConfigAsync(TrackPullConfigVo config)
|
|
||||||
{
|
|
||||||
var redisKey = _trackPullCacheService.TrackPullKey(config.SubSystemId, config.ServiceProviderCode);
|
|
||||||
if (await RedisHelper.Client.ExistsAsync(redisKey))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = Task.Run(async () =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (Track2InterfaceRelaySubSystemContext.Use(
|
|
||||||
new Track2InterfaceRelaySubSystemContext(config.SubSystemCode)))
|
|
||||||
{
|
|
||||||
var page = 1;
|
|
||||||
var orders =
|
|
||||||
await _provideQueries.FindOrderWithServiceProviderAsync(config.ServiceProviderCode, page);
|
|
||||||
while (orders.Any())
|
|
||||||
{
|
|
||||||
var serviceProviderCode = orders.FirstOrDefault()?.ServiceProviderCode;
|
|
||||||
|
|
||||||
foreach (var group in orders.GroupBy(x => x.OrderType))
|
|
||||||
{
|
|
||||||
var data = new List<object>(group.Select(x => new TrackPullPayload
|
|
||||||
{
|
|
||||||
OrderNo = x.OrderNo
|
|
||||||
}));
|
|
||||||
var attach = Base64Helper.SerializeObject(new TrackRefreshAttach(config.ServiceProviderCode,
|
|
||||||
config.SubSystemId, group.Key));
|
|
||||||
var res = await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
|
||||||
InterfaceRelayConst.GetTrackInterfaceCode, serviceProviderCode, data,
|
|
||||||
GlobalConst.TrackRefreshSubscribe, attach);
|
|
||||||
|
|
||||||
if (res.Code != InterfaceRelayConst.SuccessCode)
|
|
||||||
{
|
|
||||||
LogHelper.Error($"刷新轨迹失败:{res.ToJson()}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
orders = await _provideQueries.FindOrderWithServiceProviderAsync(config.ServiceProviderCode,
|
|
||||||
++page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LogHelper.Error(e.ToString());
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
await RedisHelper.Client.SetExAsync(redisKey, config.PullInterval * 60, 1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
using DotNetCore.CAP;
|
using DotNetCore.CAP;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using SJZY.Expand.ABP.Core;
|
|
||||||
using SJZY.Expand.ABP.Core.Logger;
|
|
||||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
|
using SJZY.Track.Application.Contract.Dtos.TrackOrder;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
using SJZY.Track.Application.Contract.Events;
|
using SJZY.Track.Application.Contract.Events;
|
||||||
using SJZY.Track.Application.Contract.Services.ProvideServices;
|
using SJZY.Track.Application.Contract.Services.ProvideServices;
|
||||||
@ -97,7 +95,7 @@ public class TrackPushService : ApplicationService, ITrackPushService
|
|||||||
/// <param name="subSystemId"></param>
|
/// <param name="subSystemId"></param>
|
||||||
/// <param name="customerId"></param>
|
/// <param name="customerId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("Track/GetTrackPushContentList")]
|
[HttpGet("Track/GetTrackPushContentList")]
|
||||||
public async Task<List<TrackPushContentDto>> GetTrackPushContentListAsync(int subSystemId, int customerId)
|
public async Task<List<TrackPushContentDto>> GetTrackPushContentListAsync(int subSystemId, int customerId)
|
||||||
{
|
{
|
||||||
var list = await _trackPushConfigRepository.GetTrackPushContentListAsync(subSystemId, customerId);
|
var list = await _trackPushConfigRepository.GetTrackPushContentListAsync(subSystemId, customerId);
|
||||||
@ -107,61 +105,13 @@ public class TrackPushService : ApplicationService, ITrackPushService
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 定时任务推送预警(》12小时没有推送的)
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[AllowAnonymous]
|
|
||||||
[HttpPost("Track/PushWarnForTask")]
|
|
||||||
public async Task<string> PushWarnForTaskAsync()
|
|
||||||
{
|
|
||||||
var hasProcess = await RedisHelper.Client.ExistsAsync(GlobalConst.TrackPushTrackWaringLockKey);
|
|
||||||
if (hasProcess)
|
|
||||||
{
|
|
||||||
return "冷却中";
|
|
||||||
}
|
|
||||||
|
|
||||||
await RedisHelper.Client.SetAsync(GlobalConst.TrackPushTrackWaringLockKey, 1, TimeSpan.FromHours(3));
|
|
||||||
|
|
||||||
_ = Task.Run(async () =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int total = 0, pageSize = 1000, waitTime = 1000;
|
|
||||||
int rows;
|
|
||||||
var pageindex = 0;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
rows = await _orderRepository.PushWarnOrdersAsync(pageSize, pageindex);
|
|
||||||
pageindex++;
|
|
||||||
total += rows;
|
|
||||||
await Task.Delay(waitTime);
|
|
||||||
} while (rows == pageSize);
|
|
||||||
|
|
||||||
LogHelper.Info($"本次预警扫描了:{total}个订单");
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LogHelper.Error(e.ToString());
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
await RedisHelper.Client.DelAsync(GlobalConst.TrackPushTrackWaringLockKey);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return "预警中";
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取轨迹推送记录
|
/// 获取轨迹推送记录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
[HttpGet("Track/GetTrackPushRecords")]
|
[HttpGet("Track/GetTrackPushRecords")]
|
||||||
public async Task<List<TrackPushRecordIndex>> GetTrackPushRecordsAsync(OrderNoInfo input)
|
public async Task<List<TrackPushRecordOutput>> GetTrackPushRecordsAsync([FromQuery] OrderNoInfo input)
|
||||||
{
|
{
|
||||||
var orderId = await _orderRepository.GetFirstAsync(x =>
|
var orderId = await _orderRepository.GetFirstAsync(x =>
|
||||||
x.SubSystemId == input.SubSystemId && x.OrderType == input.OrderType && input.OrderNo == x.OrderNo,
|
x.SubSystemId == input.SubSystemId && x.OrderType == input.OrderType && input.OrderNo == x.OrderNo,
|
||||||
@ -171,6 +121,8 @@ public class TrackPushService : ApplicationService, ITrackPushService
|
|||||||
throw new BusinessException(message: "订单不存在");
|
throw new BusinessException(message: "订单不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
return await _trackPushRecordEsRepository.GetTrackPushRecordsAsync(orderId);
|
var records = await _trackPushRecordEsRepository.GetTrackPushRecordsAsync(orderId);
|
||||||
|
|
||||||
|
return ObjectMapper.Map<List<TrackPushRecordIndex>, List<TrackPushRecordOutput>>(records);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,66 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using SJZY.Expand.ABP.Core;
|
||||||
|
using SJZY.Expand.ABP.Core.Logger;
|
||||||
|
using SJZY.Track.Application.Options;
|
||||||
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Application.Services.TimerTaskss;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单拉取状态扫描定时任务
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(GroupName = "定时任务")]
|
||||||
|
public class OrderPullStatusScanTask : ApplicationService
|
||||||
|
{
|
||||||
|
private readonly IOptionsSnapshot<TrackAppOptions> _options;
|
||||||
|
private readonly IOrderRepository _orderRepository;
|
||||||
|
|
||||||
|
public OrderPullStatusScanTask(IOrderRepository orderRepository, IOptionsSnapshot<TrackAppOptions> options)
|
||||||
|
{
|
||||||
|
_orderRepository = orderRepository;
|
||||||
|
_options = options;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 定时任务对订单拉取状态进行扫描,计算更新拉取状态
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpPost("/TimerTask/OrderPullStatusScan")]
|
||||||
|
public async Task<string> OrderPullStatusScanAsync()
|
||||||
|
{
|
||||||
|
var redisKey = GlobalConst.OrderPullStatusScanCheckKey;
|
||||||
|
if (await RedisHelper.Client.ExistsAsync(redisKey))
|
||||||
|
{
|
||||||
|
return "冷却中";
|
||||||
|
}
|
||||||
|
|
||||||
|
await RedisHelper.Client.SetAsync(redisKey, 1,
|
||||||
|
TimeSpan.FromSeconds(_options.Value.OrderPullStatusScanInterval));
|
||||||
|
|
||||||
|
var res = string.Empty;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var stopwatch = new Stopwatch();
|
||||||
|
|
||||||
|
stopwatch.Restart();
|
||||||
|
var count1 = await _orderRepository.UpdatePullStatusBySilenceAsync();
|
||||||
|
// real del
|
||||||
|
var count2 = await _orderRepository.ClearPullStatusAsync();
|
||||||
|
stopwatch.Stop();
|
||||||
|
|
||||||
|
res =
|
||||||
|
$"{nameof(OrderPullStatusScanTask)}本次扫描更新了{count1}条,删除了{count2}条订单拉取状态,耗时{stopwatch.ElapsedMilliseconds}ms";
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
await RedisHelper.Client.DelAsync(redisKey);
|
||||||
|
LogHelper.Error(e.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,9 @@
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using SJZY.Expand.ABP.Core;
|
||||||
|
using SJZY.Expand.ABP.Core.Logger;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackPull;
|
using SJZY.Track.Application.Contract.Dtos.TrackPull;
|
||||||
using SJZY.Track.Application.Helpers;
|
using SJZY.Track.Application.Helpers;
|
||||||
using SJZY.Track.Application.Options;
|
using SJZY.Track.Application.Options;
|
||||||
@ -9,32 +11,57 @@ using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
|||||||
using SJZY.Track.Domain.Enums;
|
using SJZY.Track.Domain.Enums;
|
||||||
using SJZY.Track.Domain.Queries;
|
using SJZY.Track.Domain.Queries;
|
||||||
|
|
||||||
namespace SJZY.Track.Application.BackgroundServices;
|
namespace SJZY.Track.Application.Services.TimerTaskss;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹(发生地时区)兜底扫描
|
/// 轨迹兜底扫描定时任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TrackButtomUpScanner : BackgroundService
|
[ApiExplorerSettings(GroupName = "定时任务")]
|
||||||
|
public class TrackButtomUpScanTask : ApplicationService
|
||||||
{
|
{
|
||||||
private readonly IOptionsMonitor<TrackAppOptions> _options;
|
private readonly IOptionsSnapshot<TrackAppOptions> _options;
|
||||||
private readonly IOrderRepository _orderRepository;
|
private readonly IOrderRepository _orderRepository;
|
||||||
private readonly ITimezoneQueries _timezoneQueries;
|
private readonly ITimezoneQueries _timezoneQueries;
|
||||||
|
|
||||||
public TrackButtomUpScanner(ITimezoneQueries timezoneQueries, IOrderRepository orderRepository,
|
public TrackButtomUpScanTask(IOptionsSnapshot<TrackAppOptions> options, IOrderRepository orderRepository,
|
||||||
IOptionsMonitor<TrackAppOptions> options)
|
ITimezoneQueries timezoneQueries)
|
||||||
{
|
{
|
||||||
_timezoneQueries = timezoneQueries;
|
|
||||||
_orderRepository = orderRepository;
|
|
||||||
_options = options;
|
_options = options;
|
||||||
|
_orderRepository = orderRepository;
|
||||||
|
_timezoneQueries = timezoneQueries;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task ExecuteAsync(CancellationToken stoppingToken)
|
/// <summary>
|
||||||
|
/// 定时任务对轨迹进行兜底扫描,尝试弥补轨迹中的缺失信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpPost("/TimerTask/TrackButtomUpScan")]
|
||||||
|
public async Task<string> TrackButtomUpScanAsync()
|
||||||
{
|
{
|
||||||
// 查看哪些要兜底的轨迹(服务商拉取的,且时区发生地是空的),根据子系统、服务商分组尝试兜底
|
var redisKey = GlobalConst.OrderPullStatusScanCheckKey;
|
||||||
// 维护轨迹明细、订单主表
|
if (await RedisHelper.Client.ExistsAsync(redisKey))
|
||||||
return Task.CompletedTask;
|
{
|
||||||
|
return "冷却中";
|
||||||
|
}
|
||||||
|
|
||||||
|
await RedisHelper.Client.SetAsync(redisKey, 1,
|
||||||
|
TimeSpan.FromSeconds(_options.Value.OrderPullStatusScanInterval));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// do st
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
await RedisHelper.Client.DelAsync(redisKey);
|
||||||
|
LogHelper.Error(e.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取轨迹时区
|
/// 获取轨迹时区
|
||||||
/// </summary>
|
/// </summary>
|
||||||
106
src/SJZY.Track.Application/Services/TimerTaskss/TrackPullTask.cs
Normal file
106
src/SJZY.Track.Application/Services/TimerTaskss/TrackPullTask.cs
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using SJZY.Expand.ABP.Core;
|
||||||
|
using SJZY.Expand.ABP.Core.Logger;
|
||||||
|
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||||
|
using SJZY.InterfaceRelay.Application.Contracts;
|
||||||
|
using SJZY.Track.Application.Contract.Dtos.TrackPull;
|
||||||
|
using SJZY.Track.Application.Contract.Services;
|
||||||
|
using SJZY.Track.Application.Helpers;
|
||||||
|
using SJZY.Track.Application.Track2InterfaceRelay;
|
||||||
|
using SJZY.Track.Domain.Dtos.TrackPull;
|
||||||
|
using SJZY.Track.Domain.Queries;
|
||||||
|
using Volo.Abp.Http.Client.DynamicProxying;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Application.Services.TimerTaskss;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹拉取定时任务
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(GroupName = "定时任务")]
|
||||||
|
public class TrackPullTask : ApplicationService
|
||||||
|
{
|
||||||
|
private readonly IHttpClientProxy<IInterfaceForwardServiceV2> _httpClientProxy;
|
||||||
|
private readonly IProvideQueries _provideQueries;
|
||||||
|
private readonly ITrackPullCacheService _trackPullCacheService;
|
||||||
|
|
||||||
|
public TrackPullTask(IProvideQueries provideQueries, ITrackPullCacheService trackPullCacheService,
|
||||||
|
IHttpClientProxy<IInterfaceForwardServiceV2> httpClientProxy)
|
||||||
|
{
|
||||||
|
_provideQueries = provideQueries;
|
||||||
|
_trackPullCacheService = trackPullCacheService;
|
||||||
|
_httpClientProxy = httpClientProxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 定时任务刷新轨迹
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpPost("/TimerTask/Refresh")]
|
||||||
|
public async Task<bool> RefreshForTaskAsync()
|
||||||
|
{
|
||||||
|
var configs = await _provideQueries.GetAllPullConfigsAsync();
|
||||||
|
|
||||||
|
foreach (var config in configs)
|
||||||
|
{
|
||||||
|
await RefreshForConfigAsync(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task RefreshForConfigAsync(TrackPullConfigVo config)
|
||||||
|
{
|
||||||
|
var redisKey = _trackPullCacheService.TrackPullKey(config.SubSystemId, config.ServiceProviderCode);
|
||||||
|
if (await RedisHelper.Client.ExistsAsync(redisKey))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await RedisHelper.Client.SetExAsync(redisKey, config.PullInterval * 60, 1);
|
||||||
|
|
||||||
|
_ = Task.Run(async () =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (Track2InterfaceRelaySubSystemContext.Use(
|
||||||
|
new Track2InterfaceRelaySubSystemContext(config.SubSystemCode)))
|
||||||
|
{
|
||||||
|
var page = 1;
|
||||||
|
var orders =
|
||||||
|
await _provideQueries.FindOrderWithServiceProviderAsync(config.ServiceProviderCode, page);
|
||||||
|
while (orders.Any())
|
||||||
|
{
|
||||||
|
var serviceProviderCode = orders.FirstOrDefault()?.ServiceProviderCode;
|
||||||
|
|
||||||
|
foreach (var group in orders.GroupBy(x => x.OrderType))
|
||||||
|
{
|
||||||
|
var data = new List<object>(group.Select(x => new TrackPullPayload
|
||||||
|
{
|
||||||
|
OrderNo = x.OrderNo
|
||||||
|
}));
|
||||||
|
var attach = Base64Helper.SerializeObject(new TrackRefreshAttach(config.ServiceProviderCode,
|
||||||
|
config.SubSystemId, group.Key));
|
||||||
|
var res = await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
||||||
|
InterfaceRelayConst.GetTrackInterfaceCode, serviceProviderCode, data,
|
||||||
|
GlobalConst.TrackRefreshSubscribe, attach);
|
||||||
|
|
||||||
|
if (res.Code != InterfaceRelayConst.SuccessCode)
|
||||||
|
{
|
||||||
|
LogHelper.Error($"刷新轨迹失败:{res.ToJson()}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
orders = await _provideQueries.FindOrderWithServiceProviderAsync(config.ServiceProviderCode,
|
||||||
|
++page);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
await RedisHelper.Client.DelAsync(redisKey);
|
||||||
|
LogHelper.Error(e.ToString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using SJZY.Expand.ABP.Core;
|
||||||
|
using SJZY.Expand.ABP.Core.Logger;
|
||||||
|
using SJZY.Track.Application.Track2InterfaceRelay;
|
||||||
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Application.Services.TimerTaskss;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹推送定时任务
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(GroupName = "定时任务")]
|
||||||
|
public class TrackPushTask : ApplicationService
|
||||||
|
{
|
||||||
|
private readonly IOptionsSnapshot<Track2InterfaceRelayOptions> _options;
|
||||||
|
private readonly IOrderRepository _orderRepository;
|
||||||
|
|
||||||
|
public TrackPushTask(IOrderRepository orderRepository, IOptionsSnapshot<Track2InterfaceRelayOptions> options)
|
||||||
|
{
|
||||||
|
_orderRepository = orderRepository;
|
||||||
|
_options = options;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 定时任务推送预警(》12小时没有推送的)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpPost("/TimerTask/PushWarn")]
|
||||||
|
public async Task<string> PushWarnForTaskAsync()
|
||||||
|
{
|
||||||
|
var configs = _options.Value;
|
||||||
|
if (configs == null || configs.Keys.Count == 0)
|
||||||
|
{
|
||||||
|
throw new BusinessException("未配置子系统");
|
||||||
|
}
|
||||||
|
|
||||||
|
var subSystemIds = await _orderRepository.GetSubSystemListByCodesAsync(configs.Keys.ToList());
|
||||||
|
foreach (var item in subSystemIds)
|
||||||
|
{
|
||||||
|
var subSystemId = item.id;
|
||||||
|
var redisKey = $"{GlobalConst.TrackPushWaringKeyPrefix}:{subSystemId}";
|
||||||
|
if (await RedisHelper.Client.ExistsAsync(redisKey))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
await RedisHelper.Client.SetAsync(redisKey, 1, TimeSpan.FromHours(1));
|
||||||
|
|
||||||
|
_ = Task.Run(async () =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int total = 0, pageSize = 1000, waitTime = 1000;
|
||||||
|
int rows;
|
||||||
|
var pageindex = 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
rows = await _orderRepository.PushWarnOrdersAsync(subSystemId, pageSize, pageindex);
|
||||||
|
pageindex++;
|
||||||
|
total += rows;
|
||||||
|
await Task.Delay(waitTime);
|
||||||
|
} while (rows == pageSize);
|
||||||
|
|
||||||
|
LogHelper.Info($"本次预警扫描了:{total}个订单");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
await RedisHelper.Client.DelAsync(redisKey);
|
||||||
|
LogHelper.Error(e.ToString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return "预警中";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using SJZY.Expand.ABP.Core;
|
||||||
|
using SJZY.Expand.ABP.Core.Logger;
|
||||||
|
using SJZY.Track.Application.Contract.Services;
|
||||||
|
using SJZY.Track.Application.Track2InterfaceRelay;
|
||||||
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Application.Services.TimerTaskss;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹运输时效预警定时任务
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(GroupName = "定时任务")]
|
||||||
|
public class TrackWarningTask : ApplicationService
|
||||||
|
{
|
||||||
|
private readonly IForewarningNotifyService _forewarningNotifyService;
|
||||||
|
private readonly IOptionsSnapshot<Track2InterfaceRelayOptions> _options;
|
||||||
|
private readonly IOrderRepository _orderRepository;
|
||||||
|
|
||||||
|
public TrackWarningTask(IForewarningNotifyService forewarningNotifyService, IOrderRepository orderRepository,
|
||||||
|
IOptionsSnapshot<Track2InterfaceRelayOptions> options)
|
||||||
|
{
|
||||||
|
_forewarningNotifyService = forewarningNotifyService;
|
||||||
|
_orderRepository = orderRepository;
|
||||||
|
_options = options;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹运输时效预警通知
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpPost("/TimerTask/SendWarning")]
|
||||||
|
public async Task<bool> SendWarningForTaskAsync()
|
||||||
|
{
|
||||||
|
var configs = _options.Value;
|
||||||
|
if (configs == null || configs.Keys.Count == 0)
|
||||||
|
{
|
||||||
|
throw new BusinessException("未配置子系统");
|
||||||
|
}
|
||||||
|
|
||||||
|
var subSystemIds = await _orderRepository.GetSubSystemListByCodesAsync(configs.Keys.ToList());
|
||||||
|
foreach (var item in subSystemIds)
|
||||||
|
{
|
||||||
|
var subSystemId = item.id;
|
||||||
|
// 如果已经发送过通知,不再发送
|
||||||
|
var redisKey = $"{GlobalConst.ForewarningNotifyCheckKey}:{subSystemId}";
|
||||||
|
if (await RedisHelper.Client.ExistsAsync(redisKey))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
await RedisHelper.Client.SetExAsync(redisKey, configs[item.code].WarningNotifyInterval * 60, 1);
|
||||||
|
|
||||||
|
// todo:改mq分流?
|
||||||
|
_ = Task.Run(async () =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var cnt = await _forewarningNotifyService.SendNotificationAsync(subSystemId);
|
||||||
|
LogHelper.Info($"预警通知发送成功,新增预警记录{cnt}条");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
await RedisHelper.Client.DelAsync(redisKey);
|
||||||
|
LogHelper.Error(e.ToString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,9 +1,3 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
using SJZY.Expand.ABP.Core;
|
|
||||||
using SJZY.Expand.ABP.Core.Logger;
|
|
||||||
using SJZY.Track.Application.Contract.Services;
|
|
||||||
using SJZY.Track.Application.Track2InterfaceRelay;
|
|
||||||
using SJZY.Track.Domain.Aggregates.ForewarningAggregate;
|
using SJZY.Track.Domain.Aggregates.ForewarningAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
using SJZY.Track.Domain.Dtos.Forewarning;
|
using SJZY.Track.Domain.Dtos.Forewarning;
|
||||||
@ -17,16 +11,13 @@ namespace SJZY.Track.Application.Services.TrackOrders;
|
|||||||
[Route("/Track/Order")]
|
[Route("/Track/Order")]
|
||||||
public class OrderWarningService : ApplicationService
|
public class OrderWarningService : ApplicationService
|
||||||
{
|
{
|
||||||
private readonly IForewarningNotifyService _forewarningNotifyService;
|
|
||||||
private readonly IOrderRepository _orderRepository;
|
private readonly IOrderRepository _orderRepository;
|
||||||
private readonly IWarningRecordEsRepository _warningRecordEsRepository;
|
private readonly IWarningRecordEsRepository _warningRecordEsRepository;
|
||||||
|
|
||||||
public OrderWarningService(IWarningRecordEsRepository warningRecordEsRepository, IOrderRepository orderRepository,
|
public OrderWarningService(IWarningRecordEsRepository warningRecordEsRepository, IOrderRepository orderRepository)
|
||||||
IForewarningNotifyService forewarningNotifyService)
|
|
||||||
{
|
{
|
||||||
_warningRecordEsRepository = warningRecordEsRepository;
|
_warningRecordEsRepository = warningRecordEsRepository;
|
||||||
_orderRepository = orderRepository;
|
_orderRepository = orderRepository;
|
||||||
_forewarningNotifyService = forewarningNotifyService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -78,54 +69,4 @@ public class OrderWarningService : ApplicationService
|
|||||||
return new UnifyPageResultDto<GetOrderWarningPageOutput>(list, inputVo.PageIndex, inputVo.PageSize,
|
return new UnifyPageResultDto<GetOrderWarningPageOutput>(list, inputVo.PageIndex, inputVo.PageSize,
|
||||||
(int) result.total);
|
(int) result.total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 定时任务轨迹运输时效预警推送
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[AllowAnonymous]
|
|
||||||
[HttpPost("SendWarningForTask")]
|
|
||||||
public async Task<bool> SendWarningForTaskAsync([FromBody] IOptionsSnapshot<Track2InterfaceRelayOptions> options)
|
|
||||||
{
|
|
||||||
var configs = options.Value;
|
|
||||||
if (configs == null || configs.Keys.Count == 0)
|
|
||||||
{
|
|
||||||
throw new BusinessException("未配置预警系统");
|
|
||||||
}
|
|
||||||
|
|
||||||
var subSystemIds = await _orderRepository.GetSubSystemListByCodesAsync(configs.Keys.ToList());
|
|
||||||
foreach (var item in subSystemIds)
|
|
||||||
{
|
|
||||||
var subSystemId = item.id;
|
|
||||||
// 如果已经发送过通知,不再发送
|
|
||||||
var redisKey = $"{GlobalConst.ForewarningNotifyCheckKey}:{subSystemId}";
|
|
||||||
if (await RedisHelper.Client.ExistsAsync(redisKey))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
await RedisHelper.Client.SetExAsync(redisKey, configs[item.code].WarningNotifyInterval * 60, 1);
|
|
||||||
|
|
||||||
// todo:改mq分流?
|
|
||||||
_ = Task.Run(async () =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var cnt = await _forewarningNotifyService.SendNotificationAsync(subSystemId);
|
|
||||||
LogHelper.Info($"预警通知发送成功,新增预警记录{cnt}条");
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LogHelper.Error(e.ToString());
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
await RedisHelper.Client.DelAsync(redisKey);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,7 +40,7 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
|
|||||||
}
|
}
|
||||||
|
|
||||||
private string TrackPushContentKey(int subSystemId, int customId) =>
|
private string TrackPushContentKey(int subSystemId, int customId) =>
|
||||||
$"{GlobalConst.TrackPushKeyPrefix}:{subSystemId}:{customId}";
|
$"{GlobalConst.TrackPushContentKeyPrefix}:{subSystemId}:{customId}";
|
||||||
|
|
||||||
private async Task<List<TrackPushContentConfigDto>?> DoGetPushContentConfigsAsync(int subSystemId, int customId)
|
private async Task<List<TrackPushContentConfigDto>?> DoGetPushContentConfigsAsync(int subSystemId, int customId)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -8,7 +8,6 @@ using SJZY.Expand.ABP.Core.Localization;
|
|||||||
using SJZY.Expand.ABP.Core.Logger;
|
using SJZY.Expand.ABP.Core.Logger;
|
||||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||||
using SJZY.InterfaceRelay.Application.Contracts;
|
using SJZY.InterfaceRelay.Application.Contracts;
|
||||||
using SJZY.Track.Application.BackgroundServices;
|
|
||||||
using SJZY.Track.Application.CAP;
|
using SJZY.Track.Application.CAP;
|
||||||
using SJZY.Track.Application.Contract;
|
using SJZY.Track.Application.Contract;
|
||||||
using SJZY.Track.Application.Localization;
|
using SJZY.Track.Application.Localization;
|
||||||
@ -153,8 +152,6 @@ public class SjzyTrackApplicationModule : AbpModule
|
|||||||
}, typeof(SjzyTrackApplicationModule).Assembly);
|
}, typeof(SjzyTrackApplicationModule).Assembly);
|
||||||
|
|
||||||
context.Services.Configure<TrackAppOptions>(configuration.GetSection("TrackApp"));
|
context.Services.Configure<TrackAppOptions>(configuration.GetSection("TrackApp"));
|
||||||
context.Services.AddHostedService<OrderPullStatusScanner>();
|
|
||||||
context.Services.AddHostedService<TrackButtomUpScanner>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PreConfigureServices(ServiceConfigurationContext context)
|
public override void PreConfigureServices(ServiceConfigurationContext context)
|
||||||
|
|||||||
@ -36,7 +36,7 @@ public interface IOrderRepository : IBasicRepository<OrderEntity>
|
|||||||
/// 更新推送预警单
|
/// 更新推送预警单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<int> PushWarnOrdersAsync(int pageSize, int pageindex);
|
Task<int> PushWarnOrdersAsync(int subSystemId, int pageSize, int pageindex);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新缺失标记,时区缺失和发生地缺失标记,1表示时区,2表示发生地,3表示两种
|
/// 更新缺失标记,时区缺失和发生地缺失标记,1表示时区,2表示发生地,3表示两种
|
||||||
|
|||||||
@ -32,6 +32,11 @@ public partial class GlobalConst
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ForewarningNotifyCheckKey = "ForewarningNotifyCheck";
|
public const string ForewarningNotifyCheckKey = "ForewarningNotifyCheck";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单拉取状态扫描罚时 redis key
|
||||||
|
/// </summary>
|
||||||
|
public const string OrderPullStatusScanCheckKey = "OrderPullStatusScanCheck";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// kpi区域redis key前缀
|
/// kpi区域redis key前缀
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -63,7 +68,7 @@ public partial class GlobalConst
|
|||||||
public const string TrackWarningKeyPrefix = "TrackWarning";
|
public const string TrackWarningKeyPrefix = "TrackWarning";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 12小时推送预警轨迹锁
|
/// 轨迹推送预警redis key前缀
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string TrackPushTrackWaringLockKey = "TrackPushTrackWaringLock";
|
public const string TrackPushWaringKeyPrefix = "TrackPushWaring";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,13 +116,14 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新推送预警单
|
/// 更新推送预警单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="subSystemId"></param>
|
||||||
/// <param name="pageSize"></param>
|
/// <param name="pageSize"></param>
|
||||||
/// <param name="pageindex"></param>
|
/// <param name="pageindex"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<int> PushWarnOrdersAsync(int pageSize, int pageindex)
|
public async Task<int> PushWarnOrdersAsync(int subSystemId, int pageSize, int pageindex)
|
||||||
{
|
{
|
||||||
var ordersToUpdate = await Context.Queryable<OrderEntity>()
|
var ordersToUpdate = await Context.Queryable<OrderEntity>()
|
||||||
.Where(b => !b.IsCompleted && b.QuestionType != 1)
|
.Where(b => b.SubSystemId == subSystemId && !b.IsCompleted && b.QuestionType != 1)
|
||||||
.Select(b => new
|
.Select(b => new
|
||||||
{
|
{
|
||||||
b.LatestPushTime,
|
b.LatestPushTime,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user