LingWeiConfig.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. package com.lqkj.common.config;
  2. import org.springframework.boot.context.properties.ConfigurationProperties;
  3. import org.springframework.stereotype.Component;
  4. /**
  5. * 读取项目相关配置
  6. *
  7. * @author lh
  8. */
  9. @Component
  10. @ConfigurationProperties(prefix = "lingwei")
  11. public class LingWeiConfig {
  12. /** 项目名称 */
  13. private String name;
  14. /** 版本 */
  15. private String version;
  16. /** 版权年份 */
  17. private String copyrightYear;
  18. /** 实例演示开关 */
  19. private boolean demoEnabled;
  20. /** 上传路径 */
  21. private static String profile;
  22. /** 获取地址开关 */
  23. private static boolean addressEnabled;
  24. public String getName()
  25. {
  26. return name;
  27. }
  28. public void setName(String name)
  29. {
  30. this.name = name;
  31. }
  32. public String getVersion()
  33. {
  34. return version;
  35. }
  36. public void setVersion(String version)
  37. {
  38. this.version = version;
  39. }
  40. public String getCopyrightYear()
  41. {
  42. return copyrightYear;
  43. }
  44. public void setCopyrightYear(String copyrightYear)
  45. {
  46. this.copyrightYear = copyrightYear;
  47. }
  48. public boolean isDemoEnabled()
  49. {
  50. return demoEnabled;
  51. }
  52. public void setDemoEnabled(boolean demoEnabled)
  53. {
  54. this.demoEnabled = demoEnabled;
  55. }
  56. public static String getProfile()
  57. {
  58. return profile;
  59. }
  60. public void setProfile(String profile)
  61. {
  62. LingWeiConfig.profile = profile;
  63. }
  64. public static boolean isAddressEnabled()
  65. {
  66. return addressEnabled;
  67. }
  68. public void setAddressEnabled(boolean addressEnabled)
  69. {
  70. LingWeiConfig.addressEnabled = addressEnabled;
  71. }
  72. /**
  73. * 获取导入上传路径
  74. */
  75. public static String getImportPath()
  76. {
  77. return getProfile() + "/import";
  78. }
  79. /**
  80. * 获取头像上传路径
  81. */
  82. public static String getAvatarPath()
  83. {
  84. return getProfile() + "/avatar";
  85. }
  86. /**
  87. * 获取下载路径
  88. */
  89. public static String getDownloadPath()
  90. {
  91. return getProfile() + "/download/";
  92. }
  93. /**
  94. * 获取上传路径
  95. */
  96. public static String getUploadPath()
  97. {
  98. return getProfile() + "/upload";
  99. }
  100. }