|
@@ -0,0 +1,917 @@
|
|
|
+package com.gyee.generation.service;
|
|
|
+
|
|
|
+import com.gyee.generation.init.CacheContext;
|
|
|
+import com.gyee.generation.model.auto.*;
|
|
|
+import com.gyee.generation.service.auto.IProEconInOrOutSpeedTotal2Service;
|
|
|
+import com.gyee.generation.service.auto.IProEconInOrOutSpeedTotalService;
|
|
|
+import com.gyee.generation.service.auto.IProEconInputOrOutputSpeedService;
|
|
|
+import com.gyee.generation.util.DateUtils;
|
|
|
+import com.gyee.generation.util.StringUtils;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class InputOrOutPutService {
|
|
|
+
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProEconInOrOutSpeedTotal2Service proEconInOrOutSpeedTotal2Service;
|
|
|
+ @Resource
|
|
|
+ private IProEconInOrOutSpeedTotalService proEconInOrOutSpeedTotalService;
|
|
|
+ @Resource
|
|
|
+ private IProEconInputOrOutputSpeedService proEconInputOrOutputSpeedService;
|
|
|
+ public void InputOrOutput(Date currentDate)
|
|
|
+ {
|
|
|
+ currentDate = DateUtils.truncDay(currentDate);
|
|
|
+ Date end=currentDate;
|
|
|
+ Date daybegin =DateUtils.addDays(currentDate,-1);
|
|
|
+
|
|
|
+ Calendar c=Calendar.getInstance();
|
|
|
+ c.setTime(daybegin);
|
|
|
+
|
|
|
+ int year = c.get(Calendar.YEAR);
|
|
|
+ int month =c.get(Calendar.MONTH)+1;
|
|
|
+
|
|
|
+ c.set(Calendar.DAY_OF_MONTH,1);
|
|
|
+ Date monthbegin =c.getTime();
|
|
|
+ c.set(Calendar.MONTH,0);
|
|
|
+ Date yearbegin =c.getTime();
|
|
|
+
|
|
|
+ for (ProBasicWindpowerstation wp : CacheContext.wpls)
|
|
|
+ {
|
|
|
+ List<ProBasicWindturbine> wtls=null;
|
|
|
+ if(CacheContext.wpwtmap.containsKey(wp.getId()))
|
|
|
+ {
|
|
|
+ wtls=CacheContext.wpwtmap.get(wp.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null!=wtls && !wtls.isEmpty())
|
|
|
+ {
|
|
|
+ for (ProBasicWindturbine wt : wtls)
|
|
|
+ {
|
|
|
+ System.out.println(wt.getId());
|
|
|
+
|
|
|
+ ProEconInOrOutSpeedTotal total1=null;
|
|
|
+ ProEconInOrOutSpeedTotal2 total2=null;
|
|
|
+ Optional<ProEconInOrOutSpeedTotal> total1o= proEconInOrOutSpeedTotalService.list().stream().filter(i->i.getWindturbineId().equals(wt.getId())
|
|
|
+ && i.getRecordDate().compareTo(daybegin)==0).findFirst();
|
|
|
+
|
|
|
+ if(total1o.isPresent())
|
|
|
+ {
|
|
|
+ total1=total1o.get();
|
|
|
+ }
|
|
|
+
|
|
|
+ Optional<ProEconInOrOutSpeedTotal2> total2o= proEconInOrOutSpeedTotal2Service.list().stream().filter(i->i.getWindturbineId().equals(wt.getId())
|
|
|
+ && i.getRecordDate().compareTo(daybegin)==0).findFirst();
|
|
|
+
|
|
|
+ if(total2o.isPresent())
|
|
|
+ {
|
|
|
+ total2=total2o.get();
|
|
|
+ }
|
|
|
+ if (total1 == null)
|
|
|
+ {
|
|
|
+ total1 = new ProEconInOrOutSpeedTotal();
|
|
|
+ total1.setWindturbineId(wt.getId());
|
|
|
+ total1.setWindpowerstationId(wt.getWindpowerstationId());
|
|
|
+ total1.setProjectId(wt.getProjectId());
|
|
|
+ total1.setLineId(wt.getLineId());
|
|
|
+ total1.setRecordDate(daybegin);
|
|
|
+
|
|
|
+ proEconInOrOutSpeedTotalService.save(total1);
|
|
|
+ }
|
|
|
+ if (total2 == null)
|
|
|
+ {
|
|
|
+
|
|
|
+ total2 = new ProEconInOrOutSpeedTotal2();
|
|
|
+ total2.setWindturbineId(wt.getId());
|
|
|
+ total2.setWindpowerstationId(wt.getWindpowerstationId());
|
|
|
+ total2.setProjectId(wt.getProjectId());
|
|
|
+ total2.setLineId(wt.getLineId());
|
|
|
+ total2.setRecordDate(daybegin);
|
|
|
+ proEconInOrOutSpeedTotal2Service.save(total2);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ newMethod(end, daybegin, monthbegin, yearbegin, wt.getId(), total1, total2);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void newMethod(Date end, Date daybegin, Date monthbegin,Date yearbegin, String windturbineId, ProEconInOrOutSpeedTotal total1, ProEconInOrOutSpeedTotal2 total2)
|
|
|
+ {
|
|
|
+ buildDay(end, daybegin, windturbineId, total1, total2);
|
|
|
+ buildMonth(end, monthbegin, windturbineId, total1, total2);
|
|
|
+ buildyear(end, yearbegin, windturbineId, total1, total2);
|
|
|
+
|
|
|
+ List<ProEconInOrOutSpeedTotal> items=proEconInOrOutSpeedTotalService.list().stream().filter(i->i.getWindturbineId().equals(windturbineId)).collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.add(total1);
|
|
|
+
|
|
|
+ DoubleSummaryStatistics summaryStatistics=items.stream().filter(i-> StringUtils.notEmp(i.getDayInputSmall()) && i.getDayInputSmall()>0).mapToDouble(n -> n.getDayInputSmall()).summaryStatistics();
|
|
|
+
|
|
|
+ total1.setInputSmall(summaryStatistics.getAverage());
|
|
|
+ summaryStatistics=items.stream().filter(i-> StringUtils.notEmp(i.getDayInputSmallMax()) && i.getDayInputSmallMax()>0).mapToDouble(n -> n.getDayInputSmallMax()).summaryStatistics();
|
|
|
+ total1.setInputSmallMax(summaryStatistics.getMax());
|
|
|
+ summaryStatistics=items.stream().filter(i-> StringUtils.notEmp(i.getDayInputSmallMin()) && i.getDayInputSmallMin()>0).mapToDouble(n -> n.getDayInputSmallMin()).summaryStatistics();
|
|
|
+ total1.setInputSmallMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+ summaryStatistics=items.stream().filter(i-> StringUtils.notEmp(i.getDayInputBig()) && i.getDayInputBig()>0).mapToDouble(n -> n.getDayInputBig()).summaryStatistics();
|
|
|
+ total1.setInputBig(summaryStatistics.getAverage());
|
|
|
+ summaryStatistics=items.stream().filter(i-> StringUtils.notEmp(i.getDayInputBigMax()) && i.getDayInputBigMax()>0).mapToDouble(n -> n.getDayInputBigMax()).summaryStatistics();
|
|
|
+ total1.setInputBigMax(summaryStatistics.getMax());
|
|
|
+ summaryStatistics=items.stream().filter(i-> StringUtils.notEmp(i.getDayInputBigMin()) && i.getDayInputBigMin()>0).mapToDouble(n -> n.getDayInputBigMin()).summaryStatistics();
|
|
|
+ total1.setInputBigMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+
|
|
|
+ summaryStatistics=items.stream().filter(i-> StringUtils.notEmp(i.getDayOutputSmall()) && i.getDayOutputSmall()>0).mapToDouble(n -> n.getDayOutputSmall()).summaryStatistics();
|
|
|
+ total1.setOutputSmall(summaryStatistics.getAverage());
|
|
|
+ summaryStatistics=items.stream().filter(i-> StringUtils.notEmp(i.getDayOutputSmallMax()) && i.getDayOutputSmallMax()>0).mapToDouble(n -> n.getDayOutputSmallMax()).summaryStatistics();
|
|
|
+ total1.setOutputSmallMax(summaryStatistics.getMax());
|
|
|
+ summaryStatistics=items.stream().filter(i-> StringUtils.notEmp(i.getDayOutputSmallMin()) && i.getDayOutputSmallMin()>0).mapToDouble(n -> n.getDayOutputSmallMin()).summaryStatistics();
|
|
|
+ total1.setOutputSmallMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+
|
|
|
+ summaryStatistics=items.stream().filter(i-> StringUtils.notEmp(i.getDayOutputBig()) && i.getDayOutputBig()>0).mapToDouble(n -> n.getDayOutputBig()).summaryStatistics();
|
|
|
+ total1.setOutputBig(summaryStatistics.getAverage());
|
|
|
+ summaryStatistics=items.stream().filter(i-> StringUtils.notEmp(i.getDayOutputBigMax()) && i.getDayOutputBigMax()>0).mapToDouble(n -> n.getDayOutputBigMax()).summaryStatistics();
|
|
|
+ total1.setOutputBigMax(summaryStatistics.getMax());
|
|
|
+ summaryStatistics=items.stream().filter(i-> StringUtils.notEmp(i.getDayOutputBigMin()) && i.getDayOutputBigMin()>0).mapToDouble(n -> n.getDayOutputBigMin()).summaryStatistics();
|
|
|
+ total1.setOutputBigMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //total1.INPUTSMALLRATIO = items.Where(it => it.DAYINPUTSMALL > 0 && it.DAYINPUTSMALL != null).Average(it => it.DAYINPUTSMALL);
|
|
|
+ //total1.INPUTBIGRATIO = items.Where(it => it.DAYINPUTSMALL > 0 && it.DAYINPUTSMALL != null).Average(it => it.DAYINPUTSMALL);
|
|
|
+ //total1.OUTPUTSMALLRATIO = items.Where(it => it.DAYINPUTSMALL > 0 && it.DAYINPUTSMALL != null).Average(it => it.DAYINPUTSMALL);
|
|
|
+ //total1.OUTPUTBIGMAXRATIO = items.Where(it => it.DAYINPUTSMALL > 0 && it.DAYINPUTSMALL != null).Average(it => it.DAYINPUTSMALL);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Integer count = 0;
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> recordList =proEconInputOrOutputSpeedService.list().stream()
|
|
|
+ .filter(i->i.getWindturbineId().equals(windturbineId) && StringUtils.notEmp(i.getSpeed())
|
|
|
+ && i.getSpeed()!=0).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> inputrecordList = recordList.stream()
|
|
|
+ .filter(i->i.getInputOrOutput()==1).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> outputrecordList =recordList.stream()
|
|
|
+ .filter(i->i.getInputOrOutput()==0).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> AList = inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=3).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> ACountList =inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> BList = outputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=3).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> BCountList = outputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> CList =inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()>=25).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> CCountList =inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()>11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> DList = outputrecordList.stream().filter(i-> i.getSpeed()>=25).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> DCountList = outputrecordList
|
|
|
+ .stream().filter(i-> i.getSpeed()>11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (ACountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setInputSmallRatio(new BigDecimal(AList.size()).divide(new BigDecimal(ACountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }else {
|
|
|
+ total1.setInputSmallRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (BCountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setOutputSmallRatio(new BigDecimal(BList.size()).divide(new BigDecimal(BCountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ total1.setOutputSmallRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CCountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setInputBigRatio(new BigDecimal(CList.size()).divide(new BigDecimal(CCountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }else {
|
|
|
+ total1.setInputBigRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (DCountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setOutputBigMaxRatio(new BigDecimal(DList.size()).divide(new BigDecimal(DCountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }else {
|
|
|
+ total1.setOutputBigMaxRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void buildDay(Date end, Date daybegin, String windturbineId, ProEconInOrOutSpeedTotal total1, ProEconInOrOutSpeedTotal2 total2)
|
|
|
+ {
|
|
|
+ Integer count = 0;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> recordList =proEconInputOrOutputSpeedService.list().stream()
|
|
|
+ .filter(i->i.getWindturbineId().equals(windturbineId) && StringUtils.notEmp(i.getSpeed())
|
|
|
+ && (i.getRecordDate().compareTo(daybegin)==0 || i.getRecordDate().after(daybegin))
|
|
|
+ && (i.getRecordDate().compareTo(end)==0 || i.getRecordDate().before(end))
|
|
|
+ && i.getSpeed()!=0).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> inputrecordList = recordList.stream()
|
|
|
+ .filter(i->i.getInputOrOutput()==1).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> outputrecordList =recordList.stream()
|
|
|
+ .filter(i->i.getInputOrOutput()==0).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> AList = inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=3).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> ACountList =inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> BList = outputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=3).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> BCountList = outputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> CList =inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()>=25).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> CCountList =inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()>11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> DList = outputrecordList.stream().filter(i-> i.getSpeed()>=25).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> DCountList = outputrecordList
|
|
|
+ .stream().filter(i-> i.getSpeed()>11).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ if (ACountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setDayInputSmallRatio(new BigDecimal(AList.size()).divide(new BigDecimal(ACountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }else {
|
|
|
+ total1.setDayInputSmallRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (BCountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setDayOutputSmallRatio(new BigDecimal(BList.size()).divide(new BigDecimal(BCountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ total1.setDayOutputSmallRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CCountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setDayInputBigRatio(new BigDecimal(CList.size()).divide(new BigDecimal(CCountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }else {
|
|
|
+ total1.setDayInputBigRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (DCountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setDayOutputBigRatio(new BigDecimal(DList.size()).divide(new BigDecimal(DCountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }else {
|
|
|
+ total1.setDayOutputBigRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> A1List = inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<2).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A2List = inputrecordList.stream().filter(i->i.getSpeed()>=2
|
|
|
+ && i.getSpeed()<2.5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A3List = inputrecordList.stream().filter(i->i.getSpeed()>=2.5
|
|
|
+ && i.getSpeed()<3).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A4List = inputrecordList.stream().filter(i->i.getSpeed()>=3
|
|
|
+ && i.getSpeed()<3.5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A5List = inputrecordList.stream().filter(i->i.getSpeed()>=3.5
|
|
|
+ && i.getSpeed()<4).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A6List = inputrecordList.stream().filter(i->i.getSpeed()>=4
|
|
|
+ && i.getSpeed()<5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A7List = inputrecordList.stream().filter(i->i.getSpeed()>=5
|
|
|
+ && i.getSpeed()<=11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ DoubleSummaryStatistics summaryStatistics=inputrecordList.stream().filter(i->
|
|
|
+ i.getSpeed()>0 && i.getSpeed()<5)
|
|
|
+ .mapToDouble(n -> n.getSpeed()).summaryStatistics();
|
|
|
+
|
|
|
+ total1.setDayInputSmall(summaryStatistics.getAverage());
|
|
|
+ total1.setDayInputSmallMax(summaryStatistics.getMax());
|
|
|
+ total1.setDayInputSmallMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+ summaryStatistics=inputrecordList.stream().filter(i->
|
|
|
+ i.getSpeed()>18 && i.getSpeed()<30)
|
|
|
+ .mapToDouble(n -> n.getSpeed()).summaryStatistics();
|
|
|
+
|
|
|
+ total1.setDayInputBig(summaryStatistics.getAverage());
|
|
|
+ total1.setDayInputBigMax(summaryStatistics.getMax());
|
|
|
+ total1.setDayInputBigMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+
|
|
|
+ total2.setDaya1(Double.valueOf(A1List.size()));
|
|
|
+ total2.setDaya2(Double.valueOf(A2List.size()));
|
|
|
+ total2.setDaya3(Double.valueOf(A3List.size()));
|
|
|
+ total2.setDaya4(Double.valueOf(A4List.size()));
|
|
|
+ total2.setDaya5(Double.valueOf(A5List.size()));
|
|
|
+ total2.setDaya6(Double.valueOf(A6List.size()));
|
|
|
+ total2.setDaya7(Double.valueOf(A7List.size()));
|
|
|
+
|
|
|
+
|
|
|
+ count = A1List.size() + A2List.size() + A3List.size() + A4List.size() + A5List.size() + A6List.size() + A7List.size();
|
|
|
+
|
|
|
+ if (count > 0)
|
|
|
+ {
|
|
|
+ total2.setDaya8(new BigDecimal(A1List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setDaya9(new BigDecimal(A2List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setDaya10(new BigDecimal(A3List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setDaya11(new BigDecimal(A4List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setDaya12(new BigDecimal(A5List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setDaya13(new BigDecimal(A6List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setDaya14(new BigDecimal(A7List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ total2.setDaya8(0.0);
|
|
|
+ total2.setDaya9(0.0);
|
|
|
+ total2.setDaya10(0.0);
|
|
|
+ total2.setDaya11(0.0);
|
|
|
+ total2.setDaya12(0.0);
|
|
|
+ total2.setDaya13(0.0);
|
|
|
+ total2.setDaya14(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> B1List = outputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<2).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B2List = outputrecordList.stream().filter(i->i.getSpeed()>=2
|
|
|
+ && i.getSpeed()<2.5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B3List = outputrecordList.stream().filter(i->i.getSpeed()>=2.5
|
|
|
+ && i.getSpeed()<3).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B4List = outputrecordList.stream().filter(i->i.getSpeed()>=3
|
|
|
+ && i.getSpeed()<3.5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B5List = outputrecordList.stream().filter(i->i.getSpeed()>=3.5
|
|
|
+ && i.getSpeed()<4).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B6List = outputrecordList.stream().filter(i->i.getSpeed()>=4
|
|
|
+ && i.getSpeed()<5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B7List = outputrecordList.stream().filter(i->i.getSpeed()>=5
|
|
|
+ && i.getSpeed()<=11).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ summaryStatistics=outputrecordList.stream().filter(i->
|
|
|
+ i.getSpeed()>0 && i.getSpeed()<5)
|
|
|
+ .mapToDouble(n -> n.getSpeed()).summaryStatistics();
|
|
|
+
|
|
|
+ total1.setDayOutputSmall(summaryStatistics.getAverage());
|
|
|
+ total1.setDayOutputSmallMax(summaryStatistics.getMax());
|
|
|
+ total1.setDayOutputSmallMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+ summaryStatistics=outputrecordList.stream().filter(i->
|
|
|
+ i.getSpeed()>18 && i.getSpeed()<30)
|
|
|
+ .mapToDouble(n -> n.getSpeed()).summaryStatistics();
|
|
|
+
|
|
|
+ total1.setDayOutputBig(summaryStatistics.getAverage());
|
|
|
+ total1.setDayOutputBigMax(summaryStatistics.getMax());
|
|
|
+ total1.setDayOutputBigMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ total2.setDaya1(Double.valueOf(B1List.size()));
|
|
|
+ total2.setDaya2(Double.valueOf(B2List.size()));
|
|
|
+ total2.setDaya3(Double.valueOf(B3List.size()));
|
|
|
+ total2.setDaya4(Double.valueOf(B4List.size()));
|
|
|
+ total2.setDaya5(Double.valueOf(B5List.size()));
|
|
|
+ total2.setDaya6(Double.valueOf(B6List.size()));
|
|
|
+ total2.setDaya7(Double.valueOf(B7List.size()));
|
|
|
+
|
|
|
+ count = B1List.size() + B2List.size() + B3List.size() + B4List.size() + B5List.size() + B6List.size() + B7List.size();
|
|
|
+
|
|
|
+ if (count > 0)
|
|
|
+ {
|
|
|
+ total2.setDaya8(new BigDecimal(B1List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setDaya9(new BigDecimal(B2List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setDaya10(new BigDecimal(B3List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setDaya11(new BigDecimal(B4List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setDaya12(new BigDecimal(B5List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setDaya13(new BigDecimal(B6List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setDaya14(new BigDecimal(B7List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ total2.setDaya8(0.0);
|
|
|
+ total2.setDaya9(0.0);
|
|
|
+ total2.setDaya10(0.0);
|
|
|
+ total2.setDaya11(0.0);
|
|
|
+ total2.setDaya12(0.0);
|
|
|
+ total2.setDaya13(0.0);
|
|
|
+ total2.setDaya14(0.0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void buildMonth(Date end, Date monthbegin, String windturbineId, ProEconInOrOutSpeedTotal total1, ProEconInOrOutSpeedTotal2 total2)
|
|
|
+ {
|
|
|
+ Integer count = 0;
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> recordList =proEconInputOrOutputSpeedService.list().stream()
|
|
|
+ .filter(i->i.getWindturbineId().equals(windturbineId) && StringUtils.notEmp(i.getSpeed())
|
|
|
+ && (i.getRecordDate().compareTo(monthbegin)==0 || i.getRecordDate().after(monthbegin))
|
|
|
+ && (i.getRecordDate().compareTo(end)==0 || i.getRecordDate().before(end))
|
|
|
+ && i.getSpeed()!=0).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> inputrecordList = recordList.stream()
|
|
|
+ .filter(i->i.getInputOrOutput()==1).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> outputrecordList =recordList.stream()
|
|
|
+ .filter(i->i.getInputOrOutput()==0).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> AList = inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=3).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> ACountList =inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> BList = outputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=3).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> BCountList = outputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> CList =inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()>=25).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> CCountList =inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()>11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> DList = outputrecordList.stream().filter(i-> i.getSpeed()>=25).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> DCountList = outputrecordList
|
|
|
+ .stream().filter(i-> i.getSpeed()>11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (ACountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setMonthInputSmallRatio(new BigDecimal(AList.size()).divide(new BigDecimal(ACountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }else {
|
|
|
+ total1.setMonthInputSmallRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (BCountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setMonthOutputSmallRatio(new BigDecimal(BList.size()).divide(new BigDecimal(BCountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ total1.setMonthOutputSmallRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CCountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setMonthInputBigRatio(new BigDecimal(CList.size()).divide(new BigDecimal(CCountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }else {
|
|
|
+ total1.setMonthInputBigRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (DCountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setMonthOutputBigRatio(new BigDecimal(DList.size()).divide(new BigDecimal(DCountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }else {
|
|
|
+ total1.setMonthOutputBigRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> A1List = inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<2).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A2List = inputrecordList.stream().filter(i->i.getSpeed()>=2
|
|
|
+ && i.getSpeed()<2.5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A3List = inputrecordList.stream().filter(i->i.getSpeed()>=2.5
|
|
|
+ && i.getSpeed()<3).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A4List = inputrecordList.stream().filter(i->i.getSpeed()>=3
|
|
|
+ && i.getSpeed()<3.5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A5List = inputrecordList.stream().filter(i->i.getSpeed()>=3.5
|
|
|
+ && i.getSpeed()<4).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A6List = inputrecordList.stream().filter(i->i.getSpeed()>=4
|
|
|
+ && i.getSpeed()<5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A7List = inputrecordList.stream().filter(i->i.getSpeed()>=5
|
|
|
+ && i.getSpeed()<=11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ DoubleSummaryStatistics summaryStatistics=inputrecordList.stream().filter(i->
|
|
|
+ i.getSpeed()>0 && i.getSpeed()<5)
|
|
|
+ .mapToDouble(n -> n.getSpeed()).summaryStatistics();
|
|
|
+
|
|
|
+ total1.setMonthInputSmall(summaryStatistics.getAverage());
|
|
|
+ total1.setMonthInputSmallMax(summaryStatistics.getMax());
|
|
|
+ total1.setMonthInputSmallMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+ summaryStatistics=inputrecordList.stream().filter(i->
|
|
|
+ i.getSpeed()>18 && i.getSpeed()<30)
|
|
|
+ .mapToDouble(n -> n.getSpeed()).summaryStatistics();
|
|
|
+
|
|
|
+ total1.setMonthInputBig(summaryStatistics.getAverage());
|
|
|
+ total1.setMonthInputBigMax(summaryStatistics.getMax());
|
|
|
+ total1.setMonthInputBigMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+
|
|
|
+ total2.setMontha1(Double.valueOf(A1List.size()));
|
|
|
+ total2.setMontha2(Double.valueOf(A2List.size()));
|
|
|
+ total2.setMontha3(Double.valueOf(A3List.size()));
|
|
|
+ total2.setMontha4(Double.valueOf(A4List.size()));
|
|
|
+ total2.setMontha5(Double.valueOf(A5List.size()));
|
|
|
+ total2.setMontha6(Double.valueOf(A6List.size()));
|
|
|
+ total2.setMontha7(Double.valueOf(A7List.size()));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ count = A1List.size() + A2List.size() + A3List.size() + A4List.size() + A5List.size() + A6List.size() + A7List.size();
|
|
|
+
|
|
|
+ if (count > 0)
|
|
|
+ {
|
|
|
+ total2.setMontha8(new BigDecimal(A1List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setMontha9(new BigDecimal(A2List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setMontha10(new BigDecimal(A3List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setMontha11(new BigDecimal(A4List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setMontha12(new BigDecimal(A5List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setMontha13(new BigDecimal(A6List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setMontha14(new BigDecimal(A7List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ total2.setMontha8(0.0);
|
|
|
+ total2.setMontha9(0.0);
|
|
|
+ total2.setMontha10(0.0);
|
|
|
+ total2.setMontha11(0.0);
|
|
|
+ total2.setMontha12(0.0);
|
|
|
+ total2.setMontha13(0.0);
|
|
|
+ total2.setMontha14(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> B1List = outputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<2).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B2List = outputrecordList.stream().filter(i->i.getSpeed()>=2
|
|
|
+ && i.getSpeed()<2.5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B3List = outputrecordList.stream().filter(i->i.getSpeed()>=2.5
|
|
|
+ && i.getSpeed()<3).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B4List = outputrecordList.stream().filter(i->i.getSpeed()>=3
|
|
|
+ && i.getSpeed()<3.5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B5List = outputrecordList.stream().filter(i->i.getSpeed()>=3.5
|
|
|
+ && i.getSpeed()<4).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B6List = outputrecordList.stream().filter(i->i.getSpeed()>=4
|
|
|
+ && i.getSpeed()<5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B7List = outputrecordList.stream().filter(i->i.getSpeed()>=5
|
|
|
+ && i.getSpeed()<=11).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ summaryStatistics=outputrecordList.stream().filter(i->
|
|
|
+ i.getSpeed()>0 && i.getSpeed()<5)
|
|
|
+ .mapToDouble(n -> n.getSpeed()).summaryStatistics();
|
|
|
+
|
|
|
+ total1.setMonthOutputSmall(summaryStatistics.getAverage());
|
|
|
+ total1.setMonthOutputSmallMax(summaryStatistics.getMax());
|
|
|
+ total1.setMonthOutputSmallMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+ summaryStatistics=outputrecordList.stream().filter(i->
|
|
|
+ i.getSpeed()>18 && i.getSpeed()<30)
|
|
|
+ .mapToDouble(n -> n.getSpeed()).summaryStatistics();
|
|
|
+
|
|
|
+ total1.setMonthOutputBig(summaryStatistics.getAverage());
|
|
|
+ total1.setMonthOutputBigMax(summaryStatistics.getMax());
|
|
|
+ total1.setMonthOutputBigMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ total2.setMontha1(Double.valueOf(B1List.size()));
|
|
|
+ total2.setMontha2(Double.valueOf(B2List.size()));
|
|
|
+ total2.setMontha3(Double.valueOf(B3List.size()));
|
|
|
+ total2.setMontha4(Double.valueOf(B4List.size()));
|
|
|
+ total2.setMontha5(Double.valueOf(B5List.size()));
|
|
|
+ total2.setMontha6(Double.valueOf(B6List.size()));
|
|
|
+ total2.setMontha7(Double.valueOf(B7List.size()));
|
|
|
+
|
|
|
+ count = B1List.size() + B2List.size() + B3List.size() + B4List.size() + B5List.size() + B6List.size() + B7List.size();
|
|
|
+
|
|
|
+ if (count > 0)
|
|
|
+ {
|
|
|
+ total2.setMontha8(new BigDecimal(B1List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setMontha9(new BigDecimal(B2List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setMontha10(new BigDecimal(B3List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setMontha11(new BigDecimal(B4List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setMontha12(new BigDecimal(B5List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setMontha13(new BigDecimal(B6List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setMontha14(new BigDecimal(B7List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ total2.setMontha8(0.0);
|
|
|
+ total2.setMontha9(0.0);
|
|
|
+ total2.setMontha10(0.0);
|
|
|
+ total2.setMontha11(0.0);
|
|
|
+ total2.setMontha12(0.0);
|
|
|
+ total2.setMontha13(0.0);
|
|
|
+ total2.setMontha14(0.0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void buildyear(Date end, Date yearbegin, String windturbineId, ProEconInOrOutSpeedTotal total1, ProEconInOrOutSpeedTotal2 total2)
|
|
|
+ {
|
|
|
+ Integer count = 0;
|
|
|
+ List<ProEconInputOrOutputSpeed> recordList =proEconInputOrOutputSpeedService.list().stream()
|
|
|
+ .filter(i->i.getWindturbineId().equals(windturbineId) && StringUtils.notEmp(i.getSpeed())
|
|
|
+ && (i.getRecordDate().compareTo(yearbegin)==0 || i.getRecordDate().after(yearbegin))
|
|
|
+ && (i.getRecordDate().compareTo(end)==0 || i.getRecordDate().before(end))
|
|
|
+ && i.getSpeed()!=0).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> inputrecordList = recordList.stream()
|
|
|
+ .filter(i->i.getInputOrOutput()==1).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> outputrecordList =recordList.stream()
|
|
|
+ .filter(i->i.getInputOrOutput()==0).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> AList = inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=3).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> ACountList =inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> BList = outputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=3).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> BCountList = outputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<=11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> CList =inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()>=25).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> CCountList =inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()>11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> DList = outputrecordList.stream().filter(i-> i.getSpeed()>=25).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> DCountList = outputrecordList
|
|
|
+ .stream().filter(i-> i.getSpeed()>11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (ACountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setYearInputSmallRatio(new BigDecimal(AList.size()).divide(new BigDecimal(ACountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }else {
|
|
|
+ total1.setYearInputSmallRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (BCountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setYearOutputSmallRatio(new BigDecimal(BList.size()).divide(new BigDecimal(BCountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ total1.setYearOutputSmallRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CCountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setYearInputBigRatio(new BigDecimal(CList.size()).divide(new BigDecimal(CCountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }else {
|
|
|
+ total1.setYearInputBigRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (DCountList.size() != 0)
|
|
|
+ {
|
|
|
+ total1.setYearOutputBigRatio(new BigDecimal(DList.size()).divide(new BigDecimal(DCountList.size()),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }else {
|
|
|
+ total1.setYearOutputBigRatio(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> A1List = inputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<2).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A2List = inputrecordList.stream().filter(i->i.getSpeed()>=2
|
|
|
+ && i.getSpeed()<2.5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A3List = inputrecordList.stream().filter(i->i.getSpeed()>=2.5
|
|
|
+ && i.getSpeed()<3).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A4List = inputrecordList.stream().filter(i->i.getSpeed()>=3
|
|
|
+ && i.getSpeed()<3.5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A5List = inputrecordList.stream().filter(i->i.getSpeed()>=3.5
|
|
|
+ && i.getSpeed()<4).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A6List = inputrecordList.stream().filter(i->i.getSpeed()>=4
|
|
|
+ && i.getSpeed()<5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> A7List = inputrecordList.stream().filter(i->i.getSpeed()>=5
|
|
|
+ && i.getSpeed()<=11).collect(Collectors.toList());
|
|
|
+
|
|
|
+ DoubleSummaryStatistics summaryStatistics=inputrecordList.stream().filter(i->
|
|
|
+ i.getSpeed()>0 && i.getSpeed()<5)
|
|
|
+ .mapToDouble(n -> n.getSpeed()).summaryStatistics();
|
|
|
+
|
|
|
+ total1.setYearInputSmall(summaryStatistics.getAverage());
|
|
|
+ total1.setYearInputSmallMax(summaryStatistics.getMax());
|
|
|
+ total1.setYearInputSmallMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+ summaryStatistics=inputrecordList.stream().filter(i->
|
|
|
+ i.getSpeed()>18 && i.getSpeed()<30)
|
|
|
+ .mapToDouble(n -> n.getSpeed()).summaryStatistics();
|
|
|
+
|
|
|
+ total1.setYearInputBig(summaryStatistics.getAverage());
|
|
|
+ total1.setYearInputBigMax(summaryStatistics.getMax());
|
|
|
+ total1.setYearInputBigMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+
|
|
|
+ total2.setYeara1(Double.valueOf(A1List.size()));
|
|
|
+ total2.setYeara2(Double.valueOf(A2List.size()));
|
|
|
+ total2.setYeara3(Double.valueOf(A3List.size()));
|
|
|
+ total2.setYeara4(Double.valueOf(A4List.size()));
|
|
|
+ total2.setYeara5(Double.valueOf(A5List.size()));
|
|
|
+ total2.setYeara6(Double.valueOf(A6List.size()));
|
|
|
+ total2.setYeara7(Double.valueOf(A7List.size()));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ count = A1List.size() + A2List.size() + A3List.size() + A4List.size() + A5List.size() + A6List.size() + A7List.size();
|
|
|
+
|
|
|
+ if (count > 0)
|
|
|
+ {
|
|
|
+ total2.setYeara8(new BigDecimal(A1List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setYeara9(new BigDecimal(A2List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setYeara10(new BigDecimal(A3List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setYeara11(new BigDecimal(A4List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setYeara12(new BigDecimal(A5List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setYeara13(new BigDecimal(A6List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setYeara14(new BigDecimal(A7List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ total2.setYeara8(0.0);
|
|
|
+ total2.setYeara9(0.0);
|
|
|
+ total2.setYeara10(0.0);
|
|
|
+ total2.setYeara11(0.0);
|
|
|
+ total2.setYeara12(0.0);
|
|
|
+ total2.setYeara13(0.0);
|
|
|
+ total2.setYeara14(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<ProEconInputOrOutputSpeed> B1List = outputrecordList.stream().filter(i->i.getSpeed()>0
|
|
|
+ && i.getSpeed()<2).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B2List = outputrecordList.stream().filter(i->i.getSpeed()>=2
|
|
|
+ && i.getSpeed()<2.5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B3List = outputrecordList.stream().filter(i->i.getSpeed()>=2.5
|
|
|
+ && i.getSpeed()<3).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B4List = outputrecordList.stream().filter(i->i.getSpeed()>=3
|
|
|
+ && i.getSpeed()<3.5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B5List = outputrecordList.stream().filter(i->i.getSpeed()>=3.5
|
|
|
+ && i.getSpeed()<4).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B6List = outputrecordList.stream().filter(i->i.getSpeed()>=4
|
|
|
+ && i.getSpeed()<5).collect(Collectors.toList());
|
|
|
+ List<ProEconInputOrOutputSpeed> B7List = outputrecordList.stream().filter(i->i.getSpeed()>=5
|
|
|
+ && i.getSpeed()<=11).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ summaryStatistics=outputrecordList.stream().filter(i->
|
|
|
+ i.getSpeed()>0 && i.getSpeed()<5)
|
|
|
+ .mapToDouble(n -> n.getSpeed()).summaryStatistics();
|
|
|
+
|
|
|
+ total1.setYearOutputSmall(summaryStatistics.getAverage());
|
|
|
+ total1.setYearOutputSmallMax(summaryStatistics.getMax());
|
|
|
+ total1.setYearOutputSmallMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+ summaryStatistics=outputrecordList.stream().filter(i->
|
|
|
+ i.getSpeed()>18 && i.getSpeed()<30)
|
|
|
+ .mapToDouble(n -> n.getSpeed()).summaryStatistics();
|
|
|
+
|
|
|
+ total1.setYearOutputBig(summaryStatistics.getAverage());
|
|
|
+ total1.setYearOutputBigMax(summaryStatistics.getMax());
|
|
|
+ total1.setYearOutputBigMin(summaryStatistics.getMin());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ total2.setYeara1(Double.valueOf(B1List.size()));
|
|
|
+ total2.setYeara2(Double.valueOf(B2List.size()));
|
|
|
+ total2.setYeara3(Double.valueOf(B3List.size()));
|
|
|
+ total2.setYeara4(Double.valueOf(B4List.size()));
|
|
|
+ total2.setYeara5(Double.valueOf(B5List.size()));
|
|
|
+ total2.setYeara6(Double.valueOf(B6List.size()));
|
|
|
+ total2.setYeara7(Double.valueOf(B7List.size()));
|
|
|
+
|
|
|
+ count = B1List.size() + B2List.size() + B3List.size() + B4List.size() + B5List.size() + B6List.size() + B7List.size();
|
|
|
+
|
|
|
+ if (count > 0)
|
|
|
+ {
|
|
|
+ total2.setYeara8(new BigDecimal(B1List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setYeara9(new BigDecimal(B2List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setYeara10(new BigDecimal(B3List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setYeara11(new BigDecimal(B4List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setYeara12(new BigDecimal(B5List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setYeara13(new BigDecimal(B6List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ total2.setYeara14(new BigDecimal(B7List.size()).divide(new BigDecimal(count),
|
|
|
+ 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ total2.setYeara8(0.0);
|
|
|
+ total2.setYeara9(0.0);
|
|
|
+ total2.setYeara10(0.0);
|
|
|
+ total2.setYeara11(0.0);
|
|
|
+ total2.setYeara12(0.0);
|
|
|
+ total2.setYeara13(0.0);
|
|
|
+ total2.setYeara14(0.0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|