From 37e7d721f3e2228eb2c26c18fdc258f8dad0fc35 Mon Sep 17 00:00:00 2001
From: MSuMshk <2039814060@qq.com>
Date: Thu, 4 Dec 2025 12:45:26 +0800
Subject: [PATCH] =?UTF-8?q?docs:=20=E5=AE=8C=E5=96=84=E5=8F=82=E6=95=B0?=
=?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=B8=8EStyleCop=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.editorconfig | 7 ++
Directory.Build.props | 3 +
.../Controllers/AuthController.cs | 15 ++-
.../Controllers/DeliveriesController.cs | 22 +++-
.../Controllers/DictionaryController.cs | 27 +++++
.../Controllers/FilesController.cs | 2 -
.../Controllers/HealthController.cs | 2 -
.../MerchantCategoriesController.cs | 13 ++-
.../Controllers/MerchantsController.cs | 21 +++-
.../Controllers/OrdersController.cs | 1 -
.../Controllers/PaymentsController.cs | 1 -
.../Controllers/PermissionsController.cs | 28 +++--
.../Controllers/ProductsController.cs | 1 -
.../Controllers/RolesController.cs | 4 +-
.../Controllers/StoresController.cs | 1 -
.../Controllers/SystemParametersController.cs | 1 -
.../TenantAnnouncementsController.cs | 3 +-
.../Controllers/TenantBillingsController.cs | 3 +-
.../TenantNotificationsController.cs | 1 -
.../Controllers/TenantPackagesController.cs | 19 +++-
.../Controllers/TenantsController.cs | 4 +-
.../Controllers/UserPermissionsController.cs | 4 +-
src/Api/TakeoutSaaS.AdminApi/Program.cs | 9 +-
.../Controllers/AuthController.cs | 6 ++
.../Controllers/FilesController.cs | 6 +-
.../Controllers/HealthController.cs | 2 -
.../Controllers/MeController.cs | 6 +-
src/Api/TakeoutSaaS.MiniApi/Program.cs | 3 -
.../Controllers/HealthController.cs | 2 -
src/Api/TakeoutSaaS.UserApi/Program.cs | 3 -
...pApplicationServiceCollectionExtensions.cs | 2 +-
.../Commands/AddMerchantDocumentCommand.cs | 3 +-
.../Commands/CreateMerchantCategoryCommand.cs | 2 +-
.../Commands/CreateMerchantContractCommand.cs | 3 +-
.../Commands/DeleteMerchantCategoryCommand.cs | 2 +-
.../ReorderMerchantCategoriesCommand.cs | 3 +-
.../Commands/ReviewMerchantCommand.cs | 2 +-
.../Commands/ReviewMerchantDocumentCommand.cs | 2 +-
.../UpdateMerchantContractStatusCommand.cs | 3 +-
.../App/Merchants/Dto/MerchantCategoryDto.cs | 2 -
.../App/Merchants/Dto/MerchantDetailDto.cs | 2 -
.../CreateMerchantCategoryCommandHandler.cs | 1 -
.../GetMerchantAuditLogsQueryHandler.cs | 1 -
.../GetMerchantCategoriesQueryHandler.cs | 2 -
.../GetMerchantContractsQueryHandler.cs | 1 -
.../GetMerchantDocumentsQueryHandler.cs | 1 -
.../ListMerchantCategoriesQueryHandler.cs | 1 -
...ReorderMerchantCategoriesCommandHandler.cs | 1 -
.../ReviewMerchantDocumentCommandHandler.cs | 2 +-
.../App/Merchants/MerchantMapping.cs | 2 -
.../Queries/GetMerchantCategoriesQuery.cs | 1 -
.../Queries/GetMerchantContractsQuery.cs | 1 -
.../Queries/GetMerchantDocumentsQuery.cs | 1 -
.../Queries/ListMerchantCategoriesQuery.cs | 1 -
.../Handlers/CreateOrderCommandHandler.cs | 1 +
.../Handlers/SearchPaymentsQueryHandler.cs | 1 -
.../CheckTenantQuotaCommandHandler.cs | 1 -
.../GetTenantAuditLogsQueryHandler.cs | 1 -
...arkTenantAnnouncementReadCommandHandler.cs | 2 -
.../SearchTenantAnnouncementsQueryHandler.cs | 2 -
.../Handlers/SearchTenantBillsQueryHandler.cs | 1 -
.../SearchTenantNotificationsQueryHandler.cs | 1 -
.../SearchTenantPackagesQueryHandler.cs | 1 -
.../Handlers/SearchTenantsQueryHandler.cs | 1 -
.../Abstractions/IDictionaryCache.cs | 3 -
.../Contracts/CreateDictionaryItemRequest.cs | 2 +-
.../Dictionary/Models/DictionaryGroupDto.cs | 3 +-
.../Services/DictionaryAppService.cs | 1 -
.../Abstractions/IAdminAuthService.cs | 3 -
.../Identity/Abstractions/IJwtTokenService.cs | 2 -
.../Abstractions/ILoginRateLimiter.cs | 3 -
.../Identity/Abstractions/IMiniAuthService.cs | 3 -
.../Abstractions/IRefreshTokenStore.cs | 3 -
.../Abstractions/IWeChatAuthService.cs | 3 -
.../Commands/CreateRoleTemplateCommand.cs | 1 -
.../InitializeRoleTemplatesCommand.cs | 1 -
.../Commands/UpdateRoleTemplateCommand.cs | 1 -
.../Identity/Contracts/RoleTemplateDto.cs | 2 -
.../Identity/Contracts/UserPermissionDto.cs | 1 -
.../CopyRoleTemplateCommandHandler.cs | 3 -
.../CreateRoleTemplateCommandHandler.cs | 2 -
.../Handlers/GetRoleTemplateQueryHandler.cs | 1 -
.../GetUserPermissionsQueryHandler.cs | 2 -
.../InitializeRoleTemplatesCommandHandler.cs | 3 -
.../Handlers/ListRoleTemplatesQueryHandler.cs | 2 -
.../Handlers/SearchPermissionsQueryHandler.cs | 2 -
.../Handlers/SearchRolesQueryHandler.cs | 2 -
.../SearchUserPermissionsQueryHandler.cs | 3 -
.../Identity/Handlers/TemplateMapper.cs | 2 -
.../UpdateRoleTemplateCommandHandler.cs | 2 -
.../Queries/ListRoleTemplatesQuery.cs | 1 -
.../Identity/Services/AdminAuthService.cs | 5 +-
.../Identity/Services/MiniAuthService.cs | 6 +-
.../Messaging/Abstractions/IEventPublisher.cs | 3 -
.../Messaging/Services/EventPublisher.cs | 2 -
.../Abstractions/IVerificationCodeService.cs | 2 -
.../Contracts/SendVerificationCodeResponse.cs | 2 -
.../Sms/Services/VerificationCodeService.cs | 5 +-
.../Abstractions/IFileStorageService.cs | 2 -
.../Storage/Contracts/DirectUploadResponse.cs | 3 -
.../Storage/Contracts/UploadFileRequest.cs | 1 -
.../Extensions/UploadFileTypeParser.cs | 1 -
.../Storage/Services/FileStorageService.cs | 10 +-
.../Data/IDapperExecutor.cs | 1 +
.../Diagnostics/TraceContext.cs | 2 -
.../Exceptions/ValidationException.cs | 3 -
.../Results/ApiResponse.NonGeneric.cs | 12 +++
.../Results/ApiResponse.cs | 21 ++++
.../Results/PagedResult.cs | 2 -
.../Tenancy/ITenantProvider.cs | 3 +-
.../Ids/SnowflakeIdGenerator.cs | 1 -
.../Extensions/ServiceCollectionExtensions.cs | 1 -
.../Filters/ValidateModelAttribute.cs | 1 -
.../Middleware/CorrelationIdMiddleware.cs | 13 +--
.../Middleware/ExceptionHandlingMiddleware.cs | 6 +-
.../Middleware/RequestLoggingMiddleware.cs | 3 +-
.../Security/ClaimsPrincipalExtensions.cs | 1 -
.../HttpContextCurrentUserAccessor.cs | 2 +-
.../Swagger/ConfigureSwaggerOptions.cs | 4 +-
.../Repositories/IDeliveryRepository.cs | 35 +++++-
.../Dictionary/Entities/DictionaryGroup.cs | 1 -
.../Repositories/IDictionaryRepository.cs | 37 ++++++-
.../Repositories/IIdentityUserRepository.cs | 15 ++-
.../Repositories/IPermissionRepository.cs | 3 -
.../Repositories/IRolePermissionRepository.cs | 3 -
.../Identity/Repositories/IRoleRepository.cs | 3 -
.../Repositories/IRoleTemplateRepository.cs | 3 -
.../Repositories/IUserRoleRepository.cs | 3 -
.../IMerchantCategoryRepository.cs | 25 ++++-
.../Repositories/IMerchantRepository.cs | 51 ++++++++-
.../Orders/Repositories/IOrderRepository.cs | 49 ++++++++-
.../Repositories/IPaymentRepository.cs | 34 +++++-
.../Repositories/IProductRepository.cs | 102 +++++++++++++++++-
.../Stores/Repositories/IStoreRepository.cs | 65 ++++++++++-
.../ISystemParameterRepository.cs | 24 ++++-
.../ITenantAnnouncementReadRepository.cs | 5 +-
.../ITenantAnnouncementRepository.cs | 7 +-
.../Repositories/ITenantBillingRepository.cs | 6 +-
.../ITenantNotificationRepository.cs | 6 +-
.../Repositories/ITenantPackageRepository.cs | 7 +-
.../ITenantQuotaUsageRepository.cs | 6 +-
.../Tenants/Repositories/ITenantRepository.cs | 10 +-
src/Gateway/TakeoutSaaS.ApiGateway/Program.cs | 7 +-
.../App/Options/AppSeedOptions.cs | 2 -
.../App/Options/DictionarySeedGroupOptions.cs | 1 -
.../App/Persistence/AppDataSeeder.cs | 2 -
.../App/Repositories/EfDeliveryRepository.cs | 1 -
.../EfMerchantCategoryRepository.cs | 2 -
.../App/Repositories/EfMerchantRepository.cs | 1 -
.../App/Repositories/EfOrderRepository.cs | 1 -
.../App/Repositories/EfPaymentRepository.cs | 1 -
.../App/Repositories/EfProductRepository.cs | 1 -
.../App/Repositories/EfStoreRepository.cs | 1 -
.../EfTenantAnnouncementReadRepository.cs | 1 -
.../EfTenantAnnouncementRepository.cs | 1 -
.../Repositories/EfTenantBillingRepository.cs | 1 -
.../EfTenantNotificationRepository.cs | 1 -
.../Repositories/EfTenantPackageRepository.cs | 1 -
.../EfTenantQuotaUsageRepository.cs | 1 -
.../App/Repositories/EfTenantRepository.cs | 1 -
.../DatabaseServiceCollectionExtensions.cs | 2 +-
.../Common/Persistence/AppDbContext.cs | 4 +-
.../Common/Persistence/DapperExecutor.cs | 2 +-
.../Persistence/DatabaseConnectionFactory.cs | 5 +-
.../DesignTimeDbContextFactoryBase.cs | 3 -
.../ModelBuilderCommentExtensions.cs | 4 +-
.../Persistence/TenantAwareDbContext.cs | 4 +-
.../DictionaryServiceCollectionExtensions.cs | 4 +-
.../Repositories/EfDictionaryRepository.cs | 3 +-
.../EfSystemParameterRepository.cs | 1 -
.../Services/DistributedDictionaryCache.cs | 2 +-
.../Extensions/JwtAuthenticationExtensions.cs | 7 +-
.../Extensions/ServiceCollectionExtensions.cs | 3 -
.../Persistence/EfIdentityUserRepository.cs | 4 -
.../Persistence/EfMiniUserRepository.cs | 3 -
.../Persistence/EfPermissionRepository.cs | 1 -
.../Persistence/EfRolePermissionRepository.cs | 1 -
.../Persistence/EfRoleTemplateRepository.cs | 2 -
.../Persistence/IdentityDataSeeder.cs | 2 -
.../Identity/Persistence/IdentityDbContext.cs | 1 -
.../Identity/Services/JwtTokenService.cs | 8 +-
.../Services/RedisLoginRateLimiter.cs | 3 -
.../Services/RedisRefreshTokenStore.cs | 7 +-
.../Identity/Services/WeChatAuthService.cs | 6 +-
.../20251202005208_InitSnowflake_App.cs | 3 +-
...20251202005247_InitSnowflake_Dictionary.cs | 3 +-
...20251202043204_AddSystemParametersTable.cs | 3 +-
.../20251202005226_InitSnowflake_Identity.cs | 3 +-
.../IdentityDb/20251202084523_AddRbacModel.cs | 3 +-
.../PermissionAuthorizationHandler.cs | 3 -
.../TakeoutSaaS.Module.Delivery.csproj | 3 +
.../Abstractions/IMessagePublisher.cs | 3 -
.../Abstractions/IMessageSubscriber.cs | 4 -
.../Services/RabbitMqMessagePublisher.cs | 2 -
.../Abstractions/IRecurringJobRegistrar.cs | 3 -
.../Abstractions/ISmsSender.cs | 2 -
.../Models/SmsSendRequest.cs | 2 -
.../Options/SmsOptions.cs | 2 -
.../Services/AliyunSmsSender.cs | 1 -
.../Services/SmsSenderResolver.cs | 3 -
.../Services/TencentSmsSender.cs | 5 +-
.../Abstractions/IObjectStorageProvider.cs | 2 -
.../Models/StorageDirectUploadResult.cs | 3 -
.../Models/StorageUploadRequest.cs | 3 -
.../Providers/AliyunOssStorageProvider.cs | 6 --
.../Providers/QiniuKodoStorageProvider.cs | 1 -
.../Providers/S3StorageProviderBase.cs | 5 -
.../Providers/TencentCosStorageProvider.cs | 1 -
.../Services/StorageProviderResolver.cs | 3 -
.../TenantContextAccessor.cs | 1 -
.../TenantResolutionMiddleware.cs | 1 -
.../TenantResolutionOptions.cs | 2 +-
stylecop.json | 7 ++
213 files changed, 695 insertions(+), 446 deletions(-)
create mode 100644 stylecop.json
diff --git a/.editorconfig b/.editorconfig
index 32193b8..6c8b717 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -4,3 +4,10 @@ root = true
[*.cs]
dotnet_diagnostic.SA1600.severity = error
dotnet_diagnostic.SA1601.severity = error
+dotnet_diagnostic.SA1615.severity = error
+dotnet_diagnostic.SA1629.severity = none
+dotnet_diagnostic.SA1202.severity = none
+dotnet_diagnostic.SA1200.severity = none
+dotnet_diagnostic.SA1623.severity = none
+dotnet_diagnostic.SA1111.severity = none
+dotnet_diagnostic.SA1101.severity = none
diff --git a/Directory.Build.props b/Directory.Build.props
index f83743e..6f0ab73 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -9,5 +9,8 @@
+
+
+
diff --git a/src/Api/TakeoutSaaS.AdminApi/Controllers/AuthController.cs b/src/Api/TakeoutSaaS.AdminApi/Controllers/AuthController.cs
index b38d018..32b4e5a 100644
--- a/src/Api/TakeoutSaaS.AdminApi/Controllers/AuthController.cs
+++ b/src/Api/TakeoutSaaS.AdminApi/Controllers/AuthController.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Threading;
-using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using TakeoutSaaS.Application.Identity.Abstractions;
using TakeoutSaaS.Application.Identity.Contracts;
@@ -26,6 +22,9 @@ public sealed class AuthController(IAdminAuthService authService) : BaseApiContr
///
/// 登录获取 Token
///
+ /// 登录请求。
+ /// 取消标记。
+ /// 包含访问令牌与刷新令牌的响应。
[HttpPost("login")]
[AllowAnonymous]
[ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)]
@@ -38,6 +37,9 @@ public sealed class AuthController(IAdminAuthService authService) : BaseApiContr
///
/// 刷新 Token
///
+ /// 刷新令牌请求。
+ /// 取消标记。
+ /// 新的访问令牌与刷新令牌。
[HttpPost("refresh")]
[AllowAnonymous]
[ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)]
@@ -73,6 +75,8 @@ public sealed class AuthController(IAdminAuthService authService) : BaseApiContr
/// }
///
///
+ /// 取消标记。
+ /// 当前用户档案信息。
[HttpGet("profile")]
[PermissionAuthorize("identity:profile:read")]
[ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)]
@@ -116,6 +120,9 @@ public sealed class AuthController(IAdminAuthService authService) : BaseApiContr
/// }
///
///
+ /// 目标用户 ID。
+ /// 取消标记。
+ /// 用户权限概览,未找到则返回 404。
[HttpGet("permissions/{userId:long}")]
[PermissionAuthorize("identity:permission:read")]
[ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)]
diff --git a/src/Api/TakeoutSaaS.AdminApi/Controllers/DeliveriesController.cs b/src/Api/TakeoutSaaS.AdminApi/Controllers/DeliveriesController.cs
index ae7c092..6f0f953 100644
--- a/src/Api/TakeoutSaaS.AdminApi/Controllers/DeliveriesController.cs
+++ b/src/Api/TakeoutSaaS.AdminApi/Controllers/DeliveriesController.cs
@@ -1,6 +1,5 @@
using MediatR;
using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using TakeoutSaaS.Application.App.Deliveries.Commands;
using TakeoutSaaS.Application.App.Deliveries.Dto;
@@ -24,6 +23,9 @@ public sealed class DeliveriesController(IMediator mediator) : BaseApiController
///
/// 创建配送单。
///
+ /// 创建命令。
+ /// 取消标记。
+ /// 创建后的配送单。
[HttpPost]
[PermissionAuthorize("delivery:create")]
[ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)]
@@ -39,6 +41,14 @@ public sealed class DeliveriesController(IMediator mediator) : BaseApiController
///
/// 查询配送单列表。
///
+ /// 订单 ID。
+ /// 配送状态。
+ /// 页码。
+ /// 每页大小。
+ /// 排序字段。
+ /// 是否倒序。
+ /// 取消标记。
+ /// 配送单分页列表。
[HttpGet]
[PermissionAuthorize("delivery:read")]
[ProducesResponseType(typeof(ApiResponse>), StatusCodes.Status200OK)]
@@ -69,6 +79,9 @@ public sealed class DeliveriesController(IMediator mediator) : BaseApiController
///
/// 获取配送单详情。
///
+ /// 配送单 ID。
+ /// 取消标记。
+ /// 配送单详情或未找到。
[HttpGet("{deliveryOrderId:long}")]
[PermissionAuthorize("delivery:read")]
[ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)]
@@ -87,6 +100,10 @@ public sealed class DeliveriesController(IMediator mediator) : BaseApiController
///
/// 更新配送单。
///
+ /// 配送单 ID。
+ /// 更新命令。
+ /// 取消标记。
+ /// 更新后的配送单或未找到。
[HttpPut("{deliveryOrderId:long}")]
[PermissionAuthorize("delivery:update")]
[ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)]
@@ -111,6 +128,9 @@ public sealed class DeliveriesController(IMediator mediator) : BaseApiController
///
/// 删除配送单。
///
+ /// 配送单 ID。
+ /// 取消标记。
+ /// 删除结果,未找到则返回错误。
[HttpDelete("{deliveryOrderId:long}")]
[PermissionAuthorize("delivery:delete")]
[ProducesResponseType(typeof(ApiResponse