|
@@ -14,6 +14,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
@@ -54,20 +55,26 @@ public class ZhiBiaoCalculation {
|
|
|
queryWrapper.eq("uniformCode", "AI066");
|
|
|
List<PointInfo> pointInfos = pointInfo.selectList(queryWrapper);
|
|
|
|
|
|
+
|
|
|
+ HashMap<String, HashMap<String, Double>> mapIn = new HashMap<>();
|
|
|
+
|
|
|
+ HashMap<String, HashMap<String, Double>> mapOut = new HashMap<>();
|
|
|
+
|
|
|
|
|
|
|
|
|
turbineZt.forEach(turbine -> {
|
|
|
List<PointData> pointDatas = turbine.getPointDatas();
|
|
|
|
|
|
|
|
|
- AtomicReference<String> windSpeedKey = null;
|
|
|
+ String windSpeedKey = null;
|
|
|
|
|
|
|
|
|
- pointInfos.forEach(pointInfo -> {
|
|
|
- if (Objects.equals(turbine.getTurbineId(), pointInfo.getTurbineId())) {
|
|
|
- windSpeedKey.set(pointInfo.getPointKey());
|
|
|
+ for (int i = 0; i < pointInfos.size(); i++) {
|
|
|
+ if (Objects.equals(turbine.getTurbineId(), pointInfos.get(i).getTurbineId())) {
|
|
|
+ windSpeedKey = pointInfos.get(i).getPointKey();
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
for (int i = 1; i < pointDatas.size(); i++) {
|
|
@@ -88,10 +95,17 @@ public class ZhiBiaoCalculation {
|
|
|
|
|
|
long ts11 = ts1 - 300000;
|
|
|
|
|
|
- List<PointData> pointDatas1 = adapter.getHistorySnap(javaFunctionJobHandler.goldenUri(), windSpeedKey.get(), ts11, ts1, 10);
|
|
|
+ List<PointData> pointDatas1 = adapter.getHistorySnap(javaFunctionJobHandler.goldenUri(), windSpeedKey, ts11, ts1, 10);
|
|
|
|
|
|
double avgCutInWindSpeed = pointDatas1.stream().mapToDouble(PointData::getValue).average().orElse(0);
|
|
|
System.out.println(turbine.getTurbineId() + "切入风速" + avgCutInWindSpeed);
|
|
|
+
|
|
|
+
|
|
|
+ mapIn.put(turbine.getTurbineId(), new HashMap<String, Double>() {{
|
|
|
+ put(String.valueOf(ts1), avgCutInWindSpeed);
|
|
|
+ }});
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -101,10 +115,17 @@ public class ZhiBiaoCalculation {
|
|
|
System.out.println(turbine.getTurbineId() + "切出" + stringDate);
|
|
|
|
|
|
long ts22 = ts2 - 300000;
|
|
|
- List<PointData> pointDatas2 = adapter.getHistorySnap(javaFunctionJobHandler.goldenUri(), windSpeedKey.get(), ts22, ts2, 10);
|
|
|
+ List<PointData> pointDatas2 = adapter.getHistorySnap(javaFunctionJobHandler.goldenUri(), windSpeedKey, ts22, ts2, 10);
|
|
|
double avgCutOutWindSpeed = pointDatas2.stream().mapToDouble(PointData::getValue).average().orElse(0);
|
|
|
System.out.println(turbine.getTurbineId() + "切出风速" + avgCutOutWindSpeed);
|
|
|
|
|
|
+
|
|
|
+ mapOut.put(turbine.getTurbineId(), new HashMap<String, Double>() {{
|
|
|
+ put(String.valueOf(ts2), avgCutOutWindSpeed);
|
|
|
+ }});
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|