已完成管理后台第四批 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
+50
View File
@@ -425,6 +425,7 @@ try {
ADMIN_NATIVE_READS_ENABLED = 'true'
ADMIN_NATIVE_ORGANIZATION_WRITES_ENABLED = 'true'
ADMIN_NATIVE_ACCOUNT_BATCHES_ENABLED = 'true'
ADMIN_NATIVE_CONFIGURATION_ENABLED = 'true'
ADMIN_NATIVE_ALLOW_MEMORY = 'true'
LegacyNode__Enabled = 'true'
LegacyNode__BaseUrl = $legacyBaseUrl
@@ -739,6 +740,54 @@ try {
throw 'Native admins route did not preserve the class-admin boundary'
}
foreach ($configurationRoute in @('number-rules', 'workflows')) {
$legacyConfiguration = Invoke-WebRequest -Uri "$legacyBaseUrl/api/admin/$configurationRoute" -WebSession $session
$nativeConfiguration = Invoke-WebRequest -Uri "$nativeAuthBaseUrl/api/admin/$configurationRoute" -WebSession $nativeSession
if ($nativeConfiguration.Headers['X-EIS-Implementation'] -ne 'aspnet-core') {
throw "Native admin configuration route '$configurationRoute' did not use ASP.NET Core"
}
Assert-JsonEquivalent -Expected $legacyConfiguration.Content -Actual $nativeConfiguration.Content -Label "Admin configuration '$configurationRoute'"
}
foreach ($configurationRoute in @('number-rules', 'workflows')) {
$schoolConfigurationForbidden = Invoke-WebRequest -Uri "$nativeAuthBaseUrl/api/admin/$configurationRoute" -WebSession $nativeSchoolSession -SkipHttpErrorCheck
if ($schoolConfigurationForbidden.StatusCode -ne 403) {
throw "Admin configuration route '$configurationRoute' did not preserve the super-admin boundary"
}
}
$numberRuleState = Invoke-RestMethod -Uri "$nativeAuthBaseUrl/api/admin/number-rules" -WebSession $nativeSession
$activeNumberRule = $numberRuleState.activeRule
$numberRuleBody = @{
id = $activeNumberRule.id
name = '原生年度学校流水号'
separator = $activeNumberRule.separator
segments = @($activeNumberRule.segments | ForEach-Object {
@{ type = $_.type; value = $_.value; width = $_.width }
})
} | ConvertTo-Json -Depth 5 -Compress
$savedNumberRule = Invoke-WebRequest -Uri "$nativeAuthBaseUrl/api/admin/number-rules" -Method Post -ContentType 'application/json' -Body $numberRuleBody -WebSession $nativeSession
if ($savedNumberRule.Headers['X-EIS-Implementation'] -ne 'aspnet-core' -or ($savedNumberRule.Content | ConvertFrom-Json).rule.name -ne '原生年度学校流水号') {
throw 'Native number-rule update did not persist the requested definition'
}
$workflowState = Invoke-RestMethod -Uri "$nativeAuthBaseUrl/api/admin/workflows" -WebSession $nativeSession
$accountWorkflow = @($workflowState.workflows | Where-Object { $_.businessType -eq 'candidate_account_batch' })[0]
$invalidWorkflowBody = @{ name = '无效流程'; steps = @(@{ name = '学校终审'; adminLevel = 'school' }) } | ConvertTo-Json -Depth 4 -Compress
$invalidWorkflow = Invoke-WebRequest -Uri "$nativeAuthBaseUrl/api/admin/workflows/candidate_account_batch" -Method Put -ContentType 'application/json' -Body $invalidWorkflowBody -WebSession $nativeSession -SkipHttpErrorCheck
if ($invalidWorkflow.StatusCode -ne 400) {
throw 'Native workflow update allowed a non-super final account-batch step'
}
$workflowBody = @{
name = '原生批量报名号审批'
steps = @($accountWorkflow.steps | ForEach-Object {
@{ name = $_.name; adminLevel = $_.adminLevel }
})
} | ConvertTo-Json -Depth 5 -Compress
$savedWorkflow = Invoke-WebRequest -Uri "$nativeAuthBaseUrl/api/admin/workflows/candidate_account_batch" -Method Put -ContentType 'application/json' -Body $workflowBody -WebSession $nativeSession
if ($savedWorkflow.Headers['X-EIS-Implementation'] -ne 'aspnet-core' -or ($savedWorkflow.Content | ConvertFrom-Json).workflow.name -ne '原生批量报名号审批') {
throw 'Native workflow update did not persist the account-batch definition'
}
$legacySuperBatches = Invoke-WebRequest -Uri "$legacyBaseUrl/api/admin/candidate-account-batches" -WebSession $session
$nativeSuperBatches = Invoke-WebRequest -Uri "$nativeAuthBaseUrl/api/admin/candidate-account-batches" -WebSession $nativeSession
if ($nativeSuperBatches.Headers['X-EIS-Implementation'] -ne 'aspnet-core') {
@@ -989,6 +1038,7 @@ try {
NativeAdminReads = 'passed'
NativeAdminOrganizationWrites = 'passed'
NativeAdminAccountBatches = 'passed'
NativeAdminConfiguration = 'passed'
} | Format-List
}
finally {