本批“工作流调度”迁移完成:
GET /api/admin/workflow-instances
PATCH /api/admin/workflow-instances/{id}/transfer
PATCH /api/admin/workflow-instances/{id}/supervise
覆盖资料变更、报名审核、考点变更、批量报名号和成绩复议五类流程,并实现同级转交、范围校验、超级管理员监督回退及业务状态同步重置。
This commit is contained in:
@@ -445,6 +445,7 @@ try {
|
||||
ADMIN_NATIVE_OPERATIONAL_READS_ENABLED = 'true'
|
||||
ADMIN_NATIVE_CANDIDATE_MANAGEMENT_ENABLED = 'true'
|
||||
ADMIN_NATIVE_REGISTRATION_PAYMENT_WRITES_ENABLED = 'true'
|
||||
ADMIN_NATIVE_WORKFLOW_OPERATIONS_ENABLED = 'true'
|
||||
ADMIN_NATIVE_ALLOW_MEMORY = 'true'
|
||||
LegacyNode__Enabled = 'true'
|
||||
LegacyNode__BaseUrl = $legacyBaseUrl
|
||||
@@ -821,6 +822,34 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($workflowSession in $operationalSessions) {
|
||||
$legacyWorkflowRead = Invoke-WebRequest -Uri "$legacyBaseUrl/api/admin/workflow-instances" -WebSession $workflowSession.Legacy
|
||||
$nativeWorkflowRead = Invoke-WebRequest -Uri "$nativeAuthBaseUrl/api/admin/workflow-instances" -WebSession $workflowSession.Native
|
||||
if ($nativeWorkflowRead.Headers['X-EIS-Implementation'] -ne 'aspnet-core') {
|
||||
throw "Workflow inbox for $($workflowSession.Level) admin did not use ASP.NET Core"
|
||||
}
|
||||
Assert-JsonEquivalent -Expected $legacyWorkflowRead.Content -Actual $nativeWorkflowRead.Content -Label "Workflow inbox for $($workflowSession.Level) admin"
|
||||
}
|
||||
$workflowState = Invoke-RestMethod -Uri "$nativeAuthBaseUrl/api/admin/workflow-instances" -WebSession $nativeSession
|
||||
$transferInstance = @($workflowState.instances | Where-Object { $_.status -eq 'pending' -and $_.assigneeId } | Select-Object -First 1)[0]
|
||||
if ($null -eq $transferInstance) {
|
||||
throw 'Seed data did not provide a pending workflow for transfer testing'
|
||||
}
|
||||
$invalidTransferBody = @{ assigneeId = 'missing-admin'; note = '无效转交测试' } | ConvertTo-Json -Compress
|
||||
$invalidTransfer = Invoke-WebRequest -Uri "$nativeAuthBaseUrl/api/admin/workflow-instances/$($transferInstance.id)/transfer" -Method Patch -ContentType 'application/json' -Body $invalidTransferBody -WebSession $nativeSession -SkipHttpErrorCheck
|
||||
if ($invalidTransfer.StatusCode -ne 400 -or $invalidTransfer.Headers['X-EIS-Implementation'] -ne 'aspnet-core') {
|
||||
throw 'Native workflow transfer accepted an invalid target administrator'
|
||||
}
|
||||
$transferBody = @{ assigneeId = $transferInstance.assigneeId; note = '原生同级转交验证' } | ConvertTo-Json -Compress
|
||||
$transferResponse = Invoke-WebRequest -Uri "$nativeAuthBaseUrl/api/admin/workflow-instances/$($transferInstance.id)/transfer" -Method Patch -ContentType 'application/json' -Body $transferBody -WebSession $nativeSession
|
||||
$transferredWorkflow = ($transferResponse.Content | ConvertFrom-Json).workflow
|
||||
if ($transferResponse.Headers['X-EIS-Implementation'] -ne 'aspnet-core' -or $transferredWorkflow.assigneeId -ne $transferInstance.assigneeId -or @($transferredWorkflow.actions | Select-Object -Last 1)[0].action -ne 'transfer') {
|
||||
throw 'Native workflow transfer did not persist its action and assignee'
|
||||
}
|
||||
$legacyWorkflowsAfterTransfer = Invoke-WebRequest -Uri "$legacyBaseUrl/api/admin/workflow-instances" -WebSession $session
|
||||
$nativeWorkflowsAfterTransfer = Invoke-WebRequest -Uri "$nativeAuthBaseUrl/api/admin/workflow-instances" -WebSession $nativeSession
|
||||
Assert-JsonEquivalent -Expected $legacyWorkflowsAfterTransfer.Content -Actual $nativeWorkflowsAfterTransfer.Content -Label 'Workflow transfer follow-up'
|
||||
|
||||
$archiveBody = @{
|
||||
scopeType = 'class'
|
||||
scopeValue = $profileUpdate.profile.classId
|
||||
@@ -965,6 +994,27 @@ try {
|
||||
$nativePaymentsAfterReversal = Invoke-WebRequest -Uri "$nativeAuthBaseUrl/api/admin/payments" -WebSession $nativeSession
|
||||
Assert-JsonEquivalent -Expected $legacyPaymentsAfterReversal.Content -Actual $nativePaymentsAfterReversal.Content -Label 'Payment reversal follow-up'
|
||||
|
||||
$schoolSuperviseForbidden = Invoke-WebRequest -Uri "$nativeAuthBaseUrl/api/admin/workflow-instances/$($registrationReview.workflow.id)/supervise" -Method Patch -ContentType 'application/json' -Body '{}' -WebSession $nativeSchoolSession -SkipHttpErrorCheck
|
||||
if ($schoolSuperviseForbidden.StatusCode -ne 403 -or $schoolSuperviseForbidden.Headers['X-EIS-Implementation'] -ne 'aspnet-core') {
|
||||
throw 'Native workflow supervision did not preserve the super-admin boundary'
|
||||
}
|
||||
$superviseBody = @{ currentStep = 1; note = '原生监督重新打开报名流程' } | ConvertTo-Json -Compress
|
||||
$superviseResponse = Invoke-WebRequest -Uri "$nativeAuthBaseUrl/api/admin/workflow-instances/$($registrationReview.workflow.id)/supervise" -Method Patch -ContentType 'application/json' -Body $superviseBody -WebSession $nativeSession
|
||||
$supervisedWorkflow = ($superviseResponse.Content | ConvertFrom-Json).workflow
|
||||
if ($superviseResponse.Headers['X-EIS-Implementation'] -ne 'aspnet-core' -or $supervisedWorkflow.status -ne 'pending' -or $supervisedWorkflow.currentStep -ne 1 -or @($supervisedWorkflow.actions | Select-Object -Last 1)[0].action -ne 'return') {
|
||||
throw 'Native workflow supervision did not reopen the completed registration at step 1'
|
||||
}
|
||||
$registrationStateAfterSupervision = Invoke-RestMethod -Uri "$nativeAuthBaseUrl/api/admin/registrations" -WebSession $nativeSession
|
||||
$supervisedRegistration = @($registrationStateAfterSupervision.registrations | Where-Object id -eq $nativeRegistration.registration.id)[0]
|
||||
if ($null -eq $supervisedRegistration -or $supervisedRegistration.status -ne 'pending' -or $supervisedRegistration.reviewedAt) {
|
||||
throw 'Native workflow supervision did not reset the registration business state'
|
||||
}
|
||||
foreach ($workflowSession in $operationalSessions) {
|
||||
$legacyWorkflowAfterSupervision = Invoke-WebRequest -Uri "$legacyBaseUrl/api/admin/workflow-instances" -WebSession $workflowSession.Legacy
|
||||
$nativeWorkflowAfterSupervision = Invoke-WebRequest -Uri "$nativeAuthBaseUrl/api/admin/workflow-instances" -WebSession $workflowSession.Native
|
||||
Assert-JsonEquivalent -Expected $legacyWorkflowAfterSupervision.Content -Actual $nativeWorkflowAfterSupervision.Content -Label "Workflow supervision follow-up for $($workflowSession.Level) admin"
|
||||
}
|
||||
|
||||
$legacyCenters = Invoke-WebRequest -Uri "$legacyBaseUrl/api/admin/centers" -WebSession $session
|
||||
$nativeCenters = Invoke-WebRequest -Uri "$nativeAuthBaseUrl/api/admin/centers" -WebSession $nativeSession
|
||||
if ($nativeCenters.Headers['X-EIS-Implementation'] -ne 'aspnet-core') {
|
||||
@@ -1436,6 +1486,7 @@ try {
|
||||
NativeAdminOperationalReads = 'passed'
|
||||
NativeAdminCandidateManagement = 'passed'
|
||||
NativeAdminRegistrationPaymentWrites = 'passed'
|
||||
NativeAdminWorkflowOperations = 'passed'
|
||||
} | Format-List
|
||||
}
|
||||
finally {
|
||||
|
||||
Reference in New Issue
Block a user