GyeeConfig.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. package com.gyee.power.fitting.common.config;
  2. import com.gyee.power.fitting.model.anno.AnnotationTool;
  3. import com.gyee.power.fitting.model.anno.FixedVo;
  4. import com.gyee.power.fitting.model.custom.PowerPointData;
  5. import lombok.Data;
  6. import org.apache.commons.lang3.StringUtils;
  7. import org.springframework.boot.context.properties.ConfigurationProperties;
  8. import org.springframework.boot.system.ApplicationHome;
  9. import org.springframework.core.annotation.Order;
  10. import org.springframework.stereotype.Component;
  11. import java.io.File;
  12. import java.util.List;
  13. import java.util.Map;
  14. import java.util.stream.Collectors;
  15. @Data
  16. @Order(0)
  17. @Component
  18. @ConfigurationProperties(prefix = "gyee")
  19. public class GyeeConfig {
  20. public File jarF = null;
  21. {
  22. ApplicationHome h = new ApplicationHome(getClass());
  23. jarF = h.getSource();
  24. //jarF = new File("D:\\java\\sis-background\\power-fitting\\target\\classes");
  25. }
  26. /** 数据适配器网址 **/
  27. private String adapterfdUrl;
  28. private String adaptergfUrl;
  29. /** 数据准备保存路径(原始数据) **/
  30. private String filePathPrepare;
  31. /** 数据处理保存路径(处理后的数据) **/
  32. private String filePathProcess;
  33. /** 数据拟合保存路径(拟合后的数据) **/
  34. private String filePathFitting;
  35. /** 配置文件路径 **/
  36. private String filePathPower;
  37. /**
  38. * 数据压缩下载
  39. **/
  40. private String filePathDownload;
  41. /**
  42. * 功率曲线拟合测点
  43. **/
  44. private String points;
  45. /**
  46. * 适配器读取数据等间隔时间
  47. **/
  48. private Integer interval;
  49. /**
  50. * 数据是否离线执行
  51. **/
  52. private boolean offLine;
  53. /**
  54. * 是否实时计算
  55. **/
  56. private boolean realTimeCal;
  57. //光伏转换效率系数
  58. private Map<String, Double> gfzhxlxs;
  59. public List<String> getPoints() {
  60. return getUniformCodes();
  61. }
  62. public String getFilePathPrepare() {
  63. return jarF.getParentFile().getAbsolutePath() + File.separator + filePathPrepare;
  64. }
  65. public void setFilePathPrepare(String filePathPrepare) {
  66. this.filePathPrepare = filePathPrepare;
  67. }
  68. public String getFilePathProcess() {
  69. return jarF.getParentFile().getAbsolutePath() + File.separator + filePathProcess;
  70. }
  71. public void setFilePathProcess(String filePathProcess) {
  72. this.filePathProcess = filePathProcess;
  73. }
  74. public String getFilePathFitting() {
  75. return jarF.getParentFile().getAbsolutePath() + File.separator + filePathFitting;
  76. }
  77. public void setFilePathFitting(String filePathFitting) {
  78. this.filePathFitting = filePathFitting;
  79. }
  80. public String getFilePathDownload() {
  81. return jarF.getParentFile().getAbsolutePath() + File.separator + filePathDownload;
  82. }
  83. public void setFilePathDownload(String filePathDownload) {
  84. this.filePathDownload = filePathDownload;
  85. }
  86. private List<String> getUniformCodes(){
  87. List<FixedVo> fxList = AnnotationTool.getFixedVoList(PowerPointData.class);
  88. List<String> codes = fxList.stream().filter(f -> !StringUtils.isEmpty(f.getUniformCode()))
  89. .map(d -> d.getUniformCode()).collect(Collectors.toList());
  90. return codes;
  91. }
  92. public String getFilePathPower() {
  93. return jarF.getParentFile().getAbsolutePath() + File.separator + filePathPower;
  94. }
  95. public void setFilePathPower(String filePathPower) {
  96. this.filePathPower = filePathPower;
  97. }
  98. public String getGfDataPath() {
  99. return getFilePathPrepare() + "gf" + File.separator;
  100. }
  101. }