feat: 商户类目数据库化并增加权限种子
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using TakeoutSaaS.Domain.Merchants.Enums;
|
||||
using TakeoutSaaS.Shared.Abstractions.Entities;
|
||||
|
||||
namespace TakeoutSaaS.Domain.Merchants.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 商户入驻审核日志。
|
||||
/// </summary>
|
||||
public sealed class MerchantAuditLog : MultiTenantEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 商户标识。
|
||||
/// </summary>
|
||||
public long MerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 动作类型。
|
||||
/// </summary>
|
||||
public MerchantAuditAction Action { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题。
|
||||
/// </summary>
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 详情描述。
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作人 ID。
|
||||
/// </summary>
|
||||
public long? OperatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作人名称。
|
||||
/// </summary>
|
||||
public string? OperatorName { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using TakeoutSaaS.Shared.Abstractions.Entities;
|
||||
|
||||
namespace TakeoutSaaS.Domain.Merchants.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 商户可选类目。
|
||||
/// </summary>
|
||||
public sealed class MerchantCategory : MultiTenantEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 类目名称。
|
||||
/// </summary>
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 显示顺序,越小越靠前。
|
||||
/// </summary>
|
||||
public int DisplayOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否可用。
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; } = true;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace TakeoutSaaS.Domain.Merchants.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// 商户审核日志动作。
|
||||
/// </summary>
|
||||
public enum MerchantAuditAction
|
||||
{
|
||||
/// <summary>
|
||||
/// 提交入驻申请或资料。
|
||||
/// </summary>
|
||||
ApplicationSubmitted = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 上传/更新证照。
|
||||
/// </summary>
|
||||
DocumentUploaded = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 证照审核。
|
||||
/// </summary>
|
||||
DocumentReviewed = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 合同创建或更新。
|
||||
/// </summary>
|
||||
ContractUpdated = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 合同状态变更(生效/终止)。
|
||||
/// </summary>
|
||||
ContractStatusChanged = 4,
|
||||
|
||||
/// <summary>
|
||||
/// 商户审核结果。
|
||||
/// </summary>
|
||||
MerchantReviewed = 5
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using TakeoutSaaS.Domain.Merchants.Entities;
|
||||
|
||||
namespace TakeoutSaaS.Domain.Merchants.Repositories;
|
||||
|
||||
/// <summary>
|
||||
/// 商户类目仓储契约。
|
||||
/// </summary>
|
||||
public interface IMerchantCategoryRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// 列出当前租户的类目。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<MerchantCategory>> ListAsync(long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 是否存在同名类目。
|
||||
/// </summary>
|
||||
Task<bool> ExistsAsync(string name, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 查找类目。
|
||||
/// </summary>
|
||||
Task<MerchantCategory?> FindByIdAsync(long id, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增类目。
|
||||
/// </summary>
|
||||
Task AddAsync(MerchantCategory category, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 删除类目。
|
||||
/// </summary>
|
||||
Task RemoveAsync(MerchantCategory category, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 批量更新类目信息。
|
||||
/// </summary>
|
||||
Task UpdateRangeAsync(IEnumerable<MerchantCategory> categories, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 持久化更改。
|
||||
/// </summary>
|
||||
Task SaveChangesAsync(CancellationToken cancellationToken = default);
|
||||
}
|
||||
@@ -30,11 +30,13 @@ public interface IMerchantRepository
|
||||
/// 获取指定商户的合同列表。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<MerchantContract>> GetContractsAsync(long merchantId, long tenantId, CancellationToken cancellationToken = default);
|
||||
Task<MerchantContract?> FindContractByIdAsync(long merchantId, long tenantId, long contractId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定商户的资质文件列表。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<MerchantDocument>> GetDocumentsAsync(long merchantId, long tenantId, CancellationToken cancellationToken = default);
|
||||
Task<MerchantDocument?> FindDocumentByIdAsync(long merchantId, long tenantId, long documentId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增商户主体。
|
||||
@@ -50,11 +52,13 @@ public interface IMerchantRepository
|
||||
/// 新增商户合同。
|
||||
/// </summary>
|
||||
Task AddContractAsync(MerchantContract contract, CancellationToken cancellationToken = default);
|
||||
Task UpdateContractAsync(MerchantContract contract, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增商户资质文件。
|
||||
/// </summary>
|
||||
Task AddDocumentAsync(MerchantDocument document, CancellationToken cancellationToken = default);
|
||||
Task UpdateDocumentAsync(MerchantDocument document, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 持久化变更。
|
||||
@@ -70,4 +74,14 @@ public interface IMerchantRepository
|
||||
/// 删除商户。
|
||||
/// </summary>
|
||||
Task DeleteMerchantAsync(long merchantId, long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 记录审核日志。
|
||||
/// </summary>
|
||||
Task AddAuditLogAsync(MerchantAuditLog log, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 获取审核日志。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<MerchantAuditLog>> GetAuditLogsAsync(long merchantId, long tenantId, CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user