feat: 租户账单公告通知接口

This commit is contained in:
2025-12-03 21:08:28 +08:00
parent 075906266a
commit 9fe7d9606d
47 changed files with 1522 additions and 4 deletions

View File

@@ -0,0 +1,32 @@
using MediatR;
using TakeoutSaaS.Application.App.Tenants.Commands;
using TakeoutSaaS.Application.App.Tenants.Dto;
using TakeoutSaaS.Domain.Tenants.Enums;
using TakeoutSaaS.Domain.Tenants.Repositories;
namespace TakeoutSaaS.Application.App.Tenants.Handlers;
/// <summary>
/// 标记账单支付处理器。
/// </summary>
public sealed class MarkTenantBillingPaidCommandHandler(ITenantBillingRepository billingRepository)
: IRequestHandler<MarkTenantBillingPaidCommand, TenantBillingDto?>
{
public async Task<TenantBillingDto?> Handle(MarkTenantBillingPaidCommand request, CancellationToken cancellationToken)
{
var bill = await billingRepository.FindByIdAsync(request.TenantId, request.BillingId, cancellationToken);
if (bill == null)
{
return null;
}
bill.AmountPaid = request.AmountPaid;
bill.Status = TenantBillingStatus.Paid;
bill.DueDate = bill.DueDate;
await billingRepository.UpdateAsync(bill, cancellationToken);
await billingRepository.SaveChangesAsync(cancellationToken);
return bill.ToDto();
}
}