feat: 租户创建时自动创建商户和证照记录
- 扩展 MerchantDocumentType 枚举,新增法人身份证、卫生许可证等类型 - 新增 TenantCreatedEvent 领域事件 - 修改 CreateTenantManuallyCommandHandler 发布租户创建事件 - 新增 TenantCreatedEventConsumer 消费者,自动创建商户和证照 - 实现 Tenant 1:1 Merchant 的业务关系 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,7 @@ public enum MerchantDocumentType
|
||||
BusinessLicense = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 餐饮服务许可证。
|
||||
/// 餐饮服务许可证(食品经营许可证)。
|
||||
/// </summary>
|
||||
CateringPermit = 1,
|
||||
|
||||
@@ -20,6 +20,51 @@ public enum MerchantDocumentType
|
||||
/// </summary>
|
||||
TaxCertificate = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 法人身份证正面。
|
||||
/// </summary>
|
||||
LegalPersonIdFront = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 法人身份证背面。
|
||||
/// </summary>
|
||||
LegalPersonIdBack = 4,
|
||||
|
||||
/// <summary>
|
||||
/// 卫生许可证。
|
||||
/// </summary>
|
||||
HealthPermit = 5,
|
||||
|
||||
/// <summary>
|
||||
/// 消防安全证。
|
||||
/// </summary>
|
||||
FireSafetyCertificate = 6,
|
||||
|
||||
/// <summary>
|
||||
/// 环保许可证。
|
||||
/// </summary>
|
||||
EnvironmentalPermit = 7,
|
||||
|
||||
/// <summary>
|
||||
/// 特种行业许可证。
|
||||
/// </summary>
|
||||
SpecialIndustryPermit = 8,
|
||||
|
||||
/// <summary>
|
||||
/// 商标注册证。
|
||||
/// </summary>
|
||||
TrademarkCertificate = 9,
|
||||
|
||||
/// <summary>
|
||||
/// 门店照片(门头照)。
|
||||
/// </summary>
|
||||
StoreFrontPhoto = 10,
|
||||
|
||||
/// <summary>
|
||||
/// 店内环境照片。
|
||||
/// </summary>
|
||||
StoreInteriorPhoto = 11,
|
||||
|
||||
/// <summary>
|
||||
/// 其他补充资质。
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
namespace TakeoutSaaS.Domain.Tenants.Events;
|
||||
|
||||
/// <summary>
|
||||
/// 租户创建完成事件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 当租户及其相关数据(订阅、认证资料等)创建成功后发布此事件。
|
||||
/// 消费者可据此自动创建关联的商户和证照记录。
|
||||
/// </remarks>
|
||||
public sealed record TenantCreatedEvent
|
||||
{
|
||||
// 1. 租户基本信息
|
||||
|
||||
/// <summary>
|
||||
/// 租户 ID。
|
||||
/// </summary>
|
||||
public required long TenantId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 租户编码。
|
||||
/// </summary>
|
||||
public required string Code { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 租户名称。
|
||||
/// </summary>
|
||||
public required string Name { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 租户简称。
|
||||
/// </summary>
|
||||
public string? ShortName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 法人/公司主体名称。
|
||||
/// </summary>
|
||||
public string? LegalEntityName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// LOGO 图片地址。
|
||||
/// </summary>
|
||||
public string? LogoUrl { get; init; }
|
||||
|
||||
// 2. 地址信息
|
||||
|
||||
/// <summary>
|
||||
/// 省份。
|
||||
/// </summary>
|
||||
public string? Province { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 城市。
|
||||
/// </summary>
|
||||
public string? City { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 区县。
|
||||
/// </summary>
|
||||
public string? District { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 详细地址。
|
||||
/// </summary>
|
||||
public string? Address { get; init; }
|
||||
|
||||
// 3. 联系信息
|
||||
|
||||
/// <summary>
|
||||
/// 联系人姓名。
|
||||
/// </summary>
|
||||
public string? ContactName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 联系人电话。
|
||||
/// </summary>
|
||||
public string? ContactPhone { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 联系人邮箱。
|
||||
/// </summary>
|
||||
public string? ContactEmail { get; init; }
|
||||
|
||||
// 4. 认证资料(用于创建商户证照)
|
||||
|
||||
/// <summary>
|
||||
/// 营业执照号。
|
||||
/// </summary>
|
||||
public string? BusinessLicenseNumber { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业执照图片 URL。
|
||||
/// </summary>
|
||||
public string? BusinessLicenseUrl { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 法人姓名。
|
||||
/// </summary>
|
||||
public string? LegalPersonName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 法人身份证号。
|
||||
/// </summary>
|
||||
public string? LegalPersonIdNumber { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 法人身份证正面 URL。
|
||||
/// </summary>
|
||||
public string? LegalPersonIdFrontUrl { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 法人身份证背面 URL。
|
||||
/// </summary>
|
||||
public string? LegalPersonIdBackUrl { get; init; }
|
||||
|
||||
// 5. 管理员信息
|
||||
|
||||
/// <summary>
|
||||
/// 管理员用户 ID。
|
||||
/// </summary>
|
||||
public long AdminUserId { get; init; }
|
||||
|
||||
// 6. 审核状态
|
||||
|
||||
/// <summary>
|
||||
/// 是否跳过审核(直接激活)。
|
||||
/// </summary>
|
||||
public bool IsSkipApproval { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 事件发生时间(UTC)。
|
||||
/// </summary>
|
||||
public DateTime CreatedAt { get; init; } = DateTime.UtcNow;
|
||||
}
|
||||
Reference in New Issue
Block a user