diff --git a/src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/GetCurrentMerchantCenterQueryHandler.cs b/src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/GetCurrentMerchantCenterQueryHandler.cs index c285672..07a492d 100644 --- a/src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/GetCurrentMerchantCenterQueryHandler.cs +++ b/src/Application/TakeoutSaaS.Application/App/Merchants/Handlers/GetCurrentMerchantCenterQueryHandler.cs @@ -62,7 +62,8 @@ public sealed class GetCurrentMerchantCenterQueryHandler( // 5. 读取商户主体与租户信息 var merchant = await merchantRepository.FindByIdAsync(merchantId, currentTenantId, cancellationToken) ?? throw new BusinessException(ErrorCodes.NotFound, "商户不存在"); - var tenant = await tenantRepository.FindByIdAsync(currentTenantId, cancellationToken); + var tenant = await tenantRepository.FindByIdAsync(currentTenantId, cancellationToken) + ?? throw new BusinessException(ErrorCodes.NotFound, "租户不存在"); // 6. 读取商户关联数据 var stores = await storeRepository.GetByMerchantIdAsync(merchantId, currentTenantId, cancellationToken); @@ -77,7 +78,7 @@ public sealed class GetCurrentMerchantCenterQueryHandler( var staffDtos = staffs.Select(StoreMapping.ToDto).ToList(); return new CurrentMerchantCenterDto { - Merchant = MerchantMapping.ToDetailDto(merchant, tenant?.Name, storeDtos), + Merchant = MerchantMapping.ToDetailDto(merchant, tenant.Name, storeDtos), Staffs = staffDtos, Documents = MerchantMapping.ToDocumentDtos(documents), Contracts = MerchantMapping.ToContractDtos(contracts),