|
|
@@ -1,11 +1,16 @@
|
|
|
package com.ruoyi.web.controller;
|
|
|
|
|
|
-import cn.hutool.core.collection.*;
|
|
|
-import cn.hutool.core.date.*;
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.collection.ListUtil;
|
|
|
+import cn.hutool.core.date.DateField;
|
|
|
+import cn.hutool.core.date.DateRange;
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.lang.Dict;
|
|
|
import cn.hutool.core.text.StrBuilder;
|
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
|
-import cn.hutool.core.util.*;
|
|
|
+import cn.hutool.core.util.NumberUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.ruoyi.quartz.handler.IJobHandler;
|
|
|
@@ -13,6 +18,8 @@ import com.ruoyi.ucp.entity.*;
|
|
|
import com.ruoyi.ucp.feign.AdapterApi;
|
|
|
import com.ruoyi.ucp.service.*;
|
|
|
import com.ruoyi.ucp.util.CalcCache;
|
|
|
+import com.ruoyi.ucp.util.DatePart;
|
|
|
+import com.ruoyi.ucp.util.SqlUtil;
|
|
|
import org.apache.commons.math3.fitting.PolynomialCurveFitter;
|
|
|
import org.apache.commons.math3.fitting.WeightedObservedPoints;
|
|
|
import org.slf4j.Logger;
|
|
|
@@ -73,6 +80,12 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
private IProjectInfoMin2Service projectInfoMin2Service;
|
|
|
@Resource
|
|
|
private IRealtimePredictService realtimePredictService;
|
|
|
+ @Resource
|
|
|
+ private IMeterInfoDayService meterInfoDayService;
|
|
|
+ @Resource
|
|
|
+ private IProEconEquipmentInfoJsService proEconEquipmentInfoJsService;
|
|
|
+ @Resource
|
|
|
+ private IProBaseBackfillService proBaseBackfillService;
|
|
|
|
|
|
@Override
|
|
|
public void execute() throws Exception {
|
|
|
@@ -188,10 +201,44 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
return day;
|
|
|
}
|
|
|
|
|
|
- public List<StationInfoDay> getStationinfoByDate(Date date, List<PointInfo> entity) {
|
|
|
- QueryWrapper<StationInfoDay> wrapper = new QueryWrapper<>();
|
|
|
+ public List<MeterInfoDay> getMeterinfoByDate(Date date) {
|
|
|
+ QueryWrapper<MeterInfoDay> wrapper = new QueryWrapper<>();
|
|
|
wrapper.eq("record_date", date);
|
|
|
- List<StationInfoDay> list = stationInfoDayService.list(wrapper);
|
|
|
+ return meterInfoDayService.list(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<MeterInfoDay> getMeterinfoByDate(Date date, List<PointInfo> entity) {
|
|
|
+ List<MeterInfoDay> list = getMeterinfoByDate(date);
|
|
|
+ if (CollUtil.isEmpty(list)) {
|
|
|
+ entity.forEach(pi -> {
|
|
|
+ MeterInfoDay day = new MeterInfoDay();
|
|
|
+ day.setStationId(pi.getStationId());
|
|
|
+ day.setRecordDate(date);
|
|
|
+ list.add(day);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ public MeterInfoDay getMeterinfoByDate(Date date, PointInfo entity) {
|
|
|
+ QueryWrapper<MeterInfoDay> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("record_date", date);
|
|
|
+ wrapper.eq("meter_id", entity.getUniformCode());
|
|
|
+ List<MeterInfoDay> list = meterInfoDayService.list(wrapper);
|
|
|
+ if (CollUtil.isEmpty(list)) {
|
|
|
+ MeterInfoDay day = new MeterInfoDay();
|
|
|
+ day.setStationId(entity.getStationId());
|
|
|
+ day.setBoosterId(entity.getBoosterId());
|
|
|
+ String[] split = entity.getUniformCode().split("-");
|
|
|
+ day.setMeterId(split[split.length - 1]);
|
|
|
+ day.setRecordDate(date);
|
|
|
+ list.add(day);
|
|
|
+ }
|
|
|
+ return list.get(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<StationInfoDay> getStationinfoByDate(Date date, List<PointInfo> entity) {
|
|
|
+ List<StationInfoDay> list = getStationinfoByDate(date);
|
|
|
if (CollUtil.isEmpty(list)) {
|
|
|
entity.forEach(pi -> {
|
|
|
StationInfoDay day = new StationInfoDay();
|
|
|
@@ -266,22 +313,22 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
-// public URI taosUri() {
|
|
|
-// return URI.create("http://172.16.12.101:8012/ts");
|
|
|
-// }
|
|
|
-//
|
|
|
-// public URI goldenUri() {
|
|
|
-// return URI.create("http://172.16.12.103:8011/ts");
|
|
|
-// }
|
|
|
+ // public URI taosUri() {
|
|
|
+ // return URI.create("http://172.16.12.101:8012/ts");
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // public URI goldenUri() {
|
|
|
+ // return URI.create("http://172.16.12.103:8011/ts");
|
|
|
+ // }
|
|
|
|
|
|
public URI taosUri() {
|
|
|
-// return URI.create("http://10.220.1.8:8011/ts");
|
|
|
- return URI.create("http://127.0.0.1:8011/ts");
|
|
|
+ return URI.create("http://10.220.1.8:8011/ts");
|
|
|
+ // return URI.create("http://127.0.0.1:8011/ts");
|
|
|
}
|
|
|
|
|
|
public URI goldenUri() {
|
|
|
-// return URI.create("http://10.220.1.8:8011/ts");
|
|
|
- return URI.create("http://127.0.0.1:8011/ts");
|
|
|
+ return URI.create("http://10.220.1.8:8011/ts");
|
|
|
+ // return URI.create("http://127.0.0.1:8011/ts");
|
|
|
}
|
|
|
|
|
|
public Map<String, String> getEntityMap(String uniformCode, String institutionType) {
|
|
|
@@ -300,9 +347,18 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
}
|
|
|
|
|
|
public Map<String, TurbineInfoDay> getTurbineinfoMap(Date date, List<PointInfo> entity) {
|
|
|
+ List<TurbineInfoDay> list = getTurbineinfoByDate(date, entity);
|
|
|
+ return list.stream().collect(Collectors.toMap(TurbineInfoDay::getTurbineId, Function.identity()));
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<TurbineInfoDay> getTurbineinfoByDate(Date date) {
|
|
|
QueryWrapper<TurbineInfoDay> wrapper = new QueryWrapper<>();
|
|
|
wrapper.eq("record_date", date);
|
|
|
- List<TurbineInfoDay> list = turbineInfoDayService.list(wrapper);
|
|
|
+ return turbineInfoDayService.list(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<TurbineInfoDay> getTurbineinfoByDate(Date date, List<PointInfo> entity) {
|
|
|
+ List<TurbineInfoDay> list = getTurbineinfoByDate(date);
|
|
|
if (list.isEmpty()) {
|
|
|
entity.forEach(pi -> {
|
|
|
TurbineInfoDay day = new TurbineInfoDay();
|
|
|
@@ -314,7 +370,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
list.add(day);
|
|
|
});
|
|
|
}
|
|
|
- return list.stream().collect(Collectors.toMap(TurbineInfoDay::getTurbineId, Function.identity()));
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
public List<PointInfo> getEntity(String uniformCode, String institutionType) {
|
|
|
@@ -324,6 +380,17 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
return pointService.getByEntity(pi);
|
|
|
}
|
|
|
|
|
|
+ public PointInfo getEntityOne(String uniformCode, String institutionType) {
|
|
|
+ List<PointInfo> entity = getEntity(uniformCode, institutionType);
|
|
|
+ if (CollUtil.isNotEmpty(entity)) return entity.get(0);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, PointInfo> getEntity(String uniformCode, String institutionType, Function<PointInfo, String> fun) {
|
|
|
+ List<PointInfo> entity = getEntity(uniformCode, institutionType);
|
|
|
+ return entity.stream().collect(Collectors.toMap(fun, Function.identity()));
|
|
|
+ }
|
|
|
+
|
|
|
public List<PointInfo> getEntityByUis(String uniformCode, String institutionType, String stId) {
|
|
|
PointInfo pi = new PointInfo();
|
|
|
pi.setUniformCode(uniformCode);
|
|
|
@@ -543,7 +610,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
}
|
|
|
wrapper.clear();
|
|
|
wrapper.between("record_date", beginTq, endTq);
|
|
|
-// List<StationInfoDay> sids = stationInfoDayService.list(wrapper);
|
|
|
+ // List<StationInfoDay> sids = stationInfoDayService.list(wrapper);
|
|
|
List<StationInfoDay> sids = null;
|
|
|
Map<String, List<StationInfoDay>> sidMap;
|
|
|
if (CollUtil.isNotEmpty(sids)) {
|
|
|
@@ -685,6 +752,54 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
stationInfoDayService.saveOrUpdateBatch(Collections.singleton(day));
|
|
|
}
|
|
|
|
|
|
+ public void calcStationSwGwCyRdl_ha(Date date) {
|
|
|
+ //date当天零点
|
|
|
+ DateTime time = DateUtil.beginOfDay(date);
|
|
|
+ //date昨天零点
|
|
|
+ DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
+
|
|
|
+ List<PointInfo> swdlEt = getEntity("Z-ZXYG-CX", "meter");
|
|
|
+ List<PointInfo> gwdlEt = getEntity("Z-FXYG-CX", "meter");
|
|
|
+ List<PointInfo> cydlEt = getEntity("Z-ZXYG-ZYB", "meter");
|
|
|
+ getRawDataByEntity(swdlEt, goldenUri(), time0, time);
|
|
|
+ getRawDataByEntity(gwdlEt, goldenUri(), time0, time);
|
|
|
+ getRawDataByEntity(cydlEt, goldenUri(), time0, time);
|
|
|
+
|
|
|
+ Map<String, PointInfo> swdlMap = swdlEt.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
|
|
|
+ Map<String, PointInfo> gwdlMap = gwdlEt.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
|
|
|
+ Map<String, PointInfo> cydlMap = cydlEt.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
|
|
|
+
|
|
|
+ List<StationInfoDay> byDate = getStationinfoByDate(time0, swdlEt);
|
|
|
+ String stId;
|
|
|
+ PointInfo swdlPi, gwdlPi, cydlPi;
|
|
|
+ for (StationInfoDay info : byDate) {
|
|
|
+ stId = info.getStationId();
|
|
|
+ swdlPi = swdlMap.get(stId);
|
|
|
+ gwdlPi = gwdlMap.get(stId);
|
|
|
+ cydlPi = cydlMap.get(stId);
|
|
|
+ List<PointData> swdlPds = swdlPi.getPointDatas().stream().filter(pd -> pd.getValue() != 0).collect(Collectors.toList());
|
|
|
+ double swdl = 0;
|
|
|
+ if (swdlPds.size() > 1)
|
|
|
+ swdl = Math.abs(swdlPds.get(0).getValue() - swdlPds.get(swdlPds.size() - 1).getValue()) * swdlPi.getCoef();
|
|
|
+ List<PointData> gwdlPds = gwdlPi.getPointDatas().stream().filter(pd -> pd.getValue() != 0).collect(Collectors.toList());
|
|
|
+ double gwdl = 0;
|
|
|
+ if (gwdlPds.size() > 1)
|
|
|
+ gwdl = Math.abs(gwdlPds.get(0).getValue() - gwdlPds.get(gwdlPds.size() - 1).getValue()) * gwdlPi.getCoef();
|
|
|
+ List<PointData> cydlPds = cydlPi.getPointDatas().stream().filter(pd -> pd.getValue() != 0).collect(Collectors.toList());
|
|
|
+ double cydl = 0;
|
|
|
+ if (cydlPds.size() > 1)
|
|
|
+ cydl = Math.abs(cydlPds.get(0).getValue() - cydlPds.get(cydlPds.size() - 1).getValue()) * cydlPi.getCoef();
|
|
|
+
|
|
|
+ if (swdl < 0 || swdl > 6000000) swdl = 0;
|
|
|
+ if (gwdl < 0 || gwdl > 6000000) gwdl = 0;
|
|
|
+ if (cydl < 0 || cydl > 6000000) cydl = 0;
|
|
|
+ info.setSwdl((int) swdl);
|
|
|
+ info.setGwdl((int) gwdl);
|
|
|
+ info.setZyb((int) cydl);
|
|
|
+ }
|
|
|
+ stationInfoDayService.saveOrUpdateBatch(byDate);
|
|
|
+ }
|
|
|
+
|
|
|
public void calcStationSwGwCyRdl(Date date) {
|
|
|
//date当天零点
|
|
|
DateTime time = DateUtil.beginOfDay(date);
|
|
|
@@ -1314,7 +1429,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
|
|
|
List<PointInfo> entity = getEntity("AI121", "turbine");
|
|
|
-// getZeroNextData(entity, time0, time);
|
|
|
+ // getZeroNextData(entity, time0, time);
|
|
|
getSectionDataByEntity(entity, goldenUri(), time0, time);
|
|
|
Map<String, PointInfo> turMap = entity.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
Map<String, String> fsMap = getEntityMap("AI066", "turbine");
|
|
|
@@ -1350,6 +1465,78 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
turbineInfoDayService.saveOrUpdateBatch(infoDays);
|
|
|
}
|
|
|
|
|
|
+ public void calcLineRfdl_ha(Date date) {
|
|
|
+ //date当天零点
|
|
|
+ DateTime time = DateUtil.beginOfDay(date);
|
|
|
+ //date昨天零点
|
|
|
+ DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
+
|
|
|
+ List<PointInfo> entity = getEntity("Z-ZXYG-JX", "meter");
|
|
|
+ entity = entity.stream().filter(e -> !"".equals(e.getProjectId())).collect(Collectors.toList());
|
|
|
+ getRawDataByEntity(entity, goldenUri(), time0, time);
|
|
|
+ //线路耗电量
|
|
|
+ List<PointInfo> entityHdl = getEntity("Z-FXYG-JX", "meter");
|
|
|
+ entityHdl = entityHdl.stream().filter(e -> !"".equals(e.getProjectId())).collect(Collectors.toList());
|
|
|
+ getRawDataByEntity(entityHdl, goldenUri(), time0, time);
|
|
|
+
|
|
|
+ Map<String, PointInfo> fdlMap = entity.stream().collect(Collectors.toMap(PointInfo::getLineId, Function.identity()));
|
|
|
+ Map<String, PointInfo> hdlMap = entityHdl.stream().collect(Collectors.toMap(PointInfo::getLineId, Function.identity()));
|
|
|
+ List<LineInfoDay> byDate = getLineinfoByDate(time0, entity);
|
|
|
+ for (LineInfoDay day : byDate) {
|
|
|
+ String lineId = day.getLineId();
|
|
|
+ double fdl = calcHaDl(fdlMap.get(lineId));
|
|
|
+ if (fdl < 0 || fdl > 30000000) fdl = 0;
|
|
|
+ double hdl = calcHaDl(hdlMap.get(lineId));
|
|
|
+ if (hdl < 0 || hdl > 30000000) fdl = 0;
|
|
|
+ day.setRfdl((int) fdl);
|
|
|
+ day.setHdl(hdl);
|
|
|
+ }
|
|
|
+ lineInfoDayService.saveOrUpdateBatch(byDate);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void calcTurbineRFDL_ha(Date date) {
|
|
|
+ //date当天零点
|
|
|
+ DateTime time = DateUtil.beginOfDay(date);
|
|
|
+ //date昨天零点
|
|
|
+ DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
+
|
|
|
+ List<PointInfo> entity = getEntity("AI121", "turbine");
|
|
|
+ // getZeroNextData(entity, time0, time);
|
|
|
+ getSectionDataByEntity(entity, goldenUri(), time0, time);
|
|
|
+ Map<String, PointInfo> turMap = entity.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
+ Map<String, String> fsMap = getEntityMap("AI066", "turbine");
|
|
|
+
|
|
|
+ Map<String, TurbineInfoDay> byDate = getTurbineinfoMap(time0, entity);
|
|
|
+
|
|
|
+ TurbineInfoDay infoDay;
|
|
|
+ PointInfo rfdlPi;
|
|
|
+ String turbineId;
|
|
|
+ List<TurbineInfoDay> infoDays = new ArrayList<>();
|
|
|
+ List<PointData> stat;
|
|
|
+ for (PointInfo info : entity) {
|
|
|
+ turbineId = info.getTurbineId();
|
|
|
+ infoDay = byDate.get(turbineId);
|
|
|
+
|
|
|
+ rfdlPi = turMap.get(turbineId);
|
|
|
+ double v = (rfdlPi.getPointDatas().get(1).getValue() - rfdlPi.getPointDatas().get(0).getValue()) * rfdlPi.getCoef();
|
|
|
+ if (v < 0 || v > 1000000) {
|
|
|
+ v = 0;
|
|
|
+ } else if (v > 30000) {
|
|
|
+ v = v / (v % 30000 + 3);
|
|
|
+ }
|
|
|
+ infoDay.setRfdl(v);
|
|
|
+ stat = adapter.getHistoryRaw(goldenUri(), fsMap.get(turbineId), time0.getTime(), time.getTime());
|
|
|
+ if (stat == null || stat.isEmpty()) {
|
|
|
+ infoDay.setPjfs(0.0);
|
|
|
+ } else {
|
|
|
+ infoDay.setPjfs(stat.stream().mapToDouble(PointData::getValue).average().orElse(0));
|
|
|
+ }
|
|
|
+
|
|
|
+ infoDays.add(infoDay);
|
|
|
+ }
|
|
|
+ turbineInfoDayService.saveOrUpdateBatch(infoDays);
|
|
|
+ }
|
|
|
+
|
|
|
/*public void calcTurbine5s(Date date) {
|
|
|
//date当天零点
|
|
|
DateTime time = DateUtil.beginOfDay(date);
|
|
|
@@ -1551,7 +1738,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
List<PointData> fss = fsMap.get(wtId).getPointDatas();
|
|
|
List<PointData> gls = glMapMap.get(stId).get(wtId);
|
|
|
//叶轮转速给定
|
|
|
- List<PointData> ylzsgds = collectYlzsgd.get(stId).get(wtId);
|
|
|
+ List<PointData> ylzsgds = Optional.ofNullable(collectYlzsgd.get(stId)).map(m -> m.get(wtId)).orElse(null);
|
|
|
calcTurbineXd(ztInfo, gls, fss, ylzsgds, czxd);
|
|
|
});
|
|
|
});
|
|
|
@@ -2219,10 +2406,174 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
return y;
|
|
|
}
|
|
|
|
|
|
+ public void cutInWindSpeed(Date date) {
|
|
|
+ //date当天零点
|
|
|
+ DateTime timeNow = DateUtil.beginOfDay(date);
|
|
|
+ //date昨天零点
|
|
|
+ DateTime timeBegin = DateUtil.offsetDay(timeNow, -1);
|
|
|
+ List<PointInfo> turbineZt = calcTurbineAizt(timeBegin, timeNow, 60);
|
|
|
+ List<PointInfo> turbineZtDI = calcTurbineDizt(timeBegin, timeNow, 60);
|
|
|
+ turbineZt.addAll(turbineZtDI);
|
|
|
+
|
|
|
+ //所有风机的风速测点
|
|
|
+ QueryWrapper<PointInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("uniform_code", "AI066");
|
|
|
+
|
|
|
+ List<PointInfo> pointInfos = getEntity("AI066", "turbine");
|
|
|
+ // List<PointInfo> pointInfos = pointInfo.selectList(queryWrapper);
|
|
|
+
|
|
|
+ //定义切入风速map集合
|
|
|
+ ConcurrentHashMap<String, ConcurrentHashMap<String, Double>> mapIn = new ConcurrentHashMap<>();
|
|
|
+
|
|
|
+ //定义切出风速集合
|
|
|
+ ConcurrentHashMap<String, ConcurrentHashMap<String, Double>> mapOut = new ConcurrentHashMap<>();
|
|
|
+
|
|
|
+
|
|
|
+ //遍历每台风机,取出每台风机的pointDatas
|
|
|
+ for (PointInfo turbine : turbineZt) {
|
|
|
+
|
|
|
+ mapIn.put(turbine.getTurbineId(), new ConcurrentHashMap<>());
|
|
|
+ mapOut.put(turbine.getTurbineId(), new ConcurrentHashMap<>());
|
|
|
+
|
|
|
+ List<PointData> pointDatas = turbine.getPointDatas();
|
|
|
+
|
|
|
+ //风速测点key
|
|
|
+ String windSpeedKey = null;
|
|
|
+
|
|
|
+
|
|
|
+ //遍历pointInfos,找出pointData1的id和pointInfos中相等的,取出pointInfo的pointKey
|
|
|
+ for (PointInfo info : pointInfos) {
|
|
|
+ if (Objects.equals(turbine.getTurbineId(), info.getTurbineId())) {
|
|
|
+ windSpeedKey = info.getPointKey();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //遍历pointDatas,取出当前状态和后一个状态
|
|
|
+ for (int k = 1; k < pointDatas.size(); k++) {
|
|
|
+ PointData pointData1 = pointDatas.get(k - 1);
|
|
|
+ PointData pointData2 = pointDatas.get(k);
|
|
|
+ double value1 = pointData1.getValue();
|
|
|
+ double value2 = pointData2.getValue();
|
|
|
+ //切入时间
|
|
|
+ long ts1;
|
|
|
+ //切出时间
|
|
|
+ long ts2;
|
|
|
+
|
|
|
+ //如果1的值为0,2的值为2,则为切入状态
|
|
|
+ if (value1 == 0 && value2 == 2) {
|
|
|
+ ts1 = pointData2.getTs();
|
|
|
+ // String stringDate = DateUtil.date(ts1).toString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ // System.out.println(turbine.getTurbineId() + "切入" + stringDate);
|
|
|
+ //切入时间前5分钟
|
|
|
+ long ts11 = ts1 - 300000;
|
|
|
+ //根据风速key,从适配器取切入前5分钟的所有风速
|
|
|
+ List<PointData> pointDatas1 = adapter.getHistorySnap(goldenUri(), windSpeedKey, ts11, ts1, 10);
|
|
|
+ //平均所有风速即为平均切入风速
|
|
|
+ double avgCutInWindSpeed = pointDatas1.stream().mapToDouble(PointData::getValue).average().orElse(0);
|
|
|
+ // System.out.println(turbine.getTurbineId() + "切入风速" + avgCutInWindSpeed);
|
|
|
+
|
|
|
+ //存入map集合,外层key为turbineId,内层key为ts1,value为平均切入风速
|
|
|
+
|
|
|
+ mapIn.get(turbine.getTurbineId()).put(String.valueOf(ts1), avgCutInWindSpeed);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //切出
|
|
|
+ if (value1 == 2 && value2 != 2) {
|
|
|
+ ts2 = pointData2.getTs();
|
|
|
+ String stringDate = DateUtil.date(ts2).toString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ // System.out.println(turbine.getTurbineId() + "切出" + stringDate);
|
|
|
+ //切出时间前5分钟
|
|
|
+ long ts22 = ts2 - 300000;
|
|
|
+ List<PointData> pointDatas2 = adapter.getHistorySnap(goldenUri(), windSpeedKey, ts22, ts2, 10);
|
|
|
+ double avgCutOutWindSpeed = pointDatas2.stream().mapToDouble(PointData::getValue).average().orElse(0);
|
|
|
+ // System.out.println(turbine.getTurbineId() + "切出风速" + avgCutOutWindSpeed);
|
|
|
+
|
|
|
+ //存入map集合,外层key为turbineId,内层key为ts2,value为平均切出风速
|
|
|
+
|
|
|
+ mapOut.get(turbine.getTurbineId()).put(String.valueOf(ts2), avgCutOutWindSpeed);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //遍历map集合,取出每个风机的所有切入风速,算一个平均值
|
|
|
+ ConcurrentHashMap<String, Double> mapTurbineValues = mapIn.get(turbine.getTurbineId());
|
|
|
+ //平均切入风速
|
|
|
+ double avgCutInWindSpeed = 0;
|
|
|
+ if (mapTurbineValues != null) {
|
|
|
+ AtomicReference<Double> sum = new AtomicReference<>(0.0);
|
|
|
+ //遍历mapTurbineValues,V大于5的舍弃,剩余算平均值
|
|
|
+ for (String key : mapTurbineValues.keySet()) {
|
|
|
+ if (mapTurbineValues.get(key) > 5) {
|
|
|
+ mapTurbineValues.remove(key);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mapTurbineValues.forEach((k1, v) -> {
|
|
|
+ sum.updateAndGet(v1 -> v1 + v);
|
|
|
+ });
|
|
|
+
|
|
|
+ //如果值为空则置0
|
|
|
+ if (sum.get() == 0) {
|
|
|
+ avgCutInWindSpeed = 0;
|
|
|
+ } else {
|
|
|
+ avgCutInWindSpeed = sum.get() / mapTurbineValues.size();
|
|
|
+ }
|
|
|
+ System.out.println(turbine.getTurbineId() + "切入平均风速" + avgCutInWindSpeed + "时间" + timeBegin);
|
|
|
+ }
|
|
|
+
|
|
|
+ //遍历map集合,取出每个风机的所有切出风速,算一个平均值
|
|
|
+ ConcurrentHashMap<String, Double> mapTurbineValues2 = mapOut.get(turbine.getTurbineId());
|
|
|
+
|
|
|
+ double avgCutOutWindSpeed;
|
|
|
+ if (mapTurbineValues2 != null) {
|
|
|
+ AtomicReference<Double> sum = new AtomicReference<>(0.0);
|
|
|
+
|
|
|
+ for (String key : mapTurbineValues2.keySet()) {
|
|
|
+ if (mapTurbineValues2.get(key) > 5) {
|
|
|
+ mapTurbineValues2.remove(key);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mapTurbineValues2.forEach((k2, v) -> {
|
|
|
+ sum.updateAndGet(v1 -> v1 + v);
|
|
|
+ });
|
|
|
+
|
|
|
+ if (sum.get() == 0) {
|
|
|
+ avgCutOutWindSpeed = 0;
|
|
|
+ } else {
|
|
|
+ avgCutOutWindSpeed = sum.get() / mapTurbineValues2.size();
|
|
|
+ }
|
|
|
+ System.out.println(turbine.getTurbineId() + "切出平均风速" + avgCutOutWindSpeed + "时间" + timeBegin);
|
|
|
+ }
|
|
|
+
|
|
|
+ //存入数据库
|
|
|
+ String turbineId = turbine.getTurbineId();
|
|
|
+ Date jdkDate = timeBegin.toJdkDate();
|
|
|
+ System.out.println(turbineId + " " + jdkDate);
|
|
|
+ QueryWrapper<TurbineInfoDay> turbineInfoDayQueryWrapper = new QueryWrapper<>();
|
|
|
+ turbineInfoDayQueryWrapper.eq("turbine_id", turbine.getTurbineId());
|
|
|
+ turbineInfoDayQueryWrapper.eq("record_date", timeBegin.toJdkDate());
|
|
|
+ TurbineInfoDay one = turbineInfoDayService.getOne(turbineInfoDayQueryWrapper);
|
|
|
+ System.out.println(one);
|
|
|
+ if (one == null) {
|
|
|
+ TurbineInfoDay turbineInfoDay = new TurbineInfoDay();
|
|
|
+ turbineInfoDay.setTurbineId(turbine.getTurbineId());
|
|
|
+ turbineInfoDay.setRecordDate(timeBegin.toJdkDate());
|
|
|
+ turbineInfoDay.setXfqrfs(avgCutInWindSpeed);
|
|
|
+ System.out.println(turbineInfoDay);
|
|
|
+ turbineInfoDayService.save(turbineInfoDay);
|
|
|
+ } else {
|
|
|
+ one.setXfqrfs(avgCutInWindSpeed);
|
|
|
+ System.out.println(one);
|
|
|
+ turbineInfoDayService.updateById(one);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//切入切出风速
|
|
|
|
|
|
- public void cutInWindSpeed() {
|
|
|
+ public void cutInWindSpeed2() {
|
|
|
//date当天零点
|
|
|
DateTime timeNow00 = DateUtil.beginOfDay(new Date());
|
|
|
//date昨天零点
|
|
|
@@ -2412,10 +2763,10 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void calcGlqxnh_edfs() {
|
|
|
+ public void calcGlqxnh_edfs(Date date) {
|
|
|
|
|
|
//date当天零点
|
|
|
- Date end = DateUtil.beginOfDay(new Date()).toJdkDate();
|
|
|
+ Date end = DateUtil.beginOfDay(date).toJdkDate();
|
|
|
//date昨天零点
|
|
|
Date start = DateUtil.offsetDay(end, -1).toJdkDate();
|
|
|
|
|
|
@@ -2427,20 +2778,20 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
|
|
|
Map<String, EquipmentModel> map = equipmentModelService.map();
|
|
|
|
|
|
-// List<PointInfo> entity = new ArrayList<>();
|
|
|
-// List<PointInfo> entity0 = getEntity("MX000", "state");
|
|
|
-// List<PointInfo> entity1 = getEntity("MX001", "state");
|
|
|
-// List<PointInfo> entity2 = getEntity("MX002", "state");
|
|
|
-// List<PointInfo> entity4 = getEntity("MX004", "state");
|
|
|
-// List<PointInfo> entity6 = getEntity("MX006", "state");
|
|
|
-// entity.addAll(entity0);
|
|
|
-// entity.addAll(entity1);
|
|
|
-// entity.addAll(entity2);
|
|
|
-// entity.addAll(entity4);
|
|
|
-// entity.addAll(entity6);
|
|
|
-// List<String> keys = entity.stream().map(PointInfo::getPointKey).collect(Collectors.toList());
|
|
|
-// Map<String, PointData> latest = adapter.getHistorySection(goldenUri(), String.join(",", keys), start.getTime());
|
|
|
-// Map<String, Map<String, PointInfo>> wtUcPis = entity.stream().collect(Collectors.groupingBy(PointInfo::getTurbineId, Collectors.toMap(PointInfo::getUniformCode, Function.identity())));
|
|
|
+ // List<PointInfo> entity = new ArrayList<>();
|
|
|
+ // List<PointInfo> entity0 = getEntity("MX000", "state");
|
|
|
+ // List<PointInfo> entity1 = getEntity("MX001", "state");
|
|
|
+ // List<PointInfo> entity2 = getEntity("MX002", "state");
|
|
|
+ // List<PointInfo> entity4 = getEntity("MX004", "state");
|
|
|
+ // List<PointInfo> entity6 = getEntity("MX006", "state");
|
|
|
+ // entity.addAll(entity0);
|
|
|
+ // entity.addAll(entity1);
|
|
|
+ // entity.addAll(entity2);
|
|
|
+ // entity.addAll(entity4);
|
|
|
+ // entity.addAll(entity6);
|
|
|
+ // List<String> keys = entity.stream().map(PointInfo::getPointKey).collect(Collectors.toList());
|
|
|
+ // Map<String, PointData> latest = adapter.getHistorySection(goldenUri(), String.join(",", keys), start.getTime());
|
|
|
+ // Map<String, Map<String, PointInfo>> wtUcPis = entity.stream().collect(Collectors.groupingBy(PointInfo::getTurbineId, Collectors.toMap(PointInfo::getUniformCode, Function.identity())));
|
|
|
|
|
|
List<PointInfo> entityAiZt = getEntity("AI422", "state");
|
|
|
Map<String, PointInfo> aiztMap = entityAiZt.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
@@ -2448,7 +2799,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
Map<String, Map<Integer, Integer>> collectAi = list.stream().collect(Collectors.groupingBy(
|
|
|
StateAi::getModel, Collectors.toMap(StateAi::getOriginalState, StateAi::getMappingState)));
|
|
|
|
|
|
-// Map<String, Map<Double,Double>> fitMap = new HashMap<>();
|
|
|
+ // Map<String, Map<Double,Double>> fitMap = new HashMap<>();
|
|
|
int i = 0;
|
|
|
for (PointInfo ef : entityFs) {
|
|
|
String wtId = ef.getTurbineId();
|
|
|
@@ -2460,30 +2811,30 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
ef.setPointDatas(peek);
|
|
|
|
|
|
try {
|
|
|
-// PointInfo turbineZt = calcTurbineDizt2(wtUcPis.get(wtId), latest, start, end, 60);
|
|
|
+ // PointInfo turbineZt = calcTurbineDizt2(wtUcPis.get(wtId), latest, start, end, 60);
|
|
|
PointInfo turbineAizt = calcTurbineAizt2(aiztMap.get(wtId), collectAi, start, end, 60);
|
|
|
Map<Double, Double> fit = new TreeMap<>();
|
|
|
double capacity = 2000;
|
|
|
-// if (turbineZt != null) {
|
|
|
-// System.out.println("数据处理拟合");
|
|
|
-// capacity = map.get(turbineZt.getSpare()).getPowerProduction();
|
|
|
-// fit = dataProcessAndFit(ef, glInfo, turbineZt, CalcCache.bzgl.get(turbineZt.getSpare()), capacity);
|
|
|
-//// fitMap.put(wtId, fit);
|
|
|
-// turbineZt.setPointDatas(null);
|
|
|
-// }
|
|
|
+ // if (turbineZt != null) {
|
|
|
+ // System.out.println("数据处理拟合");
|
|
|
+ // capacity = map.get(turbineZt.getSpare()).getPowerProduction();
|
|
|
+ // fit = dataProcessAndFit(ef, glInfo, turbineZt, CalcCache.bzgl.get(turbineZt.getSpare()), capacity);
|
|
|
+ //// fitMap.put(wtId, fit);
|
|
|
+ // turbineZt.setPointDatas(null);
|
|
|
+ // }
|
|
|
if (turbineAizt != null) {
|
|
|
System.out.println("数据处理拟合");
|
|
|
capacity = map.get(turbineAizt.getSpare()).getPowerProduction();
|
|
|
fit = dataProcessAndFit(ef, glInfo, turbineAizt, CalcCache.bzgl.get(turbineAizt.getSpare()), capacity);
|
|
|
-// fitMap.put(wtId, fit);
|
|
|
+ // fitMap.put(wtId, fit);
|
|
|
turbineAizt.setPointDatas(null);
|
|
|
}
|
|
|
ef.setPointDatas(null);
|
|
|
glInfo.setPointDatas(null);
|
|
|
|
|
|
//存redis
|
|
|
-// stringRedisTemplate.opsForValue().set("glqxnh:" + end.getMonth() + ":" + wtId, JSON.toJSONString(fit));
|
|
|
- System.out.println("拟合曲线的大小"+fit.size()+":"+wtId);
|
|
|
+ // stringRedisTemplate.opsForValue().set("glqxnh:" + end.getMonth() + ":" + wtId, JSON.toJSONString(fit));
|
|
|
+ System.out.println("拟合曲线的大小" + fit.size() + ":" + wtId);
|
|
|
|
|
|
|
|
|
//符合条件的风速和
|
|
|
@@ -2529,15 +2880,14 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
turbineInfoDayService.updateById(one);
|
|
|
}
|
|
|
|
|
|
- }catch (Exception e) {
|
|
|
+ } catch (Exception e) {
|
|
|
System.out.println(wtId + " " + start);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-// stringRedisTemplate.opsForValue().set("glqxnh", JSON.toJSONString(fitMap));
|
|
|
+ // stringRedisTemplate.opsForValue().set("glqxnh", JSON.toJSONString(fitMap));
|
|
|
}
|
|
|
|
|
|
//算额定风速
|
|
|
@@ -3374,7 +3724,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
pdsZsglMap.put(wtId, zsglSnap);
|
|
|
});
|
|
|
boolean b = agcInfo.getPointDatas().stream().allMatch(ad -> ad.getValue() == 0);
|
|
|
- if(b){
|
|
|
+ if (b) {
|
|
|
PointInfo info = new PointInfo();
|
|
|
info.setPointKey(agcInfo.getPointKey());
|
|
|
getLatestByEntity(Collections.singletonList(info));
|
|
|
@@ -3383,7 +3733,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
agc.setDoubleValue(agcd * agcInfo.getCoef());
|
|
|
agc.setLongValue(0L);
|
|
|
});
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
agcInfo.getPointDatas().forEach(agc -> {
|
|
|
agc.setDoubleValue(agc.getValue() * agcInfo.getCoef());
|
|
|
agc.setLongValue(0L);
|
|
|
@@ -3569,17 +3919,26 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
infoDay.setJxMin(durations.getOrDefault(6.0, 0L) / 60000.0);
|
|
|
infoDay.setXdMin(durations.getOrDefault(8.0, 0L) / 60000.0);
|
|
|
infoDay.setLxMin(durations.getOrDefault(12.0, 0L) / 60000.0);
|
|
|
+ infoDay.setDjcs(frequency.getOrDefault(0.0, 0L));
|
|
|
+ infoDay.setTjcs(frequency.getOrDefault(1.0, 0L));
|
|
|
+ infoDay.setYxcs(frequency.getOrDefault(2.0, 0L));
|
|
|
+ infoDay.setGzcs(frequency.getOrDefault(4.0, 0L));
|
|
|
+ infoDay.setJxcs(frequency.getOrDefault(6.0, 0L));
|
|
|
+ infoDay.setXdcs(frequency.getOrDefault(8.0, 0L));
|
|
|
+ infoDay.setLxcs(frequency.getOrDefault(12.0, 0L));
|
|
|
}
|
|
|
turbineInfoDayService.saveOrUpdateBatch(byDate.values());
|
|
|
}
|
|
|
|
|
|
|
|
|
public Map<String, Map<Double, Long>> calcStateDurationFrequency(List<PointData> datas) {
|
|
|
- if (CollUtil.isEmpty(datas)) return Collections.emptyMap();
|
|
|
-
|
|
|
Map<Double, Long> durations = new HashMap<>();
|
|
|
Map<Double, Long> frequency = new HashMap<>();
|
|
|
Map<String, Map<Double, Long>> dlmm = new HashMap<>();
|
|
|
+ dlmm.put("duration", durations);
|
|
|
+ dlmm.put("frequency", frequency);
|
|
|
+ if (CollUtil.isEmpty(datas)) return dlmm;
|
|
|
+
|
|
|
double prevState = datas.get(0).getValue(); // 初始状态
|
|
|
long prevTs = datas.get(0).getTs(); // 初始时间戳
|
|
|
|
|
|
@@ -3601,12 +3960,272 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
}
|
|
|
// 不要忘记计算列表中最后一个状态的持续时间(如果列表没有以状态变化结束)
|
|
|
durations.put(prevState, durations.getOrDefault(prevState, 0L) + (datas.get(datas.size() - 1).getTs() - prevTs));
|
|
|
-
|
|
|
- dlmm.put("duration", durations);
|
|
|
- dlmm.put("frequency", frequency);
|
|
|
return dlmm;
|
|
|
}
|
|
|
|
|
|
+ //依赖calcTurbineStateMin
|
|
|
+ public void calcStationCftfsfxQfxdl(Date date) {
|
|
|
+ //date当天零点
|
|
|
+ DateTime time = DateUtil.beginOfDay(date);
|
|
|
+ //date昨天零点
|
|
|
+ DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
+ List<TurbineInfoDay> byDate = getTurbineinfoByDate(time0);
|
|
|
+ Map<String, List<TurbineInfoDay>> tidsMap = byDate.stream().collect(Collectors.groupingBy(TurbineInfoDay::getStationId));
|
|
|
+ List<PointInfo> fsEt = getEntity("FCCFTFS90", "station");
|
|
|
+ List<PointInfo> fxEt = getEntity("FCCFTFX90", "station");
|
|
|
+ Map<String, PointInfo> rawFs = getRawDataByEntity(fsEt, goldenUri(), time0, time, PointInfo::getStationId);
|
|
|
+ Map<String, PointInfo> rawFx = getRawDataByEntity(fxEt, goldenUri(), time0, time, PointInfo::getStationId);
|
|
|
+ List<StationInfoDay> sids = getStationinfoByDate(time0, fsEt);
|
|
|
+
|
|
|
+ QueryWrapper<TurbineInfoDay> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.select("sum(xdss) xdss,station_id").eq("record_date", time0).groupBy("station_id");
|
|
|
+ List<TurbineInfoDay> list = turbineInfoDayService.list(wrapper);
|
|
|
+ Map<String, TurbineInfoDay> dayMap = list.stream().collect(Collectors.toMap(TurbineInfoDay::getStationId, Function.identity()));
|
|
|
+ for (StationInfoDay sid : sids) {
|
|
|
+ String stId = sid.getStationId();
|
|
|
+ List<TurbineInfoDay> tids = tidsMap.get(stId);
|
|
|
+ double whsj = tids.stream().mapToDouble(tid -> tid.getJxMin()).sum();
|
|
|
+ double gzsj = tids.stream().mapToDouble(tid -> tid.getGzMin()).sum();
|
|
|
+ double yxfss = (tids.size() * 24 * 60 - whsj - gzsj) / (tids.size() * 60);
|
|
|
+ List<PointData> fsDatas = Optional.ofNullable(rawFs.get(stId)).map(PointInfo::getPointDatas).orElse(Collections.emptyList());
|
|
|
+ sid.setCftfs(fsDatas.stream().mapToDouble(PointData::getValue).average().orElse(0d));
|
|
|
+ List<PointData> fxDatas = Optional.ofNullable(rawFx.get(stId)).map(PointInfo::getPointDatas).orElse(Collections.emptyList());
|
|
|
+ sid.setCftfx(fxDatas.stream().mapToDouble(PointData::getValue).average().orElse(0d));
|
|
|
+ sid.setYxfss(yxfss);
|
|
|
+ //弃风电量=限电时段全风场理论上网电量-限电时段全风场实际上网电量
|
|
|
+ //弃风限电率 = 弃风电量 / (风电实际发电量 + 弃风电量) × 100%
|
|
|
+ double xdss = dayMap.get(stId).getXdss();
|
|
|
+ double qfxdl = xdss * 100 / (sid.getRfdl() + xdss);
|
|
|
+ sid.setQfxdl(qfxdl);
|
|
|
+ }
|
|
|
+ stationInfoDayService.saveOrUpdateBatch(sids);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void calcMeterDlHdl(Date date) {
|
|
|
+ //date当天零点
|
|
|
+ DateTime time = DateUtil.beginOfDay(date);
|
|
|
+ //date昨天零点
|
|
|
+ DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
+ //1号主变高压侧正向有功
|
|
|
+ MeterInfoDay zbgyc1Day = calcMeterSimple("B-FXYG-ZBGYC1", time0, time, "ZB");
|
|
|
+ zbgyc1Day.setHdl(0d);
|
|
|
+ //1号主变低压侧正向有功
|
|
|
+ MeterInfoDay zbdyc1Day = calcMeterSimple("B-ZXYG-ZBDYC1", time0, time, "ZB");
|
|
|
+ calcMeterSimple("B-FXYG-ZBDYC1", time0, time, zbdyc1Day);
|
|
|
+ //2号主变高压侧正向有功
|
|
|
+ MeterInfoDay zbgyc2Day = calcMeterSimple("B-ZXYG-ZBGYC2", time0, time, "ZB");
|
|
|
+ calcMeterSimple("B-FXYG-ZBGYC2", time0, time, zbgyc2Day);
|
|
|
+ //2号主变低压侧正向有功
|
|
|
+ MeterInfoDay zbdyc2Day = calcMeterSimple("B-ZXYG-ZBDYC2", time0, time, "ZB");
|
|
|
+ calcMeterSimple("B-FXYG-ZBDYC2", time0, time, zbdyc2Day);
|
|
|
+ //1号接地变兼站用变 B-ZXYG-ZDB1 B-FXYG-ZDB1
|
|
|
+ MeterInfoDay jdb1Day = calcMeterSimple("B-ZXYG-ZDB1", time0, time, "ZYB");
|
|
|
+ calcMeterSimple("B-FXYG-ZDB1", time0, time, jdb1Day);
|
|
|
+ //2号接地变 B-ZXYG-ZDB1 B-FXYG-ZDB1
|
|
|
+ MeterInfoDay jdb2Day = calcMeterSimple("B-ZXYG-ZDB2", time0, time, "JDB");
|
|
|
+ calcMeterSimple("B-FXYG-ZDB2", time0, time, jdb2Day);
|
|
|
+ //1号SVG B-ZXYG-SVG1 B-FXYG-SVG1
|
|
|
+ MeterInfoDay svg1Day = calcMeterSimple("B-ZXYG-SVG1", time0, time, "SVG");
|
|
|
+ calcMeterSimple("B-FXYG-SVG1", time0, time, svg1Day);
|
|
|
+ //2号SVG B-ZXYG-SVG2 B-FXYG-SVG2
|
|
|
+ MeterInfoDay svg2Day = calcMeterSimple("B-ZXYG-SVG2", time0, time, "SVG");
|
|
|
+ calcMeterSimple("B-FXYG-SVG2", time0, time, svg2Day);
|
|
|
+
|
|
|
+ List<MeterInfoDay> save = new ArrayList<>();
|
|
|
+ save.add(zbdyc1Day);
|
|
|
+ save.add(zbgyc2Day);
|
|
|
+ save.add(zbdyc2Day);
|
|
|
+ meterInfoDayService.saveOrUpdateBatch(save);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void calcStationKqmd(Date date, String uniform_code) {
|
|
|
+ //date当天零点
|
|
|
+ DateTime time = DateUtil.beginOfDay(date);
|
|
|
+ //date昨天零点
|
|
|
+ DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
+ List<PointInfo> wdEt = getEntity("FCCFTWD", "station");
|
|
|
+ List<PointInfo> yqEt = getEntity("FCCFTYQ", "station");
|
|
|
+ Map<String, PointInfo> rawWd = getRawDataByEntity(wdEt, goldenUri(), time0, time, PointInfo::getStationId);
|
|
|
+ Map<String, PointInfo> secYq = getSectionDataByEntity(yqEt, goldenUri(), time0, time, PointInfo::getStationId);
|
|
|
+ List<StationInfoDay> sids = getStationinfoByDate(time0, wdEt);
|
|
|
+ for (StationInfoDay sid : sids) {
|
|
|
+ String stId = sid.getStationId();
|
|
|
+ List<PointData> wdData = rawWd.get(stId).getPointDatas();
|
|
|
+ List<PointData> yqData = secYq.get(stId).getPointDatas();
|
|
|
+ double wd = wdData.stream().mapToDouble(PointData::getValue).average().orElse(0d);
|
|
|
+ double yq = yqData.stream().mapToDouble(PointData::getValue).average().orElse(0d);
|
|
|
+ double md = 1.293 * (yq * 100 / 101325) * (273.15 / (wd + 273.15));
|
|
|
+ sid.setKqmd(md);
|
|
|
+ }
|
|
|
+ stationInfoDayService.saveOrUpdateBatch(sids);
|
|
|
+ }
|
|
|
+
|
|
|
+ public MeterInfoDay calcMeterSimple(String uniform_code, DateTime time0, DateTime time, String parent_id) {
|
|
|
+ PointInfo et = getEntityOne(uniform_code, "meter");
|
|
|
+ getRawDataByEntity(Collections.singletonList(et), goldenUri(), time0, time);
|
|
|
+ MeterInfoDay day = getMeterinfoByDate(time0, et);
|
|
|
+ day.setParentId(parent_id);
|
|
|
+ day.setFdl(calcHaDl(et));
|
|
|
+ return day;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void calcMeterSimple(String uniform_code, DateTime time0, DateTime time, MeterInfoDay day) {
|
|
|
+ PointInfo et = getEntityOne(uniform_code, "meter");
|
|
|
+ getRawDataByEntity(Collections.singletonList(et), goldenUri(), time0, time);
|
|
|
+ day.setHdl(calcHaDl(et));
|
|
|
+ }
|
|
|
+
|
|
|
+ public double calcHaDl(PointInfo pi) {
|
|
|
+ List<PointData> pds = Optional.ofNullable(pi).map(PointInfo::getPointDatas).orElse(Collections.emptyList());
|
|
|
+ pds = pi.getPointDatas().stream().filter(pd -> pd.getValue() != 0).collect(Collectors.toList());
|
|
|
+ if (pds.size() < 2) return 0;
|
|
|
+ double dl = Math.abs(pds.get(0).getValue() - pds.get(pds.size() - 1).getValue()) * pi.getCoef();
|
|
|
+ return dl;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void calcStationKydlzql(Date date) {
|
|
|
+ //date昨天零点
|
|
|
+ DateTime begin = DateUtil.offsetDay(DateUtil.beginOfDay(date), -1);
|
|
|
+ //date昨天晚
|
|
|
+ DateTime end = DateUtil.offsetDay(DateUtil.endOfDay(date), -1);
|
|
|
+
|
|
|
+ //实际功率
|
|
|
+ QueryWrapper<StationInfoMin> minWrapper = new QueryWrapper<>();
|
|
|
+ minWrapper.between("record_date", begin, end).orderByAsc("record_date");
|
|
|
+ List<StationInfoMin> minList = stationInfoMinService.list(minWrapper);
|
|
|
+ Map<String, List<StationInfoMin>> minMap = minList.stream().collect(Collectors.groupingBy(StationInfoMin::getStationId));
|
|
|
+ List<PointInfo> entityGl = getEntity("AGC001", "booster");
|
|
|
+ Map<String, Double> glpisMap = entityGl.stream().collect(Collectors.toMap(PointInfo::getStationId, PointInfo::getSpare2));
|
|
|
+
|
|
|
+ List<PointInfo> entityKyfdl = getEntity("FCKYFDL", "station");
|
|
|
+ getRawDataByEntity(entityKyfdl, taosUri(), begin, end);
|
|
|
+ Map<String, PointInfo> kyfdlMap = entityKyfdl.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
|
|
|
+ List<PointInfo> entityCzzt = getEntity("AGC009", "booster");
|
|
|
+ getRawDataByEntity(entityCzzt, taosUri(), begin, end);
|
|
|
+ Map<String, PointInfo> czztMap = entityCzzt.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
|
|
|
+ Map<String, Map<DateTime, List<Double>>> czztMapMap = new HashMap<>();
|
|
|
+ czztMap.forEach((stId, pi) -> {
|
|
|
+ Map<DateTime, List<Double>> ztMap = new HashMap<>();
|
|
|
+ long b = begin.getTime();
|
|
|
+ long e = end.getTime();
|
|
|
+ long b0 = b;
|
|
|
+ long e0 = b + 15 * 60 * 1000;
|
|
|
+ while (e0 < e) {
|
|
|
+ for (PointData pd : pi.getPointDatas()) {
|
|
|
+ long ts = pd.getTs();
|
|
|
+ if (ts >= b0 && ts < e0) {
|
|
|
+ List<Double> doubles = ztMap.computeIfAbsent(DateUtil.date(b0), k -> new ArrayList<>());
|
|
|
+ doubles.add(pd.getValue());
|
|
|
+ } else if (ts >= e0 && ts < e0 + 15 * 60 * 1000) {
|
|
|
+ List<Double> doubles = ztMap.computeIfAbsent(DateUtil.date(e0), k -> new ArrayList<>());
|
|
|
+ doubles.add(pd.getValue());
|
|
|
+ b0 = e0;
|
|
|
+ e0 += 15 * 60 * 1000;
|
|
|
+ } else {
|
|
|
+ b0 = e0;
|
|
|
+ e0 += 15 * 60 * 1000;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (pi.getPointDatas().isEmpty()) {
|
|
|
+ b0 = e0;
|
|
|
+ e0 += 15 * 60 * 1000;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ czztMapMap.put(stId, ztMap);
|
|
|
+ });
|
|
|
+
|
|
|
+ List<StationInfoDay> sids = getStationinfoByDate(begin, entityGl);
|
|
|
+ for (StationInfoDay sid : sids) {
|
|
|
+ String stId = sid.getStationId();
|
|
|
+ Double capacity = glpisMap.get(stId) * 1000;
|
|
|
+ List<StationInfoMin> mins = minMap.get(stId);
|
|
|
+ Map<DateTime, List<Double>> dtlMap = czztMapMap.get(stId);
|
|
|
+ PointInfo kyfdlPi = kyfdlMap.get(stId);
|
|
|
+ List<PointData> kyfdlDatas = Optional.ofNullable(kyfdlPi).map(PointInfo::getPointDatas).orElse(Collections.emptyList());
|
|
|
+ Map<Long, List<PointData>> kydlMap = kyfdlDatas.stream().collect(Collectors.groupingBy(pd -> pd.getTs() % (15 * 60 * 1000)));
|
|
|
+ double actualPower = 0, availablePower = 0;
|
|
|
+ for (StationInfoMin min : mins) {
|
|
|
+ List<Double> doubles = dtlMap.get(min.getRecordDate());
|
|
|
+ List<PointData> kypd = kydlMap.get(min.getRecordDate().getTime());
|
|
|
+ //限电
|
|
|
+ if (calcXdRate(doubles) > 0.6) continue;
|
|
|
+ actualPower += min.getRfdl();
|
|
|
+ availablePower += kypd.stream().mapToDouble(PointData::getValue).sum();
|
|
|
+ }
|
|
|
+ double accuracy = calcKydlAccuracy(actualPower, availablePower * kyfdlPi.getCoef(), capacity);
|
|
|
+ sid.setKydlzql(accuracy * 100);
|
|
|
+ }
|
|
|
+ stationInfoDayService.saveOrUpdateBatch(sids);
|
|
|
+ }
|
|
|
+
|
|
|
+ //依赖calcTurbineStateMin
|
|
|
+ public void calcTurbineJfplFxYxfssBll(Date date) {
|
|
|
+ //date当天零点
|
|
|
+ DateTime time = DateUtil.beginOfDay(date);
|
|
|
+ //date昨天零点
|
|
|
+ DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
+ //风速
|
|
|
+ List<PointInfo> entityFs = getEntity("AI066", "turbine");
|
|
|
+ Map<String, PointInfo> rawDataFs = getRawDataByEntity(entityFs, goldenUri(), time0, time, PointInfo::getTurbineId);
|
|
|
+ List<TurbineInfoDay> byDate = getTurbineinfoByDate(time0);
|
|
|
+ //风向
|
|
|
+ List<PointInfo> entityFx = getEntity("DI1392", "turbine");
|
|
|
+ Map<String, PointInfo> rawDataFx = getRawDataByEntity(entityFx, goldenUri(), time0, time, PointInfo::getTurbineId);
|
|
|
+
|
|
|
+ for (TurbineInfoDay day : byDate) {
|
|
|
+ String tbId = day.getTurbineId();
|
|
|
+ List<PointData> pds = Optional.ofNullable(rawDataFs.get(tbId))
|
|
|
+ .map(PointInfo::getPointDatas).orElse(Collections.emptyList());
|
|
|
+ long jfsc = calcDuration(pds, pd -> pd.getValue() < 3d);
|
|
|
+ day.setJfpl(jfsc / (1000 * 60 * 60 * 24d));
|
|
|
+ double yxfss = (24 * 60 - day.getJxMin() - day.getGzMin()) / 60;
|
|
|
+ day.setYxfss(yxfss);
|
|
|
+ List<PointData> pdsFx = Optional.ofNullable(rawDataFx.get(tbId))
|
|
|
+ .map(PointInfo::getPointDatas).orElse(Collections.emptyList());
|
|
|
+ double fx = pdsFx.stream().mapToDouble(PointData::getValue).average().orElse(0d);
|
|
|
+ day.setFx(fx);
|
|
|
+ //暴露率 = (运行小时 / 可用小时) × 100%
|
|
|
+ double bll = day.getYxMin() * 100 / (24 * 60 - day.getGzMin() - day.getJxMin());
|
|
|
+ day.setBll(bll);
|
|
|
+ }
|
|
|
+ turbineInfoDayService.saveOrUpdateBatch(byDate);
|
|
|
+ }
|
|
|
+
|
|
|
+ //依赖calcTurbineRfdl、calcTurbineStateMin、calcTurbine5s2
|
|
|
+ public void calcTurbineLyxs(Date date) {
|
|
|
+ //date当天零点
|
|
|
+ DateTime time = DateUtil.beginOfDay(date);
|
|
|
+ //date昨天零点
|
|
|
+ DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
+ List<TurbineInfoDay> byDate = getTurbineinfoByDate(time0);
|
|
|
+ Map<String, PointInfo> entityAiZt = getEntity("AI422", "state", PointInfo::getTurbineId);
|
|
|
+
|
|
|
+ for (TurbineInfoDay day : byDate) {
|
|
|
+ String tbId = day.getTurbineId();
|
|
|
+ double lyxs = day.getRfdl() / entityAiZt.get(tbId).getSpare2();
|
|
|
+ double klyl = (24 * 60 - day.getGzMin()) / (24 * 60);
|
|
|
+ double fnlyl = day.getRfdl() / day.getLlfdl();
|
|
|
+ day.setLyxs(lyxs);
|
|
|
+ day.setKlyl(klyl);
|
|
|
+ day.setFnlyl(fnlyl);
|
|
|
+ }
|
|
|
+ turbineInfoDayService.saveOrUpdateBatch(byDate);
|
|
|
+ }
|
|
|
+
|
|
|
+ public long calcDuration(List<PointData> pds, Function<PointData, Boolean> fun) {
|
|
|
+ if (CollUtil.isEmpty(pds)) return 0;
|
|
|
+ pds.sort(Comparator.comparingLong(PointData::getTs));
|
|
|
+ long result = 0;
|
|
|
+ PointData prevPd = pds.get(0);
|
|
|
+ for (PointData pd : pds) {
|
|
|
+ if (fun.apply(prevPd)) {
|
|
|
+ result += pd.getTs() - prevPd.getTs();
|
|
|
+ }
|
|
|
+ prevPd = pd;
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
public Map<Double, Long> calculateStateDurations(List<PointData> datas) {
|
|
|
if (CollUtil.isEmpty(datas)) return Collections.emptyMap();
|
|
|
|
|
|
@@ -3759,6 +4378,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
entity.addAll(entity2);
|
|
|
entity.addAll(entity4);
|
|
|
entity.addAll(entity6);
|
|
|
+ if (CollUtil.isEmpty(entity)) return new HashMap<>();
|
|
|
entity = entity.stream().filter(pi -> stId.equals(pi.getStationId())).collect(Collectors.toList());
|
|
|
if (CollUtil.isEmpty(entity)) return new HashMap<>();
|
|
|
String keys = entity.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
|
|
|
@@ -4663,6 +5283,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
entity.addAll(entity2);
|
|
|
entity.addAll(entity4);
|
|
|
entity.addAll(entity6);
|
|
|
+ if (CollUtil.isEmpty(entity)) return result;
|
|
|
String keys = entity.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
|
|
|
Map<String, PointData> latest = adapter.getHistorySection(goldenUri(), keys, time.getTime());
|
|
|
|
|
|
@@ -5361,6 +5982,11 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
return entity.stream().filter(e -> id.equals(fun.apply(e))).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
+ public void filterPointInfo2(List<PointInfo> entity, String id, Function<PointInfo, String> fun) {
|
|
|
+ entity = entity.stream().filter(e -> id.equals(fun.apply(e))).collect(Collectors.toList());
|
|
|
+ System.out.println();
|
|
|
+ }
|
|
|
+
|
|
|
public List<PointInfo> sortPointInfo(List<PointInfo> entity, Function<PointInfo, String> fun) {
|
|
|
return entity.stream().sorted(Comparator.comparing(fun)).collect(Collectors.toList());
|
|
|
}
|
|
|
@@ -6281,47 +6907,299 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// public void calcTurbineJfplPjfxGlyzxxs(Date date) {
|
|
|
-// //静风频率,平均风向、功率一致性系数
|
|
|
-// //date当天零点
|
|
|
-// DateTime time = DateUtil.beginOfDay(date);
|
|
|
-// //date昨天零点
|
|
|
-// DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
-//
|
|
|
-// List<PointInfo> entityFx = getEntity("AI066", "turbine");
|
|
|
-// getStatDataByEntity();
|
|
|
-// getZeroNextData(entity, time0, time);
|
|
|
-// Map<String, PointInfo> turMap = entity.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
-// Map<String, String> fsMap = getEntityMap("AI066", "turbine");
|
|
|
-//
|
|
|
-// Map<String, TurbineInfoDay> byDate = getTurbineinfoMap(time0, entity);
|
|
|
-//
|
|
|
-// TurbineInfoDay infoDay;
|
|
|
-// PointInfo rfdlPi;
|
|
|
-// String turbineId;
|
|
|
-// List<TurbineInfoDay> infoDays = new ArrayList<>();
|
|
|
-// DoubleStatData stat;
|
|
|
-// for (PointInfo info : entity) {
|
|
|
-// turbineId = info.getTurbineId();
|
|
|
-// infoDay = byDate.get(turbineId);
|
|
|
-//
|
|
|
-// rfdlPi = turMap.get(turbineId);
|
|
|
-// double v = (rfdlPi.getPointDatas().get(1).getValue() - rfdlPi.getPointDatas().get(0).getValue()) * rfdlPi.getCoef();
|
|
|
-// if (v < 0 || v > 1000000) {
|
|
|
-// v = 0;
|
|
|
-// } else if (v > 30000) {
|
|
|
-// v = v / (v % 30000 + 3);
|
|
|
-// }
|
|
|
-// infoDay.setRfdl(v);
|
|
|
-// stat = adapter.getHistoryStat(goldenUri(), fsMap.get(turbineId), time0.getTime(), time.getTime());
|
|
|
-// if (stat == null) {
|
|
|
-// infoDay.setPjfs(0.0);
|
|
|
-// } else {
|
|
|
-// infoDay.setPjfs(stat.getAvg().getValue());
|
|
|
-// }
|
|
|
-//
|
|
|
-// infoDays.add(infoDay);
|
|
|
-// }
|
|
|
-// turbineInfoDayService.saveOrUpdateBatch(infoDays);
|
|
|
-// }
|
|
|
+ //计算惠安报表汇总
|
|
|
+ public void calcHaBbHzSs(Date date) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //计算惠安报表汇总实时
|
|
|
+ public void calcHaBbHz(Date date) {
|
|
|
+ DateTime begin = DateUtil.beginOfDay(date);
|
|
|
+ DateTime yesterday = DateUtil.offsetDay(begin, -1);
|
|
|
+ //计算指标配置
|
|
|
+ QueryWrapper<ProBaseBackfill> fillWrapper = new QueryWrapper<>();
|
|
|
+ fillWrapper.lambda().eq(ProBaseBackfill::getPushTime, "12");
|
|
|
+ List<ProBaseBackfill> fills = proBaseBackfillService.list(fillWrapper);
|
|
|
+ Map<String, Map<String, Map<String, ProBaseBackfill>>> fillMapMap = fills.stream().collect(Collectors.groupingBy(ProBaseBackfill::getType,
|
|
|
+ Collectors.groupingBy(ProBaseBackfill::getTaskDescription, Collectors.toMap(ProBaseBackfill::getOperatingMode, Function.identity()))));
|
|
|
+ //指标保存表
|
|
|
+ QueryWrapper<ProEconEquipmentInfoJs> eijWrapper = new QueryWrapper<>();
|
|
|
+ eijWrapper.lambda().eq(ProEconEquipmentInfoJs::getRecordDate, yesterday);
|
|
|
+ List<ProEconEquipmentInfoJs> eijs = proEconEquipmentInfoJsService.list(eijWrapper);
|
|
|
+ Map<String, ProEconEquipmentInfoJs> eijMap = eijs.stream().collect(Collectors.toMap(ProEconEquipmentInfoJs::getMeterId, Function.identity()));
|
|
|
+ //风机日月发电量
|
|
|
+ Map<String, ProBaseBackfill> fillMapFdlR = fillMapMap.get("FDL").get("日");
|
|
|
+ Map<String, ProBaseBackfill> fillMapFdlY = fillMapMap.get("FDL").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapFdlN = fillMapMap.get("FDL").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapFdlR2 = fillMapMap.get("FDLFJ").get("日");
|
|
|
+ Map<String, ProBaseBackfill> fillMapFdlY2 = fillMapMap.get("FDLFJ").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapFdlN2 = fillMapMap.get("FDLFJ").get("年");
|
|
|
+ List<TurbineInfoDay> tidsR = turbineInfoDayService.getDatasByPartSelects(date, DatePart.DAY, "rfdl", TurbineInfoDay::getTurbineId);
|
|
|
+ for (TurbineInfoDay day : tidsR) {
|
|
|
+ String tbId = day.getTurbineId();
|
|
|
+ ProBaseBackfill fill = fillMapFdlR.get(tbId);
|
|
|
+ ProEconEquipmentInfoJs js = getPeeijs(fill, eijMap, yesterday);
|
|
|
+ js.setStopCode(day.getRfdl());
|
|
|
+ }
|
|
|
+ List<TurbineInfoDay> tidsY = turbineInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, "rfdl", TurbineInfoDay::getTurbineId);
|
|
|
+ for (TurbineInfoDay day : tidsY) {
|
|
|
+ String tbId = day.getTurbineId();
|
|
|
+ ProBaseBackfill fill = fillMapFdlY.get(tbId);
|
|
|
+ ProEconEquipmentInfoJs js = getPeeijs(fill, eijMap, yesterday);
|
|
|
+ js.setStopCode(day.getRfdl());
|
|
|
+ }
|
|
|
+ //实际发电量 SJFDL,上网电量 SWDL,购网电量 GWDL,场用电量 CYDL,场用电率 CYDL,综合场用电量 ZHCYDL
|
|
|
+ //综合场用电率 ZHCYDL,平均风速 PJFS,定检维护电量 DJWHDL,故障损失电量 GZSSDL,计划发电量 JHFDL
|
|
|
+ //利用小时数 LYXSS,设备可利用率 SBKLYL,受累损失电量 SLSSDL,限电量 XDL,限电率 XDL
|
|
|
+ Map<String, ProBaseBackfill> fillMapR17 = fillMapMap.get("HDL").get("日");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY01 = fillMapMap.get("SJFDL").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY02 = fillMapMap.get("SWDL").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY03 = fillMapMap.get("GWDL").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY04 = fillMapMap.get("CYDL").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY05 = fillMapMap.get("CYDLV").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY06 = fillMapMap.get("ZHCYDL").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY07 = fillMapMap.get("ZHCYDLV").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY08 = fillMapMap.get("PJFS").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY09 = fillMapMap.get("DJWHDL").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY10 = fillMapMap.get("GZSSDL").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY11 = fillMapMap.get("JHFDL").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY12 = fillMapMap.get("LYXSS").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY13 = fillMapMap.get("SBKLYL").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY14 = fillMapMap.get("SLSSDL").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY15 = fillMapMap.get("XDL").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY16 = fillMapMap.get("XDLV").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapY17 = fillMapMap.get("HDL").get("月");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN01 = fillMapMap.get("SJFDL").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN02 = fillMapMap.get("SWDL").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN03 = fillMapMap.get("GWDL").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN04 = fillMapMap.get("CYDL").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN05 = fillMapMap.get("CYDLV").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN06 = fillMapMap.get("ZHCYDL").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN07 = fillMapMap.get("ZHCYDLV").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN08 = fillMapMap.get("PJFS").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN09 = fillMapMap.get("DJWHDL").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN10 = fillMapMap.get("GZSSDL").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN11 = fillMapMap.get("JHFDL").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN12 = fillMapMap.get("LYXSS").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN13 = fillMapMap.get("SBKLYL").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN14 = fillMapMap.get("SLSSDL").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN15 = fillMapMap.get("XDL").get("年");
|
|
|
+ Map<String, ProBaseBackfill> fillMapN16 = fillMapMap.get("XDLV").get("年");
|
|
|
+ String select1 = SqlUtil.getSelectSum("swdl,gwdl,cydl,rfdl,hdl");
|
|
|
+ String select2 = SqlUtil.getSelectAvg("pjfs,klyl") + "," + SqlUtil.getSelectSum("gzss,xdss,lyxs");
|
|
|
+ String select3 = SqlUtil.getSelectSum("fdl,hdl");
|
|
|
+ String select4 = SqlUtil.getSelectSum("rfdl_fj");
|
|
|
+ //线路
|
|
|
+ List<LineInfoDay> lidsRXl = lineInfoDayService.getDatasByPartSelects(date, DatePart.DAY, select1, LineInfoDay::getLineId);
|
|
|
+ List<LineInfoDay> lidsYXl = lineInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select1, LineInfoDay::getLineId);
|
|
|
+ List<LineInfoDay> lidsYQc = lineInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select1, LineInfoDay::getProjectId);
|
|
|
+ List<LineInfoDay> lidsRCz = lineInfoDayService.getDatasByPartSelects(date, DatePart.DAY, select1, LineInfoDay::getStationId);
|
|
|
+ List<LineInfoDay> lidsYCz = lineInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select1, LineInfoDay::getStationId);
|
|
|
+ List<LineInfoDay> lidsNQc = lineInfoDayService.getDatasByPartSelects(date, DatePart.YEAR, select1, LineInfoDay::getProjectId);
|
|
|
+ List<LineInfoDay> lidsNCz = lineInfoDayService.getDatasByPartSelects(date, DatePart.YEAR, select1, LineInfoDay::getStationId);
|
|
|
+ //风机
|
|
|
+ List<TurbineInfoDay> tidsRXl = turbineInfoDayService.getDatasByPartSelects(date, DatePart.DAY, select2, TurbineInfoDay::getLineId);
|
|
|
+ List<TurbineInfoDay> tidsYXl = turbineInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select2, TurbineInfoDay::getLineId);
|
|
|
+ List<TurbineInfoDay> tidsYQc = turbineInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select2, TurbineInfoDay::getProjectId);
|
|
|
+ List<TurbineInfoDay> tidsYCz = turbineInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select2, TurbineInfoDay::getStationId);
|
|
|
+ List<TurbineInfoDay> tidsNQc = turbineInfoDayService.getDatasByPartSelects(date, DatePart.YEAR, select2, TurbineInfoDay::getProjectId);
|
|
|
+ List<TurbineInfoDay> tidsNCz = turbineInfoDayService.getDatasByPartSelects(date, DatePart.YEAR, select2, TurbineInfoDay::getStationId);
|
|
|
+ //场站
|
|
|
+ List<StationInfoDay> sidR = stationInfoDayService.getDatasByPartSelects(date, DatePart.DAY, select4, StationInfoDay::getStationId);
|
|
|
+ List<StationInfoDay> sidY = stationInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select4, StationInfoDay::getStationId);
|
|
|
+ List<StationInfoDay> sidN = stationInfoDayService.getDatasByPartSelects(date, DatePart.YEAR, select4, StationInfoDay::getStationId);
|
|
|
+ //电计量
|
|
|
+ List<MeterInfoDay> midsRMt = meterInfoDayService.getDatasByPartSelects(date, DatePart.DAY, select3, MeterInfoDay::getMeterId);
|
|
|
+ List<MeterInfoDay> midsYMt = meterInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select3, MeterInfoDay::getMeterId);
|
|
|
+ List<MeterInfoDay> midsRPrt = meterInfoDayService.getDatasByPartSelects(date, DatePart.DAY, select3, MeterInfoDay::getParentId);
|
|
|
+ List<MeterInfoDay> midsYPrt = meterInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select3, MeterInfoDay::getParentId);
|
|
|
+ //计划电量
|
|
|
+ List<ProBasicProjectPlan> plantsYQc = proBasicProjectPlanService.getDatasByPartSelect(date, DatePart.MONTH, "projectid");
|
|
|
+ List<ProBasicProjectPlan> plantsYCz = proBasicProjectPlanService.getDatasByPartSelect(date, DatePart.MONTH, "station");
|
|
|
+ List<ProBasicProjectPlan> plantsNQc = proBasicProjectPlanService.getDatasByPartSelect(date, DatePart.YEAR, "projectid");
|
|
|
+ List<ProBasicProjectPlan> plantsNCz = proBasicProjectPlanService.getDatasByPartSelect(date, DatePart.YEAR, "station");
|
|
|
+ //发电量日
|
|
|
+ lineCalcHz(midsRMt, fillMapFdlR, MeterInfoDay::getMeterId, MeterInfoDay::getFdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(sidR, fillMapFdlR2, StationInfoDay::getStationId, StationInfoDay::getRfdlFj, eijMap, yesterday);
|
|
|
+ lineCalcHz(sidR, fillMapFdlR, StationInfoDay::getStationId, sid-> Double.valueOf(sid.getRfdl()), eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsRXl, fillMapFdlR, LineInfoDay::getLineId, lid-> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsRXl, fillMapFdlR2, TurbineInfoDay::getLineId, TurbineInfoDay::getRfdl, eijMap, yesterday);
|
|
|
+ //发电量月
|
|
|
+ lineCalcHz(midsYMt, fillMapFdlY, MeterInfoDay::getMeterId, MeterInfoDay::getFdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(sidY, fillMapFdlY2, StationInfoDay::getStationId, StationInfoDay::getRfdlFj, eijMap, yesterday);
|
|
|
+ lineCalcHz(sidY, fillMapFdlY, StationInfoDay::getStationId, sid-> Double.valueOf(sid.getRfdl()), eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYXl, fillMapFdlY, LineInfoDay::getLineId, lid-> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsYXl, fillMapFdlY2, TurbineInfoDay::getLineId, TurbineInfoDay::getRfdl, eijMap, yesterday);
|
|
|
+ //发电量年
|
|
|
+ lineCalcHz(sidN, fillMapFdlN2, StationInfoDay::getStationId, StationInfoDay::getRfdlFj, eijMap, yesterday);
|
|
|
+ lineCalcHz(sidN, fillMapFdlN, StationInfoDay::getStationId, sid-> Double.valueOf(sid.getRfdl()), eijMap, yesterday);
|
|
|
+ //耗电量日
|
|
|
+ lineCalcHz(midsRMt, fillMapR17, MeterInfoDay::getMeterId, MeterInfoDay::getHdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsRXl, fillMapR17, LineInfoDay::getLineId, LineInfoDay::getHdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsRCz, fillMapR17, LineInfoDay::getStationId, LineInfoDay::getHdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(midsRPrt, fillMapR17, MeterInfoDay::getParentId, MeterInfoDay::getHdl, eijMap, yesterday);
|
|
|
+ //耗电量月
|
|
|
+ lineCalcHz(midsYMt, fillMapY17, MeterInfoDay::getMeterId, MeterInfoDay::getHdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYXl, fillMapY17, LineInfoDay::getLineId, LineInfoDay::getHdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYCz, fillMapY17, LineInfoDay::getStationId, LineInfoDay::getHdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(midsYPrt, fillMapY17, MeterInfoDay::getParentId, MeterInfoDay::getHdl, eijMap, yesterday);
|
|
|
+ //期次月
|
|
|
+ lineCalcHz(lidsYQc, fillMapY01, LineInfoDay::getProjectId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYQc, fillMapY02, LineInfoDay::getProjectId, LineInfoDay::getSwdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYQc, fillMapY03, LineInfoDay::getProjectId, LineInfoDay::getGwdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYQc, fillMapY04, LineInfoDay::getProjectId, LineInfoDay::getCydl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYQc, fillMapY05, LineInfoDay::getProjectId, lid -> lid.getCydl() / lid.getRfdl() * 100, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYQc, fillMapY06, LineInfoDay::getProjectId, lid -> lid.getRfdl() - lid.getSwdl() + lid.getGwdl(), eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYQc, fillMapY07, LineInfoDay::getProjectId, lid -> (lid.getRfdl() - lid.getSwdl() + lid.getGwdl()) / lid.getRfdl(), eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsYQc, fillMapY08, TurbineInfoDay::getProjectId, TurbineInfoDay::getPjfs, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYQc, fillMapY09, LineInfoDay::getProjectId, lid -> 0d, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsYQc, fillMapY10, TurbineInfoDay::getProjectId, TurbineInfoDay::getGzss, eijMap, yesterday);
|
|
|
+ lineCalcHz(plantsYQc, fillMapY11, ProBasicProjectPlan::getProjectId, pbpp -> pbpp.getGeneratingCapacity() / plantsYQc.size(), eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsYQc, fillMapY12, TurbineInfoDay::getProjectId, TurbineInfoDay::getLyxs, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsYQc, fillMapY13, TurbineInfoDay::getProjectId, TurbineInfoDay::getKlyl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYQc, fillMapY14, LineInfoDay::getProjectId, lid -> 0d, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsYQc, fillMapY15, TurbineInfoDay::getProjectId, TurbineInfoDay::getXdss, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsYQc, fillMapY16, TurbineInfoDay::getProjectId, TurbineInfoDay::getXdss, eijMap, yesterday);
|
|
|
+ lineCalcHz2(lidsYQc, fillMapY16, LineInfoDay::getProjectId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
|
|
|
+ //期次年
|
|
|
+ lineCalcHz(lidsNQc, fillMapN01, LineInfoDay::getProjectId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNQc, fillMapN02, LineInfoDay::getProjectId, LineInfoDay::getSwdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNQc, fillMapN03, LineInfoDay::getProjectId, LineInfoDay::getGwdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNQc, fillMapN04, LineInfoDay::getProjectId, LineInfoDay::getCydl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNQc, fillMapN05, LineInfoDay::getProjectId, lid -> lid.getCydl() / lid.getRfdl() * 100, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNQc, fillMapN06, LineInfoDay::getProjectId, lid -> lid.getRfdl() - lid.getSwdl() + lid.getGwdl(), eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNQc, fillMapN07, LineInfoDay::getProjectId, lid -> (lid.getRfdl() - lid.getSwdl() + lid.getGwdl()) / lid.getRfdl(), eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsNQc, fillMapN08, TurbineInfoDay::getProjectId, TurbineInfoDay::getPjfs, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNQc, fillMapN09, LineInfoDay::getProjectId, lid -> 0d, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsNQc, fillMapN10, TurbineInfoDay::getProjectId, TurbineInfoDay::getGzss, eijMap, yesterday);
|
|
|
+ lineCalcHz(plantsNQc, fillMapN11, ProBasicProjectPlan::getProjectId, pbpp -> pbpp.getGeneratingCapacity() / plantsNQc.size(), eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsNQc, fillMapN12, TurbineInfoDay::getProjectId, TurbineInfoDay::getLyxs, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsNQc, fillMapN13, TurbineInfoDay::getProjectId, TurbineInfoDay::getKlyl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNQc, fillMapN14, LineInfoDay::getProjectId, lid -> 0d, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsNQc, fillMapN15, TurbineInfoDay::getProjectId, TurbineInfoDay::getXdss, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsNQc, fillMapN16, TurbineInfoDay::getProjectId, TurbineInfoDay::getXdss, eijMap, yesterday);
|
|
|
+ lineCalcHz2(lidsNQc, fillMapN16, LineInfoDay::getProjectId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
|
|
|
+ //场站月
|
|
|
+ lineCalcHz(lidsYCz, fillMapY01, LineInfoDay::getStationId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYCz, fillMapY02, LineInfoDay::getStationId, LineInfoDay::getSwdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYCz, fillMapY03, LineInfoDay::getStationId, LineInfoDay::getGwdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYCz, fillMapY04, LineInfoDay::getStationId, LineInfoDay::getCydl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYCz, fillMapY05, LineInfoDay::getStationId, lid -> lid.getCydl() / lid.getRfdl() * 100, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYCz, fillMapY06, LineInfoDay::getStationId, lid -> lid.getRfdl() - lid.getSwdl() + lid.getGwdl(), eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYCz, fillMapY07, LineInfoDay::getStationId, lid -> (lid.getRfdl() - lid.getSwdl() + lid.getGwdl()) / lid.getRfdl(), eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsYCz, fillMapY08, TurbineInfoDay::getStationId, TurbineInfoDay::getPjfs, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYCz, fillMapY09, LineInfoDay::getStationId, lid -> 0d, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsYCz, fillMapY10, TurbineInfoDay::getStationId, TurbineInfoDay::getGzss, eijMap, yesterday);
|
|
|
+ lineCalcHz(plantsYCz, fillMapY11, ProBasicProjectPlan::getWindpowerstationId, pbpp -> pbpp.getGeneratingCapacity() / plantsYCz.size(), eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsYCz, fillMapY12, TurbineInfoDay::getStationId, TurbineInfoDay::getLyxs, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsYCz, fillMapY13, TurbineInfoDay::getStationId, TurbineInfoDay::getKlyl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsYCz, fillMapY14, LineInfoDay::getStationId, lid -> 0d, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsYCz, fillMapY15, TurbineInfoDay::getStationId, TurbineInfoDay::getXdss, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsYCz, fillMapY16, TurbineInfoDay::getStationId, TurbineInfoDay::getXdss, eijMap, yesterday);
|
|
|
+ lineCalcHz2(lidsYCz, fillMapY16, LineInfoDay::getStationId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
|
|
|
+ //场站年
|
|
|
+ lineCalcHz(lidsNCz, fillMapN01, LineInfoDay::getStationId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNCz, fillMapN02, LineInfoDay::getStationId, LineInfoDay::getSwdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNCz, fillMapN03, LineInfoDay::getStationId, LineInfoDay::getGwdl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNCz, fillMapN04, LineInfoDay::getStationId, LineInfoDay::getCydl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNCz, fillMapN05, LineInfoDay::getStationId, lid -> lid.getCydl() / lid.getRfdl() * 100, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNCz, fillMapN06, LineInfoDay::getStationId, lid -> lid.getRfdl() - lid.getSwdl() + lid.getGwdl(), eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNCz, fillMapN07, LineInfoDay::getStationId, lid -> (lid.getRfdl() - lid.getSwdl() + lid.getGwdl()) / lid.getRfdl(), eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsNCz, fillMapN08, TurbineInfoDay::getStationId, TurbineInfoDay::getPjfs, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNCz, fillMapN09, LineInfoDay::getStationId, lid -> 0d, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsNCz, fillMapN10, TurbineInfoDay::getStationId, TurbineInfoDay::getGzss, eijMap, yesterday);
|
|
|
+ lineCalcHz(plantsNCz, fillMapN11, ProBasicProjectPlan::getWindpowerstationId, pbpp -> pbpp.getGeneratingCapacity() / plantsNCz.size(), eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsNCz, fillMapN12, TurbineInfoDay::getStationId, TurbineInfoDay::getLyxs, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsNCz, fillMapN13, TurbineInfoDay::getStationId, TurbineInfoDay::getKlyl, eijMap, yesterday);
|
|
|
+ lineCalcHz(lidsNCz, fillMapN14, LineInfoDay::getStationId, lid -> 0d, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsNCz, fillMapN15, TurbineInfoDay::getStationId, TurbineInfoDay::getXdss, eijMap, yesterday);
|
|
|
+ lineCalcHz(tidsNCz, fillMapN16, TurbineInfoDay::getStationId, TurbineInfoDay::getXdss, eijMap, yesterday);
|
|
|
+ lineCalcHz2(lidsNCz, fillMapN16, LineInfoDay::getStationId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public <T> void lineCalcHz(List<T> items, Map<String, ProBaseBackfill> fillMap, Function<T, String> type, Function<T, Double> algorithm, Map<String, ProEconEquipmentInfoJs> eijMap, DateTime yesterday) {
|
|
|
+ for (T item : items) {
|
|
|
+ String id = type.apply(item);
|
|
|
+ ProBaseBackfill fill = fillMap.get(id);
|
|
|
+ if (fill == null) continue;
|
|
|
+ ProEconEquipmentInfoJs js = getPeeijs(fill, eijMap, yesterday);
|
|
|
+ js.setStopCode(algorithm.apply(item));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public <T> void lineCalcHz2(List<T> items, Map<String, ProBaseBackfill> fillMap, Function<T, String> type, Function<T, Double> algorithm, Map<String, ProEconEquipmentInfoJs> eijMap, DateTime yesterday) {
|
|
|
+ for (T item : items) {
|
|
|
+ String id = type.apply(item);
|
|
|
+ ProBaseBackfill fill = fillMap.get(id);
|
|
|
+ if (fill == null) continue;
|
|
|
+ ProEconEquipmentInfoJs js = getPeeijs(fill, eijMap, yesterday);
|
|
|
+ js.setStopCode(js.getStopCode() / algorithm.apply(item));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // public void lineCalcHz(List<LineInfoDay> lids, Map<String, ProBaseBackfill> fillMap, Function<LineInfoDay, String> type, Function<LineInfoDay, Double> algorithm, Map<String, ProEconEquipmentInfoJs> eijMap, DateTime yesterday) {
|
|
|
+ // for (LineInfoDay day : lids) {
|
|
|
+ // String id = type.apply(day);
|
|
|
+ // ProBaseBackfill fill = fillMap.get(id);
|
|
|
+ // ProEconEquipmentInfoJs js = getPeeijs(fill, eijMap, yesterday);
|
|
|
+ // js.setStopCode(algorithm.apply(day));
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ public ProEconEquipmentInfoJs getPeeijs(ProBaseBackfill fill, Map<String, ProEconEquipmentInfoJs> eijMap, DateTime day) {
|
|
|
+ ProEconEquipmentInfoJs js = eijMap.get(fill.getCode());
|
|
|
+ if (js == null) {
|
|
|
+ js = new ProEconEquipmentInfoJs();
|
|
|
+ js.setRecordDate(day);
|
|
|
+ js.setWpid(fill.getStation());
|
|
|
+ js.setMeterId(fill.getCode());
|
|
|
+ js.setMeterName(fill.getOperatingMode());
|
|
|
+ eijMap.put(fill.getCode(), js);
|
|
|
+ }
|
|
|
+ return js;
|
|
|
+ }
|
|
|
+ // public void calcTurbineJfplPjfxGlyzxxs(Date date) {
|
|
|
+ // //静风频率,平均风向、功率一致性系数
|
|
|
+ // //date当天零点
|
|
|
+ // DateTime time = DateUtil.beginOfDay(date);
|
|
|
+ // //date昨天零点
|
|
|
+ // DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
+ //
|
|
|
+ // List<PointInfo> entityFx = getEntity("AI066", "turbine");
|
|
|
+ // getStatDataByEntity();
|
|
|
+ // getZeroNextData(entity, time0, time);
|
|
|
+ // Map<String, PointInfo> turMap = entity.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
+ // Map<String, String> fsMap = getEntityMap("AI066", "turbine");
|
|
|
+ //
|
|
|
+ // Map<String, TurbineInfoDay> byDate = getTurbineinfoMap(time0, entity);
|
|
|
+ //
|
|
|
+ // TurbineInfoDay infoDay;
|
|
|
+ // PointInfo rfdlPi;
|
|
|
+ // String turbineId;
|
|
|
+ // List<TurbineInfoDay> infoDays = new ArrayList<>();
|
|
|
+ // DoubleStatData stat;
|
|
|
+ // for (PointInfo info : entity) {
|
|
|
+ // turbineId = info.getTurbineId();
|
|
|
+ // infoDay = byDate.get(turbineId);
|
|
|
+ //
|
|
|
+ // rfdlPi = turMap.get(turbineId);
|
|
|
+ // double v = (rfdlPi.getPointDatas().get(1).getValue() - rfdlPi.getPointDatas().get(0).getValue()) * rfdlPi.getCoef();
|
|
|
+ // if (v < 0 || v > 1000000) {
|
|
|
+ // v = 0;
|
|
|
+ // } else if (v > 30000) {
|
|
|
+ // v = v / (v % 30000 + 3);
|
|
|
+ // }
|
|
|
+ // infoDay.setRfdl(v);
|
|
|
+ // stat = adapter.getHistoryStat(goldenUri(), fsMap.get(turbineId), time0.getTime(), time.getTime());
|
|
|
+ // if (stat == null) {
|
|
|
+ // infoDay.setPjfs(0.0);
|
|
|
+ // } else {
|
|
|
+ // infoDay.setPjfs(stat.getAvg().getValue());
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // infoDays.add(infoDay);
|
|
|
+ // }
|
|
|
+ // turbineInfoDayService.saveOrUpdateBatch(infoDays);
|
|
|
+ // }
|
|
|
}
|