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;
|
||||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||||
using SJZY.Track.Domain.Consts;
|
|
||||||
using SJZY.Track.Domain.Dtos.Order;
|
using SJZY.Track.Domain.Dtos.Order;
|
||||||
|
|
||||||
namespace SJZY.Track.Repository.Repositories;
|
namespace SJZY.Track.Repository.Repositories;
|
||||||
@ -25,7 +24,8 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
|
|||||||
{
|
{
|
||||||
var idsString = string.Join(",", ids);
|
var idsString = string.Join(",", ids);
|
||||||
return Context.Ado.ExecuteCommandAsync(
|
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)
|
public async Task UpdateOrderAsync(OrderEntity order)
|
||||||
@ -71,7 +71,7 @@ SET `b`.`QuestionType` = CASE
|
|||||||
WHEN `b`.`LatestPushTime` < DATE_SUB(NOW(), INTERVAL 12 HOUR) THEN 2
|
WHEN `b`.`LatestPushTime` < DATE_SUB(NOW(), INTERVAL 12 HOUR) THEN 2
|
||||||
ELSE 0 END
|
ELSE 0 END
|
||||||
WHERE `b`.`IsCompleted` = 0 AND `b`.`QuestionType` != 1 AND `b`.`CreateTime` < @createTime
|
WHERE `b`.`IsCompleted` = 0 AND `b`.`QuestionType` != 1 AND `b`.`CreateTime` < @createTime
|
||||||
AND `a`.`IsDeleted` = 0 AND `b`.`IsDeleted` = 0 limit @pageSize", new { pageSize,createTime });
|
AND `a`.`IsDeleted` = 0 AND `b`.`IsDeleted` = 0 limit @pageSize", new { pageSize, createTime });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -81,41 +81,45 @@ AND `a`.`IsDeleted` = 0 AND `b`.`IsDeleted` = 0 limit @pageSize", new { pageSize
|
|||||||
/// <param name="pageindex"></param>
|
/// <param name="pageindex"></param>
|
||||||
/// <param name="createTime"></param>
|
/// <param name="createTime"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<int> PushWarnOrdersAsync(int pageSize,int pageindex, DateTime createTime)
|
public async Task<int> PushWarnOrdersAsync(int pageSize, int pageindex, DateTime createTime)
|
||||||
{
|
{
|
||||||
var ordersToUpdate = await Context.Queryable<OrderEntity>()
|
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) =>
|
.Where((b, a) =>
|
||||||
!b.IsCompleted
|
!b.IsCompleted
|
||||||
&& b.QuestionType != 1
|
&& b.QuestionType != 1
|
||||||
&& b.CreateTime < createTime
|
&& b.CreateTime < createTime
|
||||||
&& !a.IsDeleted
|
&& !a.IsDeleted
|
||||||
&& !b.IsDeleted)
|
&& !b.IsDeleted)
|
||||||
.Select((b, a) => b)
|
.Select((b, a) => new { Order = b })
|
||||||
.ToPageListAsync(pageindex,pageSize);
|
.ToPageListAsync(pageindex, pageSize);
|
||||||
|
|
||||||
var latestPushTimeIds = new LinkedList<int>();
|
var latestPushTimeIds = new LinkedList<int>();
|
||||||
var questionZeroIds = new LinkedList<int>();
|
var questionZeroIds = new LinkedList<int>();
|
||||||
foreach (var item in ordersToUpdate)
|
foreach (var item in ordersToUpdate)
|
||||||
{
|
{
|
||||||
var questionType = item.LatestPushTime == null
|
var order = item.Order;
|
||||||
|| item.LatestPushTime < DateTime.Now.AddHours(-12) ? 2 : 0;
|
var questionType = !order.LatestPushTime.HasValue
|
||||||
if(item.QuestionType== questionType) continue;
|
|| order.LatestPushTime < DateTime.Now.AddHours(-12)
|
||||||
if(questionType==2) latestPushTimeIds.AddLast(item.Id);
|
? 2
|
||||||
else questionZeroIds.AddLast(item.Id);
|
: 0;
|
||||||
|
if (order.QuestionType == questionType) continue;
|
||||||
|
if (questionType == 2) latestPushTimeIds.AddLast(order.Id);
|
||||||
|
else questionZeroIds.AddLast(order.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rows = 0;
|
int rows = 0;
|
||||||
if(latestPushTimeIds.Count>0)rows+= UpdateOrderQuestionType(2, latestPushTimeIds);
|
if (latestPushTimeIds.Count > 0) rows += UpdateOrderQuestionType(2, latestPushTimeIds);
|
||||||
if(questionZeroIds.Count>0)rows+= UpdateOrderQuestionType(0, questionZeroIds);
|
if (questionZeroIds.Count > 0) rows += UpdateOrderQuestionType(0, questionZeroIds);
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int UpdateOrderQuestionType(int questionType, IEnumerable<int> ids)
|
private int UpdateOrderQuestionType(int questionType, IEnumerable<int> ids)
|
||||||
{
|
{
|
||||||
var idsString = string.Join(",", ids);
|
var idsString = string.Join(",", ids);
|
||||||
return Context.Ado.ExecuteCommand(
|
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 订单关联
|
#region 订单关联
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user