|
@@ -15,6 +15,8 @@ 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.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
@@ -73,20 +75,58 @@ public class WtAlysisDayService {
|
|
|
|
|
|
pageInfo.getRecords().forEach(rsl -> {
|
|
|
TurbineInfoDay day = dayMap.get(rsl.getRecordDate());
|
|
|
- rsl.setRfdl(NumberUtil.round(day.getRfdl() / 1000,2).doubleValue());
|
|
|
- double yfdl = calFdl(rsl.getWindturbineId(), "month", rsl.getRecordDate());
|
|
|
- rsl.setYfdl(NumberUtil.round(yfdl / 1000,2).doubleValue());
|
|
|
- double nfdl = calFdl(rsl.getWindturbineId(), "year", rsl.getRecordDate());
|
|
|
- rsl.setNfdl(NumberUtil.round(nfdl / 1000,2).doubleValue());
|
|
|
- rsl.setRpjfs(NumberUtil.round(day.getPjfs(),2).doubleValue());
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ 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.setRssdl(NumberUtil.round(v / 1000,2).doubleValue());
|
|
|
- rsl.setRgzxs(NumberUtil.round(day.getGzMin() / 60,2).doubleValue());
|
|
|
- rsl.setRjxxs(NumberUtil.round(day.getJxMin() / 60,2).doubleValue());
|
|
|
- rsl.setRyxxs(NumberUtil.round(day.getYxMin() / 60,2).doubleValue());
|
|
|
- rsl.setRyfdl(NumberUtil.round(rsl.getRyfdl() /1000,2).doubleValue());
|
|
|
- rsl.setYyfdl(NumberUtil.round(rsl.getYyfdl() /1000,2).doubleValue());
|
|
|
- rsl.setNyfdl(NumberUtil.round(rsl.getNyfdl() /1000,2).doubleValue());
|
|
|
+ rsl.setRssdl(NumberUtil.round(v / 1000, 2).doubleValue());
|
|
|
+ double yssdl = calSsdl(rsl.getWindturbineId(), "month", rsl.getRecordDate(), calendar);
|
|
|
+ rsl.setYssdl(NumberUtil.round(yssdl / 1000, 2).doubleValue());
|
|
|
+ double nssdl = calSsdl(rsl.getWindturbineId(), "year", rsl.getRecordDate(), calendar);
|
|
|
+ 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());
|
|
|
});
|
|
|
|
|
|
}
|
|
@@ -94,9 +134,93 @@ 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 calFdl(String windturbineId, String type, Date endDate) {
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
+
|
|
|
+ public double calTjcs(String windturbineId, String type, Date endDate, Calendar calendar) {
|
|
|
calendar.setTime(endDate);
|
|
|
Date firstDay = null;
|
|
|
if ("month".equals(type)) {
|
|
@@ -104,8 +228,153 @@ public class WtAlysisDayService {
|
|
|
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")
|