feat: 修复更新推送预警单bug
This commit is contained in:
parent
8bcef37b74
commit
f50d427325
@ -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)
|
||||||
@ -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)
|
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;
|
||||||
@ -115,7 +118,8 @@ AND `a`.`IsDeleted` = 0 AND `b`.`IsDeleted` = 0 limit @pageSize", new { pageSize
|
|||||||
{
|
{
|
||||||
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