check_conflicts.ps1 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # 全面检查 fs-admin-saas 中所有控制器与 fs-company 自身控制器的映射冲突
  2. $saasRoot = "d:\ylrz\ylrz_saas_his_scrm\fs-admin-saas\src\main\java\com\fs"
  3. $companyRoot = "d:\ylrz\ylrz_saas_his_scrm\fs-company\src\main\java\com\fs"
  4. # 收集 fs-company 自身的所有控制器映射路径
  5. $companyMaps = @{}
  6. Get-ChildItem $companyRoot -Recurse -Filter "*Controller.java" | ForEach-Object {
  7. $content = Get-Content $_.FullName -Raw
  8. if ($content -match '@RequestMapping\("([^"]+)"\)') {
  9. $path = $Matches[1]
  10. $className = $_.BaseName
  11. $pkg = $content -match '(?s)^package\s+([^;]+)' | Out-Null; $pkg = $Matches[1]
  12. $fqn = "$pkg.$className"
  13. $companyMaps[$path] = $fqn
  14. }
  15. }
  16. # 收集 fs-admin-saas 中所有控制器(排除有 @Profile("admin") 的)
  17. $conflicts = @()
  18. Get-ChildItem $saasRoot -Recurse -Filter "*Controller.java" | ForEach-Object {
  19. $content = Get-Content $_.FullName -Raw
  20. if ($content -match '@Profile\("admin"\)') { return }
  21. if ($content -match '@RequestMapping\("([^"]+)"\)') {
  22. $path = $Matches[1]
  23. $className = $_.BaseName
  24. $content -match '(?s)^package\s+([^;]+)' | Out-Null; $pkg = $Matches[1]
  25. $fqn = "$pkg.$className"
  26. if ($companyMaps.ContainsKey($path)) {
  27. $conflicts += "CONFLICT: $fqn vs $($companyMaps[$path]) = $path"
  28. }
  29. }
  30. }
  31. "Found $($conflicts.Count) conflicts:"
  32. $conflicts | ForEach-Object { $_ }