|
@@ -33,9 +33,9 @@ public class DataFillJobHandler {
|
|
|
private AppConfig appConfig;
|
|
|
|
|
|
/**
|
|
|
+ * 计算常用测点的1分钟平均数据
|
|
|
* 风机id,uniformcode,平均数据
|
|
|
*/
|
|
|
- //private Map<String, Map<String, List<PointData>>> dsdlssMap;
|
|
|
|
|
|
@XxlJob("DataFilling")
|
|
|
public void calcEquipPowerGenDay() {
|
|
@@ -56,8 +56,6 @@ public class DataFillJobHandler {
|
|
|
endDate = DateUtil.parse(end);
|
|
|
}
|
|
|
|
|
|
- //getDatas(startDate.getTime(), endDate.getTime());
|
|
|
-
|
|
|
List<RealtimeAverageTarget> realtimeAverageTargetList = new ArrayList<>();
|
|
|
QueryWrapper<RealtimeAverageTarget> ratWrapper = new QueryWrapper<>();
|
|
|
ratWrapper.select("tbname", "time", "station_id", "equipment_id").eq("uniform_code", "1FZPJZB")
|
|
@@ -76,7 +74,6 @@ public class DataFillJobHandler {
|
|
|
List<PointData> rawByKey = adapterApi.getRawByKey(point, startDate.getTime(), endDate.getTime());
|
|
|
lpdsMap.put(uc, rawByKey);
|
|
|
});
|
|
|
- int i = 0;
|
|
|
for (DateTime minute = DateUtil.beginOfMinute(startDate); minute.isBefore(endDate); minute.offset(DateField.MINUTE, 1)) {
|
|
|
RealtimeAverageTarget rat = new RealtimeAverageTarget();
|
|
|
rat.setTime(new Timestamp(minute.getTime()));
|
|
@@ -84,7 +81,6 @@ public class DataFillJobHandler {
|
|
|
setRats(rat, equipmentId, minute.getTime(), minute.getTime() + 59999L, lpdsMap);
|
|
|
realtimeAverageTargetList.add(rat);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}else {
|
|
|
//按风机分组
|
|
@@ -116,18 +112,7 @@ public class DataFillJobHandler {
|
|
|
|
|
|
realtimeAverageTargetService.saveBatch(realtimeAverageTargetList);
|
|
|
}
|
|
|
-/*
|
|
|
- private void getDatas(long time1, long time2) {
|
|
|
- dsdlssMap = new HashMap<>();
|
|
|
- CacheContext.equipUcMap.forEach((equipId, ucode) -> {
|
|
|
- Map<String, List<PointData>> map = new HashMap<>();
|
|
|
- ucode.forEach((uc, point) -> {
|
|
|
- List<PointData> rawByKey = adapterApi.getRawByKey(point, time1, time2);
|
|
|
- map.put(uc, rawByKey);
|
|
|
- });
|
|
|
- dsdlssMap.put(equipId, map);
|
|
|
- });
|
|
|
- }*/
|
|
|
+
|
|
|
|
|
|
private void setRats(RealtimeAverageTarget rat, String equipId, long time1, long time2, Map<String, List<PointData>> lpdsMap) {
|
|
|
|
|
@@ -136,12 +121,18 @@ public class DataFillJobHandler {
|
|
|
List<PointData> generator_speeds = lpdsMap.get(appConfig.getUniformcodeOne().get("generator_speed"));
|
|
|
List<PointData> impeller_speeds = lpdsMap.get(appConfig.getUniformcodeOne().get("impeller_speed"));
|
|
|
List<PointData> wind_directions = lpdsMap.get(appConfig.getUniformcodeOne().get("wind_direction"));
|
|
|
+ List<PointData> blade_angle = lpdsMap.get(appConfig.getUniformcodeOne().get("blade_angle"));
|
|
|
+ List<PointData> engine_direction = lpdsMap.get(appConfig.getUniformcodeOne().get("engine_direction"));
|
|
|
+ List<PointData> wind_deviation = lpdsMap.get(appConfig.getUniformcodeOne().get("wind_deviation"));
|
|
|
|
|
|
double wsdv = 0;
|
|
|
double apdv = 0;
|
|
|
double gsdv = 0;
|
|
|
double isdv = 0;
|
|
|
double wddv = 0;
|
|
|
+ double badv = 0;
|
|
|
+ double eddv = 0;
|
|
|
+ double wtdv = 0;
|
|
|
|
|
|
if (wind_speeds != null && wind_speeds.size() > 0)
|
|
|
wsdv = wind_speeds.stream().filter(pd -> pd.getTs() >= time1 && pd.getTs() <= time2).mapToDouble(PointData::getDoubleValue).average().orElse(0);
|
|
@@ -153,6 +144,12 @@ public class DataFillJobHandler {
|
|
|
isdv = impeller_speeds.stream().filter(pd -> pd.getTs() >= time1 && pd.getTs() <= time2).mapToDouble(PointData::getDoubleValue).average().orElse(0);
|
|
|
if (wind_directions != null && wind_directions.size() > 0)
|
|
|
wddv = wind_directions.stream().filter(pd -> pd.getTs() >= time1 && pd.getTs() <= time2).mapToDouble(PointData::getDoubleValue).average().orElse(0);
|
|
|
+ if (blade_angle != null && blade_angle.size() > 0)
|
|
|
+ badv = blade_angle.stream().filter(pd -> pd.getTs() >= time1 && pd.getTs() <= time2).mapToDouble(PointData::getDoubleValue).average().orElse(0);
|
|
|
+ if (engine_direction != null && engine_direction.size() > 0)
|
|
|
+ eddv = engine_direction.stream().filter(pd -> pd.getTs() >= time1 && pd.getTs() <= time2).mapToDouble(PointData::getDoubleValue).average().orElse(0);
|
|
|
+ if (wind_deviation != null && wind_deviation.size() > 0)
|
|
|
+ wtdv = wind_deviation.stream().filter(pd -> pd.getTs() >= time1 && pd.getTs() <= time2).mapToDouble(PointData::getDoubleValue).average().orElse(0);
|
|
|
|
|
|
double speed = NumberUtil.round(wsdv, 2).doubleValue();
|
|
|
|
|
@@ -161,6 +158,9 @@ public class DataFillJobHandler {
|
|
|
rat.setGeneratorSpeed(NumberUtil.round(gsdv, 2).floatValue());
|
|
|
rat.setImpellerSpeed(NumberUtil.round(isdv, 2).floatValue());
|
|
|
rat.setWindDirection(NumberUtil.round(wddv, 2).floatValue());
|
|
|
+ rat.setBladeAngle(NumberUtil.round(badv, 2).floatValue());
|
|
|
+ rat.setEngineDirection(NumberUtil.round(eddv, 2).floatValue());
|
|
|
+ rat.setWindDeviation(NumberUtil.round(wtdv, 2).floatValue());
|
|
|
if (speed < 3) {
|
|
|
rat.setTheoryGeneration(0f);
|
|
|
} else {
|