fix_web_profile.ps1 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # Change @Profile("admin") to @Profile({"admin", "company"}) for non-conflicting web.controller classes
  2. # These controllers do NOT conflict with fs-company's own controllers and are needed by saasadminui
  3. $baseDir = "d:\ylrz\ylrz_saas_his_scrm\fs-admin-saas\src\main\java\com\fs\web\controller"
  4. # Non-conflicting controllers that saasadminui needs
  5. $nonConflicting = @(
  6. "system\SysUserController.java",
  7. "system\SysRoleController.java",
  8. "system\SysDeptController.java",
  9. "system\SysNoticeController.java",
  10. "system\SysPostController.java",
  11. "system\SysKeywordController.java",
  12. "system\SysProfileController.java",
  13. "system\SysUserSetController.java",
  14. "system\SysMenuController.java",
  15. "system\AdminMenuController.java",
  16. "monitor\ServerController.java",
  17. "monitor\CacheController.java",
  18. "monitor\SysUserOnlineController.java",
  19. "system\SysIndexController.java",
  20. "tool\SwaggerController.java",
  21. "tool\TestController.java"
  22. )
  23. $totalFixed = 0
  24. foreach ($file in $nonConflicting) {
  25. $fullPath = Join-Path $baseDir $file
  26. if (-not (Test-Path $fullPath)) {
  27. Write-Host "SKIP: $fullPath not found"
  28. continue
  29. }
  30. $content = [System.IO.File]::ReadAllText($fullPath)
  31. if ($content -match '@Profile\("admin"\)') {
  32. $newContent = $content -replace '@Profile\("admin"\)', '@Profile({"admin", "company"})'
  33. $utf8NoBom = New-Object System.Text.UTF8Encoding($false)
  34. [System.IO.File]::WriteAllText($fullPath, $newContent, $utf8NoBom)
  35. $totalFixed++
  36. Write-Host "FIXED: $file"
  37. } else {
  38. Write-Host "SKIP (no @Profile admin): $file"
  39. }
  40. }
  41. # Also fix the api/controller/StatisticManageController - it was excluded by excludeFilters
  42. # but now we excluded the whole api.controller package. Let's check if it's needed.
  43. $apiController = "d:\ylrz\ylrz_saas_his_scrm\fs-admin-saas\src\main\java\com\fs\api\controller\StatisticManageController.java"
  44. if (Test-Path $apiController) {
  45. $content = [System.IO.File]::ReadAllText($apiController)
  46. if ($content -match '@Profile\("admin"\)') {
  47. Write-Host "SKIP: StatisticManageController is excluded by package-level excludeFilters, cannot be enabled via @Profile"
  48. }
  49. }
  50. Write-Host "`nTotal files fixed: $totalFixed"