1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792 |
- package com.gyee.generation.service;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.gyee.common.contant.ContantXk;
- import com.gyee.common.model.PointData;
- import com.gyee.generation.init.CacheContext;
- import com.gyee.generation.model.auto.*;
- import com.gyee.generation.model.vo.StatusValue;
- import com.gyee.generation.model.vo.WpType;
- 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 com.gyee.generation.util.realtimesource.IEdosUtil;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Service;
- import javax.annotation.Resource;
- import java.math.BigDecimal;
- import java.math.RoundingMode;
- import java.util.*;
- import java.util.concurrent.Executor;
- import java.util.stream.Collectors;
- @Service
- public class InputOrOutPutService {
- @Resource
- private IEdosUtil edosUtil;
- @Resource
- private IProEconInOrOutSpeedTotal2Service proEconInOrOutSpeedTotal2Service;
- @Resource
- private IProEconInOrOutSpeedTotalService proEconInOrOutSpeedTotalService;
- @Resource
- private IProEconInputOrOutputSpeedService proEconInputOrOutputSpeedService;
- @Resource
- private Executor executor;
- @Value("${frequency.cutinandout}")
- private Integer frequency;
- private static Map<String, Double> statusRanngMap;
- public void initialInputOrOutputSpeed()
- {
- statusRanngMap=new HashMap<>();
- List<ProBasicEquipment> wtls= new ArrayList<>();
- for(ProBasicPowerstation wp: CacheContext.wpls)
- {
- if(wp.getId().contains("FDC") )
- {
- wtls.addAll(CacheContext.wpwtmap.get(wp.getId()));
- }
- }
- List<ProEconInputOrOutputSpeed> ls=new ArrayList<>();
- List<String> mxztls=new ArrayList<>();
- List<String> ssfsls=new ArrayList<>();
- for (ProBasicEquipment wt: wtls)
- {
- Map<String, ProBasicEquipmentPoint> pointmap= CacheContext.wtpAimap.get(wt.getId());
- ProBasicEquipmentPoint mxzt= pointmap.get(ContantXk.SBZT);
- mxztls.add(mxzt.getNemCode());
- ProBasicEquipmentPoint ssfs= pointmap.get(ContantXk.CJ_SSFS);
- ssfsls.add(ssfs.getNemCode());
- }
- try {
- List<PointData> mxztvaluels = edosUtil.getRealData(mxztls);
- if(!mxztvaluels.isEmpty() && mxztvaluels.size()==wtls.size())
- {
- for (int i=0;i<wtls.size();i++)
- {
- ProBasicEquipment wt=wtls.get(i);
- statusRanngMap.put(wt.getId(),mxztvaluels.get(i).getPointValueInDouble());
- }
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- public void inputOrOutputSpeed(Date recordDate) throws Exception {
- // Date begin = DateUtils.addSeconds(recordDate, -60);
- //
- // Date begin = DateUtils.addHours(recordDate, -frequency);
- // Date end = recordDate;
- // Map<String, ProEconInputOrOutputSpeed> wtTimeStatusMap=new HashMap<>();
- // Map<String,Double> wtLastStatusMap=new HashMap<>();
- //
- // QueryWrapper<ProEconInputOrOutputSpeed> queryWrapper = new QueryWrapper<>();
- // queryWrapper.ge("record_date",begin).le("record_date",end);
- // queryWrapper.orderByAsc("record_date");
- // List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list(queryWrapper);
- //
- // Map<String, Map<String,ProEconInputOrOutputSpeed>> statusMap=new HashMap<>();
- // if(!recordList.isEmpty())
- // {
- // for(ProEconInputOrOutputSpeed po:recordList)
- // {
- // if(statusMap.containsKey(po.getWindturbineId()))
- // {
- // Map<String, ProEconInputOrOutputSpeed> map= statusMap.get(po.getWindturbineId());
- // map.put(String.valueOf(po.getRecordDate().getTime()),po);
- // }else
- // {
- // Map<String, ProEconInputOrOutputSpeed> map= new HashMap<>();
- // map.put(String.valueOf(po.getRecordDate().getTime()),po);
- // statusMap.put(po.getWindturbineId(),map);
- // }
- //
- // }
- // }
- List<ProBasicEquipment> wtls= new ArrayList<>();
- for(ProBasicPowerstation wp: CacheContext.wpls)
- {
- if(wp.getId().contains("FDC") )
- {
- wtls.addAll(CacheContext.wpwtmap.get(wp.getId()));
- }
- }
- List<ProEconInputOrOutputSpeed> ls=new ArrayList<>();
- List<String> mxztls=new ArrayList<>();
- List<String> ssfsls=new ArrayList<>();
- for (ProBasicEquipment wt: wtls)
- {
- Map<String, ProBasicEquipmentPoint> pointmap= CacheContext.wtpAimap.get(wt.getId());
- ProBasicEquipmentPoint mxzt= pointmap.get(ContantXk.SBZT);
- mxztls.add(mxzt.getNemCode());
- ProBasicEquipmentPoint ssfs= pointmap.get(ContantXk.CJ_SSFS);
- ssfsls.add(ssfs.getNemCode());
- }
- List<PointData> mxztvaluels = edosUtil.getRealData(mxztls);
- List<PointData> ssfsvaluels = edosUtil.getRealData(ssfsls);
- if(ssfsvaluels.size() == mxztvaluels.size() && ssfsvaluels.size()==wtls.size())
- {
- for (int i=0;i<wtls.size();i++)
- {
- ProBasicEquipment wt=wtls.get(i);
- double status=StringUtils.round(mxztvaluels.get(i).getPointValueInDouble(),0);
- if(null !=statusRanngMap)
- {
- double lastStatus=StringUtils.round( statusRanngMap.get(wt.getId()),0);
- PointData ssfspo=ssfsvaluels.get(i);
- // 切入切出风速
- if (lastStatus == StatusValue.DJ.getCode() && status == StatusValue.YX.getCode())
- {
- ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
- input.setWindturbineId(wt.getId());
- input.setWindpowerstationId(wt.getWindpowerstationId());
- input.setProjectId(wt.getProjectId());
- input.setLineId(wt.getLineId());
- input.setRecordDate(DateUtils.truncate(new Date()));
- input.setInputOrOutput(1);
- input.setSpeed(StringUtils.round(ssfspo.getPointValueInDouble(),2));
- // if(statusMap.containsKey(wt.getId()))
- // {
- // Map<String, ProEconInputOrOutputSpeed> map= statusMap.get(wt.getId());
- //
- // if(!map.containsKey(String.valueOf(ssfspo.getPointTime())) )
- // {
- // ls.add(input);
- // }
- // }else {
- // ls.add(input);
- // }
- ls.add(input);
- }
- else if (lastStatus == StatusValue.YX.getCode() && status== StatusValue.DJ.getCode())
- {
- ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
- input.setWindturbineId(wt.getId());
- input.setWindpowerstationId(wt.getWindpowerstationId());
- input.setProjectId(wt.getProjectId());
- input.setLineId(wt.getLineId());
- input.setRecordDate(DateUtils.truncate(new Date()));
- input.setInputOrOutput(0);
- input.setSpeed(StringUtils.round(ssfspo.getPointValueInDouble(),2));
- // if(statusMap.containsKey(wt.getId()))
- // {
- // Map<String, ProEconInputOrOutputSpeed> map= statusMap.get(wt.getId());
- //
- // if(!map.containsKey(String.valueOf(ssfspo.getPointTime())) )
- // {
- // ls.add(input);
- // }
- // }else
- // {
- // ls.add(input);
- // }
- ls.add(input);
- }
- }
- statusRanngMap.put(wt.getId(),status);
- }
- }
- // for (ProBasicEquipment wt: wtls) {
- // {
- //
- //// if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {
- //// continue;
- //// }
- // Map<String, ProBasicEquipmentPoint> pointmap= CacheContext.wtpAimap.get(wt.getId());
- //
- //
- // if(statusMap.containsKey(wt.getId()))
- // {
- // wtTimeStatusMap=statusMap.get(wt.getId());
- // }
- //
- // double lastStatus=-1;
- //
- //
- // ProBasicEquipmentPoint mxzt= pointmap.get(ContantXk.SBZT);
- // ProBasicEquipmentPoint ssfs= pointmap.get(ContantXk.CJ_SSFS);
- //
- // //获取5分钟没个间隔1秒钟,保证状态与时序库保持一致
- // List<PointData> statusls = edosUtil.getHistoryDatasSnap(mxzt.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000,null,1L);
- // List<PointData> ssfsls = edosUtil.getHistoryDatasSnap(ssfs.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000,null,1L);
- //
- //
- // if(!statusls.isEmpty() && !ssfsls.isEmpty() && ssfsls.size()==statusls.size())
- // {
- //
- // for(int i=0;i<statusls.size();i++)
- // {
- //
- //
- // if(wtLastStatusMap.containsKey(wt.getId()))
- // {
- // lastStatus=wtLastStatusMap.get(wt.getId());
- // }
- //
- // PointData statuspo=statusls.get(i);
- // PointData ssfspo=ssfsls.get(i);
- // double status= StringUtils.round(statuspo.getPointValueInDouble(),0);
- //
- // if(i==0)
- // {
- // lastStatus=status;
- // }
- // if (!Objects.equals(lastStatus, status))
- // {
- //
- // // 切入切出风速
- // if (lastStatus == 0 && status == 1)
- // {
- // ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
- //
- // input.setWindturbineId(wt.getId());
- // input.setWindpowerstationId(wt.getWindpowerstationId());
- // input.setProjectId(wt.getProjectId());
- // input.setLineId(wt.getLineId());
- // input.setRecordDate(new Date());
- // input.setInputOrOutput(1);
- //
- //
- // input.setSpeed(StringUtils.round(ssfspo.getPointValueInDouble(),2));
- //
- // if(!wtTimeStatusMap.containsKey(String.valueOf(statuspo.getPointTime())) && !wtTimeStatusMap.get(String.valueOf(statuspo.getPointTime())).getWindturbineId().equals(wt.getId()))
- // {
- // //roEconInputOrOutputSpeedService.save(input);
- // ls.add(input);
- // }
- // lastStatus=status;
- //
- // }
- // else if (lastStatus == 1 && status== 0)
- // {
- // ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
- // input.setWindturbineId(wt.getId());
- // input.setWindpowerstationId(wt.getWindpowerstationId());
- // input.setProjectId(wt.getProjectId());
- // input.setLineId(wt.getLineId());
- // input.setRecordDate(new Date());
- // input.setInputOrOutput(0);
- //
- // input.setSpeed(StringUtils.round(ssfspo.getPointValueInDouble(),2));
- //
- // if(!wtTimeStatusMap.containsKey(String.valueOf(statuspo.getPointTime())) && !wtTimeStatusMap.get(String.valueOf(statuspo.getPointTime())).getWindturbineId().equals(wt.getId()))
- // {
- // //proEconInputOrOutputSpeedService.save(input);
- //
- // ls.add(input);
- // }
- // lastStatus=status;
- // }
- //
- // wtLastStatusMap.put(wt.getId(), status);
- //
- // }
- // }
- //
- //
- //
- // }
- //
- // }
- //
- // System.out.println("切入切出数量"+ls.size());
- List<ProEconInputOrOutputSpeed> templs = new ArrayList<>();
- for (ProEconInputOrOutputSpeed vo : ls) {
- templs.add(vo);
- if (templs.size() == 100) {
- proEconInputOrOutputSpeedService.saveBatch(templs);
- templs = new ArrayList<>();
- }
- }
- if (!templs.isEmpty()) {
- proEconInputOrOutputSpeedService.saveBatch(templs);
- }
- // }
- }
- public void inputOrOutput(Date currentDate) {
- currentDate = DateUtils.truncate(currentDate);
- // Date end = DateUtils.addDays(currentDate, 1);
- // Date daybegin =DateUtils.truncate(currentDate);
- Date end = currentDate;
- Date daybegin = DateUtils.addDays(currentDate, -1);
- Calendar c = Calendar.getInstance();
- c.setTime(daybegin);
- c.set(Calendar.DAY_OF_MONTH, 1);
- Date monthbegin = c.getTime();
- c.set(Calendar.MONTH, 0);
- Date yearbegin = c.getTime();
- for (ProBasicPowerstation wp : CacheContext.wpls) {
- if(wp.getId().contains(WpType.GDC.id))
- {
- continue;
- }
- List<ProBasicEquipment> wtls = null;
- if (CacheContext.wpwtmap.containsKey(wp.getId())) {
- wtls = CacheContext.wpwtmap.get(wp.getId());
- }
- if (null != wtls && !wtls.isEmpty()) {
- for (ProBasicEquipment wt : wtls) {
- ProEconInOrOutSpeedTotal total1 = null;
- ProEconInOrOutSpeedTotal2 total2 = null;
- QueryWrapper<ProEconInOrOutSpeedTotal> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("record_date",daybegin).eq("windturbine_id",wt.getId());
- Optional<ProEconInOrOutSpeedTotal> total1o = proEconInOrOutSpeedTotalService.list(queryWrapper)
- .stream()
- // .filter(i -> i.getWindturbineId().equals(wt.getId())
- // && i.getRecordDate().compareTo(daybegin) == 0)
- .findFirst();
- if (total1o.isPresent()) {
- total1 = total1o.get();
- }
- QueryWrapper<ProEconInOrOutSpeedTotal2> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("record_date",daybegin).eq("windturbine_id",wt.getId());
- Optional<ProEconInOrOutSpeedTotal2> total2o = proEconInOrOutSpeedTotal2Service.list(queryWrapper2).stream()
- // .filter(i -> i.getWindturbineId().equals(wt.getId())
- // && i.getRecordDate().compareTo(daybegin) == 0)
- .findFirst();
- if (total2o.isPresent()) {
- total2 = total2o.get();
- }
- if (total1 != null) {
- QueryWrapper<ProEconInOrOutSpeedTotal> wrapper = new QueryWrapper<>();
- wrapper.eq("id", total1.getId());
- proEconInOrOutSpeedTotalService.remove(wrapper);
- }
- if (total2 != null) {
- QueryWrapper<ProEconInOrOutSpeedTotal2> wrapper = new QueryWrapper<>();
- wrapper.eq("id", total2.getId());
- proEconInOrOutSpeedTotal2Service.remove(wrapper);
- }
- total1 = new ProEconInOrOutSpeedTotal();
- total1.setWindturbineId(wt.getId());
- total1.setWindpowerstationId(wt.getWindpowerstationId());
- total1.setProjectId(wt.getProjectId());
- total1.setLineId(wt.getLineId());
- total1.setRecordDate(daybegin);
- total1.setCompanyId(wt.getCompanyId());
- total1.setRegionId(wt.getRegionId());
- if(wt.getWindpowerstationId().contains(WpType.FDC.id))
- {
- total1.setTypes("-1");
- }else
- {
- total1.setTypes("-2");
- }
- total2 = new ProEconInOrOutSpeedTotal2();
- total2.setWindturbineId(wt.getId());
- total2.setWindpowerstationId(wt.getWindpowerstationId());
- total2.setProjectId(wt.getProjectId());
- total2.setLineId(wt.getLineId());
- total2.setRecordDate(daybegin);
- total2.setRegionId(wt.getRegionId());
- total2.setCompanyId(wt.getCompanyId());
- if(wt.getWindpowerstationId().contains(WpType.FDC.id))
- {
- total2.setTypes("-1");
- }else
- {
- total2.setTypes("-2");
- }
- newMethod(end, daybegin, monthbegin, yearbegin, wt.getId(), total1, total2);
- verify(total1);
- proEconInOrOutSpeedTotalService.save(total1);
- proEconInOrOutSpeedTotal2Service.save(total2);
- }
- }
- }
- }
- private void verify(ProEconInOrOutSpeedTotal total1) {
- //日小风切入
- if (Double.isInfinite(total1.getDayInputSmall()) || Double.isNaN(total1.getDayInputSmall()))
- {
- total1.setDayInputSmall(0.0);
- }else
- {
- total1.setDayInputSmall(StringUtils.round(total1.getDayInputSmall(),2));
- }
- //日小风切入最小值
- if (Double.isInfinite(total1.getDayInputSmallMin()) || Double.isNaN(total1.getDayInputSmallMin()))
- {
- total1.setDayInputSmallMin(0.0);
- }else
- {
- total1.setDayInputSmallMin(StringUtils.round(total1.getDayInputSmallMin(),2));
- }
- //日小风切入最大值
- if (Double.isInfinite(total1.getDayInputSmallMax()) || Double.isNaN(total1.getDayInputSmallMax()))
- {
- total1.setDayInputSmallMax(0.0);
- }else
- {
- total1.setDayInputSmallMax(StringUtils.round(total1.getDayInputSmallMax(),2));
- }
- //日大风切入
- if (Double.isInfinite(total1.getDayInputBig()) || Double.isNaN(total1.getDayInputBig()))
- {
- total1.setDayInputBig(0.0);
- }else
- {
- total1.setDayInputBig(StringUtils.round(total1.getDayInputBig(),2));
- }
- //日大风切入最大值
- if (Double.isInfinite(total1.getDayInputBigMin()) || Double.isNaN(total1.getDayInputBigMin()))
- {
- total1.setDayInputBigMin(0.0);
- }else
- {
- total1.setDayInputBigMin(StringUtils.round(total1.getDayInputBigMin(),2));
- }
- //日大风切入最大值
- if (Double.isInfinite(total1.getDayInputBigMax()) || Double.isNaN(total1.getDayInputBigMax()))
- {
- total1.setDayInputBigMax(0.0);
- }else
- {
- total1.setDayInputBigMax(StringUtils.round(total1.getDayInputBigMax(),2));
- }
- //日小风切出
- if (Double.isInfinite(total1.getDayOutputSmall()) || Double.isNaN(total1.getDayOutputSmall()))
- {
- total1.setDayOutputSmall(0.0);
- }else
- {
- total1.setDayOutputSmall(StringUtils.round(total1.getDayOutputSmall(),2));
- }
- //日小风切出最小值
- if (Double.isInfinite(total1.getDayOutputSmallMin()) || Double.isNaN(total1.getDayOutputSmallMin()))
- {
- total1.setDayOutputSmallMin(0.0);
- }else
- {
- total1.setDayOutputSmallMin(StringUtils.round(total1.getDayOutputSmallMin(),2));
- }
- //日小风切出最大值
- if (Double.isInfinite(total1.getDayOutputSmallMax()) || Double.isNaN(total1.getDayOutputSmallMax()))
- {
- total1.setDayOutputSmallMax(0.0);
- }else
- {
- total1.setDayOutputSmallMax(StringUtils.round(total1.getDayOutputSmallMax(),2));
- }
- //日大风切出
- if (Double.isInfinite(total1.getDayOutputBig()) || Double.isNaN(total1.getDayOutputBig()))
- {
- total1.setDayOutputBig(0.0);
- }else
- {
- total1.setDayOutputBig(StringUtils.round(total1.getDayOutputBig(),2));
- }
- //日大风切出最大值
- if (Double.isInfinite(total1.getDayOutputBigMin()) || Double.isNaN(total1.getDayOutputBigMin()))
- {
- total1.setDayOutputBigMin(0.0);
- }else
- {
- total1.setDayOutputBigMin(StringUtils.round(total1.getDayOutputBigMin(),2));
- }
- //日大风切出最大值
- if (Double.isInfinite(total1.getDayOutputBigMax()) || Double.isNaN(total1.getDayOutputBigMax()))
- {
- total1.setDayOutputBigMax(0.0);
- }else
- {
- total1.setDayOutputBigMax(StringUtils.round(total1.getDayOutputBigMax(),2));
- }
- //月小风切入
- if (Double.isInfinite(total1.getMonthInputSmall()) || Double.isNaN(total1.getMonthInputSmall()))
- {
- total1.setMonthInputSmall(0.0);
- }else
- {
- total1.setMonthInputSmall(StringUtils.round(total1.getMonthInputSmall(),2));
- }
- //月小风切入最小值
- if (Double.isInfinite(total1.getMonthInputSmallMin()) || Double.isNaN(total1.getMonthInputSmallMin()))
- {
- total1.setMonthInputSmallMin(0.0);
- }else
- {
- total1.setMonthInputSmallMin(StringUtils.round(total1.getMonthInputSmallMin(),2));
- }
- //月小风切入最大值
- if (Double.isInfinite(total1.getMonthInputSmallMax()) || Double.isNaN(total1.getMonthInputSmallMax()))
- {
- total1.setMonthInputSmallMax(0.0);
- }else
- {
- total1.setMonthInputSmallMax(StringUtils.round(total1.getMonthInputSmallMax(),2));
- }
- //月大风切入
- if (Double.isInfinite(total1.getMonthInputBig()) || Double.isNaN(total1.getMonthInputBig()))
- {
- total1.setMonthInputBig(0.0);
- }else
- {
- total1.setMonthInputBig(StringUtils.round(total1.getMonthInputBig(),2));
- }
- //月大风切入最大值
- if (Double.isInfinite(total1.getMonthInputBigMin()) || Double.isNaN(total1.getMonthInputBigMin()))
- {
- total1.setMonthInputBigMin(0.0);
- }else
- {
- total1.setMonthInputBigMin(StringUtils.round(total1.getMonthInputBigMin(),2));
- }
- //月大风切入最大值
- if (Double.isInfinite(total1.getMonthInputBigMax()) || Double.isNaN(total1.getMonthInputBigMax()))
- {
- total1.setMonthInputBigMax(0.0);
- }else
- {
- total1.setMonthInputBigMax(StringUtils.round(total1.getMonthInputBigMax(),2));
- }
- //月小风切出
- if (Double.isInfinite(total1.getMonthOutputSmall()) || Double.isNaN(total1.getMonthOutputSmall()))
- {
- total1.setMonthOutputSmall(0.0);
- }else
- {
- total1.setMonthOutputSmall(StringUtils.round(total1.getMonthOutputSmall(),2));
- }
- //月小风切出最小值
- if (Double.isInfinite(total1.getMonthOutputSmallMin()) || Double.isNaN(total1.getMonthOutputSmallMin()))
- {
- total1.setMonthOutputSmallMin(0.0);
- }else
- {
- total1.setMonthOutputSmallMin(StringUtils.round(total1.getMonthOutputSmallMin(),2));
- }
- //月小风切出最大值
- if (Double.isInfinite(total1.getMonthOutputSmallMax()) || Double.isNaN(total1.getMonthOutputSmallMax()))
- {
- total1.setMonthOutputSmallMax(0.0);
- }else
- {
- total1.setMonthOutputSmallMax(StringUtils.round(total1.getMonthOutputSmallMax(),2));
- }
- //月大风切出
- if (Double.isInfinite(total1.getMonthOutputBig()) || Double.isNaN(total1.getMonthOutputBig()))
- {
- total1.setMonthOutputBig(0.0);
- }else
- {
- total1.setMonthOutputBig(StringUtils.round(total1.getMonthOutputBig(),2));
- }
- //月大风切出最大值
- if (Double.isInfinite(total1.getMonthOutputBigMin()) || Double.isNaN(total1.getMonthOutputBigMin()))
- {
- total1.setMonthOutputBigMin(0.0);
- }else
- {
- total1.setMonthOutputBigMin(StringUtils.round(total1.getMonthOutputBigMin(),2));
- }
- //月大风切出最大值
- if (Double.isInfinite(total1.getMonthOutputBigMax()) || Double.isNaN(total1.getMonthOutputBigMax()))
- {
- total1.setMonthOutputBigMax(0.0);
- }else
- {
- total1.setMonthOutputBigMax(StringUtils.round(total1.getMonthOutputBigMax(),2));
- }
- //年小风切入
- if (Double.isInfinite(total1.getYearInputSmall()) || Double.isNaN(total1.getYearInputSmall()))
- {
- total1.setYearInputSmall(0.0);
- }else
- {
- total1.setYearInputSmall(StringUtils.round(total1.getYearInputSmall(),2));
- }
- //年小风切入最小值
- if (Double.isInfinite(total1.getYearInputSmallMin()) || Double.isNaN(total1.getYearInputSmallMin()))
- {
- total1.setYearInputSmallMin(0.0);
- }else
- {
- total1.setYearInputSmallMin(StringUtils.round(total1.getYearInputSmallMin(),2));
- }
- //年小风切入最大值
- if (Double.isInfinite(total1.getYearInputSmallMax()) || Double.isNaN(total1.getYearInputSmallMax()))
- {
- total1.setYearInputSmallMax(0.0);
- }else
- {
- total1.setYearInputSmallMax(StringUtils.round(total1.getYearInputSmallMax(),2));
- }
- //年大风切入
- if (Double.isInfinite(total1.getYearInputBig()) || Double.isNaN(total1.getYearInputBig()))
- {
- total1.setYearInputBig(0.0);
- }else
- {
- total1.setYearInputBig(StringUtils.round(total1.getYearInputBig(),2));
- }
- //年大风切入最大值
- if (Double.isInfinite(total1.getYearInputBigMin()) || Double.isNaN(total1.getYearInputBigMin()))
- {
- total1.setYearInputBigMin(0.0);
- }else
- {
- total1.setYearInputBigMin(StringUtils.round(total1.getYearInputBigMin(),2));
- }
- //年大风切入最大值
- if (Double.isInfinite(total1.getYearInputBigMax()) || Double.isNaN(total1.getYearInputBigMax()))
- {
- total1.setYearInputBigMax(0.0);
- }else
- {
- total1.setYearInputBigMax(StringUtils.round(total1.getYearInputBigMax(),2));
- }
- //年小风切出
- if (Double.isInfinite(total1.getYearOutputSmall()) || Double.isNaN(total1.getYearOutputSmall()))
- {
- total1.setYearOutputSmall(0.0);
- }else
- {
- total1.setYearOutputSmall(StringUtils.round(total1.getYearOutputSmall(),2));
- }
- //年小风切出最小值
- if (Double.isInfinite(total1.getYearOutputSmallMin()) || Double.isNaN(total1.getYearOutputSmallMin()))
- {
- total1.setYearOutputSmallMin(0.0);
- }else
- {
- total1.setYearOutputSmallMin(StringUtils.round(total1.getYearOutputSmallMin(),2));
- }
- //年小风切出最大值
- if (Double.isInfinite(total1.getYearOutputSmallMax()) || Double.isNaN(total1.getYearOutputSmallMax()))
- {
- total1.setYearOutputSmallMax(0.0);
- }else
- {
- total1.setYearOutputSmallMax(StringUtils.round(total1.getYearOutputSmallMax(),2));
- }
- //年大风切出
- if (Double.isInfinite(total1.getYearOutputBig()) || Double.isNaN(total1.getYearOutputBig()))
- {
- total1.setYearOutputBig(0.0);
- }else
- {
- total1.setYearOutputBig(StringUtils.round(total1.getYearOutputBig(),2));
- }
- //年大风切出最大值
- if (Double.isInfinite(total1.getYearOutputBigMin()) || Double.isNaN(total1.getYearOutputBigMin()))
- {
- total1.setYearOutputBigMin(0.0);
- }else
- {
- total1.setYearOutputBigMin(StringUtils.round(total1.getYearOutputBigMin(),2));
- }
- //年大风切出最大值
- if (Double.isInfinite(total1.getYearOutputBigMax()) || Double.isNaN(total1.getYearOutputBigMax()))
- {
- total1.setYearOutputBigMax(0.0);
- }else
- {
- total1.setYearOutputBigMax(StringUtils.round(total1.getYearOutputBigMax(),2));
- }
- //小风切入
- if (Double.isInfinite(total1.getInputSmall()) || Double.isNaN(total1.getInputSmall()))
- {
- total1.setInputSmall(0.0);
- }else
- {
- total1.setInputSmall(StringUtils.round(total1.getInputSmall(),2));
- }
- //小风切入最小值
- if (Double.isInfinite(total1.getInputSmallMin()) || Double.isNaN(total1.getInputSmallMin()))
- {
- total1.setInputSmallMin(0.0);
- }else
- {
- total1.setInputSmallMin(StringUtils.round(total1.getInputSmallMin(),2));
- }
- //小风切入最大值
- if (Double.isInfinite(total1.getInputSmallMax()) || Double.isNaN(total1.getInputSmallMax()))
- {
- total1.setInputSmallMax(0.0);
- }else
- {
- total1.setInputSmallMax(StringUtils.round(total1.getInputSmallMax(),2));
- }
- //大风切入
- if (Double.isInfinite(total1.getInputBig()) || Double.isNaN(total1.getInputBig()))
- {
- total1.setInputBig(0.0);
- }else
- {
- total1.setInputBig(StringUtils.round(total1.getInputBig(),2));
- }
- //大风切入最大值
- if (Double.isInfinite(total1.getInputBigMin()) || Double.isNaN(total1.getInputBigMin()))
- {
- total1.setInputBigMin(0.0);
- }else
- {
- total1.setInputBigMin(StringUtils.round(total1.getInputBigMin(),2));
- }
- //大风切入最大值
- if (Double.isInfinite(total1.getInputBigMax()) || Double.isNaN(total1.getInputBigMax()))
- {
- total1.setInputBigMax(0.0);
- }else
- {
- total1.setInputBigMax(StringUtils.round(total1.getInputBigMax(),2));
- }
- //小风切出
- if (Double.isInfinite(total1.getOutputSmall()) || Double.isNaN(total1.getOutputSmall()))
- {
- total1.setOutputSmall(0.0);
- }else
- {
- total1.setOutputSmall(StringUtils.round(total1.getOutputSmall(),2));
- }
- //小风切出最小值
- if (Double.isInfinite(total1.getOutputSmallMin()) || Double.isNaN(total1.getOutputSmallMin()))
- {
- total1.setOutputSmallMin(0.0);
- }else
- {
- total1.setOutputSmallMin(StringUtils.round(total1.getOutputSmallMin(),2));
- }
- //小风切出最大值
- if (Double.isInfinite(total1.getOutputSmallMax()) || Double.isNaN(total1.getOutputSmallMax()))
- {
- total1.setOutputSmallMax(0.0);
- }else
- {
- total1.setOutputSmallMax(StringUtils.round(total1.getOutputSmallMax(),2));
- }
- //大风切出
- if (Double.isInfinite(total1.getOutputBig()) || Double.isNaN(total1.getOutputBig()))
- {
- total1.setOutputBig(0.0);
- }else
- {
- total1.setOutputBig(StringUtils.round(total1.getOutputBig(),2));
- }
- //大风切出最大值
- if (Double.isInfinite(total1.getOutputBigMin()) || Double.isNaN(total1.getOutputBigMin()))
- {
- total1.setOutputBigMin(0.0);
- }else
- {
- total1.setOutputBigMin(StringUtils.round(total1.getOutputBigMin(),2));
- }
- //大风切出最大值
- if (Double.isInfinite(total1.getOutputBigMax()) || Double.isNaN(total1.getOutputBigMax()))
- {
- total1.setOutputBigMax(0.0);
- }else
- {
- total1.setOutputBigMax(StringUtils.round(total1.getOutputBigMax(),2));
- }
- //日小风切入合格率
- if (Double.isInfinite(total1.getDayInputSmallRatio()) || Double.isNaN(total1.getDayInputSmallRatio()))
- {
- total1.setDayInputSmallRatio(0.0);
- }else
- {
- total1.setDayInputSmallRatio(StringUtils.round(total1.getDayInputSmallRatio(),2));
- }
- //日小风切出合格率
- if (Double.isInfinite(total1.getDayOutputSmallRatio()) || Double.isNaN(total1.getDayOutputSmallRatio()))
- {
- total1.setDayOutputSmallRatio(0.0);
- }else
- {
- total1.setDayOutputSmallRatio(StringUtils.round(total1.getDayOutputSmallRatio(),2));
- }
- //日大风切入合格率
- if (Double.isInfinite(total1.getDayInputBigRatio()) || Double.isNaN(total1.getDayInputBigRatio()))
- {
- total1.setDayInputBigRatio(0.0);
- }else
- {
- total1.setDayInputBigRatio(StringUtils.round(total1.getDayInputBigRatio(),2));
- }
- //日大风切出合格率
- if (Double.isInfinite(total1.getDayOutputBigRatio()) || Double.isNaN(total1.getDayOutputBigRatio()))
- {
- total1.setDayOutputBigRatio(0.0);
- }else
- {
- total1.setDayOutputBigRatio(StringUtils.round(total1.getDayOutputBigRatio(),2));
- }
- //月小风切入合格率
- if (Double.isInfinite(total1.getMonthInputSmallRatio()) || Double.isNaN(total1.getMonthInputSmallRatio()))
- {
- total1.setMonthInputSmallRatio(0.0);
- }else
- {
- total1.setMonthInputSmallRatio(StringUtils.round(total1.getMonthInputSmallRatio(),2));
- }
- //月小风切出合格率
- if (Double.isInfinite(total1.getMonthOutputSmallRatio()) || Double.isNaN(total1.getMonthOutputSmallRatio()))
- {
- total1.setMonthOutputSmallRatio(0.0);
- }else
- {
- total1.setMonthOutputSmallRatio(StringUtils.round(total1.getMonthOutputSmallRatio(),2));
- }
- //月大风切入合格率
- if (Double.isInfinite(total1.getMonthInputBigRatio()) || Double.isNaN(total1.getMonthInputBigRatio()))
- {
- total1.setMonthInputBigRatio(0.0);
- }else
- {
- total1.setMonthInputBigRatio(StringUtils.round(total1.getMonthInputBigRatio(),2));
- }
- //月大风切出合格率
- if (Double.isInfinite(total1.getMonthOutputBigRatio()) || Double.isNaN(total1.getMonthOutputBigRatio()))
- {
- total1.setMonthOutputBigRatio(0.0);
- }else
- {
- total1.setMonthOutputBigRatio(StringUtils.round(total1.getMonthOutputBigRatio(),2));
- }
- //年小风切入合格率
- if (Double.isInfinite(total1.getYearInputSmallRatio()) || Double.isNaN(total1.getYearInputSmallRatio()))
- {
- total1.setYearInputSmallRatio(0.0);
- }else
- {
- total1.setYearInputSmallRatio(StringUtils.round(total1.getYearInputSmallRatio(),2));
- }
- //年小风切出合格率
- if (Double.isInfinite(total1.getYearOutputSmallRatio()) || Double.isNaN(total1.getYearOutputSmallRatio()))
- {
- total1.setYearOutputSmallRatio(0.0);
- }else
- {
- total1.setYearOutputSmallRatio(StringUtils.round(total1.getYearOutputSmallRatio(),2));
- }
- //年大风切入合格率
- if (Double.isInfinite(total1.getYearInputBigRatio()) || Double.isNaN(total1.getYearInputBigRatio()))
- {
- total1.setYearInputBigRatio(0.0);
- }else
- {
- total1.setYearInputBigRatio(StringUtils.round(total1.getYearInputBigRatio(),2));
- }
- //年大风切出合格率
- if (Double.isInfinite(total1.getYearOutputBigRatio()) || Double.isNaN(total1.getYearOutputBigRatio()))
- {
- total1.setYearOutputBigRatio(0.0);
- }else
- {
- total1.setYearOutputBigRatio(StringUtils.round(total1.getYearOutputBigRatio(),2));
- }
- //总小风切入合格率
- if (Double.isInfinite(total1.getInputSmallRatio()) || Double.isNaN(total1.getInputSmallRatio()))
- {
- total1.setInputSmallRatio(0.0);
- }else
- {
- total1.setInputSmallRatio(StringUtils.round(total1.getInputSmallRatio(),2));
- }
- //总小风切出合格率
- if (Double.isInfinite(total1.getOutputSmallRatio()) || Double.isNaN(total1.getOutputSmallRatio()))
- {
- total1.setOutputSmallRatio(0.0);
- }else
- {
- total1.setOutputSmallRatio(StringUtils.round(total1.getOutputSmallRatio(),2));
- }
- //总大风切入合格率
- if (Double.isInfinite(total1.getInputBigRatio()) || Double.isNaN(total1.getInputBigRatio()))
- {
- total1.setInputBigRatio(0.0);
- }else
- {
- total1.setInputBigRatio(StringUtils.round(total1.getInputBigRatio(),2));
- }
- //总大风切出合格率
- if (Double.isInfinite(total1.getOutputBigMaxRatio()) || Double.isNaN(total1.getOutputBigMaxRatio()))
- {
- total1.setOutputBigMaxRatio(0.0);
- }else
- {
- total1.setOutputBigMaxRatio(StringUtils.round(total1.getOutputBigMaxRatio(),2));
- }
- }
- 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);
- QueryWrapper<ProEconInOrOutSpeedTotal> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("windturbine_id",windturbineId);
- List<ProEconInOrOutSpeedTotal> items = proEconInOrOutSpeedTotalService.list(queryWrapper);
- // .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(ProEconInOrOutSpeedTotal::getDayInputSmall).summaryStatistics();
- total1.setInputSmall(summaryStatistics.getAverage());
- //总小风切入最大值
- summaryStatistics = items.stream()
- .filter(i -> StringUtils.notEmp(i.getDayInputSmallMax()) && i.getDayInputSmallMax() > 0)
- .mapToDouble(ProEconInOrOutSpeedTotal::getDayInputSmallMax).summaryStatistics();
- total1.setInputSmallMax(summaryStatistics.getMax());
- //总小风切入最小值
- summaryStatistics = items.stream()
- .filter(i -> StringUtils.notEmp(i.getDayInputSmallMin()) && i.getDayInputSmallMin() > 0)
- .mapToDouble(ProEconInOrOutSpeedTotal::getDayInputSmallMin).summaryStatistics();
- total1.setInputSmallMin(summaryStatistics.getMin());
- //总大风切入
- summaryStatistics = items.stream()
- .filter(i -> StringUtils.notEmp(i.getDayInputBig()) && i.getDayInputBig() > 0)
- .mapToDouble(ProEconInOrOutSpeedTotal::getDayInputBig).summaryStatistics();
- total1.setInputBig(summaryStatistics.getAverage());
- //总大风切入最大值
- summaryStatistics = items.stream()
- .filter(i -> StringUtils.notEmp(i.getDayInputBigMax()) && i.getDayInputBigMax() > 0)
- .mapToDouble(ProEconInOrOutSpeedTotal::getDayInputBigMax).summaryStatistics();
- total1.setInputBigMax(summaryStatistics.getMax());
- //总大风切入最小值
- summaryStatistics = items.stream()
- .filter(i -> StringUtils.notEmp(i.getDayInputBigMin()) && i.getDayInputBigMin() > 0)
- .mapToDouble(ProEconInOrOutSpeedTotal::getDayInputBigMin).summaryStatistics();
- total1.setInputBigMin(summaryStatistics.getMin());
- //总小风切出
- summaryStatistics = items.stream()
- .filter(i -> StringUtils.notEmp(i.getDayOutputSmall()) && i.getDayOutputSmall() > 0)
- .mapToDouble(ProEconInOrOutSpeedTotal::getDayOutputSmall).summaryStatistics();
- total1.setOutputSmall(summaryStatistics.getAverage());
- //总小风切出最大值
- summaryStatistics = items.stream()
- .filter(i -> StringUtils.notEmp(i.getDayOutputSmallMax()) && i.getDayOutputSmallMax() > 0)
- .mapToDouble(ProEconInOrOutSpeedTotal::getDayOutputSmallMax).summaryStatistics();
- total1.setOutputSmallMax(summaryStatistics.getMax());
- //总小风切出最小值
- summaryStatistics = items.stream()
- .filter(i -> StringUtils.notEmp(i.getDayOutputSmallMin()) && i.getDayOutputSmallMin() > 0)
- .mapToDouble(ProEconInOrOutSpeedTotal::getDayOutputSmallMin).summaryStatistics();
- total1.setOutputSmallMin(summaryStatistics.getMin());
- //总大风切出
- summaryStatistics = items.stream()
- .filter(i -> StringUtils.notEmp(i.getDayOutputBig()) && i.getDayOutputBig() > 0)
- .mapToDouble(ProEconInOrOutSpeedTotal::getDayOutputBig).summaryStatistics();
- total1.setOutputBig(summaryStatistics.getAverage());
- //总大风切出最大值
- summaryStatistics = items.stream()
- .filter(i -> StringUtils.notEmp(i.getDayOutputBigMax()) && i.getDayOutputBigMax() > 0)
- .mapToDouble(ProEconInOrOutSpeedTotal::getDayOutputBigMax).summaryStatistics();
- total1.setOutputBigMax(summaryStatistics.getMax());
- //总大风切出最小值
- summaryStatistics = items.stream()
- .filter(i -> StringUtils.notEmp(i.getDayOutputBigMin()) && i.getDayOutputBigMin() > 0)
- .mapToDouble(ProEconInOrOutSpeedTotal::getDayOutputBigMin).summaryStatistics();
- total1.setOutputBigMin(summaryStatistics.getMin());
- QueryWrapper<ProEconInputOrOutputSpeed> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("windturbine_id",windturbineId).isNotNull("speed").ne("speed",0);
- List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list(queryWrapper2);
- // .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() >= 25).collect(Collectors.toList());
- List<ProEconInputOrOutputSpeed> CCountList = inputrecordList.stream().filter(i -> 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) {
- int count;
- QueryWrapper<ProEconInputOrOutputSpeed> queryWrapper = new QueryWrapper<>();
- queryWrapper.ge("record_date",daybegin).le("record_date",end).eq("windturbine_id",windturbineId).isNotNull("speed");
- List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list(queryWrapper);
- // .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(ProEconInputOrOutputSpeed::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(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
- total1.setDayInputBig(summaryStatistics.getAverage());
- total1.setDayInputBigMax(summaryStatistics.getMax());
- total1.setDayInputBigMin(summaryStatistics.getMin());
- total2.setDaya1((double) A1List.size());
- total2.setDaya2((double) A2List.size());
- total2.setDaya3((double) A3List.size());
- total2.setDaya4((double) A4List.size());
- total2.setDaya5((double) A5List.size());
- total2.setDaya6((double) A6List.size());
- total2.setDaya7((double) 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(ProEconInputOrOutputSpeed::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(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
- total1.setDayOutputBig(summaryStatistics.getAverage());
- total1.setDayOutputBigMax(summaryStatistics.getMax());
- total1.setDayOutputBigMin(summaryStatistics.getMin());
- total2.setDaya1((double) B1List.size());
- total2.setDaya2((double) B2List.size());
- total2.setDaya3((double) B3List.size());
- total2.setDaya4((double) B4List.size());
- total2.setDaya5((double) B5List.size());
- total2.setDaya6((double) B6List.size());
- total2.setDaya7((double) 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) {
- int count;
- QueryWrapper<ProEconInputOrOutputSpeed> queryWrapper = new QueryWrapper<>();
- queryWrapper.ge("record_date",monthbegin).le("record_date",end).eq("windturbine_id",windturbineId).isNotNull("speed");
- List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list(queryWrapper);
- // .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(ProEconInputOrOutputSpeed::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(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
- total1.setMonthInputBig(summaryStatistics.getAverage());
- total1.setMonthInputBigMax(summaryStatistics.getMax());
- total1.setMonthInputBigMin(summaryStatistics.getMin());
- total2.setMontha1((double) A1List.size());
- total2.setMontha2((double) A2List.size());
- total2.setMontha3((double) A3List.size());
- total2.setMontha4((double) A4List.size());
- total2.setMontha5((double) A5List.size());
- total2.setMontha6((double) A6List.size());
- total2.setMontha7((double) 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(ProEconInputOrOutputSpeed::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(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
- total1.setMonthOutputBig(summaryStatistics.getAverage());
- total1.setMonthOutputBigMax(summaryStatistics.getMax());
- total1.setMonthOutputBigMin(summaryStatistics.getMin());
- total2.setMontha1((double) B1List.size());
- total2.setMontha2((double) B2List.size());
- total2.setMontha3((double) B3List.size());
- total2.setMontha4((double) B4List.size());
- total2.setMontha5((double) B5List.size());
- total2.setMontha6((double) B6List.size());
- total2.setMontha7((double) 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) {
- int count;
- QueryWrapper<ProEconInputOrOutputSpeed> queryWrapper = new QueryWrapper<>();
- queryWrapper.ge("record_date",yearbegin).le("record_date",end).eq("windturbine_id",windturbineId).isNotNull("speed");
- List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list(queryWrapper);
- // .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(ProEconInputOrOutputSpeed::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(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
- total1.setYearInputBig(summaryStatistics.getAverage());
- total1.setYearInputBigMax(summaryStatistics.getMax());
- total1.setYearInputBigMin(summaryStatistics.getMin());
- total2.setYeara1((double) A1List.size());
- total2.setYeara2((double) A2List.size());
- total2.setYeara3((double) A3List.size());
- total2.setYeara4((double) A4List.size());
- total2.setYeara5((double) A5List.size());
- total2.setYeara6((double) A6List.size());
- total2.setYeara7((double) 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(ProEconInputOrOutputSpeed::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(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
- total1.setYearOutputBig(summaryStatistics.getAverage());
- total1.setYearOutputBigMax(summaryStatistics.getMax());
- total1.setYearOutputBigMin(summaryStatistics.getMin());
- total2.setYeara1((double) B1List.size());
- total2.setYeara2((double) B2List.size());
- total2.setYeara3((double) B3List.size());
- total2.setYeara4((double) B4List.size());
- total2.setYeara5((double) B5List.size());
- total2.setYeara6((double) B6List.size());
- total2.setYeara7((double) 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);
- }
- }
- }
|