|
@@ -7,6 +7,7 @@ import com.gyee.common.model.StringUtils;
|
|
|
import com.gyee.runeconomy.config.GyeeConfig;
|
|
|
import com.gyee.runeconomy.controller.agc.AgcDeviateConfig;
|
|
|
import com.gyee.runeconomy.controller.agc.FileService;
|
|
|
+import com.gyee.runeconomy.model.TemperatureComponentInfo;
|
|
|
import com.gyee.runeconomy.model.TemperatureInfo;
|
|
|
import com.gyee.runeconomy.model.auto.*;
|
|
|
import com.gyee.runeconomy.service.auto.*;
|
|
@@ -19,9 +20,6 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.time.LocalDate;
|
|
|
-import java.time.temporal.TemporalAdjusters;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -96,7 +94,6 @@ public class CacheContext implements CommandLineRunner {
|
|
|
@Resource
|
|
|
GyeeConfig config;
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 温度矩阵信息
|
|
|
*/
|
|
@@ -194,9 +191,11 @@ public class CacheContext implements CommandLineRunner {
|
|
|
/**
|
|
|
* AGC信息缓存
|
|
|
*/
|
|
|
- public static Map<String, AgcDeviateConfig> agcDeviateConfigMap= new HashMap<>();
|
|
|
+ public static Map<String, AgcDeviateConfig> agcDeviateConfigMap = new HashMap<>();
|
|
|
public static Map<String, List<String>> files = new HashMap<>();
|
|
|
|
|
|
+ private final List<String> order = Arrays.asList("风机信息", "主轴", "发电机", "齿轮箱", "变桨", "液压", "其他");
|
|
|
+
|
|
|
@Override
|
|
|
public void run(String... args) throws Exception {
|
|
|
logger.info("缓存开始------------------------------------------------------------");
|
|
@@ -707,7 +706,8 @@ public class CacheContext implements CommandLineRunner {
|
|
|
wpls.stream().forEach(d -> list.addAll(proBasicEquipmentPointService.selectList(d.getId(), config.getPoints())));
|
|
|
pointNewMap.putAll(list.stream().collect(Collectors.groupingBy(u -> u.getWindturbineId())));
|
|
|
}
|
|
|
- private void cacheAGC(){
|
|
|
+
|
|
|
+ private void cacheAGC() {
|
|
|
|
|
|
AgcDeviateConfig[] adcs = fileService.getFromFile(config.getFilePathPower() + "agc_info_net.json", AgcDeviateConfig[].class);
|
|
|
initFiles();
|
|
@@ -718,7 +718,7 @@ public class CacheContext implements CommandLineRunner {
|
|
|
|
|
|
private void initFiles() {
|
|
|
files = new HashMap<>();
|
|
|
- File f = new File(config.getFilePathPower() );
|
|
|
+ File f = new File(config.getFilePathPower());
|
|
|
File[] fs = f.listFiles();
|
|
|
for (File v : fs) {
|
|
|
if (v.isDirectory()) {
|
|
@@ -735,12 +735,10 @@ public class CacheContext implements CommandLineRunner {
|
|
|
files.get(name).add(v.getPath());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
private void initTemperatureInfo() {
|
|
|
Map<String, TemperatureInfo> tis = new HashMap<>();
|
|
|
-// Map<String, StationStatus> ssm = getStationStatusMap();
|
|
|
-
|
|
|
try {
|
|
|
-// List<TemperatureInfoEntity> ls = temperatureinfoRepository.findAll();
|
|
|
List<Temperatureinfo> ls = iTemperatureinfoService.list();
|
|
|
for (Temperatureinfo ti : ls) {
|
|
|
if (ti == null || ti.getWindturbineid() == null || "".equals(ti.getWindturbineid())) {
|
|
@@ -761,6 +759,18 @@ public class CacheContext implements CommandLineRunner {
|
|
|
}
|
|
|
tis.get(ti.getWindturbineid()).addTemperaturePoint(ti);
|
|
|
}
|
|
|
+ for (TemperatureInfo ti : tis.values()) {
|
|
|
+ List<TemperatureComponentInfo> temperatureComponentInfos = ti.getTemperatureComponentInfos();
|
|
|
+ if (temperatureComponentInfos != null) {
|
|
|
+ Comparator<TemperatureComponentInfo> comparator = (info1, info2) -> {
|
|
|
+ int index1 = order.indexOf(info1.getName());
|
|
|
+ int index2 = order.indexOf(info2.getName());
|
|
|
+ return Integer.compare(index1, index2);
|
|
|
+ };
|
|
|
+ temperatureComponentInfos.sort(comparator);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
temperatureInfos = new ArrayList<>(tis.values());
|
|
|
temperatureInfos.sort((x, y) -> {
|
|
|
if (x.getStationId().equals(y.getStationId())) {
|