analyze_final.ps1 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # Filter meaningful 404 and 500 errors (exclude DELETE without ID, trailing slash, etc.)
  2. $content = Get-Content "d:\ylrz\saasadminui\api_test_v2_results.txt" -Raw
  3. $sections = $content -split "=== "
  4. $notFound = @()
  5. $serverErr = @()
  6. foreach ($section in $sections) {
  7. if ($section.StartsWith("404")) {
  8. $notFound = ($section -split "`n" | Where-Object { $_.Trim() -ne "" -and $_ -notmatch "^404" })
  9. } elseif ($section.StartsWith("500")) {
  10. $serverErr = ($section -split "`n" | Where-Object { $_.Trim() -ne "" -and $_ -notmatch "^500" })
  11. }
  12. }
  13. # Filter 404: only GET and POST (these are the real page/list queries)
  14. $meaningful404 = $notFound | Where-Object { $_ -match "^(GET|POST)\s+" }
  15. $delete404 = $notFound | Where-Object { $_ -match "^DELETE\s+" }
  16. $put404 = $notFound | Where-Object { $_ -match "^PUT\s+" }
  17. Write-Host "=== 404 Breakdown ==="
  18. Write-Host "GET/POST 404: $($meaningful404.Count) <-- REAL ISSUES"
  19. Write-Host "DELETE 404: $($delete404.Count)"
  20. Write-Host "PUT 404: $($put404.Count)"
  21. # Filter 500: categorize by error type
  22. $methodNotSupported = $serverErr | Where-Object { $_ -match "not supported" }
  23. $numberFormat = $serverErr | Where-Object { $_ -match "NumberFormatException|Failed to convert" }
  24. $bodyMissing = $serverErr | Where-Object { $_ -match "Required request body is missing|Required request parameter" }
  25. $businessErr = $serverErr | Where-Object { $_ -match "操作失败|业务" }
  26. $mybatisErr = $serverErr | Where-Object { $_ -match "mybatis|BuilderException|ReflectionException" }
  27. $jsonErr = $serverErr | Where-Object { $_ -match "JSON parse error|Cannot deserialize" }
  28. $other500 = $serverErr | Where-Object {
  29. $_ -notmatch "not supported" -and
  30. $_ -notmatch "NumberFormatException|Failed to convert" -and
  31. $_ -notmatch "Required request body|Required request parameter" -and
  32. $_ -notmatch "操作失败" -and
  33. $_ -notmatch "mybatis|BuilderException|ReflectionException" -and
  34. $_ -notmatch "JSON parse error|Cannot deserialize"
  35. }
  36. Write-Host "`n=== 500 Breakdown ==="
  37. Write-Host "Method not supported: $($methodNotSupported.Count) <-- Test artifact, not real error"
  38. Write-Host "NumberFormatException (path var mismatch): $($numberFormat.Count) <-- Path variable issue"
  39. Write-Host "Missing request body/param: $($bodyMissing.Count) <-- Test artifact, needs proper params"
  40. Write-Host "Business error: $($businessErr.Count) <-- REAL ISSUES"
  41. Write-Host "MyBatis error: $($mybatisErr.Count) <-- REAL ISSUES (SQL/mapping problems)"
  42. Write-Host "JSON deserialize error: $($jsonErr.Count) <-- REAL ISSUES"
  43. Write-Host "Other 500: $($other500.Count) <-- NEEDS INVESTIGATION"
  44. # Show GET/POST 404 by module
  45. Write-Host "`n=== GET/POST 404 by Module ==="
  46. $nfByMod = @{}
  47. foreach ($line in $meaningful404) {
  48. if ($line -match "\s+/([^/]+)/") {
  49. $mod = $Matches[1]
  50. if (-not $nfByMod.ContainsKey($mod)) { $nfByMod[$mod] = 0 }
  51. $nfByMod[$mod]++
  52. }
  53. }
  54. $nfByMod.GetEnumerator() | Sort-Object Value -Descending | ForEach-Object { Write-Host " $($_.Key): $($_.Value)" }
  55. # Show MyBatis errors detail
  56. Write-Host "`n=== MyBatis Errors ==="
  57. $mybatisErr | ForEach-Object { Write-Host " $_" }
  58. # Show real business errors
  59. Write-Host "`n=== Business Errors ==="
  60. $businessErr | Select-Object -First 20 | ForEach-Object { Write-Host " $_" }
  61. # Show other 500 that need investigation
  62. Write-Host "`n=== Other 500 Errors (need investigation) ==="
  63. $other500 | Select-Object -First 20 | ForEach-Object { Write-Host " $_" }
  64. # Show meaningful 404 samples
  65. Write-Host "`n=== GET/POST 404 Samples ==="
  66. $meaningful404 | Sort-Object | Select-Object -First 40 | ForEach-Object { Write-Host " $_" }
  67. # Real error count summary
  68. $real404 = $meaningful404.Count
  69. $real500 = $businessErr.Count + $mybatisErr.Count + $jsonErr.Count + $other500.Count
  70. $testArtifact500 = $methodNotSupported.Count + $numberFormat.Count + $bodyMissing.Count
  71. Write-Host "`n========================================"
  72. Write-Host "=== REAL ERROR SUMMARY ==="
  73. Write-Host "========================================"
  74. Write-Host "Real 404 (GET/POST paths missing): $real404"
  75. Write-Host "Real 500 (business/mybatis/json/other): $real500"
  76. Write-Host "Test artifact 500 (method/param mismatch): $testArtifact500"
  77. Write-Host ""
  78. Write-Host "Total real issues to fix: $($real404 + $real500)"