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.IProEconPowerstationInfoDay1Service; import com.gyee.generation.util.DateUtils; import com.gyee.generation.util.realtimesource.IEdosUtil; import com.gyee.generation.util.statisticcs.Initial; 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; /** * 计算区域日信息 */ public void calRegionInfoDay(Date recordDate) throws Exception { List wpinfodayls = proEconPowerstationInfoDay1Service.list().stream() .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0 // && CacheContext.wpmap.containsKey(i.getWindpowerstationId()) && i.getLocation().equals(Location.cp.getValue())) .collect(Collectors.toList()); if (!wpinfodayls.isEmpty()) { Map>> rgmap = new HashMap<>(); for (ProEconPowerstationInfoDay1 wpinfo : wpinfodayls) { if (rgmap.containsKey(wpinfo.getRegionId())) { Map> map = rgmap.get(wpinfo.getRegionId()); List qbls = map.get("qb"); List fdls = map.get("fd"); List gfls = map.get("gf"); if (wpinfo.getForeignKeyId().contains("-1")) { fdls.add(wpinfo); } else if (wpinfo.getForeignKeyId().contains("-2")) { gfls.add(wpinfo); } else if (wpinfo.getForeignKeyId().contains("0")) { qbls.add(wpinfo); } } else { Map> map = new HashMap<>(); List qbls = new ArrayList<>(); List gfls = new ArrayList<>(); List fdls = new ArrayList<>(); if (wpinfo.getForeignKeyId().contains("-1")) { fdls.add(wpinfo); } else if (wpinfo.getForeignKeyId().contains("-2")) { gfls.add(wpinfo); } else if (wpinfo.getForeignKeyId().contains("0")) { qbls.add(wpinfo); } map.put("qb", qbls); map.put("fd", fdls); map.put("gf", gfls); rgmap.put(wpinfo.getRegionId(), map); } } //判断是否有重复记录,先删除重复记录 List idls = proEconPowerstationInfoDay1Service.list().stream() .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0 // && CacheContext.wpmap.containsKey(i.getWindpowerstationId()) && i.getLocation().equals(Location.rg.getValue())).map(ProEconPowerstationInfoDay1::getId) .collect(Collectors.toList()); if (idls.size() > 0) { proEconPowerstationInfoDay1Service.removeByIds(idls); } for (Map.Entry>> entry : rgmap.entrySet()) { Map> map = entry.getValue(); List qbls = map.get("qb"); List fdls = map.get("fd"); List gfls = 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.truncate(recordDate)); gf.setForeignKeyId(cp.getId()+"-2"); gf.setLocation(Location.rg.getValue()); fd.setRegionId(cp.getId()); fd.setRecordDate(DateUtils.truncate(recordDate)); fd.setForeignKeyId(cp.getId()+"-1"); fd.setLocation(Location.rg.getValue()); qb.setRegionId(cp.getId()); qb.setRecordDate(DateUtils.truncate(recordDate)); qb.setForeignKeyId(cp.getId()+"0"); qb.setLocation(Location.rg.getValue()); Initial.initial(qb); Initial.initial(fd); Initial.initial(gf); //计算区域级全部 calCp(qb, qbls); //计算公司级风电场站 calCp(fd, fdls); //计算公司级光电场站 calCp(gf, gfls); proEconPowerstationInfoDay1Service.save(qb); proEconPowerstationInfoDay1Service.save(fd); proEconPowerstationInfoDay1Service.save(gf); } // }else // { // logger.debug("公司所属场站数量与保存的场站日信息数量不一致,未进行{0}统计-------结束", entry.getKey()); // // } } } } /** * 计算公司日信息 */ public void calCompanyInfoDay(Date recordDate) { List wpinfodayls = proEconPowerstationInfoDay1Service.list().stream() .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0 && i.getLocation().equals(Location.wp.getValue())) .collect(Collectors.toList()); if (!wpinfodayls.isEmpty()) { Map>> cpmap = new HashMap<>(); for (ProEconPowerstationInfoDay1 wpinfo : wpinfodayls) { if (cpmap.containsKey(wpinfo.getCompanyId())) { Map> map = cpmap.get(wpinfo.getCompanyId()); List qbls = map.get("qb"); List fdls = map.get("fd"); List gfls = map.get("gf"); if (wpinfo.getWindpowerstationId().contains("FDC")) { fdls.add(wpinfo); } else { gfls.add(wpinfo); } qbls.add(wpinfo); } else { Map> map = new HashMap<>(); List qbls = new ArrayList<>(); List gfls = new ArrayList<>(); List 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); cpmap.put(wpinfo.getCompanyId(), map); } } //判断是否有重复记录,先删除重复记录 List idls = proEconPowerstationInfoDay1Service.list().stream() .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0 && i.getLocation().equals(Location.cp.getValue())).map(ProEconPowerstationInfoDay1::getId) .collect(Collectors.toList()); if (idls.size() > 0) { proEconPowerstationInfoDay1Service.removeByIds(idls); } for (Map.Entry>> entry : cpmap.entrySet()) { Map> map = entry.getValue(); List qbls = map.get("qb"); List fdls = map.get("fd"); List gfls = 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.truncate(recordDate)); gf.setForeignKeyId(cp.getId()+"-2"); gf.setLocation(Location.cp.getValue()); fd.setRegionId(cp.getRegionId()); fd.setCompanyId(cp.getId()); fd.setRecordDate(DateUtils.truncate(recordDate)); fd.setForeignKeyId(cp.getId()+"-1"); fd.setLocation(Location.cp.getValue()); qb.setRegionId(cp.getRegionId()); qb.setCompanyId(cp.getId()); qb.setRecordDate(DateUtils.truncate(recordDate)); qb.setForeignKeyId(cp.getId()+"0"); qb.setLocation(Location.cp.getValue()); Initial.initial(qb); Initial.initial(fd); Initial.initial(gf); //计算公司级全部场站 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 ls) { if (!ls.isEmpty()) { // DoubleSummaryStatistics summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRzdfs).summaryStatistics(); // //日最大风速 // pewp.setRzdfs(summaryStatistics.getMax()); // //日最小风速 // summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRzxfs).summaryStatistics(); // pewp.setRzxfs(summaryStatistics.getMin()); // //日平均风速 // summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRpjfs).summaryStatistics(); // pewp.setRpjfs(summaryStatistics.getAverage()); // // summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRzdgl).summaryStatistics(); // //日最大功率 // pewp.setRzdgl(summaryStatistics.getMax()); // //日最小功率 // summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRzxgl).summaryStatistics(); // pewp.setRzxgl(summaryStatistics.getMin()); // //日平均功率 // summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRpjgl).summaryStatistics(); // pewp.setRpjgl(summaryStatistics.getAverage()); //日发电量 DoubleSummaryStatistics summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRfdl).summaryStatistics(); pewp.setRfdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日可用电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRkydl).summaryStatistics(); pewp.setRkydl(StringUtils.round(summaryStatistics.getSum(), 2)); //日理论发电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRllfdl).summaryStatistics(); pewp.setRllfdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日故障损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRgzssdl).summaryStatistics(); pewp.setRgzssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日场内受累故障损失电量 pewp.setRcnslgzssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日检修损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRjxssdl).summaryStatistics(); pewp.setRjxssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日场内受累检修损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRcnsljxssdl).summaryStatistics(); pewp.setRcnsljxssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日待机损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRdjssdl).summaryStatistics(); pewp.setRdjssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日缺陷降出力损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRqxjclssdl).summaryStatistics(); pewp.setRqxjclssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日手动停机损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRsdtjssdl).summaryStatistics(); pewp.setRsdtjssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日性能损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRxnssdl).summaryStatistics(); pewp.setRxnssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日限电停机损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRxdtjssdl).summaryStatistics(); pewp.setRxdtjssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日限电降出力损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRxdjclssdl).summaryStatistics(); pewp.setRxdjclssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日场外受累电网损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRcwsldwssdl).summaryStatistics(); pewp.setRcwsldwssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日场外受累天气损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRcwsltqssdl).summaryStatistics(); pewp.setRcwsltqssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日增发电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRzfdl).summaryStatistics(); pewp.setRzfdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日欠发电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRqfdl).summaryStatistics(); pewp.setRqfdl(StringUtils.round(summaryStatistics.getSum(), 2)); //日自耗电 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRzhd).summaryStatistics(); pewp.setRzhd(StringUtils.round(summaryStatistics.getSum(), 2)); //月发电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYfdl).summaryStatistics(); pewp.setYfdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月可用电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYkydl).summaryStatistics(); pewp.setYkydl(StringUtils.round(summaryStatistics.getSum(), 2)); //月理论发电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYllfdl).summaryStatistics(); pewp.setYllfdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月故障损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYgzssdl).summaryStatistics(); pewp.setYgzssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月场内受累故障损失电量 pewp.setYcnslgzssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月检修损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYjxssdl).summaryStatistics(); pewp.setYjxssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月场内受累检修损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYcnsljxssdl).summaryStatistics(); pewp.setYcnsljxssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月待机损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYdjssdl).summaryStatistics(); pewp.setYdjssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月缺陷降出力损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYqxjclssdl).summaryStatistics(); pewp.setYqxjclssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月手动停机损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYsdtjssdl).summaryStatistics(); pewp.setYsdtjssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月性能损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYxnssdl).summaryStatistics(); pewp.setYxnssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月限电停机损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYxdtjssdl).summaryStatistics(); pewp.setYxdtjssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月限电降出力损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYxdjclssdl).summaryStatistics(); pewp.setYxdjclssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月场外受累电网损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYcwsldwssdl).summaryStatistics(); pewp.setYcwsldwssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月场外受累天气损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYcwsltqssdl).summaryStatistics(); pewp.setYcwsltqssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月增发电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYzfdl).summaryStatistics(); pewp.setYzfdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月欠发电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYqfdl).summaryStatistics(); pewp.setYqfdl(StringUtils.round(summaryStatistics.getSum(), 2)); //月自耗电 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYzhd).summaryStatistics(); pewp.setYzhd(StringUtils.round(summaryStatistics.getSum(), 2)); //年发电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNfdl).summaryStatistics(); pewp.setNfdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年可用电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNkydl).summaryStatistics(); pewp.setNkydl(StringUtils.round(summaryStatistics.getSum(), 2)); //年理论发电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNllfdl).summaryStatistics(); pewp.setNllfdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年故障损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNgzssdl).summaryStatistics(); pewp.setNgzssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年场内受累故障损失电量 pewp.setNcnslgzssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年检修损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNjxssdl).summaryStatistics(); pewp.setNjxssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年场内受累检修损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNcnsljxssdl).summaryStatistics(); pewp.setNcnsljxssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年待机损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNdjssdl).summaryStatistics(); pewp.setNdjssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年缺陷降出力损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNqxjclssdl).summaryStatistics(); pewp.setNqxjclssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年手动停机损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNsdtjssdl).summaryStatistics(); pewp.setNsdtjssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年性能损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNxnssdl).summaryStatistics(); pewp.setNxnssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年限电停机损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNxdtjssdl).summaryStatistics(); pewp.setNxdtjssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年限电降出力损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNxdjclssdl).summaryStatistics(); pewp.setNxdjclssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年场外受累电网损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNcwsldwssdl).summaryStatistics(); pewp.setNcwsldwssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年场外受累天气损失电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNcwsltqssdl).summaryStatistics(); pewp.setNcwsltqssdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年增发电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNzfdl).summaryStatistics(); pewp.setNzfdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年欠发电量 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNqfdl).summaryStatistics(); pewp.setNqfdl(StringUtils.round(summaryStatistics.getSum(), 2)); //年自耗电 summaryStatistics = ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNzhd).summaryStatistics(); pewp.setNzhd(StringUtils.round(summaryStatistics.getSum(), 2)); } } /** * 计算场站日信息 */ public void calWindpowerInfoDay(Date recordDate) throws Exception { Calendar c = Calendar.getInstance(); c.setTime(recordDate); Date end = c.getTime(); Date begin = DateUtils.truncate(c.getTime()); //判断是否有重复记录,先删除重复记录 List idls = proEconPowerstationInfoDay1Service.list().stream() .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0 && CacheContext.wpmap.containsKey(i.getWindpowerstationId()) && i.getLocation().equals(Location.wp.getValue())).map(ProEconPowerstationInfoDay1::getId) .collect(Collectors.toList()); if (idls.size() > 0) { proEconPowerstationInfoDay1Service.removeByIds(idls); } List dayls=new ArrayList<>(); for (ProBasicPowerstation wp : CacheContext.wpls) { if (CacheContext.wppointmap.containsKey(wp.getId())) { Map pointmap = CacheContext.wppointmap.get(wp.getId()); ProEconPowerstationInfoDay1 pewp = new ProEconPowerstationInfoDay1(); Initial.initial(pewp); pewp.setRegionId(wp.getRegionId()); pewp.setCompanyId(wp.getCompanyId()); pewp.setRecordDate(DateUtils.truncate(recordDate)); pewp.setForeignKeyId(wp.getId()); pewp.setWindpowerstationId(wp.getId()); pewp.setLocation(Location.wp.getValue()); //昨日的统计结果 List pepid1ls = new ArrayList<>(); Calendar cl = Calendar.getInstance(); cl.setTime(recordDate); //昨日的统计结果 cl.add(Calendar.DAY_OF_MONTH, -1); if (cl.get(Calendar.DAY_OF_MONTH) != 1) { pepid1ls = proEconPowerstationInfoDay1Service.list().stream() .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0 && i.getLocation().equals(Location.wp.getValue()) && i.getWindpowerstationId().equals(wp.getId()) ) .collect(Collectors.toList()); } extracted(recordDate, end, begin, pointmap, pewp, pepid1ls); //*******************************************年信息统计*********************************************************/ dayls.add(pewp); // proEconPowerstationInfoDay1Service.save(pewp); } } proEconPowerstationInfoDay1Service.saveBatch(dayls); } /** * 计算项目日信息 */ public void calProjectInfoDay(Date recordDate) throws Exception { Calendar c = Calendar.getInstance(); c.setTime(recordDate); Date end = c.getTime(); Date begin = DateUtils.truncate(c.getTime()); //判断是否有重复记录,先删除重复记录 List idls = proEconPowerstationInfoDay1Service.list().stream() .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0 && CacheContext.pjmap.containsKey(i.getProjectId()) && i.getLocation().equals(Location.pj.getValue())).map(ProEconPowerstationInfoDay1::getId) .collect(Collectors.toList()); if (idls.size() > 0) { proEconPowerstationInfoDay1Service.removeByIds(idls); } List dayls=new ArrayList<>(); for (ProBasicProject pj : CacheContext.pjls) { if (CacheContext.propointmap.containsKey(pj.getId())) { Map pointmap = CacheContext.propointmap.get(pj.getId()); ProEconPowerstationInfoDay1 pewp = new ProEconPowerstationInfoDay1(); Initial.initial(pewp); if (CacheContext.wpmap.containsKey(pj.getWindpowerstationId())) { ProBasicPowerstation wp = CacheContext.wpmap.get(pj.getWindpowerstationId()); pewp.setRegionId(wp.getRegionId()); pewp.setCompanyId(wp.getCompanyId()); } pewp.setForeignKeyId(pj.getId()); pewp.setWindpowerstationId(pj.getWindpowerstationId()); pewp.setProjectId(pj.getId()); pewp.setLocation(Location.pj.getValue()); pewp.setRecordDate(DateUtils.truncate(recordDate)); //昨日的统计结果 List pepid1ls = new ArrayList<>(); Calendar cl = Calendar.getInstance(); cl.setTime(recordDate); //昨日的统计结果 cl.add(Calendar.DAY_OF_MONTH, -1); if (cl.get(Calendar.DAY_OF_MONTH) != 1) { pepid1ls = proEconPowerstationInfoDay1Service.list().stream() .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0 && i.getLocation().equals(Location.pj.getValue()) && i.getProjectId().equals(pj.getId()) ) .collect(Collectors.toList()); } extracted(recordDate, end, begin, pointmap, pewp, pepid1ls); dayls.add(pewp); // proEconPowerstationInfoDay1Service.save(pewp); } } proEconPowerstationInfoDay1Service.saveBatch(dayls); } /** * 计算线路日信息 */ public void calLineInfoDay(Date recordDate) throws Exception { Calendar c = Calendar.getInstance(); c.setTime(recordDate); Date end = c.getTime(); Date begin = DateUtils.truncate(c.getTime()); //判断是否有重复记录,先删除重复记录 List idls = proEconPowerstationInfoDay1Service.list().stream() .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0 && CacheContext.lnmap.containsKey(i.getLineId()) && i.getLocation().equals(Location.ln.getValue())).map(ProEconPowerstationInfoDay1::getId) .collect(Collectors.toList()); if (idls.size() > 0) { proEconPowerstationInfoDay1Service.removeByIds(idls); } List dayls=new ArrayList<>(); for (ProBasicLine ln : CacheContext.lnls) { if (CacheContext.linepointmap.containsKey(ln.getId())) { Map pointmap = CacheContext.linepointmap.get(ln.getId()); ProEconPowerstationInfoDay1 pewp = new ProEconPowerstationInfoDay1(); if (CacheContext.pjmap.containsKey(ln.getProjectId())) { ProBasicProject pj = CacheContext.pjmap.get(ln.getProjectId()); if (CacheContext.wpmap.containsKey(pj.getWindpowerstationId())) { ProBasicPowerstation wp = CacheContext.wpmap.get(pj.getWindpowerstationId()); pewp.setRegionId(wp.getRegionId()); pewp.setCompanyId(wp.getCompanyId()); pewp.setWindpowerstationId(wp.getId()); } } Initial.initial(pewp); pewp.setForeignKeyId(ln.getId()); pewp.setLineId(ln.getId()); pewp.setLocation(Location.ln.getValue()); pewp.setProjectId(ln.getProjectId()); pewp.setRecordDate(DateUtils.truncate(recordDate)); //昨日的统计结果 List pepid1ls = new ArrayList<>(); Calendar cl = Calendar.getInstance(); cl.setTime(recordDate); //昨日的统计结果 cl.add(Calendar.DAY_OF_MONTH, -1); if (cl.get(Calendar.DAY_OF_MONTH) != 1) { pepid1ls = proEconPowerstationInfoDay1Service.list().stream() .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0 && i.getLocation().equals(Location.ln.getValue()) && i.getLineId().equals(ln.getId()) ) .collect(Collectors.toList()); } extracted(recordDate, end, begin, pointmap, pewp, pepid1ls); dayls.add(pewp); // proEconPowerstationInfoDay1Service.save(pewp); } } proEconPowerstationInfoDay1Service.saveBatch(dayls); } private void extracted(Date recordDate, Date end, Date begin, Map pointmap, ProEconPowerstationInfoDay1 pewp, List pepid1ls) throws Exception { //*******************************************日信息统计*********************************************************/ if (pointmap.containsKey(ContantXk.SSPJFS)) { ProBasicPowerstationPoint point = pointmap.get(ContantXk.SSPJFS); List pointls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000); if (!pointls.isEmpty()) { DoubleSummaryStatistics summaryStatistics = pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics(); //日最大风速 pewp.setRzdfs(summaryStatistics.getMax()); //日最小风速 pewp.setRzxfs(summaryStatistics.getMin()); //日平均风速 pewp.setRpjfs(summaryStatistics.getAverage()); } } if (pointmap.containsKey(ContantXk.SSZGL)) { ProBasicPowerstationPoint point = pointmap.get(ContantXk.SSZGL); List pointls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000); if (!pointls.isEmpty()) { DoubleSummaryStatistics summaryStatistics = pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics(); //日最大功率 pewp.setRzdgl(summaryStatistics.getMax()); //日最小功率 pewp.setRzxgl(summaryStatistics.getMin()); //日平均功率 pewp.setRpjgl(summaryStatistics.getAverage()); } } if (pointmap.containsKey(ContantXk.RFDL)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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(pewp); } else { ProEconPowerstationInfoDay1 pepid = pepid1ls.get(0); //如果昨日大于今日最大功率 if (pepid.getYzdgl() > pewp.getRzdgl()) { pewp.setYzdgl(pepid.getYzdgl()); } else { pewp.setYzdgl(pewp.getRzdgl()); } //如果昨日大于今日最大风速 if (pepid.getYzdfs() > pewp.getRzdfs()) { pewp.setYzdfs(pepid.getYzdfs()); } else { pewp.setYzdfs(pewp.getRzdfs()); } //如果昨日小于今日最小功率 if (pepid.getYzxgl() < pewp.getRzxgl()) { pewp.setYzxgl(pepid.getYzxgl()); } else { pewp.setYzxgl(pewp.getRzxgl()); } //如果昨日小于今日最小风速 if (pepid.getYzxfs() < pewp.getRzxfs()) { pewp.setYzxfs(pepid.getYzxfs()); } else { pewp.setYzxfs(pewp.getRzxfs()); } double pjfs = BigDecimal.valueOf(pewp.getYpjfs() + pepid.getRpjfs()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue(); pewp.setYzxfs(pjfs); double pjgl = BigDecimal.valueOf(pewp.getYpjgl() + pepid.getRpjgl()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue(); pewp.setYzxgl(pjgl); } if (pointmap.containsKey(ContantXk.YFDL)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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(pewp); } else { ProEconPowerstationInfoDay1 pepid = pepid1ls.get(0); //如果昨日大于今日最大功率 if (pepid.getNzdgl() > pewp.getRzdgl()) { pewp.setNzdgl(pepid.getNzdgl()); } else { pewp.setNzdgl(pewp.getRzdgl()); } //如果昨日大于今日最大风速 if (pepid.getNzdfs() > pewp.getRzdfs()) { pewp.setNzdfs(pepid.getNzdfs()); } else { pewp.setNzdfs(pewp.getRzdfs()); } //如果昨日小于今日最小功率 if (pepid.getNzxgl() < pewp.getRzxgl()) { pewp.setNzxgl(pepid.getNzxgl()); } else { pewp.setNzxgl(pewp.getRzxgl()); } //如果昨日小于今日最小风速 if (pepid.getNzxfs() < pewp.getRzxfs()) { pewp.setNzxfs(pepid.getNzxfs()); } else { pewp.setNzxfs(pewp.getRzxfs()); } double pjfs = BigDecimal.valueOf(pewp.getNpjfs() + pepid.getRpjfs()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue(); pewp.setNzxfs(pjfs); double pjgl = BigDecimal.valueOf(pewp.getNpjgl() + pepid.getRpjgl()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue(); pewp.setNzxgl(pjgl); } if (pointmap.containsKey(ContantXk.NFDL)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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)) { ProBasicPowerstationPoint 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(ProEconPowerstationInfoDay1 pewp) { //年最大风速 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(ProEconPowerstationInfoDay1 pewp) { //月最大风速 pewp.setYzdfs(pewp.getRzdfs()); //月最小风速 pewp.setYzxfs(pewp.getRzxfs()); //月平均风速 pewp.setYpjfs(pewp.getRpjfs()); //月最大功率 pewp.setYzdgl(pewp.getRzdgl()); //月最小功率 pewp.setYzxgl(pewp.getRzxgl()); //月平均功率 pewp.setYpjgl(pewp.getRpjgl()); } }