| 1234567891011121314151617181920212223242526272829303132333435 |
- # 全面检查 fs-admin-saas 中所有控制器与 fs-company 自身控制器的映射冲突
- $saasRoot = "d:\ylrz\ylrz_saas_his_scrm\fs-admin-saas\src\main\java\com\fs"
- $companyRoot = "d:\ylrz\ylrz_saas_his_scrm\fs-company\src\main\java\com\fs"
- # 收集 fs-company 自身的所有控制器映射路径
- $companyMaps = @{}
- Get-ChildItem $companyRoot -Recurse -Filter "*Controller.java" | ForEach-Object {
- $content = Get-Content $_.FullName -Raw
- if ($content -match '@RequestMapping\("([^"]+)"\)') {
- $path = $Matches[1]
- $className = $_.BaseName
- $pkg = $content -match '(?s)^package\s+([^;]+)' | Out-Null; $pkg = $Matches[1]
- $fqn = "$pkg.$className"
- $companyMaps[$path] = $fqn
- }
- }
- # 收集 fs-admin-saas 中所有控制器(排除有 @Profile("admin") 的)
- $conflicts = @()
- Get-ChildItem $saasRoot -Recurse -Filter "*Controller.java" | ForEach-Object {
- $content = Get-Content $_.FullName -Raw
- if ($content -match '@Profile\("admin"\)') { return }
- if ($content -match '@RequestMapping\("([^"]+)"\)') {
- $path = $Matches[1]
- $className = $_.BaseName
- $content -match '(?s)^package\s+([^;]+)' | Out-Null; $pkg = $Matches[1]
- $fqn = "$pkg.$className"
- if ($companyMaps.ContainsKey($path)) {
- $conflicts += "CONFLICT: $fqn vs $($companyMaps[$path]) = $path"
- }
- }
- }
- "Found $($conflicts.Count) conflicts:"
- $conflicts | ForEach-Object { $_ }
|