12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445 |
- package com.gyee.generation.service;//package com.gyee.generation.service;
- import com.gyee.common.contant.ContantXk;
- import com.gyee.common.model.PointData;
- import com.gyee.common.model.StringUtils;
- import com.gyee.generation.init.CacheContext;
- import com.gyee.generation.model.auto.*;
- import com.gyee.generation.model.vo.Location;
- import com.gyee.generation.service.auto.*;
- import com.gyee.generation.util.DateUtils;
- import com.gyee.generation.util.realtimesource.IEdosUtil;
- import com.gyee.generation.util.statisticcs.Initial;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- 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 WindPowerInfo1Service {
- private static final Logger logger = LoggerFactory.getLogger(WindPowerInfo1Service.class);
- @Resource
- private IEdosUtil edosUtil;
- @Resource
- private IProEconPowerstationInfoDay1Service proEconPowerstationInfoDay1Service;
- /**
- * 计算区域日信息
- * @param recordDate
- * @throws Exception
- */
- public void calRegionInfoDay(Date recordDate) throws Exception {
- List<ProEconPowerstationInfoDay1> wpinfodayls = proEconPowerstationInfoDay1Service.list().stream()
- .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
- // && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
- && i.getLocation().equals(Location.cp.getValue()))
- .collect(Collectors.toList());
- if(!wpinfodayls.isEmpty())
- {
- Map<String, Map<String, List<ProEconPowerstationInfoDay1>>>rgmap=new HashMap<>();
- for(ProEconPowerstationInfoDay1 wpinfo:wpinfodayls)
- {
- if(rgmap.containsKey(wpinfo.getCompanyId()))
- {
- Map<String, List<ProEconPowerstationInfoDay1>> map=rgmap.get(wpinfo.getCompanyId());
- List<ProEconPowerstationInfoDay1> qbls=map.get("qb");
- List<ProEconPowerstationInfoDay1> gfls=map.get("fd");
- List<ProEconPowerstationInfoDay1> fdls=map.get("gf");
- if(wpinfo.getForeignKeyId().equals("-1"))
- {
- fdls.add(wpinfo);
- }else if(wpinfo.getForeignKeyId().equals("-2")){
- gfls.add(wpinfo);
- }
- qbls.add(wpinfo);
- }else
- {
- Map<String, List<ProEconPowerstationInfoDay1>> map=new HashMap<>();
- List<ProEconPowerstationInfoDay1> qbls=new ArrayList<>();
- List<ProEconPowerstationInfoDay1> gfls=new ArrayList<>();
- List<ProEconPowerstationInfoDay1> fdls=new ArrayList<>();
- if(wpinfo.getForeignKeyId().equals("-1"))
- {
- fdls.add(wpinfo);
- }else if(wpinfo.getForeignKeyId().equals("-2")){
- gfls.add(wpinfo);
- }
- qbls.add(wpinfo);
- map.put("qb",qbls);
- map.put("fd",fdls);
- map.put("gf",gfls);
- }
- }
- //判断是否有重复记录,先删除重复记录
- List<String> idls = proEconPowerstationInfoDay1Service.list().stream()
- .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
- // && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
- && i.getLocation().equals(Location.rg.getValue())).map(ProEconPowerstationInfoDay1::getId)
- .collect(Collectors.toList());
- if (idls != null && idls.size() > 0) {
- proEconPowerstationInfoDay1Service.removeByIds(idls);
- }
- for(Map.Entry<String, Map<String, List<ProEconPowerstationInfoDay1>>> entry:rgmap.entrySet()){
- Map<String, List<ProEconPowerstationInfoDay1>> map=entry.getValue();
- List<ProEconPowerstationInfoDay1> qbls=map.get("qb");
- List<ProEconPowerstationInfoDay1> gfls=map.get("fd");
- List<ProEconPowerstationInfoDay1> fdls=map.get("gf");
- // if(CacheContext.cpwpmap.size()==qbls.size())
- // {
- ProEconPowerstationInfoDay1 qb=new ProEconPowerstationInfoDay1();
- ProEconPowerstationInfoDay1 fd=new ProEconPowerstationInfoDay1();
- ProEconPowerstationInfoDay1 gf=new ProEconPowerstationInfoDay1();
- if(CacheContext.rgmap.containsKey(entry.getKey()))
- {
- ProBasicRegion cp=CacheContext.rgmap.get(entry.getKey());
- gf.setRegionId(cp.getId());
- gf.setRecordDate(DateUtils.truncDay(recordDate));
- gf.setForeignKeyId("-2");
- gf.setLocation(Location.rg.getValue());
- fd.setRegionId(cp.getId());
- fd.setRecordDate(DateUtils.truncDay(recordDate));
- fd.setForeignKeyId("-1");
- fd.setLocation(Location.rg.getValue());
- qb.setRegionId(cp.getId());
- qb.setRecordDate(DateUtils.truncDay(recordDate));
- qb.setForeignKeyId("0");
- qb.setLocation(Location.rg.getValue());
- //计算区域级全部
- calCp(qb,qbls);
- //计算公司级风电场站
- calCp(fd,fdls);
- //计算公司级光电场站
- calCp(gf,gfls);
- proEconPowerstationInfoDay1Service.save(qb);
- proEconPowerstationInfoDay1Service.save(fd);
- proEconPowerstationInfoDay1Service.save(gf);
- }
- // }else
- // {
- // logger.debug("公司所属场站数量与保存的场站日信息数量不一致,未进行{0}统计-------结束", entry.getKey());
- //
- // }
- };
- }
- }
- /**
- * 计算公司日信息
- * @param recordDate
- * @throws Exception
- */
- public void calCompanyInfoDay(Date recordDate) throws Exception {
- List<ProEconPowerstationInfoDay1> wpinfodayls = proEconPowerstationInfoDay1Service.list().stream()
- .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
- // && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
- && i.getLocation().equals(Location.wp.getValue()))
- .collect(Collectors.toList());
- if(!wpinfodayls.isEmpty())
- {
- Map<String, Map<String, List<ProEconPowerstationInfoDay1>>>cpmap=new HashMap<>();
- for(ProEconPowerstationInfoDay1 wpinfo:wpinfodayls)
- {
- if(cpmap.containsKey(wpinfo.getCompanyId()))
- {
- Map<String, List<ProEconPowerstationInfoDay1>> map=cpmap.get(wpinfo.getCompanyId());
- List<ProEconPowerstationInfoDay1> qbls=map.get("qb");
- List<ProEconPowerstationInfoDay1> gfls=map.get("fd");
- List<ProEconPowerstationInfoDay1> fdls=map.get("gf");
- if(wpinfo.getWindpowerstationId().contains("FDC"))
- {
- fdls.add(wpinfo);
- }else {
- gfls.add(wpinfo);
- }
- qbls.add(wpinfo);
- }else
- {
- Map<String, List<ProEconPowerstationInfoDay1>> map=new HashMap<>();
- List<ProEconPowerstationInfoDay1> qbls=new ArrayList<>();
- List<ProEconPowerstationInfoDay1> gfls=new ArrayList<>();
- List<ProEconPowerstationInfoDay1> fdls=new ArrayList<>();
- if(wpinfo.getWindpowerstationId().contains("FDC"))
- {
- fdls.add(wpinfo);
- }else {
- gfls.add(wpinfo);
- }
- qbls.add(wpinfo);
- map.put("qb",qbls);
- map.put("fd",fdls);
- map.put("gf",gfls);
- }
- }
- //判断是否有重复记录,先删除重复记录
- List<String> idls = proEconPowerstationInfoDay1Service.list().stream()
- .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
- // && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
- && i.getLocation().equals(Location.cp.getValue())).map(ProEconPowerstationInfoDay1::getId)
- .collect(Collectors.toList());
- if (idls != null && idls.size() > 0) {
- proEconPowerstationInfoDay1Service.removeByIds(idls);
- }
- for(Map.Entry<String, Map<String, List<ProEconPowerstationInfoDay1>>> entry:cpmap.entrySet()){
- Map<String, List<ProEconPowerstationInfoDay1>> map=entry.getValue();
- List<ProEconPowerstationInfoDay1> qbls=map.get("qb");
- List<ProEconPowerstationInfoDay1> gfls=map.get("fd");
- List<ProEconPowerstationInfoDay1> fdls=map.get("gf");
- // if(CacheContext.cpwpmap.size()==qbls.size())
- // {
- ProEconPowerstationInfoDay1 qb=new ProEconPowerstationInfoDay1();
- ProEconPowerstationInfoDay1 fd=new ProEconPowerstationInfoDay1();
- ProEconPowerstationInfoDay1 gf=new ProEconPowerstationInfoDay1();
- if(CacheContext.cpmap.containsKey(entry.getKey()))
- {
- ProBasicCompany cp=CacheContext.cpmap.get(entry.getKey());
- gf.setRegionId(cp.getRegionId());
- gf.setCompanyId(cp.getId());
- gf.setRecordDate(DateUtils.truncDay(recordDate));
- gf.setForeignKeyId("-2");
- gf.setLocation(Location.cp.getValue());
- fd.setRegionId(cp.getRegionId());
- fd.setCompanyId(cp.getId());
- fd.setRecordDate(DateUtils.truncDay(recordDate));
- fd.setForeignKeyId("-1");
- fd.setLocation(Location.cp.getValue());
- qb.setRegionId(cp.getRegionId());
- qb.setCompanyId(cp.getId());
- qb.setRecordDate(DateUtils.truncDay(recordDate));
- qb.setForeignKeyId("0");
- qb.setLocation(Location.cp.getValue());
- //计算公司级全部场站
- calCp(qb,qbls);
- //计算公司级风电场站
- calCp(fd,fdls);
- //计算公司级光电场站
- calCp(gf,gfls);
- proEconPowerstationInfoDay1Service.save(qb);
- proEconPowerstationInfoDay1Service.save(fd);
- proEconPowerstationInfoDay1Service.save(gf);
- }
- // }else
- // {
- // logger.debug("公司所属场站数量与保存的场站日信息数量不一致,未进行{0}统计-------结束", entry.getKey());
- //
- // }
- };
- }
- }
- private void calCp(ProEconPowerstationInfoDay1 pewp,List<ProEconPowerstationInfoDay1> ls) throws Exception {
- if(!ls.isEmpty())
- {
- // DoubleSummaryStatistics summaryStatistics=ls.stream().mapToDouble(n -> n.getRzdfs()).summaryStatistics();
- // //日最大风速
- // pewp.setRzdfs(summaryStatistics.getMax());
- // //日最小风速
- // summaryStatistics=ls.stream().mapToDouble(n -> n.getRzxfs()).summaryStatistics();
- // pewp.setRzxfs(summaryStatistics.getMin());
- // //日平均风速
- // summaryStatistics=ls.stream().mapToDouble(n -> n.getRpjfs()).summaryStatistics();
- // pewp.setRpjfs(summaryStatistics.getAverage());
- //
- // summaryStatistics=ls.stream().mapToDouble(n -> n.getRzdgl()).summaryStatistics();
- // //日最大功率
- // pewp.setRzdgl(summaryStatistics.getMax());
- // //日最小功率
- // summaryStatistics=ls.stream().mapToDouble(n -> n.getRzxgl()).summaryStatistics();
- // pewp.setRzxgl(summaryStatistics.getMin());
- // //日平均功率
- // summaryStatistics=ls.stream().mapToDouble(n -> n.getRpjgl()).summaryStatistics();
- // pewp.setRpjgl(summaryStatistics.getAverage());
- //日发电量
- DoubleSummaryStatistics summaryStatistics=ls.stream().mapToDouble(n -> n.getRfdl()).summaryStatistics();
- pewp.setRfdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日可用电量
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRkydl()).summaryStatistics();
- pewp.setRkydl(StringUtils.round(summaryStatistics.getSum(),2));
- //日理论发电量
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRllfdl()).summaryStatistics();
- pewp.setRllfdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日故障损失电量
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRgzssdl()).summaryStatistics();
- pewp.setRgzssdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日场内受累故障损失电量
- pewp.setRcnslgzssdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日检修损失电量
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRjxssdl()).summaryStatistics();
- pewp.setRjxssdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日场内受累检修损失电量
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRcnsljxssdl()).summaryStatistics();
- pewp.setRcnsljxssdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日待机损失电量
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRdjssdl()).summaryStatistics();
- pewp.setRdjssdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日缺陷降出力损失电量
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRqxjclssdl()).summaryStatistics();
- pewp.setRqxjclssdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日手动停机损失电量
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRsdtjssdl()).summaryStatistics();
- pewp.setRsdtjssdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日性能损失电量
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRxnssdl()).summaryStatistics();
- pewp.setRxnssdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日限电停机损失电量
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRxdtjssdl()).summaryStatistics();
- pewp.setRxdtjssdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日限电降出力损失电量
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRxdjclssdl()).summaryStatistics();
- pewp.setRxdjclssdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日场外受累电网损失电量
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRcwsldwssdl()).summaryStatistics();
- pewp.setRcwsldwssdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日场外受累天气损失电量
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRcwsltqssdl()).summaryStatistics();
- pewp.setRcwsltqssdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日增发电量
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRzfdl()).summaryStatistics();
- pewp.setRzfdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日欠发电量
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRqfdl()).summaryStatistics();
- pewp.setRqfdl(StringUtils.round(summaryStatistics.getSum(),2));
- //日自耗电
- summaryStatistics=ls.stream().mapToDouble(n -> n.getRzhd()).summaryStatistics();
- pewp.setRzhd(StringUtils.round(summaryStatistics.getSum(),2));
- }
- }
- /**
- * 计算场站日信息
- * @param recordDate
- * @throws Exception
- */
- public void calWindpowerInfoDay(Date recordDate) throws Exception {
- Calendar c=Calendar.getInstance();
- c.setTime(recordDate);
- Date end=c.getTime();
- Date begin= DateUtils.truncDay(c.getTime());
- List<ProEconPowerstationInfoDay1> wpinfodayls=new ArrayList<>();
- //判断是否有重复记录,先删除重复记录
- List<String> idls = proEconPowerstationInfoDay1Service.list().stream()
- .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
- && CacheContext.wpmap.containsKey(i.getWindpowerstationId())
- && i.getLocation().equals(Location.wp.getValue())).map(ProEconPowerstationInfoDay1::getId)
- .collect(Collectors.toList());
- if (idls != null && idls.size() > 0) {
- proEconPowerstationInfoDay1Service.removeByIds(idls);
- }
- for(ProBasicWindpowerstation wp:CacheContext.wpls)
- {
- if(CacheContext.wppointmap.containsKey(wp.getId()))
- {
- Map<String, ProBasicWppoint> pointmap=CacheContext.wppointmap.get(wp.getId());
- ProEconPowerstationInfoDay1 pewp=new ProEconPowerstationInfoDay1();
- Initial.initial(pewp);
- pewp.setRegionId(wp.getRegionId());
- pewp.setCompanyId(wp.getCompanyId());
- pewp.setRecordDate(DateUtils.truncDay(recordDate));
- pewp.setForeignKeyId("0");
- pewp.setWindpowerstationId(wp.getId());
- pewp.setLocation(Location.wp.getValue());
- //昨日的统计结果
- List<ProEconPowerstationInfoDay1> pepid1ls =new ArrayList<>();
- Calendar cl=Calendar.getInstance();
- cl.setTime(recordDate);
- if(cl.get(Calendar.DAY_OF_MONTH)!=1)
- {
- pepid1ls = proEconPowerstationInfoDay1Service.list().stream()
- .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(cl.getTime())) == 0
- && i.getWindpowerstationId().equals(wp.getId())
- && i.getLocation().equals(Location.wp.getValue()))
- .collect(Collectors.toList());
- }
- extracted(recordDate, end, begin, pointmap, pewp,pepid1ls);
- /*******************************************年信息统计*********************************************************/
- // wpinfodayls.add(pewp);
- proEconPowerstationInfoDay1Service.save(pewp);
- }
- }
- }
- /**
- * 计算项目日信息
- * @param recordDate
- * @throws Exception
- */
- public void calProjectInfoDay(Date recordDate) throws Exception {
- Calendar c=Calendar.getInstance();
- c.setTime(recordDate);
- Date end=c.getTime();
- Date begin= DateUtils.truncDay(c.getTime());
- //判断是否有重复记录,先删除重复记录
- List<String> idls = proEconPowerstationInfoDay1Service.list().stream()
- .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
- && CacheContext.pjmap.containsKey(i.getProjectId())
- && i.getLocation().equals(Location.pj.getValue())).map(ProEconPowerstationInfoDay1::getId)
- .collect(Collectors.toList());
- if (idls != null && idls.size() > 0) {
- proEconPowerstationInfoDay1Service.removeByIds(idls);
- }
- for(ProBasicProject pj:CacheContext.pjls)
- {
- if(CacheContext.wppointmap.containsKey(pj.getId()))
- {
- Map<String, ProBasicWppoint> pointmap=CacheContext.wppointmap.get(pj.getId());
- ProEconPowerstationInfoDay1 pewp=new ProEconPowerstationInfoDay1();
- Initial.initial(pewp);
- pewp.setForeignKeyId("0");
- pewp.setWindpowerstationId(pj.getWindpowerstationId());
- pewp.setProjectId(pj.getId());
- pewp.setLocation(Location.pj.getValue());
- pewp.setRecordDate(DateUtils.truncDay(recordDate));
- //昨日的统计结果
- List<ProEconPowerstationInfoDay1> pepid1ls =new ArrayList<>();
- Calendar cl=Calendar.getInstance();
- cl.setTime(recordDate);
- if(cl.get(Calendar.DAY_OF_MONTH)!=1)
- {
- pepid1ls = proEconPowerstationInfoDay1Service.list().stream()
- .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(cl.getTime())) == 0
- && i.getProjectId().equals(pj.getId())
- && i.getLocation().equals(Location.pj.getValue()))
- .collect(Collectors.toList());
- }
- extracted(recordDate, end, begin, pointmap, pewp,pepid1ls);
- proEconPowerstationInfoDay1Service.save(pewp);
- }
- }
- }
- /**
- * 计算线路日信息
- * @param recordDate
- * @throws Exception
- */
- public void calLineInfoDay(Date recordDate) throws Exception {
- Calendar c=Calendar.getInstance();
- c.setTime(recordDate);
- Date end=c.getTime();
- Date begin= DateUtils.truncDay(c.getTime());
- //判断是否有重复记录,先删除重复记录
- List<String> idls = proEconPowerstationInfoDay1Service.list().stream()
- .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
- && CacheContext.lnmap.containsKey(i.getLineId())
- && i.getLocation().equals(Location.ln.getValue()) ).map(ProEconPowerstationInfoDay1::getId)
- .collect(Collectors.toList());
- if (idls != null && idls.size() > 0) {
- proEconPowerstationInfoDay1Service.removeByIds(idls);
- }
- for(ProBasicLine ln:CacheContext.lnls)
- {
- if(CacheContext.wppointmap.containsKey(ln.getId()))
- {
- Map<String, ProBasicWppoint> pointmap=CacheContext.wppointmap.get(ln.getId());
- ProEconPowerstationInfoDay1 pewp=new ProEconPowerstationInfoDay1();
- Initial.initial(pewp);
- pewp.setForeignKeyId("0");
- pewp.setLineId(ln.getId());
- pewp.setLocation(Location.ln.getValue());
- pewp.setProjectId(ln.getProjectId());
- pewp.setRecordDate(DateUtils.truncDay(recordDate));
- //昨日的统计结果
- List<ProEconPowerstationInfoDay1> pepid1ls =new ArrayList<>();
- Calendar cl=Calendar.getInstance();
- cl.setTime(recordDate);
- if(cl.get(Calendar.DAY_OF_MONTH)!=1)
- {
- pepid1ls = proEconPowerstationInfoDay1Service.list().stream()
- .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(cl.getTime())) == 0
- && i.getLineId().equals(ln.getId())
- && i.getLocation().equals(Location.ln.getValue()))
- .collect(Collectors.toList());
- }
- extracted(recordDate, end, begin, pointmap, pewp,pepid1ls);
- proEconPowerstationInfoDay1Service.save(pewp);
- }
- }
- }
- private void extracted(Date recordDate, Date end, Date begin,Map<String, ProBasicWppoint> pointmap, ProEconPowerstationInfoDay1 pewp,List<ProEconPowerstationInfoDay1> pepid1ls) throws Exception {
- /*******************************************日信息统计*********************************************************/
- if(pointmap.containsKey(ContantXk.SSPJFS))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.SSPJFS);
- List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
- if(!pointls.isEmpty())
- {
- DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
- //日最大风速
- pewp.setRzdfs(summaryStatistics.getMax());
- //日最小风速
- pewp.setRzxfs(summaryStatistics.getMin());
- //日平均风速
- pewp.setRpjfs(summaryStatistics.getAverage());
- }
- }
- if(pointmap.containsKey(ContantXk.SSZGL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.SSZGL);
- List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
- if(!pointls.isEmpty())
- {
- DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
- //日最大功率
- pewp.setRzdgl(summaryStatistics.getMax());
- //日最小功率
- pewp.setRzxgl(summaryStatistics.getMin());
- //日平均功率
- pewp.setRpjgl(summaryStatistics.getAverage());
- }
- }
- if(pointmap.containsKey(ContantXk.RFDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RFDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日发电量
- pewp.setRfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RKYDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RKYDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日可用电量
- pewp.setRkydl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RLLFDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RLLFDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日理论发电量
- pewp.setRllfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RGZSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RGZSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日故障损失电量
- pewp.setRgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RCNSLGZSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RCNSLGZSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日场内受累故障损失电量
- pewp.setRcnslgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RJXSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RJXSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日检修损失电量
- pewp.setRjxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RCNSLJXSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RCNSLJXSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日场内受累检修损失电量
- pewp.setRcnsljxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RDJSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RDJSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日待机损失电量
- pewp.setRdjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RQXJCLSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RQXJCLSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日缺陷降出力损失电量
- pewp.setRqxjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RSDTJSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RSDTJSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日手动停机损失电量
- pewp.setRsdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RXNSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RXNSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日性能损失电量
- pewp.setRxnssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RXDTJSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RXDTJSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日限电停机损失电量
- pewp.setRxdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RXDJCLSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RXDJCLSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日限电降出力损失电量
- pewp.setRxdjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RCWSLDWSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RCWSLDWSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日场外受累电网损失电量
- pewp.setRcwsldwssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RCWSLTQSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RCWSLTQSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日场外受累天气损失电量
- pewp.setRcwsltqssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RZFDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RZFDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日增发电量
- pewp.setRzfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RQFDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RQFDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日欠发电量
- pewp.setRqfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.RZHD))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.RZHD);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //日自耗电
- pewp.setRzhd(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- /*******************************************日信息统计*********************************************************/
- /*******************************************月信息统计*********************************************************/
- if(pepid1ls.isEmpty())
- {
- setPowerandSpeedMonth(end, begin, pointmap, pewp);
- }else
- {
- if(!pepid1ls.isEmpty())
- {
- ProEconPowerstationInfoDay1 pepid=pepid1ls.get(0);
- //如果昨日大于今日最大功率
- if(pepid.getYzdgl()> pewp.getRzdgl())
- {
- pewp.setYzdgl(pepid.getRzdgl());
- }else {
- pewp.setYzdgl(pewp.getRzdgl());
- }
- //如果昨日大于今日最大风速
- if(pepid.getYzdfs()> pewp.getRzdfs())
- {
- pewp.setYzdfs(pepid.getRzdfs());
- }else
- {
- pewp.setYzdfs(pewp.getRzdfs());
- }
- //如果昨日小于今日最小功率
- if(pepid.getYzxgl()< pewp.getRzxgl())
- {
- pewp.setYzxgl(pepid.getRzxgl());
- }else
- {
- pewp.setYzxgl(pewp.getRzxgl());
- }
- //如果昨日小于今日最小风速
- if(pepid.getYzxfs()< pewp.getRzxfs())
- {
- pewp.setYzxfs(pepid.getRzxfs());
- }else
- {
- pewp.setYzxfs(pewp.getRzxfs());
- }
- double pjfs = new BigDecimal(pewp.getYpjfs()+pepid.getRpjfs()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
- pewp.setYzxfs(pjfs);
- double pjgl = new BigDecimal(pewp.getYpjgl()+pepid.getRpjgl()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
- pewp.setYzxgl(pjgl);
- }else
- {
- setPowerandSpeedMonth(end, begin, pointmap, pewp);
- }
- }
- if(pointmap.containsKey(ContantXk.YFDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YFDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月发电量
- pewp.setYfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YKYDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YKYDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月可用电量
- pewp.setYkydl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YLLFDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YLLFDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月理论发电量
- pewp.setYllfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YGZSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YGZSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月故障损失电量
- pewp.setYgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YCNSLGZSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YCNSLGZSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月场内受累故障损失电量
- pewp.setYcnslgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YJXSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YJXSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月检修损失电量
- pewp.setYjxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YCNSLJXSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YCNSLJXSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月场内受累检修损失电量
- pewp.setYcnsljxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YDJSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YDJSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月待机损失电量
- pewp.setYdjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YQXJCLSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YQXJCLSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月缺陷降出力损失电量
- pewp.setYqxjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YSDTJSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YSDTJSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月手动停机损失电量
- pewp.setYsdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YXNSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YXNSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月性能损失电量
- pewp.setYxnssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YXDTJSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YXDTJSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月限电停机损失电量
- pewp.setYxdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YXDJCLSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YXDJCLSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月限电降出力损失电量
- pewp.setYxdjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YCWSLDWSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YCWSLDWSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月场外受累电网损失电量
- pewp.setYcwsldwssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YCWSLTQSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YCWSLTQSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月场外受累天气损失电量
- pewp.setYcwsltqssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YZFDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YZFDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月增发电量
- pewp.setYzfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YQFDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YQFDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月欠发电量
- pewp.setYqfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.YZHD))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.YZHD);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //月自耗电
- pewp.setYzhd(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- /*******************************************月信息统计*********************************************************/
- /*******************************************年信息统计*********************************************************/
- if(pepid1ls.isEmpty())
- {
- setPowerandSpeedYear(end, begin, pointmap, pewp);
- }else
- {
- if(!pepid1ls.isEmpty())
- {
- ProEconPowerstationInfoDay1 pepid=pepid1ls.get(0);
- //如果昨日大于今日最大功率
- if(pepid.getNzdgl()> pewp.getRzdgl())
- {
- pewp.setNzdgl(pepid.getRzdgl());
- }else {
- pewp.setNzdgl(pewp.getRzdgl());
- }
- //如果昨日大于今日最大风速
- if(pepid.getNzdfs()> pewp.getRzdfs())
- {
- pewp.setNzdfs(pepid.getRzdfs());
- }else
- {
- pewp.setNzdfs(pewp.getRzdfs());
- }
- //如果昨日小于今日最小功率
- if(pepid.getNzxgl()< pewp.getRzxgl())
- {
- pewp.setNzxgl(pepid.getRzxgl());
- }else
- {
- pewp.setNzxgl(pewp.getRzxgl());
- }
- //如果昨日小于今日最小风速
- if(pepid.getNzxfs()< pewp.getRzxfs())
- {
- pewp.setNzxfs(pepid.getRzxfs());
- }else
- {
- pewp.setNzxfs(pewp.getRzxfs());
- }
- double pjfs = new BigDecimal(pewp.getNpjfs()+pepid.getRpjfs()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
- pewp.setNzxfs(pjfs);
- double pjgl = new BigDecimal(pewp.getNpjgl()+pepid.getRpjgl()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
- pewp.setNzxgl(pjgl);
- }else
- {
- setPowerandSpeedYear(end, begin, pointmap, pewp);
- }
- }
- if(pointmap.containsKey(ContantXk.NFDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NFDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年发电量
- pewp.setNfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NKYDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NKYDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年可用电量
- pewp.setNkydl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NLLFDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NLLFDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年理论发电量
- pewp.setNllfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NGZSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NGZSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年故障损失电量
- pewp.setNgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NCNSLGZSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NCNSLGZSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年场内受累故障损失电量
- pewp.setNcnslgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NJXSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NJXSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年检修损失电量
- pewp.setNjxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NCNSLJXSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NCNSLJXSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年场内受累检修损失电量
- pewp.setNcnsljxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NDJSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NDJSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年待机损失电量
- pewp.setNdjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NQXJCLSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NQXJCLSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年缺陷降出力损失电量
- pewp.setNqxjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NSDTJSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NSDTJSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年手动停机损失电量
- pewp.setNsdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NXNSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NXNSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年性能损失电量
- pewp.setNxnssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NXDTJSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NXDTJSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年限电停机损失电量
- pewp.setNxdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NXDJCLSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NXDJCLSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年限电降出力损失电量
- pewp.setNxdjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NCWSLDWSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NCWSLDWSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年场外受累电网损失电量
- pewp.setNcwsldwssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NCWSLTQSSDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NCWSLTQSSDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年场外受累天气损失电量
- pewp.setNcwsltqssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NZFDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NZFDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年增发电量
- pewp.setNzfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NQFDL))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NQFDL);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年欠发电量
- pewp.setNqfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- if(pointmap.containsKey(ContantXk.NZHD))
- {
- ProBasicWppoint point= pointmap.get(ContantXk.NZHD);
- PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
- if(StringUtils.notEmp(pointValue))
- {
- //年自耗电
- pewp.setNzhd(StringUtils.round(pointValue.getPointValueInDouble(),2));
- }
- }
- }
- private void setPowerandSpeedYear(Date end, Date begin, Map<String, ProBasicWppoint> pointmap, ProEconPowerstationInfoDay1 pewp) throws Exception {
- //年最大风速
- pewp.setNzdfs(pewp.getRzdfs());
- //年最小风速
- pewp.setNzxfs(pewp.getRzxfs());
- //年平均风速
- pewp.setNpjfs(pewp.getRpjfs());
- //年最大功率
- pewp.setNzdgl(pewp.getRzdgl());
- //年最小功率
- pewp.setNzxgl(pewp.getRzxgl());
- //年平均功率
- pewp.setNpjgl(pewp.getRpjgl());
- }
- private void setPowerandSpeedMonth(Date end, Date begin, Map<String, ProBasicWppoint> pointmap, ProEconPowerstationInfoDay1 pewp) throws Exception {
- //月最大风速
- pewp.setYzdfs(pewp.getRzdfs());
- //月最小风速
- pewp.setYzxfs(pewp.getRzxfs());
- //月平均风速
- pewp.setYpjfs(pewp.getRpjfs());
- //月最大功率
- pewp.setYzdgl(pewp.getRzdgl());
- //月最小功率
- pewp.setYzxgl(pewp.getRzxgl());
- //月平均功率
- pewp.setYpjgl(pewp.getRpjgl());
- }
- }
|