已完成管理后台第四批 ASP.NET Core 10 迁移:报名号规则与审批流程配置。

原生接口:
GET/POST /api/admin/number-rules
GET /api/admin/workflows
PUT /api/admin/workflows/{businessType}
实现包括:
报名号规则预览、创建和更新
自动停用旧规则
审批流程步骤重建
班级、校级、超级管理员层级校验
考点及批量申领流程禁止班级审批
批量申领最终步骤强制为超级管理员
配置更新与审计日志事务提交
This commit is contained in:
2026-07-23 08:28:53 +08:00 Unverified
parent f7c34247fd
commit 3665aa3aa9
13 changed files with 460 additions and 24 deletions
@@ -45,13 +45,25 @@ public static class NativeAdminReadEndpoints
Execute(context, service.UpdateSelfRegistrationAsync(Token(context), body, cancellationToken)));
}
if (!options.NativeAccountBatchesEnabled) return endpoints;
endpoints.MapGet("/api/admin/candidate-account-batches", (HttpContext context, IAdminAccountBatchService service, CancellationToken cancellationToken) =>
Execute(context, service.GetAsync(Token(context), cancellationToken)));
endpoints.MapPost("/api/admin/candidate-account-batches", (HttpContext context, JsonObject body, IAdminAccountBatchService service, CancellationToken cancellationToken) =>
Execute(context, service.SubmitAsync(Token(context), body, cancellationToken)));
endpoints.MapPatch("/api/admin/candidate-account-batches/{batchId}", (HttpContext context, string batchId, JsonObject body, IAdminAccountBatchService service, CancellationToken cancellationToken) =>
Execute(context, service.ReviewAsync(Token(context), batchId, body, cancellationToken)));
if (options.NativeAccountBatchesEnabled)
{
endpoints.MapGet("/api/admin/candidate-account-batches", (HttpContext context, IAdminAccountBatchService service, CancellationToken cancellationToken) =>
Execute(context, service.GetAsync(Token(context), cancellationToken)));
endpoints.MapPost("/api/admin/candidate-account-batches", (HttpContext context, JsonObject body, IAdminAccountBatchService service, CancellationToken cancellationToken) =>
Execute(context, service.SubmitAsync(Token(context), body, cancellationToken)));
endpoints.MapPatch("/api/admin/candidate-account-batches/{batchId}", (HttpContext context, string batchId, JsonObject body, IAdminAccountBatchService service, CancellationToken cancellationToken) =>
Execute(context, service.ReviewAsync(Token(context), batchId, body, cancellationToken)));
}
if (!options.NativeConfigurationEnabled) return endpoints;
endpoints.MapGet("/api/admin/number-rules", (HttpContext context, IAdminConfigurationService service, CancellationToken cancellationToken) =>
Execute(context, service.GetNumberRulesAsync(Token(context), cancellationToken)));
endpoints.MapPost("/api/admin/number-rules", (HttpContext context, JsonObject body, IAdminConfigurationService service, CancellationToken cancellationToken) =>
Execute(context, service.SaveNumberRuleAsync(Token(context), body, cancellationToken)));
endpoints.MapGet("/api/admin/workflows", (HttpContext context, IAdminConfigurationService service, CancellationToken cancellationToken) =>
Execute(context, service.GetWorkflowsAsync(Token(context), cancellationToken)));
endpoints.MapPut("/api/admin/workflows/{businessType}", (HttpContext context, string businessType, JsonObject body, IAdminConfigurationService service, CancellationToken cancellationToken) =>
Execute(context, service.SaveWorkflowAsync(Token(context), businessType, body, cancellationToken)));
return endpoints;
}
+6 -1
View File
@@ -47,7 +47,8 @@ var adminMigrationOptions = AdminMigrationOptions.FromEnvironment(
authenticationOptions.NativeEnabled,
authenticationOptions.SharesLegacySessions,
builder.Configuration.GetValue<bool>("AdminMigration:NativeOrganizationWritesEnabled"),
builder.Configuration.GetValue<bool>("AdminMigration:NativeAccountBatchesEnabled"));
builder.Configuration.GetValue<bool>("AdminMigration:NativeAccountBatchesEnabled"),
builder.Configuration.GetValue<bool>("AdminMigration:NativeConfigurationEnabled"));
builder.Services.AddEisInfrastructure(
DatabaseOptions.FromEnvironment(applicationRoot, builder.Environment.IsProduction()),
DocumentVerificationOptions.FromEnvironment(builder.Environment.IsProduction()),
@@ -104,6 +105,7 @@ app.MapGet("/health/migration", async (LegacyApiProxy proxy, CancellationToken c
nativeReadsEnabled = adminMigrationOptions.NativeReadsEnabled,
nativeOrganizationWritesEnabled = adminMigrationOptions.NativeOrganizationWritesEnabled,
nativeAccountBatchesEnabled = adminMigrationOptions.NativeAccountBatchesEnabled,
nativeConfigurationEnabled = adminMigrationOptions.NativeConfigurationEnabled,
nativeRoutes = (adminMigrationOptions.NativeReadsEnabled
? new[] { "GET context", "GET dashboard", "GET schools", "GET school-organization", "GET admins", "GET exams" }
: [])
@@ -117,6 +119,9 @@ app.MapGet("/health/migration", async (LegacyApiProxy proxy, CancellationToken c
.Concat(adminMigrationOptions.NativeAccountBatchesEnabled
? new[] { "GET/POST/PATCH candidate-account-batches" }
: [])
.Concat(adminMigrationOptions.NativeConfigurationEnabled
? new[] { "GET/POST number-rules", "GET/PUT workflows" }
: [])
.ToArray()
},
features = MigrationFeatureCatalog.Current(authenticationOptions.NativeEnabled, candidateMigrationOptions.NativeEnabled)
+2 -1
View File
@@ -12,7 +12,8 @@
"AdminMigration": {
"NativeReadsEnabled": false,
"NativeOrganizationWritesEnabled": false,
"NativeAccountBatchesEnabled": false
"NativeAccountBatchesEnabled": false,
"NativeConfigurationEnabled": false
},
"Logging": {
"LogLevel": {