GyeeConfig.java 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. package com.gyee.runeconomy.config;
  2. import com.gyee.runeconomy.dto.FiveLoss.AnnotationTool;
  3. import com.gyee.runeconomy.dto.FiveLoss.FixedVo;
  4. import com.gyee.runeconomy.dto.result.PowerPointData;
  5. import lombok.Data;
  6. import org.apache.commons.lang3.StringUtils;
  7. import org.springframework.beans.factory.annotation.Value;
  8. import org.springframework.boot.context.properties.ConfigurationProperties;
  9. import org.springframework.boot.system.ApplicationHome;
  10. import org.springframework.stereotype.Component;
  11. import java.io.File;
  12. import java.util.List;
  13. import java.util.stream.Collectors;
  14. @Data
  15. @Component
  16. @ConfigurationProperties(prefix = "gyee")
  17. public class GyeeConfig {
  18. public File jarF = null;
  19. {
  20. ApplicationHome h = new ApplicationHome(getClass());
  21. jarF = h.getSource();
  22. }
  23. /**
  24. * 数据适配器网址
  25. **/
  26. @Value("${db.url1}")
  27. private String AdapterfdUrl;
  28. @Value("${db.url1}")
  29. private String AdaptergfUrl;
  30. @Value("${db.url1}")
  31. private String TaosUrl;
  32. /**
  33. * 数据准备保存路径(原始数据)
  34. **/
  35. @Value("${powerCurveFitting.prepare}")
  36. private String filePathPrepare;
  37. /**
  38. * 数据处理保存路径(处理后的数据)
  39. **/
  40. @Value("${powerCurveFitting.process}")
  41. private String filePathProcess;
  42. /**
  43. * 数据拟合保存路径(拟合后的数据)
  44. **/
  45. @Value("${powerCurveFitting.fitting}")
  46. private String filePathFitting;
  47. /** 配置文件路径 **/
  48. @Value("${powerCurveFitting.file-path-power}")
  49. private String filePathPower;
  50. /**
  51. * 数据压缩下载
  52. **/
  53. private String filePathDownload;
  54. /**
  55. * 功率曲线拟合测点
  56. **/
  57. private String points;
  58. /**
  59. * 数据是否离线执行
  60. **/
  61. private boolean offLine;
  62. // public List<String> getPoints() {
  63. // if (null == points) {
  64. // return Collections.emptyList();
  65. // } else {
  66. // return Arrays.asList(points.split(","));
  67. // }
  68. // }
  69. public List<String> getPoints() {
  70. return getUniformCodes();
  71. }
  72. private List<String> getUniformCodes(){
  73. List<FixedVo> fxList = AnnotationTool.getFixedVoList(PowerPointData.class);
  74. List<String> codes = fxList.stream().filter(f -> !StringUtils.isEmpty(f.getUniformCode()))
  75. .map(d -> d.getUniformCode()).collect(Collectors.toList());
  76. return codes;
  77. }
  78. public String getFilePathPower() {
  79. return jarF.getParentFile().getAbsolutePath() + File.separator + filePathPower;
  80. }
  81. public void setFilePathPower(String filePathPower) {
  82. this.filePathPower = filePathPower;
  83. }
  84. public String getFilePathPrepare() {
  85. return jarF.getParentFile().getAbsolutePath() + "\\" + filePathPrepare;
  86. }
  87. public void setFilePathPrepare(String filePathPrepare) {
  88. this.filePathPrepare = filePathPrepare;
  89. }
  90. public String getFilePathProcess() {
  91. return jarF.getParentFile().getAbsolutePath() + "\\" + filePathProcess;
  92. }
  93. public void setFilePathProcess(String filePathProcess) {
  94. this.filePathProcess = filePathProcess;
  95. }
  96. public String getFilePathFitting() {
  97. return jarF.getParentFile().getAbsolutePath() + "\\" + filePathFitting;
  98. }
  99. public void setFilePathFitting(String filePathFitting) {
  100. this.filePathFitting = filePathFitting;
  101. }
  102. public String getFilePathDownload() {
  103. return jarF.getParentFile().getAbsolutePath() + "\\" + filePathDownload;
  104. }
  105. public void setFilePathDownload(String filePathDownload) {
  106. this.filePathDownload = filePathDownload;
  107. }
  108. }