|
|
@@ -1,5 +1,7 @@
|
|
|
package com.gyee.runeconomy.service;
|
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
@@ -14,8 +16,6 @@ import org.springframework.stereotype.Service;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.time.LocalDate;
|
|
|
-import java.time.ZoneId;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -61,62 +61,55 @@ public class WtAlysisDayService {
|
|
|
|
|
|
List<ProEconWtAlysisDay> ls = new ArrayList<>();
|
|
|
page1.getRecords().forEach(rs -> {
|
|
|
- TurbineInfoDay day = dayMap.get(rs.getRecordDate());
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
+ Date record = rs.getRecordDate();
|
|
|
+ DateTime beginMonth = DateUtil.beginOfMonth(record);
|
|
|
+ DateTime beginYear = DateUtil.beginOfYear(record);
|
|
|
+ TurbineInfoDay turMonth = turbineInfoDayService.getTurbineSingle(rs.getTurbineId(), beginMonth, record);
|
|
|
+ TurbineInfoDay turYear = turbineInfoDayService.getTurbineSingle(rs.getTurbineId(), beginYear, record);
|
|
|
+
|
|
|
ProEconWtAlysisDay rsl = new ProEconWtAlysisDay();
|
|
|
rsl.setWindturbineId(rs.getTurbineId());
|
|
|
rsl.setRecordDate(rs.getRecordDate());
|
|
|
- rsl.setRfdl(NumberUtil.round(day.getRfdl() / 1000, 2).doubleValue());
|
|
|
- double yfdl = calFdl(rsl.getWindturbineId(), "month", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setYfdl(NumberUtil.round(yfdl / 1000, 2).doubleValue());
|
|
|
- double nfdl = calFdl(rsl.getWindturbineId(), "year", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setNfdl(NumberUtil.round(nfdl / 1000, 2).doubleValue());
|
|
|
- rsl.setRpjfs(NumberUtil.round(day.getPjfs(), 2).doubleValue());
|
|
|
- double ypjfs = calPjfs(rsl.getWindturbineId(), "month", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setYpjfs(NumberUtil.round(ypjfs, 2).doubleValue());
|
|
|
- double npjfs = calPjfs(rsl.getWindturbineId(), "year", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setNpjfs(NumberUtil.round(npjfs, 2).doubleValue());
|
|
|
- double v = day.getGzss() + day.getJhjxss() + day.getXdss() + day.getXnss() + day.getSlss();
|
|
|
+ rsl.setRfdl(NumberUtil.round(rs.getRfdl() / 1000, 2).doubleValue());
|
|
|
+ rsl.setYfdl(NumberUtil.round(turMonth.getRfdl() / 1000, 2).doubleValue());
|
|
|
+ rsl.setNfdl(NumberUtil.round(turYear.getRfdl() / 1000, 2).doubleValue());
|
|
|
+ rsl.setRpjfs(NumberUtil.round(rs.getPjfs(), 2).doubleValue());
|
|
|
+ rsl.setYpjfs(NumberUtil.round(turMonth.getPjfs(), 2).doubleValue());
|
|
|
+ rsl.setNpjfs(NumberUtil.round(turYear.getPjfs(), 2).doubleValue());
|
|
|
+ double v = rs.getGzss() + rs.getJhjxss() + rs.getXdss() + rs.getXnss() + rs.getSlss();
|
|
|
rsl.setRssdl(NumberUtil.round(v / 1000, 2).doubleValue());
|
|
|
- double yssdl = calSsdl(rsl.getWindturbineId(), "month", rsl.getRecordDate(), calendar);
|
|
|
+ double yssdl = turMonth.getGzss() + turMonth.getJhjxss() + turMonth.getXdss() + turMonth.getXnss() + turMonth.getSlss();
|
|
|
rsl.setYssdl(NumberUtil.round(yssdl / 1000, 2).doubleValue());
|
|
|
- double nssdl = calSsdl(rsl.getWindturbineId(), "year", rsl.getRecordDate(), calendar);
|
|
|
+ double nssdl = turYear.getGzss() + turYear.getJhjxss() + turYear.getXdss() + turYear.getXnss() + turYear.getSlss();
|
|
|
rsl.setNssdl(NumberUtil.round(nssdl / 1000, 2).doubleValue());
|
|
|
- rsl.setRgzxs(NumberUtil.round(day.getGzMin() / 60, 2).doubleValue());
|
|
|
- double ygzxs = calGzxs(rsl.getWindturbineId(), "month", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setYgzxs(NumberUtil.round(ygzxs / 60, 2).doubleValue());
|
|
|
- double ngzxs = calGzxs(rsl.getWindturbineId(), "year", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setNgzxs(NumberUtil.round(ngzxs / 60, 2).doubleValue());
|
|
|
- rsl.setRjxxs(NumberUtil.round(day.getJxMin() / 60, 2).doubleValue());
|
|
|
- double yjxxs = calJxxs(rsl.getWindturbineId(), "month", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setYjxxs(NumberUtil.round(yjxxs / 60, 2).doubleValue());
|
|
|
- double njxxs = calJxxs(rsl.getWindturbineId(), "year", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setNjxxs(NumberUtil.round(njxxs / 60, 2).doubleValue());
|
|
|
- rsl.setRyxxs(NumberUtil.round(day.getYxMin() / 60, 2).doubleValue());
|
|
|
- double yyxxs = calYxxs(rsl.getWindturbineId(), "month", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setYyxxs(NumberUtil.round(yyxxs / 60, 2).doubleValue());
|
|
|
- double nyxxs = calYxxs(rsl.getWindturbineId(), "year", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setNyxxs(NumberUtil.round(nyxxs / 60, 2).doubleValue());
|
|
|
- rsl.setRdjxs(NumberUtil.round(day.getDjMin() / 60, 2).doubleValue());
|
|
|
- double ydjxs = calDjxs(rsl.getWindturbineId(), "month", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setYdjxs(NumberUtil.round(ydjxs / 60, 2).doubleValue());
|
|
|
- double ndjxs = calDjxs(rsl.getWindturbineId(), "year", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setNdjxs(NumberUtil.round(ndjxs / 60, 2).doubleValue());
|
|
|
- rsl.setRtjcs(NumberUtil.round(day.getTjcs(), 2).doubleValue());
|
|
|
- double ytjcs = calTjcs(rsl.getWindturbineId(), "month", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setYtjcs(NumberUtil.round(ytjcs, 2).doubleValue());
|
|
|
- double ntjcs = calTjcs(rsl.getWindturbineId(), "year", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setNtjcs(NumberUtil.round(ntjcs, 2).doubleValue());
|
|
|
- rsl.setRsbklyl(NumberUtil.round(day.getKlyl(), 2).doubleValue());
|
|
|
- double ysbklyl = calSbklyl(rsl.getWindturbineId(), "month", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setYsbklyl(NumberUtil.round(ysbklyl, 2).doubleValue());
|
|
|
- double nsbklyl = calSbklyl(rsl.getWindturbineId(), "year", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setNsbklyl(NumberUtil.round(nsbklyl, 2).doubleValue());
|
|
|
- rsl.setRpjwd(NumberUtil.round(day.getHjwd(), 2).doubleValue());
|
|
|
- double ypjwd = calPjwd(rsl.getWindturbineId(), "month", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setYpjwd(NumberUtil.round(ypjwd, 2).doubleValue());
|
|
|
- double npjwd = calPjwd(rsl.getWindturbineId(), "year", rsl.getRecordDate(), calendar);
|
|
|
- rsl.setNpjwd(NumberUtil.round(npjwd, 2).doubleValue());
|
|
|
+ rsl.setRgzxs(NumberUtil.round(rs.getGzMin() / 60, 2).doubleValue());
|
|
|
+ rsl.setYgzxs(NumberUtil.round(turMonth.getGzMin() / 60, 2).doubleValue());
|
|
|
+ rsl.setNgzxs(NumberUtil.round(turYear.getGzMin() / 60, 2).doubleValue());
|
|
|
+ rsl.setRjxxs(NumberUtil.round(rs.getJxMin() / 60, 2).doubleValue());
|
|
|
+ rsl.setYjxxs(NumberUtil.round(turMonth.getJxMin() / 60, 2).doubleValue());
|
|
|
+ rsl.setNjxxs(NumberUtil.round(turYear.getJxMin() / 60, 2).doubleValue());
|
|
|
+ rsl.setRyxxs(NumberUtil.round(rs.getYxMin() / 60, 2).doubleValue());
|
|
|
+ rsl.setYyxxs(NumberUtil.round(turMonth.getYxMin() / 60, 2).doubleValue());
|
|
|
+ rsl.setNyxxs(NumberUtil.round(turYear.getYxMin() / 60, 2).doubleValue());
|
|
|
+ rsl.setRdjxs(NumberUtil.round(rs.getDjMin() / 60, 2).doubleValue());
|
|
|
+ rsl.setYdjxs(NumberUtil.round(turMonth.getDjMin() / 60, 2).doubleValue());
|
|
|
+ rsl.setNdjxs(NumberUtil.round(turYear.getDjMin() / 60, 2).doubleValue());
|
|
|
+ rsl.setRzdxs(NumberUtil.round(rs.getLxMin() / 60, 2).doubleValue());
|
|
|
+ rsl.setYzdxs(NumberUtil.round(turMonth.getLxMin() / 60, 2).doubleValue());
|
|
|
+ rsl.setNzdxs(NumberUtil.round(turYear.getLxMin() / 60, 2).doubleValue());
|
|
|
+ rsl.setRtjcs(NumberUtil.round(rs.getTjcs(), 2).doubleValue());
|
|
|
+ rsl.setYtjcs(NumberUtil.round(turMonth.getTjcs(), 2).doubleValue());
|
|
|
+ rsl.setNtjcs(NumberUtil.round(turYear.getTjcs(), 2).doubleValue());
|
|
|
+ rsl.setRsbklyl(NumberUtil.round(rs.getKlyl(), 2).doubleValue());
|
|
|
+ rsl.setYsbklyl(NumberUtil.round(turMonth.getKlyl(), 2).doubleValue());
|
|
|
+ rsl.setNsbklyl(NumberUtil.round(turYear.getKlyl(), 2).doubleValue());
|
|
|
+ rsl.setRpjwd(NumberUtil.round(rs.getHjwd(), 2).doubleValue());
|
|
|
+ rsl.setYpjwd(NumberUtil.round(turMonth.getHjwd(), 2).doubleValue());
|
|
|
+ rsl.setNpjwd(NumberUtil.round(turYear.getHjwd(), 2).doubleValue());
|
|
|
+ rsl.setRyxfs(NumberUtil.round(rs.getYxfss(),2).doubleValue());
|
|
|
+ rsl.setYyxfs(NumberUtil.round(turMonth.getYxfss(), 2).doubleValue());
|
|
|
+ rsl.setNyxfs(NumberUtil.round(turYear.getYxfss(),2).doubleValue());
|
|
|
+
|
|
|
ls.add(rsl);
|
|
|
});
|
|
|
if (!ls.isEmpty()) {
|
|
|
@@ -128,258 +121,4 @@ public class WtAlysisDayService {
|
|
|
return pageInfo;
|
|
|
}
|
|
|
|
|
|
- public double calSsdl(String windturbineId, String type, Date endDate, Calendar calendar) {
|
|
|
- calendar.setTime(endDate);
|
|
|
- Date firstDay = null;
|
|
|
- if ("month".equals(type)) {
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- } else if ("year".equals(type)) {
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_YEAR, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- }
|
|
|
- QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
|
|
|
- currentqw.select("station_id,MAX(record_date) AS record_date,SUM(gzss) AS gzss,SUM(jhjxss) AS jhjxss,SUM(xdss) AS xdss,SUM(xnss) AS xnss,SUM(slss) AS slss")
|
|
|
- .ge("record_date", firstDay)
|
|
|
- .le("record_date", endDate)
|
|
|
- .eq("turbine_id", windturbineId)
|
|
|
- .like("station_id", "_FDC_")
|
|
|
- .groupBy("station_id");
|
|
|
- List<TurbineInfoDay> monthData = turbineInfoDayService.list(currentqw);
|
|
|
- TurbineInfoDay tur = monthData.get(0);
|
|
|
- return tur.getGzss() + tur.getJhjxss() + tur.getXnss() + tur.getSlss() + tur.getXdss();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public double calPjwd(String windturbineId, String type, Date endDate, Calendar calendar) {
|
|
|
- calendar.setTime(endDate);
|
|
|
- Date firstDay = null;
|
|
|
- LocalDate localDate = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
- int d = 0;
|
|
|
- if ("month".equals(type)) {
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- d = localDate.getDayOfMonth();
|
|
|
- } else if ("year".equals(type)) {
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_YEAR, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- d = localDate.getDayOfYear();
|
|
|
- }
|
|
|
- QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
|
|
|
- currentqw.select("station_id,MAX(record_date) AS record_date,SUM(hjwd) AS hjwd")
|
|
|
- .ge("record_date", firstDay)
|
|
|
- .le("record_date", endDate)
|
|
|
- .eq("turbine_id", windturbineId)
|
|
|
- .like("station_id", "_FDC_")
|
|
|
- .groupBy("station_id");
|
|
|
- List<TurbineInfoDay> monthData = turbineInfoDayService.list(currentqw);
|
|
|
- if (d != 0) {
|
|
|
- return monthData.get(0).getHjwd() / (d);
|
|
|
- } else {
|
|
|
- return monthData.get(0).getHjwd();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public double calSbklyl(String windturbineId, String type, Date endDate, Calendar calendar) {
|
|
|
- calendar.setTime(endDate);
|
|
|
- Date firstDay = null;
|
|
|
- LocalDate localDate = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
- int d = 0;
|
|
|
- if ("month".equals(type)) {
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- d = localDate.getDayOfMonth();
|
|
|
- } else if ("year".equals(type)) {
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_YEAR, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- d = localDate.getDayOfYear();
|
|
|
- }
|
|
|
- QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
|
|
|
- currentqw.select("station_id,MAX(record_date) AS record_date,SUM(klyl) AS klyl")
|
|
|
- .ge("record_date", firstDay)
|
|
|
- .le("record_date", endDate)
|
|
|
- .eq("turbine_id", windturbineId)
|
|
|
- .like("station_id", "_FDC_")
|
|
|
- .groupBy("station_id");
|
|
|
- List<TurbineInfoDay> monthData = turbineInfoDayService.list(currentqw);
|
|
|
- if (d != 0) {
|
|
|
- return monthData.get(0).getKlyl() / (d);
|
|
|
- } else {
|
|
|
- return monthData.get(0).getKlyl();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public double calTjcs(String windturbineId, String type, Date endDate, Calendar calendar) {
|
|
|
- calendar.setTime(endDate);
|
|
|
- Date firstDay = null;
|
|
|
- if ("month".equals(type)) {
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- } else if ("year".equals(type)) {
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_YEAR, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- }
|
|
|
- QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
|
|
|
- currentqw.select("station_id,MAX(record_date) AS record_date,SUM(tjcs) AS tjcs")
|
|
|
- .ge("record_date", firstDay)
|
|
|
- .le("record_date", endDate)
|
|
|
- .eq("turbine_id", windturbineId)
|
|
|
- .like("station_id", "_FDC_")
|
|
|
- .groupBy("station_id");
|
|
|
- List<TurbineInfoDay> monthData = turbineInfoDayService.list(currentqw);
|
|
|
- return monthData.get(0).getTjcs();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public double calDjxs(String windturbineId, String type, Date endDate, Calendar calendar) {
|
|
|
- calendar.setTime(endDate);
|
|
|
- Date firstDay = null;
|
|
|
- if ("month".equals(type)) {
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- } else if ("year".equals(type)) {
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_YEAR, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- }
|
|
|
- QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
|
|
|
- currentqw.select("station_id,MAX(record_date) AS record_date,SUM(dj_min) AS dj_min")
|
|
|
- .ge("record_date", firstDay)
|
|
|
- .le("record_date", endDate)
|
|
|
- .eq("turbine_id", windturbineId)
|
|
|
- .like("station_id", "_FDC_")
|
|
|
- .groupBy("station_id");
|
|
|
- List<TurbineInfoDay> monthData = turbineInfoDayService.list(currentqw);
|
|
|
- return monthData.get(0).getDjMin();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public double calYxxs(String windturbineId, String type, Date endDate, Calendar calendar) {
|
|
|
- calendar.setTime(endDate);
|
|
|
- Date firstDay = null;
|
|
|
- if ("month".equals(type)) {
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- } else if ("year".equals(type)) {
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_YEAR, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- }
|
|
|
- QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
|
|
|
- currentqw.select("station_id,MAX(record_date) AS record_date,SUM(yx_min) AS yx_min")
|
|
|
- .ge("record_date", firstDay)
|
|
|
- .le("record_date", endDate)
|
|
|
- .eq("turbine_id", windturbineId)
|
|
|
- .like("station_id", "_FDC_")
|
|
|
- .groupBy("station_id");
|
|
|
- List<TurbineInfoDay> monthData = turbineInfoDayService.list(currentqw);
|
|
|
- return monthData.get(0).getYxMin();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public double calJxxs(String windturbineId, String type, Date endDate, Calendar calendar) {
|
|
|
- calendar.setTime(endDate);
|
|
|
- Date firstDay = null;
|
|
|
- if ("month".equals(type)) {
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- } else if ("year".equals(type)) {
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_YEAR, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- }
|
|
|
- QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
|
|
|
- currentqw.select("station_id,MAX(record_date) AS record_date,SUM(jx_min) AS jx_min")
|
|
|
- .ge("record_date", firstDay)
|
|
|
- .le("record_date", endDate)
|
|
|
- .eq("turbine_id", windturbineId)
|
|
|
- .like("station_id", "_FDC_")
|
|
|
- .groupBy("station_id");
|
|
|
- List<TurbineInfoDay> monthData = turbineInfoDayService.list(currentqw);
|
|
|
- return monthData.get(0).getJxMin();
|
|
|
- }
|
|
|
-
|
|
|
- public double calGzxs(String windturbineId, String type, Date endDate, Calendar calendar) {
|
|
|
- calendar.setTime(endDate);
|
|
|
- Date firstDay = null;
|
|
|
- if ("month".equals(type)) {
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- } else if ("year".equals(type)) {
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_YEAR, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- }
|
|
|
- QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
|
|
|
- currentqw.select("station_id,MAX(record_date) AS record_date,SUM(gz_min) AS gz_min")
|
|
|
- .ge("record_date", firstDay)
|
|
|
- .le("record_date", endDate)
|
|
|
- .eq("turbine_id", windturbineId)
|
|
|
- .like("station_id", "_FDC_")
|
|
|
- .groupBy("station_id");
|
|
|
- List<TurbineInfoDay> monthData = turbineInfoDayService.list(currentqw);
|
|
|
- return monthData.get(0).getGzMin();
|
|
|
- }
|
|
|
-
|
|
|
- public double calPjfs(String windturbineId, String type, Date endDate, Calendar calendar) {
|
|
|
- calendar.setTime(endDate);
|
|
|
- Date firstDay = null;
|
|
|
- LocalDate localDate = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
- int d = 0;
|
|
|
- if ("month".equals(type)) {
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- d = localDate.getDayOfMonth();
|
|
|
- } else if ("year".equals(type)) {
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_YEAR, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- d = localDate.getDayOfYear();
|
|
|
- }
|
|
|
- QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
|
|
|
- currentqw.select("station_id,MAX(record_date) AS record_date,SUM(pjfs) AS pjfs")
|
|
|
- .ge("record_date", firstDay)
|
|
|
- .le("record_date", endDate)
|
|
|
- .eq("turbine_id", windturbineId)
|
|
|
- .like("station_id", "_FDC_")
|
|
|
- .groupBy("station_id");
|
|
|
- List<TurbineInfoDay> monthData = turbineInfoDayService.list(currentqw);
|
|
|
- if (d != 0) {
|
|
|
- return monthData.get(0).getPjfs() / (d);
|
|
|
- } else {
|
|
|
- return monthData.get(0).getPjfs();
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public double calFdl(String windturbineId, String type, Date endDate, Calendar calendar) {
|
|
|
- calendar.setTime(endDate);
|
|
|
- Date firstDay = null;
|
|
|
- if ("month".equals(type)) {
|
|
|
- calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- } else if ("year".equals(type)) {
|
|
|
- calendar.set(Calendar.MONTH, 0);
|
|
|
- calendar.set(Calendar.DAY_OF_YEAR, 1);
|
|
|
- firstDay = calendar.getTime();
|
|
|
- }
|
|
|
- QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
|
|
|
- currentqw.select("station_id,MAX(record_date) AS record_date,SUM(rfdl) AS rfdl")
|
|
|
- .ge("record_date", firstDay)
|
|
|
- .le("record_date", endDate)
|
|
|
- .eq("turbine_id", windturbineId)
|
|
|
- .like("station_id", "_FDC_")
|
|
|
- .groupBy("station_id");
|
|
|
- List<TurbineInfoDay> monthData = turbineInfoDayService.list(currentqw);
|
|
|
- return monthData.get(0).getRfdl();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
}
|