# 检查队列状态的PowerShell脚本 Write-Host "=== 检查应用状态 ===" -ForegroundColor Green $port8080 = netstat -ano | findstr :8080 if ($port8080) { Write-Host "✅ 应用正在运行 (端口8080)" -ForegroundColor Green } else { Write-Host "❌ 应用未运行 (端口8080)" -ForegroundColor Red } Write-Host "`n=== 检查Java进程 ===" -ForegroundColor Green $javaProcesses = Get-Process | Where-Object {$_.ProcessName -like "*java*"} if ($javaProcesses) { Write-Host "✅ 找到Java进程:" -ForegroundColor Green $javaProcesses | Select-Object Id, ProcessName, CPU | Format-Table } else { Write-Host "❌ 没有找到Java进程" -ForegroundColor Red } Write-Host "`n=== 尝试启动应用 ===" -ForegroundColor Yellow try { Write-Host "启动Spring Boot应用..." -ForegroundColor Yellow Start-Process -FilePath "java" -ArgumentList "-jar", "target/demo-0.0.1-SNAPSHOT.jar", "--spring.profiles.active=dev" -WindowStyle Hidden Write-Host "✅ 应用启动命令已执行" -ForegroundColor Green Write-Host "等待应用启动..." -ForegroundColor Yellow Start-Sleep -Seconds 30 Write-Host "`n=== 检查应用是否启动成功 ===" -ForegroundColor Green $port8080After = netstat -ano | findstr :8080 if ($port8080After) { Write-Host "✅ 应用启动成功" -ForegroundColor Green Write-Host "`n=== 测试诊断接口 ===" -ForegroundColor Green try { $response = Invoke-WebRequest -Uri "http://localhost:8080/api/diagnostic/queue-status" -Method GET -TimeoutSec 10 Write-Host "✅ 诊断接口响应成功" -ForegroundColor Green Write-Host "响应内容:" -ForegroundColor Yellow $response.Content | ConvertFrom-Json | ConvertTo-Json -Depth 3 } catch { Write-Host "❌ 诊断接口调用失败: $($_.Exception.Message)" -ForegroundColor Red } } else { Write-Host "❌ 应用启动失败" -ForegroundColor Red } } catch { Write-Host "❌ 启动应用失败: $($_.Exception.Message)" -ForegroundColor Red } Write-Host "`n=== 检查完成 ===" -ForegroundColor Green