package com.gyee.power.fitting.common.config; import com.gyee.power.fitting.model.anno.AnnotationTool; import com.gyee.power.fitting.model.anno.FixedVo; import com.gyee.power.fitting.model.custom.PowerPointData; import lombok.Data; import org.apache.commons.lang3.StringUtils; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.system.ApplicationHome; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import java.io.File; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @Data @Order(0) @Component @ConfigurationProperties(prefix = "gyee") public class GyeeConfig { public File jarF = null; { ApplicationHome h = new ApplicationHome(getClass()); jarF = h.getSource(); //jarF = new File("D:\\java\\sis-background\\power-fitting\\target\\classes"); } /** 数据适配器网址 **/ private String adapterfdUrl; private String adaptergfUrl; /** 数据准备保存路径(原始数据) **/ private String filePathPrepare; /** 数据处理保存路径(处理后的数据) **/ private String filePathProcess; /** 数据拟合保存路径(拟合后的数据) **/ private String filePathFitting; /** 配置文件路径 **/ private String filePathPower; /** * 数据压缩下载 **/ private String filePathDownload; /** * 功率曲线拟合测点 **/ private String points; /** * 适配器读取数据等间隔时间 **/ private Integer interval; /** * 数据是否离线执行 **/ private boolean offLine; /** * 是否实时计算 **/ private boolean realTimeCal; //光伏转换效率系数 private Map gfzhxlxs; public List getPoints() { return getUniformCodes(); } public String getFilePathPrepare() { return jarF.getParentFile().getAbsolutePath() + File.separator + filePathPrepare; } public void setFilePathPrepare(String filePathPrepare) { this.filePathPrepare = filePathPrepare; } public String getFilePathProcess() { return jarF.getParentFile().getAbsolutePath() + File.separator + filePathProcess; } public void setFilePathProcess(String filePathProcess) { this.filePathProcess = filePathProcess; } public String getFilePathFitting() { return jarF.getParentFile().getAbsolutePath() + File.separator + filePathFitting; } public void setFilePathFitting(String filePathFitting) { this.filePathFitting = filePathFitting; } public String getFilePathDownload() { return jarF.getParentFile().getAbsolutePath() + File.separator + filePathDownload; } public void setFilePathDownload(String filePathDownload) { this.filePathDownload = filePathDownload; } private List getUniformCodes(){ List fxList = AnnotationTool.getFixedVoList(PowerPointData.class); List codes = fxList.stream().filter(f -> !StringUtils.isEmpty(f.getUniformCode())) .map(d -> d.getUniformCode()).collect(Collectors.toList()); return codes; } public String getFilePathPower() { return jarF.getParentFile().getAbsolutePath() + File.separator + filePathPower; } public void setFilePathPower(String filePathPower) { this.filePathPower = filePathPower; } public String getGfDataPath() { return getFilePathPrepare() + "gf" + File.separator; } }