Merge branch 'refs/heads/S04轨迹预警' into test
This commit is contained in:
commit
c155a9d673
@ -1,7 +1,6 @@
|
||||
using SJZY.Track.Domain;
|
||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||
using SJZY.Track.Domain.Consts;
|
||||
using SJZY.Track.Domain.Dtos.Order;
|
||||
|
||||
namespace SJZY.Track.Repository.Repositories;
|
||||
@ -25,7 +24,8 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
|
||||
{
|
||||
var idsString = string.Join(",", ids);
|
||||
return Context.Ado.ExecuteCommandAsync(
|
||||
$"UPDATE `t_order` SET `DeficiencyTag` = @newValue ,UpdateTime= current_timestamp WHERE `Id` IN ({idsString})", new { newValue });
|
||||
$"UPDATE `t_order` SET `DeficiencyTag` = @newValue ,UpdateTime= current_timestamp WHERE `Id` IN ({idsString})",
|
||||
new { newValue });
|
||||
}
|
||||
|
||||
public async Task UpdateOrderAsync(OrderEntity order)
|
||||
@ -84,25 +84,28 @@ AND `a`.`IsDeleted` = 0 AND `b`.`IsDeleted` = 0 limit @pageSize", new { pageSize
|
||||
public async Task<int> PushWarnOrdersAsync(int pageSize, int pageindex, DateTime createTime)
|
||||
{
|
||||
var ordersToUpdate = await Context.Queryable<OrderEntity>()
|
||||
.LeftJoin<TrackPushConfigEntity>((b, a) => a.SubSystemId == b.SubSystemId && a.CustomId == b.CustomId)
|
||||
.InnerJoin<TrackPushConfigEntity>((b, a) => a.SubSystemId == b.SubSystemId && a.CustomId == b.CustomId)
|
||||
.Where((b, a) =>
|
||||
!b.IsCompleted
|
||||
&& b.QuestionType != 1
|
||||
&& b.CreateTime < createTime
|
||||
&& !a.IsDeleted
|
||||
&& !b.IsDeleted)
|
||||
.Select((b, a) => b)
|
||||
.Select((b, a) => new { Order = b })
|
||||
.ToPageListAsync(pageindex, pageSize);
|
||||
|
||||
var latestPushTimeIds = new LinkedList<int>();
|
||||
var questionZeroIds = new LinkedList<int>();
|
||||
foreach (var item in ordersToUpdate)
|
||||
{
|
||||
var questionType = item.LatestPushTime == null
|
||||
|| item.LatestPushTime < DateTime.Now.AddHours(-12) ? 2 : 0;
|
||||
if(item.QuestionType== questionType) continue;
|
||||
if(questionType==2) latestPushTimeIds.AddLast(item.Id);
|
||||
else questionZeroIds.AddLast(item.Id);
|
||||
var order = item.Order;
|
||||
var questionType = !order.LatestPushTime.HasValue
|
||||
|| order.LatestPushTime < DateTime.Now.AddHours(-12)
|
||||
? 2
|
||||
: 0;
|
||||
if (order.QuestionType == questionType) continue;
|
||||
if (questionType == 2) latestPushTimeIds.AddLast(order.Id);
|
||||
else questionZeroIds.AddLast(order.Id);
|
||||
}
|
||||
|
||||
int rows = 0;
|
||||
@ -115,7 +118,8 @@ AND `a`.`IsDeleted` = 0 AND `b`.`IsDeleted` = 0 limit @pageSize", new { pageSize
|
||||
{
|
||||
var idsString = string.Join(",", ids);
|
||||
return Context.Ado.ExecuteCommand(
|
||||
$"UPDATE `t_order` SET `QuestionType` = @questionType ,UpdateTime= current_timestamp WHERE `Id` IN ({idsString})", new { questionType });
|
||||
$"UPDATE `t_order` SET `QuestionType` = @questionType ,UpdateTime= current_timestamp WHERE `Id` IN ({idsString})",
|
||||
new { questionType });
|
||||
}
|
||||
|
||||
#region 订单关联
|
||||
|
||||
Loading…
Reference in New Issue
Block a user