|
@@ -1,5 +1,6 @@
|
|
|
package com.ruoyi;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
@@ -328,61 +329,6 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
stationInfoHourService.saveOrUpdateBatch(byHours);
|
|
|
}
|
|
|
|
|
|
- public void writeReportPool(Date date) {
|
|
|
- //date当天零点
|
|
|
- DateTime time = DateUtil.beginOfDay(date);
|
|
|
- //date昨天零点
|
|
|
- DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
- DateTime beginOfMonth = DateUtil.beginOfMonth(time0);
|
|
|
- DateTime beginOfYear = DateUtil.beginOfYear(time0);
|
|
|
-
|
|
|
- QueryWrapper<StationInfoDay> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq("record_date", time0);
|
|
|
- List<StationInfoDay> days = stationInfoDayService.list(wrapper);
|
|
|
- Map<String, StationInfoDay> dayMap = days.stream().collect(Collectors.toMap(StationInfoDay::getStationId, Function.identity()));
|
|
|
- wrapper = new QueryWrapper<>();
|
|
|
- wrapper.select("sum(rfdl) rfdl,sum(swdl) swdl,sum(gwdl) gwdl,sum(cydl) cydl,sum(zhcydl) zhcydl,station_id")
|
|
|
- .between("record_date", beginOfMonth.toJdkDate(), time0.toJdkDate())
|
|
|
- .groupBy("station_id");
|
|
|
- List<StationInfoDay> monthDays = stationInfoDayService.list(wrapper);
|
|
|
- Map<String, StationInfoDay> monthMap = monthDays.stream().collect(Collectors.toMap(StationInfoDay::getStationId, Function.identity()));
|
|
|
- wrapper = new QueryWrapper<>();
|
|
|
- wrapper.select("sum(rfdl) rfdl,sum(swdl) swdl,sum(gwdl) gwdl,sum(cydl) cydl,sum(zhcydl) zhcydl,station_id")
|
|
|
- .between("record_date", beginOfYear.toJdkDate(), time0.toJdkDate())
|
|
|
- .groupBy("station_id");
|
|
|
- List<StationInfoDay> yearDays = stationInfoDayService.list(wrapper);
|
|
|
- Map<String, StationInfoDay> yearMap = yearDays.stream().collect(Collectors.toMap(StationInfoDay::getStationId, Function.identity()));
|
|
|
- QueryWrapper<ProEconReportIndicatorPool> wrapperrp = new QueryWrapper<>();
|
|
|
- wrapperrp.eq("record_date", time0).last("and foreign_key_id = windpowerstation_id");
|
|
|
- List<ProEconReportIndicatorPool> pools = reportIndicatorPoolService.list(wrapperrp);
|
|
|
-// pools = pools.stream().filter(p -> p.getWindpowerstationId().equals("GJNY_SXGS_ZZ_FDC_STA")).collect(Collectors.toList());
|
|
|
-
|
|
|
- StationInfoDay day, month, year;
|
|
|
- List<ProEconReportIndicatorPool> poolList = new ArrayList<>();
|
|
|
- for (ProEconReportIndicatorPool pool : pools) {
|
|
|
- String stationId = pool.getWindpowerstationId();
|
|
|
- day = dayMap.get(stationId);
|
|
|
- pool.setRfdldb(day.getRfdl().doubleValue());
|
|
|
- pool.setRswdldb(day.getSwdl().doubleValue());
|
|
|
- pool.setRgwgwdldb(day.getGwdl().doubleValue());
|
|
|
- pool.setRfdcydldb(day.getCydl().doubleValue());
|
|
|
- pool.setRzhcydldb(day.getZhcydl().doubleValue());
|
|
|
- month = monthMap.get(stationId);
|
|
|
- pool.setYfdldb(month.getRfdl().doubleValue());
|
|
|
- pool.setYswdldb(month.getSwdl().doubleValue());
|
|
|
- pool.setYgwgwdldb(month.getGwdl().doubleValue());
|
|
|
- pool.setYfdcydldb(month.getCydl().doubleValue());
|
|
|
- pool.setYzhcydldb(month.getZhcydl().doubleValue());
|
|
|
- year = yearMap.get(stationId);
|
|
|
- pool.setNfdldb(year.getRfdl().doubleValue());
|
|
|
- pool.setNswdldb(year.getSwdl().doubleValue());
|
|
|
- pool.setNgwgwdldb(year.getGwdl().doubleValue());
|
|
|
- pool.setNfdcydldb(year.getCydl().doubleValue());
|
|
|
- pool.setNzhcydldb(year.getZhcydl().doubleValue());
|
|
|
- poolList.add(pool);
|
|
|
- }
|
|
|
- reportIndicatorPoolService.saveOrUpdateBatch(poolList);
|
|
|
- }
|
|
|
|
|
|
public void calcLineDjlRfdl(Date date) {
|
|
|
//date当天零点
|
|
@@ -1149,6 +1095,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
System.out.println(ztPI.getSpare());
|
|
|
System.out.println(e.getMessage());
|
|
|
}
|
|
|
+ System.out.println("拟合完成" + glyc);
|
|
|
return glyc;
|
|
|
}
|
|
|
|
|
@@ -1243,9 +1190,9 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
|
|
|
|
|
|
//插入集合
|
|
|
- List<TurbineInfoDay > interest = new ArrayList<>();
|
|
|
+ List<TurbineInfoDay> interest = new ArrayList<>();
|
|
|
//更新集合
|
|
|
- List<TurbineInfoDay > update = new ArrayList<>();
|
|
|
+ List<TurbineInfoDay> update = new ArrayList<>();
|
|
|
//遍历每台风机,取出每台风机的pointDatas
|
|
|
for (PointInfo turbine : turbineZt) {
|
|
|
|
|
@@ -1439,10 +1386,9 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
int i = 0;
|
|
|
|
|
|
//插入集合
|
|
|
- List<TurbineInfoDay > interest = new ArrayList<>();
|
|
|
+ List<TurbineInfoDay> interest = new ArrayList<>();
|
|
|
//更新集合
|
|
|
- List<TurbineInfoDay > update = new ArrayList<>();
|
|
|
-
|
|
|
+ List<TurbineInfoDay> update = new ArrayList<>();
|
|
|
|
|
|
|
|
|
for (PointInfo ef : entityFs) {
|
|
@@ -1523,12 +1469,11 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
update.add(one);
|
|
|
}
|
|
|
|
|
|
- }catch (Exception e) {
|
|
|
+ } catch (Exception e) {
|
|
|
System.out.println(wtId + " " + start);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1537,13 +1482,180 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
// //批量更新
|
|
|
// turbineInfoDayService.updateBatchById(update);
|
|
|
// //批量插入或更新
|
|
|
-// turbineInfoDayService.saveOrUpdateBatch(interest);
|
|
|
-// turbineInfoDayService.saveOrUpdateBatch(update);
|
|
|
+ turbineInfoDayService.saveOrUpdateBatch(interest);
|
|
|
+ turbineInfoDayService.saveOrUpdateBatch(update);
|
|
|
|
|
|
|
|
|
+// stringRedisTemplate.opsForValue().set("glqxnh", JSON.toJSONString(fitMap));
|
|
|
+ }
|
|
|
|
|
|
|
|
|
-// stringRedisTemplate.opsForValue().set("glqxnh", JSON.toJSONString(fitMap));
|
|
|
+ public void writeReportPool(Date date) {
|
|
|
+ //date当天零点
|
|
|
+ DateTime time = DateUtil.beginOfDay(date);
|
|
|
+ //date昨天零点
|
|
|
+ DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
+ DateTime beginOfMonth = DateUtil.beginOfMonth(time0);
|
|
|
+ DateTime beginOfYear = DateUtil.beginOfYear(time0);
|
|
|
+
|
|
|
+ QueryWrapper<StationInfoDay> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("record_date", time0);
|
|
|
+ List<StationInfoDay> days = stationInfoDayService.list(wrapper);
|
|
|
+ Map<String, StationInfoDay> dayMap = days.stream().collect(Collectors.toMap(StationInfoDay::getStationId, Function.identity()));
|
|
|
+ wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.select("sum(rfdl) rfdl,sum(swdl) swdl,sum(gwdl) gwdl,sum(cydl) cydl,sum(zhcydl) zhcydl,station_id")
|
|
|
+ .between("record_date", beginOfMonth.toJdkDate(), time0.toJdkDate())
|
|
|
+ .groupBy("station_id");
|
|
|
+ List<StationInfoDay> monthDays = stationInfoDayService.list(wrapper);
|
|
|
+ Map<String, StationInfoDay> monthMap = monthDays.stream().collect(Collectors.toMap(StationInfoDay::getStationId, Function.identity()));
|
|
|
+ wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.select("sum(rfdl) rfdl,sum(swdl) swdl,sum(gwdl) gwdl,sum(cydl) cydl,sum(zhcydl) zhcydl,station_id")
|
|
|
+ .between("record_date", beginOfYear.toJdkDate(), time0.toJdkDate())
|
|
|
+ .groupBy("station_id");
|
|
|
+ List<StationInfoDay> yearDays = stationInfoDayService.list(wrapper);
|
|
|
+ Map<String, StationInfoDay> yearMap = yearDays.stream().collect(Collectors.toMap(StationInfoDay::getStationId, Function.identity()));
|
|
|
+ QueryWrapper<ProEconReportIndicatorPool> wrapperrp = new QueryWrapper<>();
|
|
|
+ wrapperrp.eq("record_date", time0).last("and foreign_key_id = windpowerstation_id");
|
|
|
+ List<ProEconReportIndicatorPool> pools = reportIndicatorPoolService.list(wrapperrp);
|
|
|
+
|
|
|
+ StationInfoDay day, month, year;
|
|
|
+ List<ProEconReportIndicatorPool> poolList = new ArrayList<>();
|
|
|
+ for (ProEconReportIndicatorPool pool : pools) {
|
|
|
+ String stationId = pool.getWindpowerstationId();
|
|
|
+ day = dayMap.get(stationId);
|
|
|
+ pool.setRfdldb(day.getRfdl().doubleValue());
|
|
|
+ pool.setRswdldb(day.getSwdl().doubleValue());
|
|
|
+ pool.setRgwgwdldb(day.getGwdl().doubleValue());
|
|
|
+ pool.setRfdcydldb(day.getCydl().doubleValue());
|
|
|
+ pool.setRzhcydldb(day.getZhcydl().doubleValue());
|
|
|
+ month = monthMap.get(stationId);
|
|
|
+ pool.setYfdldb(month.getRfdl().doubleValue());
|
|
|
+ pool.setYswdldb(month.getSwdl().doubleValue());
|
|
|
+ pool.setYgwgwdldb(month.getGwdl().doubleValue());
|
|
|
+ pool.setYfdcydldb(month.getCydl().doubleValue());
|
|
|
+ pool.setYzhcydldb(month.getZhcydl().doubleValue());
|
|
|
+ year = yearMap.get(stationId);
|
|
|
+ pool.setNfdldb(year.getRfdl().doubleValue());
|
|
|
+ pool.setNswdldb(year.getSwdl().doubleValue());
|
|
|
+ pool.setNgwgwdldb(year.getGwdl().doubleValue());
|
|
|
+ pool.setNfdcydldb(year.getCydl().doubleValue());
|
|
|
+ pool.setNzhcydldb(year.getZhcydl().doubleValue());
|
|
|
+ poolList.add(pool);
|
|
|
+ }
|
|
|
+ reportIndicatorPoolService.saveOrUpdateBatch(poolList);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void writeReportPoolProject(Date date) {
|
|
|
+ //date当天零点
|
|
|
+ DateTime time = DateUtil.beginOfDay(date);
|
|
|
+ //date昨天零点
|
|
|
+ DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
+ DateTime beginOfMonth = DateUtil.beginOfMonth(time0);
|
|
|
+ DateTime beginOfYear = DateUtil.beginOfYear(time0);
|
|
|
+
|
|
|
+ QueryWrapper<LineInfoDay> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.select("sum(rfdl) rfdl,sum(swdl) swdl,sum(gwdl) gwdl,sum(cydl) cydl,project_id")
|
|
|
+ .eq("record_date", time0)
|
|
|
+ .groupBy("project_id");
|
|
|
+ List<LineInfoDay> days = lineInfoDayService.list(wrapper);
|
|
|
+ Map<String, LineInfoDay> dayMap = days.stream().collect(Collectors.toMap(LineInfoDay::getProjectId, Function.identity()));
|
|
|
+ wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.select("sum(rfdl) rfdl,sum(swdl) swdl,sum(gwdl) gwdl,sum(cydl) cydl,project_id")
|
|
|
+ .between("record_date", beginOfMonth, time0)
|
|
|
+ .groupBy("project_id");
|
|
|
+ List<LineInfoDay> monthDays = lineInfoDayService.list(wrapper);
|
|
|
+ Map<String, LineInfoDay> monthMap = monthDays.stream().collect(Collectors.toMap(LineInfoDay::getProjectId, Function.identity()));
|
|
|
+ wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.select("sum(rfdl) rfdl,sum(swdl) swdl,sum(gwdl) gwdl,sum(cydl) cydl,project_id")
|
|
|
+ .between("record_date", beginOfYear, time0)
|
|
|
+ .groupBy("project_id");
|
|
|
+ List<LineInfoDay> yearDays = lineInfoDayService.list(wrapper);
|
|
|
+ Map<String, LineInfoDay> yearMap = yearDays.stream().collect(Collectors.toMap(LineInfoDay::getProjectId, Function.identity()));
|
|
|
+
|
|
|
+ QueryWrapper<ProEconReportIndicatorPool> wrapperrp = new QueryWrapper<>();
|
|
|
+ wrapperrp.eq("record_date", time0).last("and foreign_key_id = project_id");
|
|
|
+ List<ProEconReportIndicatorPool> pools = reportIndicatorPoolService.list(wrapperrp);
|
|
|
+
|
|
|
+ LineInfoDay day, month, year;
|
|
|
+ List<ProEconReportIndicatorPool> poolList = new ArrayList<>();
|
|
|
+ String projectId;
|
|
|
+ for (ProEconReportIndicatorPool pool : pools) {
|
|
|
+ projectId = pool.getProjectId();
|
|
|
+ day = dayMap.get(projectId);
|
|
|
+ pool.setRfdldb(day.getRfdl().doubleValue());
|
|
|
+ pool.setRswdldb(day.getSwdl());
|
|
|
+ pool.setRgwgwdldb(day.getGwdl());
|
|
|
+ pool.setRfdcydldb(day.getCydl());
|
|
|
+ month = monthMap.get(projectId);
|
|
|
+ pool.setYfdldb(month.getRfdl().doubleValue());
|
|
|
+ pool.setYswdldb(month.getSwdl());
|
|
|
+ pool.setYgwgwdldb(month.getGwdl());
|
|
|
+ pool.setYfdcydldb(month.getCydl());
|
|
|
+ year = yearMap.get(projectId);
|
|
|
+ pool.setNfdldb(year.getRfdl().doubleValue());
|
|
|
+ pool.setNswdldb(year.getSwdl());
|
|
|
+ pool.setNgwgwdldb(year.getGwdl());
|
|
|
+ pool.setNfdcydldb(year.getCydl());
|
|
|
+ poolList.add(pool);
|
|
|
+ }
|
|
|
+ reportIndicatorPoolService.saveOrUpdateBatch(poolList);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void writeReportPoolPjfs(Date date) {
|
|
|
+ //date当天零点
|
|
|
+ DateTime time = DateUtil.beginOfDay(date);
|
|
|
+ //date昨天零点
|
|
|
+ DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
+ DateTime beginOfMonth = DateUtil.beginOfMonth(time0);
|
|
|
+ DateTime beginOfYear = DateUtil.beginOfYear(time0);
|
|
|
+
|
|
|
+ QueryWrapper<TurbineInfoDay> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.select("avg(pjfs) pjfs,project_id")
|
|
|
+ .eq("record_date", time0)
|
|
|
+ .groupBy("project_id");
|
|
|
+ List<TurbineInfoDay> days = turbineInfoDayService.list(wrapper);
|
|
|
+ Map<String, TurbineInfoDay> dayMap = days.stream().collect(Collectors.toMap(TurbineInfoDay::getProjectId, Function.identity()));
|
|
|
+ wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.select("avg(pjfs) pjfs,project_id")
|
|
|
+ .between("record_date", beginOfMonth, time0)
|
|
|
+ .groupBy("project_id");
|
|
|
+ List<TurbineInfoDay> monthDays = turbineInfoDayService.list(wrapper);
|
|
|
+ Map<String, TurbineInfoDay> monthMap = monthDays.stream().collect(Collectors.toMap(TurbineInfoDay::getProjectId, Function.identity()));
|
|
|
+ wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.select("avg(pjfs) pjfs,project_id")
|
|
|
+ .between("record_date", beginOfYear, time0)
|
|
|
+ .groupBy("project_id");
|
|
|
+ List<TurbineInfoDay> yearDays = turbineInfoDayService.list(wrapper);
|
|
|
+ Map<String, TurbineInfoDay> yearMap = yearDays.stream().collect(Collectors.toMap(TurbineInfoDay::getProjectId, Function.identity()));
|
|
|
+
|
|
|
+ QueryWrapper<ProEconReportIndicatorPool> wrapperrp = new QueryWrapper<>();
|
|
|
+ wrapperrp.eq("record_date", time0).last("and foreign_key_id = project_id");
|
|
|
+ List<ProEconReportIndicatorPool> pools = reportIndicatorPoolService.list(wrapperrp);
|
|
|
+ wrapperrp = new QueryWrapper<>();
|
|
|
+ wrapperrp.eq("record_date", time0).eq("foreign_key_id", "GJNY_SXGS_DBXNY_ZGS0");
|
|
|
+ List<ProEconReportIndicatorPool> pools2 = reportIndicatorPoolService.list(wrapperrp);
|
|
|
+
|
|
|
+ TurbineInfoDay day, month, year;
|
|
|
+ String projectId;
|
|
|
+ for (ProEconReportIndicatorPool pool : pools) {
|
|
|
+ projectId = pool.getProjectId();
|
|
|
+ day = dayMap.get(projectId);
|
|
|
+ pool.setRpjfs(day.getPjfs());
|
|
|
+ month = monthMap.get(projectId);
|
|
|
+ pool.setYpjfs(month.getPjfs());
|
|
|
+ year = yearMap.get(projectId);
|
|
|
+ pool.setNpjfs(year.getPjfs());
|
|
|
+ }
|
|
|
+ double v1 = pools.stream().mapToDouble(ProEconReportIndicatorPool::getRpjfs).average().orElse(0);
|
|
|
+ double v2 = pools.stream().mapToDouble(ProEconReportIndicatorPool::getYpjfs).average().orElse(0);
|
|
|
+ double v3 = pools.stream().mapToDouble(ProEconReportIndicatorPool::getNpjfs).average().orElse(0);
|
|
|
+ if (CollUtil.isNotEmpty(pools2)) {
|
|
|
+ pools2.get(0).setRpjfs(v1);
|
|
|
+ pools2.get(0).setYpjfs(v2);
|
|
|
+ pools2.get(0).setNpjfs(v3);
|
|
|
+ reportIndicatorPoolService.saveOrUpdateBatch(pools2);
|
|
|
+ }
|
|
|
+ reportIndicatorPoolService.saveOrUpdateBatch(pools);
|
|
|
}
|
|
|
|
|
|
|