style: 命令不可变化与规范补充

This commit is contained in:
2025-12-02 12:09:46 +08:00
parent 3e01943727
commit 541b75ecd8
13 changed files with 217 additions and 186 deletions

View File

@@ -7,65 +7,65 @@ namespace TakeoutSaaS.Application.App.Deliveries.Commands;
/// <summary>
/// 更新配送单命令。
/// </summary>
public sealed class UpdateDeliveryOrderCommand : IRequest<DeliveryOrderDto?>
public sealed record UpdateDeliveryOrderCommand : IRequest<DeliveryOrderDto?>
{
/// <summary>
/// 配送单 ID。
/// </summary>
public long DeliveryOrderId { get; set; }
public long DeliveryOrderId { get; init; }
/// <summary>
/// 订单 ID。
/// </summary>
public long OrderId { get; set; }
public long OrderId { get; init; }
/// <summary>
/// 服务商。
/// </summary>
public DeliveryProvider Provider { get; set; } = DeliveryProvider.InHouse;
public DeliveryProvider Provider { get; init; } = DeliveryProvider.InHouse;
/// <summary>
/// 第三方单号。
/// </summary>
public string? ProviderOrderId { get; set; }
public string? ProviderOrderId { get; init; }
/// <summary>
/// 状态。
/// </summary>
public DeliveryStatus Status { get; set; } = DeliveryStatus.Pending;
public DeliveryStatus Status { get; init; } = DeliveryStatus.Pending;
/// <summary>
/// 配送费。
/// </summary>
public decimal? DeliveryFee { get; set; }
public decimal? DeliveryFee { get; init; }
/// <summary>
/// 骑手姓名。
/// </summary>
public string? CourierName { get; set; }
public string? CourierName { get; init; }
/// <summary>
/// 骑手电话。
/// </summary>
public string? CourierPhone { get; set; }
public string? CourierPhone { get; init; }
/// <summary>
/// 下发时间。
/// </summary>
public DateTime? DispatchedAt { get; set; }
public DateTime? DispatchedAt { get; init; }
/// <summary>
/// 取餐时间。
/// </summary>
public DateTime? PickedUpAt { get; set; }
public DateTime? PickedUpAt { get; init; }
/// <summary>
/// 完成时间。
/// </summary>
public DateTime? DeliveredAt { get; set; }
public DateTime? DeliveredAt { get; init; }
/// <summary>
/// 异常原因。
/// </summary>
public string? FailureReason { get; set; }
public string? FailureReason { get; init; }
}

View File

@@ -7,45 +7,45 @@ namespace TakeoutSaaS.Application.App.Merchants.Commands;
/// <summary>
/// 更新商户命令。
/// </summary>
public sealed class UpdateMerchantCommand : IRequest<MerchantDto?>
public sealed record UpdateMerchantCommand : IRequest<MerchantDto?>
{
/// <summary>
/// 商户 ID。
/// </summary>
public long MerchantId { get; set; }
public long MerchantId { get; init; }
/// <summary>
/// 品牌名称。
/// </summary>
public string BrandName { get; set; } = string.Empty;
public string BrandName { get; init; } = string.Empty;
/// <summary>
/// 品牌简称。
/// </summary>
public string? BrandAlias { get; set; }
public string? BrandAlias { get; init; }
/// <summary>
/// Logo 地址。
/// </summary>
public string? LogoUrl { get; set; }
public string? LogoUrl { get; init; }
/// <summary>
/// 品类。
/// </summary>
public string? Category { get; set; }
public string? Category { get; init; }
/// <summary>
/// 联系电话。
/// </summary>
public string ContactPhone { get; set; } = string.Empty;
public string ContactPhone { get; init; } = string.Empty;
/// <summary>
/// 联系邮箱。
/// </summary>
public string? ContactEmail { get; set; }
public string? ContactEmail { get; init; }
/// <summary>
/// 入驻状态。
/// </summary>
public MerchantStatus Status { get; set; }
public MerchantStatus Status { get; init; }
}

View File

@@ -8,110 +8,110 @@ namespace TakeoutSaaS.Application.App.Orders.Commands;
/// <summary>
/// 更新订单命令。
/// </summary>
public sealed class UpdateOrderCommand : IRequest<OrderDto?>
public sealed record UpdateOrderCommand : IRequest<OrderDto?>
{
/// <summary>
/// 订单 ID。
/// </summary>
public long OrderId { get; set; }
public long OrderId { get; init; }
/// <summary>
/// 订单号。
/// </summary>
public string OrderNo { get; set; } = string.Empty;
public string OrderNo { get; init; } = string.Empty;
/// <summary>
/// 门店 ID。
/// </summary>
public long StoreId { get; set; }
public long StoreId { get; init; }
/// <summary>
/// 渠道。
/// </summary>
public OrderChannel Channel { get; set; } = OrderChannel.MiniProgram;
public OrderChannel Channel { get; init; } = OrderChannel.MiniProgram;
/// <summary>
/// 履约方式。
/// </summary>
public DeliveryType DeliveryType { get; set; } = DeliveryType.DineIn;
public DeliveryType DeliveryType { get; init; } = DeliveryType.DineIn;
/// <summary>
/// 状态。
/// </summary>
public OrderStatus Status { get; set; } = OrderStatus.PendingPayment;
public OrderStatus Status { get; init; } = OrderStatus.PendingPayment;
/// <summary>
/// 支付状态。
/// </summary>
public PaymentStatus PaymentStatus { get; set; } = PaymentStatus.Unpaid;
public PaymentStatus PaymentStatus { get; init; } = PaymentStatus.Unpaid;
/// <summary>
/// 顾客姓名。
/// </summary>
public string? CustomerName { get; set; }
public string? CustomerName { get; init; }
/// <summary>
/// 顾客手机号。
/// </summary>
public string? CustomerPhone { get; set; }
public string? CustomerPhone { get; init; }
/// <summary>
/// 桌号。
/// </summary>
public string? TableNo { get; set; }
public string? TableNo { get; init; }
/// <summary>
/// 排队号。
/// </summary>
public string? QueueNumber { get; set; }
public string? QueueNumber { get; init; }
/// <summary>
/// 预约 ID。
/// </summary>
public long? ReservationId { get; set; }
public long? ReservationId { get; init; }
/// <summary>
/// 商品金额。
/// </summary>
public decimal ItemsAmount { get; set; }
public decimal ItemsAmount { get; init; }
/// <summary>
/// 优惠金额。
/// </summary>
public decimal DiscountAmount { get; set; }
public decimal DiscountAmount { get; init; }
/// <summary>
/// 应付金额。
/// </summary>
public decimal PayableAmount { get; set; }
public decimal PayableAmount { get; init; }
/// <summary>
/// 实付金额。
/// </summary>
public decimal PaidAmount { get; set; }
public decimal PaidAmount { get; init; }
/// <summary>
/// 支付时间。
/// </summary>
public DateTime? PaidAt { get; set; }
public DateTime? PaidAt { get; init; }
/// <summary>
/// 完成时间。
/// </summary>
public DateTime? FinishedAt { get; set; }
public DateTime? FinishedAt { get; init; }
/// <summary>
/// 取消时间。
/// </summary>
public DateTime? CancelledAt { get; set; }
public DateTime? CancelledAt { get; init; }
/// <summary>
/// 取消原因。
/// </summary>
public string? CancelReason { get; set; }
public string? CancelReason { get; init; }
/// <summary>
/// 备注。
/// </summary>
public string? Remark { get; set; }
public string? Remark { get; init; }
}

View File

@@ -7,55 +7,55 @@ namespace TakeoutSaaS.Application.App.Payments.Commands;
/// <summary>
/// 更新支付记录命令。
/// </summary>
public sealed class UpdatePaymentCommand : IRequest<PaymentDto?>
public sealed record UpdatePaymentCommand : IRequest<PaymentDto?>
{
/// <summary>
/// 支付记录 ID。
/// </summary>
public long PaymentId { get; set; }
public long PaymentId { get; init; }
/// <summary>
/// 订单 ID。
/// </summary>
public long OrderId { get; set; }
public long OrderId { get; init; }
/// <summary>
/// 支付方式。
/// </summary>
public PaymentMethod Method { get; set; } = PaymentMethod.Unknown;
public PaymentMethod Method { get; init; } = PaymentMethod.Unknown;
/// <summary>
/// 支付状态。
/// </summary>
public PaymentStatus Status { get; set; } = PaymentStatus.Unpaid;
public PaymentStatus Status { get; init; } = PaymentStatus.Unpaid;
/// <summary>
/// 金额。
/// </summary>
public decimal Amount { get; set; }
public decimal Amount { get; init; }
/// <summary>
/// 平台交易号。
/// </summary>
public string? TradeNo { get; set; }
public string? TradeNo { get; init; }
/// <summary>
/// 渠道单号。
/// </summary>
public string? ChannelTransactionId { get; set; }
public string? ChannelTransactionId { get; init; }
/// <summary>
/// 支付时间。
/// </summary>
public DateTime? PaidAt { get; set; }
public DateTime? PaidAt { get; init; }
/// <summary>
/// 备注。
/// </summary>
public string? Remark { get; set; }
public string? Remark { get; init; }
/// <summary>
/// 原始回调。
/// </summary>
public string? Payload { get; set; }
public string? Payload { get; init; }
}

View File

@@ -7,100 +7,100 @@ namespace TakeoutSaaS.Application.App.Products.Commands;
/// <summary>
/// 更新商品命令。
/// </summary>
public sealed class UpdateProductCommand : IRequest<ProductDto?>
public sealed record UpdateProductCommand : IRequest<ProductDto?>
{
/// <summary>
/// 商品 ID。
/// </summary>
public long ProductId { get; set; }
public long ProductId { get; init; }
/// <summary>
/// 门店 ID。
/// </summary>
public long StoreId { get; set; }
public long StoreId { get; init; }
/// <summary>
/// 分类 ID。
/// </summary>
public long CategoryId { get; set; }
public long CategoryId { get; init; }
/// <summary>
/// 商品编码。
/// </summary>
public string SpuCode { get; set; } = string.Empty;
public string SpuCode { get; init; } = string.Empty;
/// <summary>
/// 名称。
/// </summary>
public string Name { get; set; } = string.Empty;
public string Name { get; init; } = string.Empty;
/// <summary>
/// 副标题。
/// </summary>
public string? Subtitle { get; set; }
public string? Subtitle { get; init; }
/// <summary>
/// 单位。
/// </summary>
public string? Unit { get; set; }
public string? Unit { get; init; }
/// <summary>
/// 现价。
/// </summary>
public decimal Price { get; set; }
public decimal Price { get; init; }
/// <summary>
/// 原价。
/// </summary>
public decimal? OriginalPrice { get; set; }
public decimal? OriginalPrice { get; init; }
/// <summary>
/// 库存数量。
/// </summary>
public int? StockQuantity { get; set; }
public int? StockQuantity { get; init; }
/// <summary>
/// 每单限购。
/// </summary>
public int? MaxQuantityPerOrder { get; set; }
public int? MaxQuantityPerOrder { get; init; }
/// <summary>
/// 状态。
/// </summary>
public ProductStatus Status { get; set; } = ProductStatus.Draft;
public ProductStatus Status { get; init; } = ProductStatus.Draft;
/// <summary>
/// 主图。
/// </summary>
public string? CoverImage { get; set; }
public string? CoverImage { get; init; }
/// <summary>
/// 图集。
/// </summary>
public string? GalleryImages { get; set; }
public string? GalleryImages { get; init; }
/// <summary>
/// 描述。
/// </summary>
public string? Description { get; set; }
public string? Description { get; init; }
/// <summary>
/// 支持堂食。
/// </summary>
public bool EnableDineIn { get; set; } = true;
public bool EnableDineIn { get; init; } = true;
/// <summary>
/// 支持自提。
/// </summary>
public bool EnablePickup { get; set; } = true;
public bool EnablePickup { get; init; } = true;
/// <summary>
/// 支持配送。
/// </summary>
public bool EnableDelivery { get; set; } = true;
public bool EnableDelivery { get; init; } = true;
/// <summary>
/// 是否推荐。
/// </summary>
public bool IsFeatured { get; set; }
public bool IsFeatured { get; init; }
}

View File

@@ -7,100 +7,100 @@ namespace TakeoutSaaS.Application.App.Stores.Commands;
/// <summary>
/// 更新门店命令。
/// </summary>
public sealed class UpdateStoreCommand : IRequest<StoreDto?>
public sealed record UpdateStoreCommand : IRequest<StoreDto?>
{
/// <summary>
/// 门店 ID。
/// </summary>
public long StoreId { get; set; }
public long StoreId { get; init; }
/// <summary>
/// 商户 ID。
/// </summary>
public long MerchantId { get; set; }
public long MerchantId { get; init; }
/// <summary>
/// 门店编码。
/// </summary>
public string Code { get; set; } = string.Empty;
public string Code { get; init; } = string.Empty;
/// <summary>
/// 门店名称。
/// </summary>
public string Name { get; set; } = string.Empty;
public string Name { get; init; } = string.Empty;
/// <summary>
/// 电话。
/// </summary>
public string? Phone { get; set; }
public string? Phone { get; init; }
/// <summary>
/// 负责人。
/// </summary>
public string? ManagerName { get; set; }
public string? ManagerName { get; init; }
/// <summary>
/// 状态。
/// </summary>
public StoreStatus Status { get; set; } = StoreStatus.Closed;
public StoreStatus Status { get; init; } = StoreStatus.Closed;
/// <summary>
/// 省份。
/// </summary>
public string? Province { get; set; }
public string? Province { get; init; }
/// <summary>
/// 城市。
/// </summary>
public string? City { get; set; }
public string? City { get; init; }
/// <summary>
/// 区县。
/// </summary>
public string? District { get; set; }
public string? District { get; init; }
/// <summary>
/// 详细地址。
/// </summary>
public string? Address { get; set; }
public string? Address { get; init; }
/// <summary>
/// 经度。
/// </summary>
public double? Longitude { get; set; }
public double? Longitude { get; init; }
/// <summary>
/// 纬度。
/// </summary>
public double? Latitude { get; set; }
public double? Latitude { get; init; }
/// <summary>
/// 公告。
/// </summary>
public string? Announcement { get; set; }
public string? Announcement { get; init; }
/// <summary>
/// 标签。
/// </summary>
public string? Tags { get; set; }
public string? Tags { get; init; }
/// <summary>
/// 配送半径。
/// </summary>
public decimal DeliveryRadiusKm { get; set; }
public decimal DeliveryRadiusKm { get; init; }
/// <summary>
/// 支持堂食。
/// </summary>
public bool SupportsDineIn { get; set; } = true;
public bool SupportsDineIn { get; init; } = true;
/// <summary>
/// 支持自提。
/// </summary>
public bool SupportsPickup { get; set; } = true;
public bool SupportsPickup { get; init; } = true;
/// <summary>
/// 支持配送。
/// </summary>
public bool SupportsDelivery { get; set; } = true;
public bool SupportsDelivery { get; init; } = true;
}