|
@@ -1,7 +1,10 @@
|
|
package com.gyee.power.fitting.common.spring;
|
|
package com.gyee.power.fitting.common.spring;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
import com.gyee.power.fitting.common.config.GyeeConfig;
|
|
import com.gyee.power.fitting.common.config.GyeeConfig;
|
|
|
|
+import com.gyee.power.fitting.common.util.FileUtil;
|
|
import com.gyee.power.fitting.model.*;
|
|
import com.gyee.power.fitting.model.*;
|
|
|
|
+import com.gyee.power.fitting.model.agc.AgcDeviateConfig;
|
|
import com.gyee.power.fitting.service.*;
|
|
import com.gyee.power.fitting.service.*;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -27,7 +30,7 @@ import java.util.stream.Collectors;
|
|
public class InitialRunner implements CommandLineRunner {
|
|
public class InitialRunner implements CommandLineRunner {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
- GyeeConfig config;
|
|
|
|
|
|
+ private GyeeConfig config;
|
|
@Resource
|
|
@Resource
|
|
private WindturbineService windturbineService;
|
|
private WindturbineService windturbineService;
|
|
@Resource
|
|
@Resource
|
|
@@ -115,6 +118,7 @@ public class InitialRunner implements CommandLineRunner {
|
|
public static Map<String, List<Modelpowerdetails>> modelPowerDetailMap = new HashMap<>();
|
|
public static Map<String, List<Modelpowerdetails>> modelPowerDetailMap = new HashMap<>();
|
|
/** key: NG01_01, speed, power**/
|
|
/** key: NG01_01, speed, power**/
|
|
public static Map<String, Map<Double, Double>> zsllglMap = new HashMap<>();
|
|
public static Map<String, Map<Double, Double>> zsllglMap = new HashMap<>();
|
|
|
|
+ public static Map<String, AgcDeviateConfig> powerPreMap = new HashMap<>();
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void run(String... args) {
|
|
public void run(String... args) {
|
|
@@ -126,6 +130,7 @@ public class InitialRunner implements CommandLineRunner {
|
|
cacheProject();
|
|
cacheProject();
|
|
cacheLine();
|
|
cacheLine();
|
|
cachePhotovoltaicInfo();
|
|
cachePhotovoltaicInfo();
|
|
|
|
+ cacheFGL();
|
|
|
|
|
|
// 耗时缓存
|
|
// 耗时缓存
|
|
new Thread(() -> {
|
|
new Thread(() -> {
|
|
@@ -180,8 +185,9 @@ public class InitialRunner implements CommandLineRunner {
|
|
wpList.stream().forEach(d -> list.addAll(pointService.selectList(d.getId(), config.getPoints())));
|
|
wpList.stream().forEach(d -> list.addAll(pointService.selectList(d.getId(), config.getPoints())));
|
|
pointMap.putAll(list.stream().collect(Collectors.groupingBy(u -> u.getWindturbineid())));
|
|
pointMap.putAll(list.stream().collect(Collectors.groupingBy(u -> u.getWindturbineid())));
|
|
log.info("cachePoints: " + pointMap.size());
|
|
log.info("cachePoints: " + pointMap.size());
|
|
- if (pointMap.size() == 0)
|
|
|
|
|
|
+ if (pointMap.size() == 0) {
|
|
log.error("cachePoints", "测点数据缓存失败");
|
|
log.error("cachePoints", "测点数据缓存失败");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -189,8 +195,9 @@ public class InitialRunner implements CommandLineRunner {
|
|
*/
|
|
*/
|
|
private void cacheEquipment() {
|
|
private void cacheEquipment() {
|
|
equipmentList.addAll(equipmentmodelService.selectList());
|
|
equipmentList.addAll(equipmentmodelService.selectList());
|
|
- for (Equipmentmodel eq : equipmentList)
|
|
|
|
|
|
+ for (Equipmentmodel eq : equipmentList) {
|
|
equipmentMap.put(eq.getId(), eq);
|
|
equipmentMap.put(eq.getId(), eq);
|
|
|
|
+ }
|
|
log.info("设备型号数据缓存完成");
|
|
log.info("设备型号数据缓存完成");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -223,12 +230,25 @@ public class InitialRunner implements CommandLineRunner {
|
|
}else{
|
|
}else{
|
|
List<Powermodel> list = powermodelService.selectByWtId(wtId);
|
|
List<Powermodel> list = powermodelService.selectByWtId(wtId);
|
|
Map<Double, Double> collect = list.stream().collect(Collectors.toMap(Powermodel::getSpeed, Powermodel::getPower));
|
|
Map<Double, Double> collect = list.stream().collect(Collectors.toMap(Powermodel::getSpeed, Powermodel::getPower));
|
|
- if (zsllglMap.containsKey(wtId))
|
|
|
|
|
|
+ if (zsllglMap.containsKey(wtId)) {
|
|
zsllglMap.replace(wtId, collect);
|
|
zsllglMap.replace(wtId, collect);
|
|
- else
|
|
|
|
|
|
+ } else {
|
|
zsllglMap.put(wtId, collect);
|
|
zsllglMap.put(wtId, collect);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
log.info("自算功率数据缓存完成");
|
|
log.info("自算功率数据缓存完成");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 功率预测相关测点
|
|
|
|
+ */
|
|
|
|
+ private void cacheFGL(){
|
|
|
|
+ String str = FileUtil.getStringFromFile(config.getFilePathPower() + "fgl_info.json");
|
|
|
|
+ AgcDeviateConfig[] object = JSON.parseObject(str, AgcDeviateConfig[].class);
|
|
|
|
+ for (AgcDeviateConfig conf : object){
|
|
|
|
+ powerPreMap.put(conf.getId(), conf);
|
|
|
|
+ }
|
|
|
|
+ log.info("自功率预测相关测点数据缓存完成");
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|