RuoYiConfig.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. package com.ruoyi.common.config;
  2. import org.springframework.boot.context.properties.ConfigurationProperties;
  3. import org.springframework.stereotype.Component;
  4. /**
  5. * 读取项目相关配置
  6. *
  7. * @author ruoyi
  8. */
  9. @Component
  10. @ConfigurationProperties(prefix = "ruoyi")
  11. public class RuoYiConfig
  12. {
  13. /** 项目名称 */
  14. private String name;
  15. /** 版本 */
  16. private String version;
  17. /** 版权年份 */
  18. private String copyrightYear;
  19. /** 实例演示开关 */
  20. private boolean demoEnabled;
  21. /** 上传路径 */
  22. private static String profile;
  23. /** 人脸照片地址 */
  24. private static String faceUrl;
  25. /** 获取地址开关 */
  26. private static boolean addressEnabled;
  27. /** 验证码类型 */
  28. private static String captchaType;
  29. public String getName()
  30. {
  31. return name;
  32. }
  33. public void setName(String name)
  34. {
  35. this.name = name;
  36. }
  37. public String getVersion()
  38. {
  39. return version;
  40. }
  41. public void setVersion(String version)
  42. {
  43. this.version = version;
  44. }
  45. public String getCopyrightYear()
  46. {
  47. return copyrightYear;
  48. }
  49. public void setCopyrightYear(String copyrightYear)
  50. {
  51. this.copyrightYear = copyrightYear;
  52. }
  53. public boolean isDemoEnabled()
  54. {
  55. return demoEnabled;
  56. }
  57. public void setDemoEnabled(boolean demoEnabled)
  58. {
  59. this.demoEnabled = demoEnabled;
  60. }
  61. public static String getProfile()
  62. {
  63. return profile;
  64. }
  65. public void setProfile(String profile)
  66. {
  67. RuoYiConfig.profile = profile;
  68. }
  69. public static boolean isAddressEnabled()
  70. {
  71. return addressEnabled;
  72. }
  73. public void setAddressEnabled(boolean addressEnabled)
  74. {
  75. RuoYiConfig.addressEnabled = addressEnabled;
  76. }
  77. public static String getCaptchaType() {
  78. return captchaType;
  79. }
  80. public void setCaptchaType(String captchaType) {
  81. RuoYiConfig.captchaType = captchaType;
  82. }
  83. public static String getFaceUrl() {
  84. return faceUrl;
  85. }
  86. public void setFaceUrl(String faceUrl) {
  87. RuoYiConfig.faceUrl = faceUrl;
  88. }
  89. /**
  90. * 获取导入上传路径
  91. */
  92. public static String getImportPath()
  93. {
  94. return getProfile() + "/import";
  95. }
  96. /**
  97. * 获取头像上传路径
  98. */
  99. public static String getAvatarPath()
  100. {
  101. return getProfile() + "/avatar";
  102. }
  103. /**
  104. * 获取人脸上传路径
  105. */
  106. public static String getFacePath()
  107. {
  108. return getFaceUrl() + "/face";
  109. }
  110. /**
  111. * 获取下载路径
  112. */
  113. public static String getDownloadPath()
  114. {
  115. return getProfile() + "/download/";
  116. }
  117. /**
  118. * 获取上传路径
  119. */
  120. public static String getUploadPath()
  121. {
  122. return getProfile() + "/upload";
  123. }
  124. }