|
|
@@ -1,6 +1,8 @@
|
|
|
package com.gyee.runeconomy.service.EarlyWarning;
|
|
|
|
|
|
import com.gyee.runeconomy.dto.report.*;
|
|
|
+import com.gyee.runeconomy.dto.response.FwjslDTO;
|
|
|
+import com.gyee.runeconomy.dto.response.QxjslDTO;
|
|
|
import com.gyee.runeconomy.entity.StationInfoMonth;
|
|
|
import com.gyee.runeconomy.init.CacheContext;
|
|
|
import com.gyee.runeconomy.model.auto.ProBasicEquipment;
|
|
|
@@ -8,6 +10,7 @@ import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
|
|
|
import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay4;
|
|
|
import com.gyee.runeconomy.model.auto.TurbineInfoDay;
|
|
|
import com.gyee.runeconomy.service.IStationInfoMonthService;
|
|
|
+import com.gyee.runeconomy.service.auto.IProEconBrownoutsEvent2Service;
|
|
|
import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay4Service;
|
|
|
import com.gyee.runeconomy.service.auto.ITurbineInfoDayService;
|
|
|
import com.gyee.runeconomy.util.StringUtils;
|
|
|
@@ -16,6 +19,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.time.YearMonth;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
@@ -25,12 +30,11 @@ public class NewGetWindReportService {
|
|
|
@Autowired
|
|
|
private ITurbineInfoDayService turbineInfoDayService;
|
|
|
@Resource
|
|
|
- private IProEconPowerstationInfoDay4Service proEconPowerstationInfoDay4Service;
|
|
|
- @Resource
|
|
|
private IStationInfoMonthService stationInfoMonthService;
|
|
|
@Autowired
|
|
|
private NewWindReportService windReportService;
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private IProEconBrownoutsEvent2Service event2Service;
|
|
|
public Map<String, Object> Electricity(String wpid, String time) throws Exception {
|
|
|
Map<String, Object> map = new LinkedHashMap<>();
|
|
|
|
|
|
@@ -43,6 +47,39 @@ public class NewGetWindReportService {
|
|
|
List<ProBasicEquipment> wtls = CacheContext.wtls;
|
|
|
|
|
|
map.put("Station_information", stationInfo);//场站信息
|
|
|
+ String year = time.substring(0, 4);
|
|
|
+ String yearbegin = year + "-01-01";
|
|
|
+ String yearend = year + "-12-31";
|
|
|
+
|
|
|
+ String qnyear = String.valueOf(Integer.parseInt(time.substring(0, 4)) - 1);
|
|
|
+ String qnyearbegin = qnyear + "-01-01";
|
|
|
+ String qnyearend = qnyear + "-12-31";
|
|
|
+
|
|
|
+ // 解析年月字符串
|
|
|
+ YearMonth yearMonth = YearMonth.parse(time);
|
|
|
+
|
|
|
+ // 计算开始日期(当月第一天)
|
|
|
+ String beginDate = yearMonth.atDay(1).format(DateTimeFormatter.ISO_LOCAL_DATE);
|
|
|
+
|
|
|
+ // 计算结束日期(当月最后一天)
|
|
|
+ String endDate = yearMonth.atEndOfMonth().format(DateTimeFormatter.ISO_LOCAL_DATE);
|
|
|
+
|
|
|
+ // 减去一个月
|
|
|
+ YearMonth previousYearMonth = yearMonth.minusMonths(1);
|
|
|
+
|
|
|
+ // 计算开始日期(上个月第一天)
|
|
|
+ String sybeginDate = previousYearMonth.atDay(1).format(DateTimeFormatter.ISO_LOCAL_DATE);
|
|
|
+
|
|
|
+ // 计算结束日期(上个月最后一天)
|
|
|
+ String syendDate = previousYearMonth.atEndOfMonth().format(DateTimeFormatter.ISO_LOCAL_DATE);
|
|
|
+
|
|
|
+
|
|
|
+ YearMonth qnYearMonth = yearMonth.minusYears(1);
|
|
|
+ // 计算开始日期(当月第一天)
|
|
|
+ String qndybeginDate = qnYearMonth.atDay(1).format(DateTimeFormatter.ISO_LOCAL_DATE);
|
|
|
+
|
|
|
+ // 计算结束日期(当月最后一天)
|
|
|
+ String qndyendDate = qnYearMonth.atEndOfMonth().format(DateTimeFormatter.ISO_LOCAL_DATE);
|
|
|
|
|
|
int bl = 1000;
|
|
|
//当月数据
|
|
|
@@ -56,21 +93,30 @@ public class NewGetWindReportService {
|
|
|
List<TurbineInfoDay> ssdlbottom3list = turbineInfoDayService.ssdlbottomList(time);
|
|
|
List<TurbineInfoDay> linedlList = turbineInfoDayService.lineList(time);
|
|
|
|
|
|
- List<ProEconPowerstationInfoDay4> dyList = proEconPowerstationInfoDay4Service.dyList(time);
|
|
|
+ List<FwjslDTO> fwjsllist = event2Service.getResetTimelyRateInfo(null,null , beginDate, endDate);
|
|
|
+ List<FwjslDTO> syfwjsllist = event2Service.getResetTimelyRateInfo(null,null , sybeginDate, syendDate);
|
|
|
+ List<FwjslDTO> qndyfwjsllist = event2Service.getResetTimelyRateInfo(null,null , qndybeginDate, qndyendDate);
|
|
|
+ List<FwjslDTO> yearfwjsllist = event2Service.getResetTimelyRateInfo(null,null , yearbegin, yearend);
|
|
|
+ List<FwjslDTO> qnyearfwjsllist = event2Service.getResetTimelyRateInfo(null,null , qnyearbegin, qnyearend);
|
|
|
+
|
|
|
+ List<QxjslDTO> xqjsllist = event2Service.getDefectsEliminatRateList(null, null, beginDate, endDate);
|
|
|
+ List<QxjslDTO> syxqjsllist = event2Service.getDefectsEliminatRateList(null, null, sybeginDate, syendDate);
|
|
|
+ List<QxjslDTO> qndyxqjsllist = event2Service.getDefectsEliminatRateList(null, null, qndybeginDate, qndyendDate);
|
|
|
+ List<QxjslDTO> yearxqjsllist = event2Service.getDefectsEliminatRateList(null, null, yearbegin, yearend);
|
|
|
+ List<QxjslDTO> qnyearxqjsllist = event2Service.getDefectsEliminatRateList(null, null, qnyearbegin, qnyearend);
|
|
|
List<StationInfoMonth> monthslist = stationInfoMonthService.monthslist(time);
|
|
|
//去年当月数据
|
|
|
List<TurbineInfoDay> qnmonthList = turbineInfoDayService.qnmonthList(time);
|
|
|
- List<ProEconPowerstationInfoDay4> qndymttList = proEconPowerstationInfoDay4Service.qndymttList(time);
|
|
|
List<StationInfoMonth> qndylist = stationInfoMonthService.qndylist(time);
|
|
|
|
|
|
//当年数据
|
|
|
List<TurbineInfoDay> yearList = turbineInfoDayService.yearList(time);
|
|
|
- List<ProEconPowerstationInfoDay4> yearmttrList = proEconPowerstationInfoDay4Service.yearmttrList(time);
|
|
|
+// List<ProEconPowerstationInfoDay4> yearmttrList = proEconPowerstationInfoDay4Service.yearmttrList(time);
|
|
|
List<StationInfoMonth> yearlist = stationInfoMonthService.yearlist(time);
|
|
|
|
|
|
// 查询上一年度相同时间段
|
|
|
List<TurbineInfoDay> qyearList = turbineInfoDayService.qyearList(time);
|
|
|
- List<ProEconPowerstationInfoDay4> qnmttList = proEconPowerstationInfoDay4Service.qnmttList(time);
|
|
|
+// List<ProEconPowerstationInfoDay4> qnmttList = proEconPowerstationInfoDay4Service.qnmttList(time);
|
|
|
List<StationInfoMonth> qnmttlist = stationInfoMonthService.qnmttlist(time);
|
|
|
|
|
|
setTurbineIdFromNemCode(wtls, top3list);
|
|
|
@@ -456,33 +502,51 @@ public class NewGetWindReportService {
|
|
|
String yfwjsltrend = "red";
|
|
|
String yxqjsltrend = "red";
|
|
|
|
|
|
+ double llfdl = 1;
|
|
|
+ double qnllfdl = 0;
|
|
|
+ double fdl = 0;
|
|
|
+ double qnfdl = 0;
|
|
|
+ double gzss = 0;
|
|
|
+ double qngzss = 0;
|
|
|
+ double xdss = 0;
|
|
|
+ double qnxdss = 0;
|
|
|
+ double yfnlyl = 0;
|
|
|
+ double qnmonthfnlyl = 0;
|
|
|
+ double ymtbf = 0;
|
|
|
+ double qnmonthmtbf = 0;
|
|
|
+ double ymttr = 0;
|
|
|
+ double qnmonthmttr = 0;
|
|
|
+ double yfwjsl = 0;
|
|
|
+ double qnmonthyfwjsl = 0;
|
|
|
+ double xqjsl = 0;
|
|
|
+ double qnxqjsl = 0;
|
|
|
|
|
|
if (monthList.size() > 0) {
|
|
|
- double llfdl = monthList.size() > 0 ? monthList.get(0).getLlfdl() : 1;
|
|
|
- double qnllfdl = qnmonthList.size() > 0 ? qnmonthList.get(0).getLlfdl() : 1;
|
|
|
- double fdl = monthList.size() > 0 ? monthList.get(0).getRfdl() : 0;
|
|
|
- double qnfdl = qnmonthList.size() > 0 ? qnmonthList.get(0).getRfdl() : 1;
|
|
|
- double gzss = monthList.size() > 0 ? monthList.get(0).getGzss() : 0;
|
|
|
- double qngzss = qnmonthList.size() > 0 ? qnmonthList.get(0).getGzss() : 1;
|
|
|
- double xdss = monthList.size() > 0 ? monthList.get(0).getXdss() : 0;
|
|
|
- double qnxdss = qnmonthList.size() > 0 ? qnmonthList.get(0).getXdss() : 1;
|
|
|
- double yfnlyl = fdl / llfdl * 100;
|
|
|
- double qnmonthfnlyl = qnllfdl > 1 ? qnfdl / qnllfdl * 100 : 0.0;
|
|
|
- double ymtbf = monthslist.size() > 0 ? monthslist.get(0).getMtbf() : 0;
|
|
|
- double qnmonthmtbf = qndylist.size() > 0 ? qndylist.get(0).getMtbf() : 0;
|
|
|
- double ymttr = monthslist.size() > 0 ? monthslist.get(0).getMttr() : 0;
|
|
|
- double qnmonthmttr = qndylist.size() > 0 ? qndylist.get(0).getMttr() : 0;
|
|
|
- double yfwjsl = dyList.size() > 0 && dyList.get(0).getYfwjsl() != null
|
|
|
- ? dyList.get(0).getYfwjsl().doubleValue()
|
|
|
+ llfdl = monthList.size() > 0 ? monthList.get(0).getLlfdl() : 1;
|
|
|
+ qnllfdl = qnmonthList.size() > 0 ? qnmonthList.get(0).getLlfdl() : 1;
|
|
|
+ fdl = monthList.size() > 0 ? monthList.get(0).getRfdl() : 0;
|
|
|
+ qnfdl = qnmonthList.size() > 0 ? qnmonthList.get(0).getRfdl() : 1;
|
|
|
+ gzss = monthList.size() > 0 ? monthList.get(0).getGzss() : 0;
|
|
|
+ qngzss = qnmonthList.size() > 0 ? qnmonthList.get(0).getGzss() : 1;
|
|
|
+ xdss = monthList.size() > 0 ? monthList.get(0).getXdss() : 0;
|
|
|
+ qnxdss = qnmonthList.size() > 0 ? qnmonthList.get(0).getXdss() : 1;
|
|
|
+ yfnlyl = monthList.size()>0 ? monthList.get(0).getFnlyl() :0;
|
|
|
+ qnmonthfnlyl = qnllfdl > 1 ? qnfdl / qnllfdl * 100 : 0.0;
|
|
|
+ ymtbf = monthslist.size() > 0 ? monthslist.get(0).getMtbf() : 0;
|
|
|
+ qnmonthmtbf = qndylist.size() > 0 ? qndylist.get(0).getMtbf() : 0;
|
|
|
+ ymttr = monthslist.size() > 0 ? monthslist.get(0).getMttr() : 0;
|
|
|
+ qnmonthmttr = qndylist.size() > 0 ? qndylist.get(0).getMttr() : 0;
|
|
|
+ yfwjsl = fwjsllist.size() > 0 && fwjsllist.get(0).getWfzfwl()!=0
|
|
|
+ ? fwjsllist.get(0).getWfzfwl()
|
|
|
: 0.0;
|
|
|
- double qnmonthyfwjsl = qndymttList.size() > 0 && qndymttList.get(0).getYfwjsl() != null
|
|
|
- ? qndymttList.get(0).getYfwjsl().doubleValue()
|
|
|
+ qnmonthyfwjsl = qndyfwjsllist.size() > 0 && qndyfwjsllist.get(0).getWfzfwl()!=0
|
|
|
+ ? qndyfwjsllist.get(0).getWfzfwl()
|
|
|
: 0.0;
|
|
|
- double xqjsl = dyList.size() > 0 && dyList.get(0).getYgzxqjsl() != null
|
|
|
- ? dyList.get(0).getYgzxqjsl().doubleValue()
|
|
|
+ xqjsl = xqjsllist.size() > 0 && xqjsllist.get(0).getXqjsl()!=0
|
|
|
+ ? xqjsllist.get(0).getXqjsl().doubleValue()
|
|
|
: 0.0;
|
|
|
- double qnxqjsl = qndymttList.size() > 0 && qndymttList.get(0).getYgzxqjsl() != null
|
|
|
- ? qndymttList.get(0).getYgzxqjsl().doubleValue()
|
|
|
+ qnxqjsl = qndyxqjsllist.size() > 0 && qndyxqjsllist.get(0).getXqjsl()!=0
|
|
|
+ ? qndyxqjsllist.get(0).getXqjsl()
|
|
|
: 0.0;
|
|
|
|
|
|
monthllfdl = StringUtils.round(qnllfdl > 1 ? (llfdl - qnllfdl) / qnllfdl * 100 : 0, 2);
|
|
|
@@ -520,56 +584,56 @@ public class NewGetWindReportService {
|
|
|
|
|
|
if (yearList.size() > 0) {
|
|
|
double nllfdl = yearList.size() > 0 ? yearList.get(0).getLlfdl() : 1;
|
|
|
- double qnllfdl = qyearList.size() > 0 ? qyearList.get(0).getLlfdl() : 1;
|
|
|
+ double qnyearllfdl = qyearList.size() > 0 ? qyearList.get(0).getLlfdl() : 1;
|
|
|
double nfdl = yearList.size() > 0 ? yearList.get(0).getRfdl() : 0;
|
|
|
- double qnfdl = qyearList.size() > 0 ? qyearList.get(0).getRfdl() : 1;
|
|
|
+ double qnyearfdl = qyearList.size() > 0 ? qyearList.get(0).getRfdl() : 1;
|
|
|
double nfnlyl = nfdl / nllfdl * 100;
|
|
|
- double qnfnlyl = qnfdl / qnllfdl * 100;
|
|
|
+ double qnfnlyl = qnyearfdl / qnyearllfdl * 100;
|
|
|
double ngzss = yearList.size() > 0 ? yearList.get(0).getGzss() : 0;
|
|
|
- double qngzss = qyearList.size() > 0 ? qyearList.get(0).getGzss() : 1;
|
|
|
+ double qnyeargzss = qyearList.size() > 0 ? qyearList.get(0).getGzss() : 1;
|
|
|
double nxdss = yearList.size() > 0 ? yearList.get(0).getXdss() : 0;
|
|
|
- double qnxdss = qyearList.size() > 0 ? qyearList.get(0).getXdss() : 1;
|
|
|
+ double qnyearxdss = qyearList.size() > 0 ? qyearList.get(0).getXdss() : 1;
|
|
|
double nmtbf = yearlist.size() > 0 ? yearlist.get(0).getMtbf() : 0;
|
|
|
double qnmtbf = qnmttlist.size() > 0 ? qnmttlist.get(0).getMtbf() : 0;
|
|
|
double nmttr = yearlist.size() > 0 ? yearlist.get(0).getMttr() : 0;
|
|
|
double qnmttr = qnmttlist.size() > 0 ? qnmttlist.get(0).getMttr() : 0;
|
|
|
- double nyfwjsl = yearmttrList.size() > 0 && yearmttrList.get(0).getNfwjsl() != null
|
|
|
- ? yearmttrList.get(0).getNfwjsl().doubleValue()
|
|
|
+ double nyfwjsl = yearfwjsllist.size() > 0 && yearfwjsllist.get(0).getWfzfwl()!=0
|
|
|
+ ? yearfwjsllist.get(0).getWfzfwl()
|
|
|
: 0.0;
|
|
|
- double qnyfwjsl = qnmttList.size() > 0 && qnmttList.get(0).getNfwjsl() != null
|
|
|
- ? qnmttList.get(0).getNfwjsl().doubleValue()
|
|
|
+ double qnyfwjsl = qnyearfwjsllist.size() > 0 && qnyearfwjsllist.get(0).getWfzfwl()!=0
|
|
|
+ ? qnyearfwjsllist.get(0).getWfzfwl()
|
|
|
: 0.0;
|
|
|
- double nxqjsl = yearmttrList.size() > 0 && yearmttrList.get(0).getNgzxqjsl() != null
|
|
|
- ? yearmttrList.get(0).getNgzxqjsl().doubleValue()
|
|
|
+ double nxqjsl = yearxqjsllist.size() > 0 && yearxqjsllist.get(0).getXqjsl()!=0
|
|
|
+ ? yearxqjsllist.get(0).getXqjsl()
|
|
|
: 0.0;
|
|
|
- double qnxqjsl = qnmttList.size() > 0 && qnmttList.get(0).getNgzxqjsl() != null
|
|
|
- ? qnmttList.get(0).getNgzxqjsl().doubleValue()
|
|
|
+ double qnyearxqjsl = qnyearxqjsllist.size() > 0 && qnyearxqjsllist.get(0).getXqjsl()!=0
|
|
|
+ ? qnyearxqjsllist.get(0).getXqjsl()
|
|
|
: 0.0;
|
|
|
|
|
|
|
|
|
- if (qnllfdl != 0 && qnllfdl != 1 || qnfdl != 1 || qngzss != 1 || qnxdss != 1) {
|
|
|
- yearllfdl = StringUtils.round((nllfdl - qnllfdl) / qnllfdl * 100, 2);
|
|
|
- yearfdl = StringUtils.round((nfdl - qnfdl) / qnfdl * 100, 2);
|
|
|
+ if (qnyearllfdl != 0 && qnyearllfdl != 1 || qnyearfdl != 1 || qnyeargzss != 1 || qnyearxdss != 1) {
|
|
|
+ yearllfdl = StringUtils.round((nllfdl - qnyearllfdl) / qnyearllfdl * 100, 2);
|
|
|
+ yearfdl = StringUtils.round((nfdl - qnyearfdl) / qnyearfdl * 100, 2);
|
|
|
yearfnlyl = StringUtils.round(((nfnlyl - qnfnlyl) / qnfnlyl * 100), 2);
|
|
|
- yeargzssl = StringUtils.round((ngzss - qngzss) / qngzss * 100, 2);
|
|
|
- yearxdssl = StringUtils.round((nxdss - qnxdss) / qnxdss * 100, 2);
|
|
|
+ yeargzssl = StringUtils.round((ngzss - qnyeargzss) / qnyeargzss * 100, 2);
|
|
|
+ yearxdssl = StringUtils.round((nxdss - qnyearxdss) / qnyearxdss * 100, 2);
|
|
|
yearmtbf = StringUtils.round((nmtbf - qnmtbf) / qnmtbf * 100, 2);
|
|
|
yearmttr = StringUtils.round((nmttr - qnmttr) / qnmttr * 100, 2);
|
|
|
yearyfwjsl = StringUtils.round((nyfwjsl - qnyfwjsl) / qnyfwjsl * 100, 2);
|
|
|
- yearxqjsl = StringUtils.round((nxqjsl - qnxqjsl) / qnxqjsl * 100, 2);
|
|
|
+ yearxqjsl = StringUtils.round((nxqjsl - qnyearxqjsl) / qnyearxqjsl * 100, 2);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
List<comprehensive> comprehensiveList = Arrays.asList(
|
|
|
- createComprehensive("理论发电量", monthllfdl, yearllfdl, yllfdltrend),
|
|
|
- createComprehensive("发电量", monthfdl, yearfdl, yfdltrend),
|
|
|
- createComprehensive("风能利用率", monthfnlyl, yearfnlyl, yfnlyltrend),
|
|
|
- createComprehensive("故障损失率", monthgzssl, yeargzssl, ygzsssltrend),
|
|
|
- createComprehensive("限电损失率", monthxdssl, yearxdssl, yxdsssltrend),
|
|
|
- createComprehensive("MTBF", monthmtbf, yearmtbf, ymtbftrend),
|
|
|
- createComprehensive("MTTR", monthmttr, yearmttr, ymttrtrend),
|
|
|
- createComprehensive("复位及时率", monthyfwjsl, yearyfwjsl, yfwjsltrend),
|
|
|
- createComprehensive("消缺及时率", monthxqjsl, yearxqjsl, yxqjsltrend)
|
|
|
+ createComprehensive("理论发电量",StringUtils.round(llfdl / bl,2), monthllfdl, yearllfdl, yllfdltrend),
|
|
|
+ createComprehensive("发电量",StringUtils.round(fdl/ bl,2),monthfdl, yearfdl, yfdltrend),
|
|
|
+ createComprehensive("风能利用率", StringUtils.round(yfnlyl,2),monthfnlyl, yearfnlyl, yfnlyltrend),
|
|
|
+ createComprehensive("故障损失", StringUtils.round(gzss / bl,2),monthgzssl, yeargzssl, ygzsssltrend),
|
|
|
+ createComprehensive("限电损失", StringUtils.round(xdss / bl,2),monthxdssl, yearxdssl, yxdsssltrend),
|
|
|
+ createComprehensive("MTBF", StringUtils.round(ymtbf,2),monthmtbf, yearmtbf, ymtbftrend),
|
|
|
+ createComprehensive("MTTR", StringUtils.round(ymttr,2),monthmttr, yearmttr, ymttrtrend),
|
|
|
+ createComprehensive("复位及时率", StringUtils.round(yfwjsl,2),monthyfwjsl, yearyfwjsl, yfwjsltrend),
|
|
|
+ createComprehensive("消缺及时率", StringUtils.round(xqjsl,2),monthxqjsl, yearxqjsl, yxqjsltrend)
|
|
|
);
|
|
|
map.put("comprehensiveList", comprehensiveList);
|
|
|
|
|
|
@@ -688,9 +752,10 @@ public class NewGetWindReportService {
|
|
|
}
|
|
|
|
|
|
// 辅助方法
|
|
|
- private comprehensive createComprehensive(String category, double monthZzl, double yearZzl, String trend) {
|
|
|
+ private comprehensive createComprehensive(String category,double monthValue, double monthZzl, double yearZzl, String trend) {
|
|
|
comprehensive comp = new comprehensive();
|
|
|
comp.setCategory(category);
|
|
|
+ comp.setMonth_value(monthValue);
|
|
|
comp.setMonth_zzl(monthZzl);
|
|
|
comp.setYear_zzl(yearZzl);
|
|
|
comp.setTrend(trend);
|