feat: 添加订单大厅看板 API(四列数据 + 统计 + 重连补偿 + 操作端点)
Some checks failed
Build and Deploy TenantApi + SkuWorker / build-and-deploy (push) Has been cancelled
Some checks failed
Build and Deploy TenantApi + SkuWorker / build-and-deploy (push) Has been cancelled
- 新增 OrderBoardCardDto、OrderBoardResultDto、OrderBoardStatsDto - 新增看板查询 Query + Handler(board/stats/pending-since) - IOrderRepository 扩展 GetActiveOrdersAsync、GetOrdersChangedSinceAsync - EfOrderRepository 实现看板查询方法 - 新增 OrderBoardController(GET board/stats/pending-since + POST accept/reject/complete/confirm) - 新增 RejectOrderRequest 契约
This commit is contained in:
@@ -313,6 +313,35 @@ public sealed class EfOrderRepository(TakeoutAppDbContext context) : IOrderRepos
|
||||
context.Orders.Remove(existing);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<Order>> GetActiveOrdersAsync(long tenantId, long storeId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
// 查询待接单、制作中、待取餐的活跃订单
|
||||
var activeStatuses = new[]
|
||||
{
|
||||
OrderStatus.AwaitingPreparation,
|
||||
OrderStatus.InProgress,
|
||||
OrderStatus.Ready
|
||||
};
|
||||
|
||||
return await context.Orders
|
||||
.AsNoTracking()
|
||||
.Where(x => x.TenantId == tenantId && x.StoreId == storeId && activeStatuses.Contains(x.Status))
|
||||
.OrderBy(x => x.CreatedAt)
|
||||
.ToListAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<Order>> GetOrdersChangedSinceAsync(long tenantId, long storeId, DateTime since, CancellationToken cancellationToken = default)
|
||||
{
|
||||
// 查询指定时间后创建或更新的订单
|
||||
return await context.Orders
|
||||
.AsNoTracking()
|
||||
.Where(x => x.TenantId == tenantId && x.StoreId == storeId && x.UpdatedAt >= since)
|
||||
.OrderByDescending(x => x.UpdatedAt)
|
||||
.ToListAsync(cancellationToken);
|
||||
}
|
||||
|
||||
private IQueryable<Order> BuildSearchAllOrdersQuery(
|
||||
long tenantId,
|
||||
long? storeId,
|
||||
|
||||
Reference in New Issue
Block a user