check_uncovered.ps1 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # 找出未被当前 excludeFilters 覆盖的冲突
  2. $excludedPatterns = @(
  3. "com\.fs\.framework\.web\.service\.UserDetailsServiceImpl",
  4. "com\.fs\.api\.controller\..*",
  5. "com\.fs\.web\.controller\..*",
  6. "com\.fs\.his\.controller\.FsFollowController",
  7. "com\.fs\.his\.controller\.FsFollowReportController",
  8. "com\.fs\.his\.controller\.FsUserOnlineStateController",
  9. "com\.fs\.his\.controller\.FsMaterialGroupController",
  10. "com\.fs\.his\.controller\.FsMaterialController",
  11. "com\.fs\.his\.controller\.FsUserOperationLogController",
  12. "com\.fs\.his\.controller\.FsDoctorController",
  13. "com\.fs\.his\.controller\.FsStoreOrderBillLogController",
  14. "com\.fs\.admin\.controller\..*",
  15. "com\.fs\.admin\.helper\..*",
  16. "com\.fs\.company\.controller\.chat\..*",
  17. "com\.fs\.chat\.controller\.FastGptRoleController",
  18. "com\.fs\.crm\.controller\..*",
  19. "com\.fs\.course\.controller\..*",
  20. "com\.fs\.qw\.controller\..*",
  21. "com\.fs\.live\.controller\..*",
  22. "com\.fs\.newAdv\.controller\..*",
  23. "com\.fs\.company\.controller\.hisStore\..*",
  24. "com\.fs\.user\.controller\..*",
  25. "com\.fs\.proxy\.controller\..*",
  26. "com\.fs\.fastGpt\.[^.]+",
  27. "com\.fs\.fastgptApi\.[^.]+",
  28. "com\.fs\.company\.controller\.transfer\..*",
  29. "com\.fs\.task\.[^.]+",
  30. "com\.fs\.ad\.controller\..*",
  31. "com\.fs\.third\.controller\..*",
  32. "com\.fs\.quartz\.saas\.QuartzSaaSConfig"
  33. )
  34. $saasRoot = "d:\ylrz\ylrz_saas_his_scrm\fs-admin-saas\src\main\java\com\fs"
  35. $companyRoot = "d:\ylrz\ylrz_saas_his_scrm\fs-company\src\main\java\com\fs"
  36. # 收集 fs-company 自身的所有控制器映射路径
  37. $companyMaps = @{}
  38. Get-ChildItem $companyRoot -Recurse -Filter "*Controller.java" | ForEach-Object {
  39. $content = Get-Content $_.FullName -Raw
  40. if ($content -match '@RequestMapping\("([^"]+)"\)') {
  41. $path = $Matches[1]
  42. $className = $_.BaseName
  43. $content -match '(?s)^package\s+([^;]+)' | Out-Null; $pkg = $Matches[1]
  44. $fqn = "$pkg.$className"
  45. $companyMaps[$path] = $fqn
  46. }
  47. }
  48. # 收集未被排除的冲突
  49. $uncoveredConflicts = @()
  50. Get-ChildItem $saasRoot -Recurse -Filter "*Controller.java" | ForEach-Object {
  51. $content = Get-Content $_.FullName -Raw
  52. if ($content -match '@Profile\("admin"\)') { return }
  53. if ($content -match '@RequestMapping\("([^"]+)"\)') {
  54. $path = $Matches[1]
  55. $className = $_.BaseName
  56. $content -match '(?s)^package\s+([^;]+)' | Out-Null; $pkg = $Matches[1]
  57. $fqn = "$pkg.$className"
  58. # 检查是否被排除
  59. $excluded = $false
  60. foreach ($pattern in $excludedPatterns) {
  61. if ($fqn -match $pattern) { $excluded = $true; break }
  62. }
  63. if (-not $excluded -and $companyMaps.ContainsKey($path)) {
  64. $uncoveredConflicts += "UNCOVERED: $fqn vs $($companyMaps[$path]) = $path"
  65. }
  66. }
  67. }
  68. "Found $($uncoveredConflicts.Count) uncovered conflicts:"
  69. $uncoveredConflicts | ForEach-Object { $_ }