完成门店管理后端接口与任务
This commit is contained in:
@@ -9,6 +9,97 @@ namespace TakeoutSaaS.Application.App.Stores;
|
||||
/// </summary>
|
||||
public static class StoreMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// 映射门店 DTO。
|
||||
/// </summary>
|
||||
/// <param name="store">门店实体。</param>
|
||||
/// <returns>DTO。</returns>
|
||||
public static StoreDto ToDto(Store store) => new()
|
||||
{
|
||||
Id = store.Id,
|
||||
TenantId = store.TenantId,
|
||||
MerchantId = store.MerchantId,
|
||||
Code = store.Code,
|
||||
Name = store.Name,
|
||||
Phone = store.Phone,
|
||||
ManagerName = store.ManagerName,
|
||||
Status = store.Status,
|
||||
SignboardImageUrl = store.SignboardImageUrl,
|
||||
OwnershipType = store.OwnershipType,
|
||||
AuditStatus = store.AuditStatus,
|
||||
BusinessStatus = store.BusinessStatus,
|
||||
ClosureReason = store.ClosureReason,
|
||||
ClosureReasonText = store.ClosureReasonText,
|
||||
CategoryId = store.CategoryId,
|
||||
RejectionReason = store.RejectionReason,
|
||||
SubmittedAt = store.SubmittedAt,
|
||||
ActivatedAt = store.ActivatedAt,
|
||||
ForceClosedAt = store.ForceClosedAt,
|
||||
ForceCloseReason = store.ForceCloseReason,
|
||||
Province = store.Province,
|
||||
City = store.City,
|
||||
District = store.District,
|
||||
Address = store.Address,
|
||||
Longitude = store.Longitude,
|
||||
Latitude = store.Latitude,
|
||||
Announcement = store.Announcement,
|
||||
Tags = store.Tags,
|
||||
DeliveryRadiusKm = store.DeliveryRadiusKm,
|
||||
SupportsDineIn = store.SupportsDineIn,
|
||||
SupportsPickup = store.SupportsPickup,
|
||||
SupportsDelivery = store.SupportsDelivery,
|
||||
SupportsReservation = store.SupportsReservation,
|
||||
SupportsQueueing = store.SupportsQueueing,
|
||||
CreatedAt = store.CreatedAt
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 映射门店费用 DTO。
|
||||
/// </summary>
|
||||
/// <param name="fee">费用配置。</param>
|
||||
/// <returns>DTO。</returns>
|
||||
public static StoreFeeDto ToDto(StoreFee fee) => new()
|
||||
{
|
||||
Id = fee.Id,
|
||||
StoreId = fee.StoreId,
|
||||
MinimumOrderAmount = fee.MinimumOrderAmount,
|
||||
DeliveryFee = fee.BaseDeliveryFee,
|
||||
PackagingFeeMode = fee.PackagingFeeMode,
|
||||
FixedPackagingFee = fee.FixedPackagingFee,
|
||||
FreeDeliveryThreshold = fee.FreeDeliveryThreshold,
|
||||
CreatedAt = fee.CreatedAt,
|
||||
UpdatedAt = fee.UpdatedAt
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 映射门店资质 DTO。
|
||||
/// </summary>
|
||||
/// <param name="qualification">资质实体。</param>
|
||||
/// <returns>DTO。</returns>
|
||||
public static StoreQualificationDto ToDto(StoreQualification qualification)
|
||||
{
|
||||
int? daysUntilExpiry = qualification.ExpiresAt.HasValue
|
||||
? (int)Math.Ceiling((qualification.ExpiresAt.Value.Date - DateTime.UtcNow.Date).TotalDays)
|
||||
: null;
|
||||
|
||||
return new StoreQualificationDto
|
||||
{
|
||||
Id = qualification.Id,
|
||||
StoreId = qualification.StoreId,
|
||||
QualificationType = qualification.QualificationType,
|
||||
FileUrl = qualification.FileUrl,
|
||||
DocumentNumber = qualification.DocumentNumber,
|
||||
IssuedAt = qualification.IssuedAt,
|
||||
ExpiresAt = qualification.ExpiresAt,
|
||||
IsExpired = qualification.IsExpired,
|
||||
IsExpiringSoon = qualification.IsExpiringSoon,
|
||||
DaysUntilExpiry = daysUntilExpiry,
|
||||
SortOrder = qualification.SortOrder,
|
||||
CreatedAt = qualification.CreatedAt,
|
||||
UpdatedAt = qualification.UpdatedAt
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 映射营业时段 DTO。
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user