PurchaseConfig.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. package com.ozs.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 = "purchase")
  11. public class PurchaseConfig
  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 boolean addressEnabled;
  25. /** 验证码类型 */
  26. private static String captchaType;
  27. /** 获取权限开关 */
  28. private static boolean permissionsEnable;
  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. PurchaseConfig.profile = profile;
  68. }
  69. public static boolean isAddressEnabled()
  70. {
  71. return addressEnabled;
  72. }
  73. public void setAddressEnabled(boolean addressEnabled)
  74. {
  75. PurchaseConfig.addressEnabled = addressEnabled;
  76. }
  77. public static String getCaptchaType() {
  78. return captchaType;
  79. }
  80. public void setCaptchaType(String captchaType) {
  81. PurchaseConfig.captchaType = captchaType;
  82. }
  83. public static boolean isPermissionsEnable()
  84. {
  85. return permissionsEnable;
  86. }
  87. public void setPermissionsEnable(boolean permissionsEnable)
  88. {
  89. PurchaseConfig.permissionsEnable = permissionsEnable;
  90. }
  91. /**
  92. * 获取导入上传路径
  93. */
  94. public static String getImportPath()
  95. {
  96. return getProfile() + "/import";
  97. }
  98. /**
  99. * 获取头像上传路径
  100. */
  101. public static String getAvatarPath()
  102. {
  103. return getProfile() + "/avatar";
  104. }
  105. /**
  106. * 获取下载路径
  107. */
  108. public static String getDownloadPath()
  109. {
  110. return getProfile() + "/upload/";
  111. }
  112. /**
  113. * 获取上传路径
  114. */
  115. public static String getUploadPath()
  116. {
  117. return getProfile() + "/upload";
  118. }
  119. }