feat: 扩展领域模型与配置
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using TakeoutSaaS.Domain.Deliveries.Enums;
|
||||
using TakeoutSaaS.Shared.Abstractions.Entities;
|
||||
|
||||
namespace TakeoutSaaS.Domain.Deliveries.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 配送状态事件流水。
|
||||
/// </summary>
|
||||
public sealed class DeliveryEvent : MultiTenantEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 配送单标识。
|
||||
/// </summary>
|
||||
public Guid DeliveryOrderId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 事件类型。
|
||||
/// </summary>
|
||||
public DeliveryEventType EventType { get; set; } = DeliveryEventType.Updated;
|
||||
|
||||
/// <summary>
|
||||
/// 事件描述。
|
||||
/// </summary>
|
||||
public string Message { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 原始数据 JSON。
|
||||
/// </summary>
|
||||
public string? Payload { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发生时间。
|
||||
/// </summary>
|
||||
public DateTime OccurredAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using TakeoutSaaS.Domain.Deliveries.Enums;
|
||||
using TakeoutSaaS.Shared.Abstractions.Entities;
|
||||
|
||||
namespace TakeoutSaaS.Domain.Deliveries.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 配送单。
|
||||
/// </summary>
|
||||
public sealed class DeliveryOrder : MultiTenantEntityBase
|
||||
{
|
||||
public Guid OrderId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配送服务商。
|
||||
/// </summary>
|
||||
public DeliveryProvider Provider { get; set; } = DeliveryProvider.InHouse;
|
||||
|
||||
/// <summary>
|
||||
/// 第三方配送单号。
|
||||
/// </summary>
|
||||
public string? ProviderOrderId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态。
|
||||
/// </summary>
|
||||
public DeliveryStatus Status { get; set; } = DeliveryStatus.Pending;
|
||||
|
||||
/// <summary>
|
||||
/// 配送费。
|
||||
/// </summary>
|
||||
public decimal? DeliveryFee { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 骑手姓名。
|
||||
/// </summary>
|
||||
public string? CourierName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 骑手电话。
|
||||
/// </summary>
|
||||
public string? CourierPhone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 下发时间。
|
||||
/// </summary>
|
||||
public DateTime? DispatchedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 取餐时间。
|
||||
/// </summary>
|
||||
public DateTime? PickedUpAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 完成时间。
|
||||
/// </summary>
|
||||
public DateTime? DeliveredAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 异常原因。
|
||||
/// </summary>
|
||||
public string? FailureReason { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace TakeoutSaaS.Domain.Deliveries.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// 配送事件类型。
|
||||
/// </summary>
|
||||
public enum DeliveryEventType
|
||||
{
|
||||
/// <summary>
|
||||
/// 状态更新。
|
||||
/// </summary>
|
||||
Updated = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 渠道回调。
|
||||
/// </summary>
|
||||
Callback = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 加价或异常通知。
|
||||
/// </summary>
|
||||
Exception = 2
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace TakeoutSaaS.Domain.Deliveries.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// 配送服务商类型。
|
||||
/// </summary>
|
||||
public enum DeliveryProvider
|
||||
{
|
||||
InHouse = 0,
|
||||
Dada = 1,
|
||||
FlashEx = 2,
|
||||
Meituan = 3,
|
||||
Eleme = 4,
|
||||
Shunfeng = 5
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace TakeoutSaaS.Domain.Deliveries.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// 配送状态。
|
||||
/// </summary>
|
||||
public enum DeliveryStatus
|
||||
{
|
||||
Pending = 0,
|
||||
Accepted = 1,
|
||||
PickingUp = 2,
|
||||
Delivering = 3,
|
||||
Completed = 4,
|
||||
Cancelled = 5,
|
||||
Failed = 6
|
||||
}
|
||||
Reference in New Issue
Block a user