admin/src/Oms.Domain/OrdersAggregate/Repositories/IOrderRepository.cs
zzh 72a1a3590e
All checks were successful
Build and Deploy / deploy (push) Successful in 1m19s
feat: 新增经营地图工作台统计接口(产品/国家线路与热力)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-19 11:24:06 +08:00

182 lines
7.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Fake.Domain.Repositories;
using Oms.Domain.OrdersAggregate.Entities;
namespace Oms.Domain.OrdersAggregate.Repositories;
public interface IOrderRepository : IRepository<Order>
{
Task<(List<Order> Items, int Total)> GetFilteredPagedListAsync(
int pageIndex,
int pageSize,
OrderListFilter filter,
CancellationToken cancellationToken = default);
Task<List<Order>> GetFilteredListAsync(
OrderListFilter filter,
CancellationToken cancellationToken = default);
Task<Order?> GetByServiceNoAsync(string serviceNo, CancellationToken cancellationToken = default);
Task<bool> HasServiceNoAsync(string serviceNo, CancellationToken cancellationToken = default);
Task<Order?> GetByTrackNoAsync(string trackNo, CancellationToken cancellationToken = default);
Task<Order?> GetByWaybillNoAsync(string waybillNo, CancellationToken cancellationToken = default);
Task<Order?> GetByCustomerAndClientNoAsync(int customerId, string clientNo, CancellationToken cancellationToken = default);
Task<Order?> GetByRequestIdAsync(string requestId, CancellationToken cancellationToken = default);
Task<List<OrderSender>> GetSendersByOrderIdsAsync(IEnumerable<int> orderIds, CancellationToken cancellationToken = default);
Task<List<OrderRecipient>> GetRecipientsByOrderIdsAsync(IEnumerable<int> orderIds, CancellationToken cancellationToken = default);
Task<List<OrderDeclaration>> GetDeclarationsByOrderIdsAsync(IEnumerable<int> orderIds, CancellationToken cancellationToken = default);
Task<List<OrderWeight>> GetWeightsByOrderIdsAsync(IEnumerable<int> orderIds, CancellationToken cancellationToken = default);
/// <summary>
/// 一次加载下游预报所需订单主表与关联子表(避免消费端按表连打 5 次)。
/// </summary>
Task<Dictionary<int, OrderDownstreamCreateOneBundle>> GetDownstreamCreateOneBundlesAsync(
IEnumerable<int> orderIds,
CancellationToken cancellationToken = default);
Task<OrderSender> InsertSenderAsync(OrderSender sender, CancellationToken cancellationToken = default);
Task<OrderRecipient> InsertRecipientAsync(OrderRecipient recipient, CancellationToken cancellationToken = default);
Task InsertDeclarationsAsync(IEnumerable<OrderDeclaration> declarations, CancellationToken cancellationToken = default);
Task ReplaceDeclarationsAsync(int orderId, IEnumerable<OrderDeclaration> declarations, CancellationToken cancellationToken = default);
Task InsertWeightsAsync(IEnumerable<OrderWeight> weights, CancellationToken cancellationToken = default);
Task ReplaceWeightsAsync(int orderId, IEnumerable<OrderWeight> weights, CancellationToken cancellationToken = default);
Task UpsertFeesAsync(int orderId, IEnumerable<OrderFee> fees, CancellationToken cancellationToken = default);
Task DeleteReceivableFeesAsync(int orderId, CancellationToken cancellationToken = default);
Task DeleteReceivableFeesByStageAsync(int orderId, string chargingStage, CancellationToken cancellationToken = default);
Task DeletePayableFeesAsync(int orderId, CancellationToken cancellationToken = default);
Task DeletePayableFeesByStageAsync(int orderId, string chargingStage, CancellationToken cancellationToken = default);
Task UpdateSenderAsync(OrderSender sender, CancellationToken cancellationToken = default);
Task UpdateRecipientAsync(OrderRecipient recipient, CancellationToken cancellationToken = default);
Task<List<OrderFee>> GetFeesByOrderIdsAsync(IEnumerable<int> orderIds, CancellationToken cancellationToken = default);
/// <summary>
/// 列表页:按订单聚合应收金额合计(不加载费用明细行)。
/// </summary>
Task<Dictionary<int, decimal>> GetReceivableSumByOrderIdsAsync(
IEnumerable<int> orderIds,
CancellationToken cancellationToken = default);
Task<(List<OrderReceivablePayableRow> Items, int Total)> GetReceivablePayablePagedListAsync(
int pageIndex,
int pageSize,
OrderReceivablePayableFilter filter,
CancellationToken cancellationToken = default);
Task<List<OrderReceivablePayableSummaryRow>> GetReceivablePayableSummaryAsync(
OrderReceivablePayableFilter filter,
CancellationToken cancellationToken = default);
Task<List<OrderReceivablePayableRow>> GetReceivablePayableExportListAsync(
OrderReceivablePayableFilter filter,
int maxRows,
CancellationToken cancellationToken = default);
Task<List<OrderStatusCountRow>> GetStatusCountsAsync(int? customerId, CancellationToken cancellationToken = default);
Task<List<OrderStatusCountRow>> GetStatusCountsByFilterAsync(
OrderListFilter filter,
CancellationToken cancellationToken = default);
Task<Dictionary<string, (int Pending, int Processed)>> GetHandleStatusCountsByFilterAsync(
OrderListFilter filter,
CancellationToken cancellationToken = default);
Task<Dictionary<string, int>> GetFulfillProgressCountsByFilterAsync(
OrderListFilter filter,
CancellationToken cancellationToken = default);
Task<int> CountByFilterAndCreateTimeRangeAsync(
OrderListFilter filter,
DateTime startInclusive,
DateTime endExclusive,
CancellationToken cancellationToken = default);
Task<int> CountByFilterAndShipTimeRangeAsync(
OrderListFilter filter,
DateTime startInclusive,
DateTime endExclusive,
CancellationToken cancellationToken = default);
/// <summary>
/// 按创建时间汇总客户应付金额(Order.PayableAmount,营销后净额)。
/// </summary>
Task<decimal> SumPayableAmountByCreateTimeRangeAsync(
OrderListFilter filter,
DateTime startInclusive,
DateTime endExclusive,
CancellationToken cancellationToken = default);
Task<decimal> SumFeeAmountByPayTimeRangeAsync(
OrderListFilter filter,
string feeType,
DateTime startInclusive,
DateTime endExclusive,
CancellationToken cancellationToken = default);
Task<List<Order>> GetOrdersByFilterAndCreateTimeRangeAsync(
OrderListFilter filter,
DateTime startInclusive,
DateTime endExclusive,
CancellationToken cancellationToken = default);
/// <summary>
/// 只更新标签模板 Id,避免面单生成覆盖预报计费正在写入的订单字段。
/// </summary>
Task UpdateLabelTemplateIdAsync(int orderId, int labelTemplateId, CancellationToken cancellationToken = default);
/// <summary>
/// 营销分析:按支付/创建时间拉取订单营销快照投影。
/// </summary>
Task<List<MarketingOrderSnapshotRow>> ListMarketingSnapshotsByTimeRangeAsync(
DateTime startInclusive,
DateTime endExclusive,
bool usePayTime,
CancellationToken cancellationToken = default);
/// <summary>
/// 代理分析:按支付/创建时间拉取带 AgentId 的订单投影。
/// </summary>
Task<List<AgentAnalysisOrderRow>> ListAgentAnalysisOrdersByTimeRangeAsync(
DateTime startInclusive,
DateTime endExclusive,
bool usePayTime,
CancellationToken cancellationToken = default);
/// <summary>
/// 经营地图:按创建时间拉取轻量投影(含发件省/市)。
/// </summary>
Task<List<BizOpsOrderProjectionRow>> ListBizOpsProjectionsByCreateTimeRangeAsync(
OrderListFilter filter,
DateTime startInclusive,
DateTime endExclusive,
CancellationToken cancellationToken = default);
/// <summary>
/// 经营地图:按订单汇总应收/应付费用。
/// </summary>
Task<List<BizOpsOrderFeeSumRow>> SumFeesByOrderIdsAsync(
IEnumerable<int> orderIds,
CancellationToken cancellationToken = default);
}