package com.gyee.runeconomy.service.goodness; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gyee.common.contant.ContantXk; import com.gyee.common.model.PointData; import com.gyee.common.util.DoubleUtils; import com.gyee.common.util.SortUtils; import com.gyee.common.vo.benchmark.DataVo; import com.gyee.common.vo.threerate.PvVo; import com.gyee.runeconomy.dto.EchartDataVo; import com.gyee.runeconomy.init.CacheContext; import com.gyee.runeconomy.model.auto.*; import com.gyee.runeconomy.service.auto.IProEconEquipmentInfoDay6Service; import com.gyee.runeconomy.service.auto.IProEconWindturbineGoodnessService; import com.gyee.runeconomy.util.DateUtils; import com.gyee.runeconomy.util.StringUtils; import com.gyee.runeconomy.util.realtimesource.IEdosUtil; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.util.*; /** * @ClassName : WindturbinegoodnessService * @Author : xieshengjie * @Date: 2021/2/20 20:35 * @Description : 单机性能总览service */ @Service public class WindturbinegoodnessService { @Resource private IProEconWindturbineGoodnessService proEconWindturbineGoodnessService; @Resource private IProEconEquipmentInfoDay6Service proEconEquipmentInfoDay6Service; @Resource private IEdosUtil edosUtil; public Page windturbinegoodnessList(Integer pageNum, Integer pageSize, String cmId, String type, String wpId, String recorddate) { if (StringUtils.empty(pageNum)) { pageNum = 1; } if (StringUtils.empty(pageSize)) { pageSize = 10; } //构造分页构造器 Page pageInfo = new Page<>(pageNum, pageSize); if (StringUtils.notEmp(type) && StringUtils.notEmp(recorddate)) { Date date = com.gyee.common.util.DateUtils.parseDate(recorddate); //构造条件构造器 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); //添加过滤条件 if (StringUtils.notEmp(wpId)) { queryWrapper.eq(ProEconWindturbineGoodness::getWindtpowerstationId, wpId). eq(ProEconWindturbineGoodness::getRecordDate, date); if (StringUtils.notEmp(type) && !type.equals("0")) { queryWrapper.eq(ProEconWindturbineGoodness::getTypes, type); } } else if (StringUtils.notEmp(cmId) && CacheContext.cpmap.containsKey(cmId)) { queryWrapper. eq(ProEconWindturbineGoodness::getCompanyId, cmId). eq(ProEconWindturbineGoodness::getRecordDate, date); if (StringUtils.notEmp(type) && !type.equals("0")) { queryWrapper.eq(ProEconWindturbineGoodness::getTypes, type); } } else if (StringUtils.notEmp(cmId) && CacheContext.rgmap.containsKey(cmId)) { queryWrapper.eq(ProEconWindturbineGoodness::getRegionId, cmId). eq(ProEconWindturbineGoodness::getRecordDate, date); if (StringUtils.notEmp(type) && !type.equals("0")) { queryWrapper.eq(ProEconWindturbineGoodness::getTypes, type); } } queryWrapper.orderByAsc(ProEconWindturbineGoodness::getWindturbineId); //执行查询 proEconWindturbineGoodnessService.page(pageInfo, queryWrapper); } return pageInfo; } /** * 初始化折线图数据 * * @return */ public List findWtRealPowerChar(String wtId, Date recorddate) throws Exception { List vos = new ArrayList(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date endDate = sdfs.parse(sdf.format(DateUtils.addDays(recorddate, 1)) + " 01:00:00"); Date beginDate = sdfs.parse(sdf.format(recorddate) + " 00:00:00"); int length = 25; for (int i = 0; i < length; i++) { DataVo vo = new DataVo(); vo.setValue1(0.0);// 实发功率 vo.setValue2(0.0);// 保证功率 vo.setValue3(0.0);// 风速 vo.setValue4(0.0);// 状态 vos.add(vo); } Map wtpointmap = CacheContext.wtpAimap.get(wtId); ProBasicEquipmentPoint sjgl = wtpointmap.get(ContantXk.CJ_SSGL); // ProBasicEquipmentPoint bzgl = wtpointmap.get(ContantXk.ZSGL); // ProBasicEquipmentPoint bzgl = wtpointmap.get(ContantXk.BZGL); ProBasicEquipmentPoint bzgl = wtpointmap.get(ContantXk.SSBZGL); ProBasicEquipmentPoint pjfs = wtpointmap.get(ContantXk.CJ_SSFS); // WindTurbineTestingPointAi2 fs = map.get(ContantXk.TPOINT_WT_PJFS); List sjglls = null; if (null != sjgl) { sjglls = edosUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 3600L); if (!sjglls.isEmpty()) { int count = 0; double temp = 0; for (int i = 0; i < vos.size(); i++) { vos.get(i).setTime(sjglls.get(i).getPointTime()); if (i < sjglls.size() && StringUtils.notEmp(sjglls.get(i).getPointTime())) { if (vos.get(i).getTime() <= DateUtils.now().getTime()) { temp = sjglls.get(i).getPointValueInDouble(); if (Math.abs(temp) < 10000) { vos.get(i).setValue1(StringUtils.round(temp, 2));// 实际功率 } count++; } else { vos.get(i).setValue1(0d);// 实际功率 } } } } } if (null != bzgl) { List bzglls = edosUtil.getHistoryDatasSnap(bzgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 3600L); if (!bzglls.isEmpty()) { int count = 0; double temp = 0; for (int i = 0; i < vos.size(); i++) { vos.get(i).setTime(bzglls.get(i).getPointTime()); if (i < bzglls.size() && StringUtils.notEmp(bzglls.get(i).getPointTime())) { if (vos.get(i).getTime() <= DateUtils.now().getTime()) { temp = bzglls.get(i).getPointValueInDouble(); if (Math.abs(temp) < 10000) { if (sjglls != null && sjglls.get(i).getPointValueInDouble() > temp) { temp = sjglls.get(i).getPointValueInDouble(); } vos.get(i).setValue2(StringUtils.round(temp, 2));// 保证功率 } count++; } else { vos.get(i).setValue2(0d);// 保证功率 } } } } } if (null != pjfs) { List pjfsls = edosUtil.getHistoryDatasSnap(pjfs, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 3600L); if (!pjfsls.isEmpty()) { int count = 0; double temp = 0; for (int i = 0; i < vos.size(); i++) { vos.get(i).setTime(pjfsls.get(i).getPointTime()); if (i < pjfsls.size() && StringUtils.notEmp(pjfsls.get(i).getPointTime())) { if (vos.get(i).getTime() <= DateUtils.now().getTime()) { temp = pjfsls.get(i).getPointValueInDouble(); vos.get(i).setValue3(StringUtils.round(temp, 2));// 风速 count++; } else { vos.get(i).setValue3(0d);// 实际功率 } } } } } return vos; } public List> getplotBands(String wtId, Date recorddate) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); Calendar c = Calendar.getInstance(); c.setTime(recorddate); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); Date beginDate = c.getTime(); c.add(Calendar.DAY_OF_MONTH, 1); Date endDate = c.getTime(); List xtime = new ArrayList<>(); List vos = new ArrayList<>(); List> resultvos = new ArrayList<>(); Map map = new HashMap<>(); int length = 240; String plotBands = null; StringBuilder sb = new StringBuilder(""); Map wtpointmap = CacheContext.wtpAimap.get(wtId); ProBasicEquipmentPoint fjzt = wtpointmap.get(ContantXk.SBZT); String beginTime = null; String endTime = null; String time = null; if (null != fjzt) { List fjztls = edosUtil.getHistoryDatasSnap(fjzt, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 360L); int zt = 0; for (int i = 0; i < fjztls.size(); i++) { if (i < fjztls.size()) { PointData pd = fjztls.get(i); int zttemp = Double.valueOf(pd.getPointValueInDouble()).intValue(); Date resultDate = new Date(pd.getPointTime()); beginTime = sdf.format(resultDate); time = sdf2.format(resultDate); xtime.add(beginTime); if (i == 0) { zt = zttemp; EchartDataVo vo = new EchartDataVo(); vo.setxAxis(beginTime); vo.setTime1(time); vo.setName(judgeSatte(zttemp)); EchartDataVo.ItemStyle item = vo.new ItemStyle(); item.setColor(judgeColor(zttemp)); vo.setItemStyle(item); vos.add(vo); } else { if (zt != zttemp) { zt = zttemp; c = Calendar.getInstance(); c.setTime(resultDate); // c.add(Calendar.MINUTE, -6); endTime = sdf.format(c.getTime()); time = sdf2.format(c.getTime()); vos.get(0).setTime2(time); EchartDataVo vo = new EchartDataVo(); vo.setxAxis(endTime); vos.add(vo); if (vos.size() == 2) { resultvos.add(vos); vos = new ArrayList<>(); vo = new EchartDataVo(); vo.setxAxis(beginTime); vo.setTime1(sdf2.format(resultDate)); vo.setName(judgeSatte(zttemp)); EchartDataVo.ItemStyle item = vo.new ItemStyle(); item.setColor(judgeColor(zttemp)); vo.setItemStyle(item); vos.add(vo); } } else if (i == fjztls.size() - 1) { zt = zttemp; c = Calendar.getInstance(); c.setTime(resultDate); // c.add(Calendar.MINUTE, -6); endTime = sdf.format(c.getTime()); time = sdf2.format(c.getTime()); vos.get(0).setTime2(time); EchartDataVo vo = new EchartDataVo(); vo.setxAxis(endTime); vo.setxAxis(beginTime); vo.setTime1(sdf2.format(resultDate)); vo.setName(judgeSatte(zttemp)); EchartDataVo.ItemStyle item = vo.new ItemStyle(); item.setColor(judgeColor(zttemp)); vo.setItemStyle(item); vos.add(vo); resultvos.add(vos); } } } } } return resultvos; } private String judgeSatte(int zt) { String ztname = null; switch (zt) { case 0: ztname = "待机"; break; case 1: ztname = "运行"; break; case 2: ztname = "故障"; break; case 3: ztname = "检修"; break; case 4: ztname = "限电"; break; case 5: ztname = "受累"; break; case 6: ztname = "中断"; break; default: } return ztname; } // 运行 #08FCF0 待机 #34A90A 维护 #FD7D1C 故障 #FD0100 限电 #D201D8 离线 #A6A6A6 private String judgeColor(int zt) { String ztname = null; switch (zt) { case 0: ztname = "#BFFFDF"; break; case 1: ztname = "#E7FFFF"; break; case 2: ztname = "#FFBFBF"; break; case 3: ztname = "#FFDFBF"; break; case 4: ztname = "#FFDFFF"; break; case 5: ztname = "#FFDFFF"; break; case 6: ztname = "#DDDDDD"; break; default: } return ztname; } public Map getPlotBand(String wtId, String begin, String end) throws Exception { Map wtpointmap = CacheContext.wtpAimap.get(wtId); ProBasicEquipmentPoint fdlAi = wtpointmap.get(ContantXk.RFDL); ProBasicEquipmentPoint fsAi = wtpointmap.get(ContantXk.CJ_SSFS); ProBasicEquipmentPoint llfdlAi = wtpointmap.get(ContantXk.RLLFDL); ProBasicEquipmentPoint glAi = wtpointmap.get(ContantXk.CJ_SSGL); ProBasicEquipmentPoint fjztAi = wtpointmap.get(ContantXk.SBZT); Date begindate = DateUtils.parseDate5(begin); Date enddate = DateUtils.parseDate5(end); Map tempmap = new HashMap(); // 发电量 double beginfdl = 0.0; double endfdl = 0.0; double fdl = 0.0; // String[] id=new String[1]; // DNAVal[] val= edosUtil.getHistMatrix(id,begindate.getTime() / 1000); // beginfdl=val[0].DValue; // val= edosUtil.getHistMatrix(id,enddate.getTime() / 1000); // endfdl=val[0].DValue; List beginfdlls = edosUtil.getHistoryDatasSnap(fdlAi, begindate.getTime() / 1000, begindate.getTime() / 1000, (long) 1, 3600L); if (!beginfdlls.isEmpty()) { beginfdl = beginfdlls.get(0).getPointValueInDouble(); } List endfdlls = edosUtil.getHistoryDatasSnap(fdlAi, enddate.getTime() / 1000, enddate.getTime() / 1000, (long) 1, 3600L); if (!endfdlls.isEmpty()) { endfdl = endfdlls.get(0).getPointValueInDouble(); } fdl = endfdl - beginfdl; tempmap.put("fdl", String.valueOf(StringUtils.round(fdl, 2))); // 理论电量 double beginllfdl = 0.0; double endllfdl = 0.0; double llfdl = 0.0; List beginllfdls = edosUtil.getHistoryDatasSnap(llfdlAi, begindate.getTime() / 1000, begindate.getTime() / 1000, (long) 1, 3600L); if (!beginllfdls.isEmpty()) { beginllfdl = beginllfdls.get(0).getPointValueInDouble(); } List endllfdls = edosUtil.getHistoryDatasSnap(llfdlAi, enddate.getTime() / 1000, enddate.getTime() / 1000, (long) 1, 3600L); if (!endllfdls.isEmpty()) { endllfdl = endllfdls.get(0).getPointValueInDouble(); } llfdl = endllfdl - beginllfdl; // llfdl=new BigDecimal(llfdl).multiply(new // BigDecimal(10000)).doubleValue(); tempmap.put("llfdl", String.valueOf(StringUtils.round(llfdl, 2))); // 风机状态 int fjzt = 0; List fjztls = edosUtil.getHistoryDatasSnap(fjztAi, begindate.getTime() / 1000, enddate.getTime() / 1000, (long) 1, 3600L); if (!fjztls.isEmpty()) { fjzt = Double.valueOf(fjztls.get(0).getPointValueInDouble()).intValue(); tempmap.put("fjzt", judgeSatte(fjzt)); } // 风速 double fs = 0.0; Double time1 = new BigDecimal(DateUtils.minutesDiff(begindate, enddate)) .divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN) .doubleValue(); List fsls = edosUtil.getHistoryDatasSnap(fsAi, begindate.getTime() / 1000, enddate.getTime() / 1000, (long) time1.longValue(), 3600L); if (!fsls.isEmpty()) { for (PointData po : fsls) { fs = fs + po.getPointValueInDouble(); } if (time1 == 0) { time1 = 1.0; } double fstemp = new BigDecimal(fs).divide( new BigDecimal(time1.doubleValue()), 2, RoundingMode.HALF_EVEN).doubleValue(); tempmap.put("fs", String.valueOf(StringUtils.round(fstemp, 2))); } // 功率 double gl = 0.0; Double time2 = new BigDecimal(DateUtils.minutesDiff(begindate, enddate)) .divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN) .doubleValue(); List glls = edosUtil.getHistoryDatasSnap(glAi, begindate.getTime() / 1000, enddate.getTime() / 1000, (long) time2.longValue(), 3600L); if (!glls.isEmpty()) { for (PointData po : glls) { gl = gl + po.getPointValueInDouble(); } if (time2 == 0) { time2 = 1.0; } double gltemp = new BigDecimal(gl).divide( new BigDecimal(time2.doubleValue()), 2, RoundingMode.HALF_EVEN).doubleValue(); tempmap.put("gl", String.valueOf(StringUtils.round(gltemp, 2))); } // 时长 tempmap.put("sc", String.valueOf(StringUtils.round(DateUtils.hoursDiff2(begindate, enddate), 2))); // 损失电量 if (fjzt != 1) { fdl = 0.0; tempmap.put("fdl", "0.0"); tempmap.put("gl", "0.0"); } tempmap.put("ssdl", String.valueOf(StringUtils.round(llfdl - fdl, 2))); tempmap.put("ks", begin); tempmap.put("js", end); return tempmap; } private String getColor(StringBuilder temp, Integer zt) { if (StringUtils.notEmp(zt)) { switch (zt) { case 0: temp.setLength(0); temp.append("color: '#BFFFDF',"); break; case 1: temp.setLength(0); temp.append("color: '#E7FFFF',"); break; case 2: temp.setLength(0); temp.append("color: '#FFBFBF',"); break; case 3: temp.setLength(0); temp.append("color: '#DDDDDD',"); break; case 4: temp.setLength(0); temp.append("color: '#FFDFBF',"); break; case 5: temp.setLength(0); temp.append("color: '#FFDFFF',"); break; case 6: temp.setLength(0); temp.append("color: '#FFDFFF',"); break; default: break; } } return String.valueOf(temp); } public List findRealPowerCharBy24(String wtId, Date recorddate) throws Exception { List vos = new ArrayList(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date endDate = sdfs.parse(sdf.format(DateUtils.addDays(recorddate, 1)) + " 00:0:00"); Date beginDate = sdfs.parse(sdf.format(recorddate) + " 00:00:00"); int length = 24; for (int i = 0; i < length; i++) { DataVo vo = new DataVo(); vo.setValue1(0.0);// scada发电量 vo.setValue2(0.0);// 维护损失 vo.setValue3(0.0);// 故障损失 vo.setValue4(0.0);// 限电损失 vo.setValue5(0.0);// 欠发损失 vo.setValue6(0.0);// 风速 vos.add(vo); } Map wtpointmap = CacheContext.wtpAimap.get(wtId); ProBasicEquipmentPoint fdl = wtpointmap.get(ContantXk.RFDL); ProBasicEquipmentPoint whss = wtpointmap.get(ContantXk.RJXSSDL); ProBasicEquipmentPoint gzss = wtpointmap.get(ContantXk.RGZSSDL); ProBasicEquipmentPoint xdss = wtpointmap.get(ContantXk.RXDTJSSDL); ProBasicEquipmentPoint qfss = wtpointmap.get(ContantXk.RXNSSDL); ProBasicEquipmentPoint fs = wtpointmap.get(ContantXk.CJ_SSFS); try { if (null != fdl) { List fdlls = edosUtil.getHistoryDatasSnap(fdl, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 3600L); int count = 0; double temp1 = 0; for (int i = 0; i < length; i++) { if (i < fdlls.size() && StringUtils.notEmp(fdlls.get(i + 1).getPointTime())) { vos.get(i).setTime(fdlls.get(i + 1).getPointTime()); if (vos.get(i).getTime() <= DateUtils.now().getTime()) { if (i != 0) { temp1 = fdlls.get(i + 1).getPointValueInDouble(); double temp2 = fdlls.get(i).getPointValueInDouble(); temp1 = temp1 - temp2; vos.get(i).setValue1(StringUtils.round(temp1 * 1000, 2));// 发电量 } else { temp1 = fdlls.get(i + 1).getPointValueInDouble(); vos.get(i).setValue1(StringUtils.round(temp1 * 1000, 2));// 发电量 } // temp1 = new BigDecimal(temp1).divide(new // BigDecimal(10000), 2, // RoundingMode.HALF_EVEN).doubleValue(); // temp1 = new BigDecimal(temp1).divide( // new BigDecimal(100000), 2, // RoundingMode.HALF_EVEN).multiply( // new BigDecimal(100)).doubleValue(); count++; } else { vos.get(i).setTime(fdlls.get(i).getPointTime()); vos.get(i).setValue1(0d);// 发电量 } } } } } catch (Exception e) { // TODO: handle exception } /* * 维护损失 */ try { if (null != whss) { List whssls = edosUtil.getHistoryDatasSnap(whss, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 3600L); int count = 0; double temp1 = 0; for (int i = 0; i < length; i++) { if (i < whssls.size() && StringUtils.notEmp(whssls.get(i + 1).getPointTime())) { vos.get(i).setTime(whssls.get(i + 1).getPointTime()); if (vos.get(i).getTime() <= DateUtils.now().getTime()) { if (i != 0) { temp1 = whssls.get(i + 1).getPointValueInDouble(); double temp2 = whssls.get(i).getPointValueInDouble(); temp1 = temp1 - temp2; // temp1 = new BigDecimal(temp1).divide(new // BigDecimal(10000), 2, // RoundingMode.HALF_EVEN).doubleValue(); vos.get(i).setValue2(StringUtils.round(temp1 * 1000, 2));// 维护损失电量 count++; } else { temp1 = whssls.get(i + 1).getPointValueInDouble(); vos.get(i).setValue2(StringUtils.round(temp1 * 1000, 2));// 维护损失电量 } // temp1 = new BigDecimal(temp1).divide( // new BigDecimal(100000), 2, // RoundingMode.HALF_EVEN).multiply( // new BigDecimal(100)).doubleValue(); } else { // vos.get(i-1).setTime(whssls.get(i).getPointTime()*1000); vos.get(i).setValue2(0d);// 维护损失电量 } } } } } catch (Exception e) { // TODO: handle exception } /* * 故障损失 */ try { if (null != gzss) { List gzssls = edosUtil.getHistoryDatasSnap(gzss, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 3600L); int count = 0; double temp1 = 0; for (int i = 0; i < length; i++) { if (i < gzssls.size() && StringUtils.notEmp(gzssls.get(i + 1).getPointTime())) { vos.get(i).setTime(gzssls.get(i + 1).getPointTime()); if (vos.get(i).getTime() <= DateUtils.now().getTime()) { if (i != 0) { temp1 = gzssls.get(i + 1).getPointValueInDouble(); double temp2 = gzssls.get(i).getPointValueInDouble(); temp1 = temp1 - temp2; // temp1 = new BigDecimal(temp1).divide(new // BigDecimal(10000), 2, // RoundingMode.HALF_EVEN).doubleValue(); // temp1 = new BigDecimal(temp1).divide( // new BigDecimal(100000), 2, // RoundingMode.HALF_EVEN).multiply( // new BigDecimal(100)).doubleValue(); vos.get(i).setValue3(StringUtils.round(temp1 * 1000, 2));// 维护损失电量 count++; } else { temp1 = gzssls.get(i + 1).getPointValueInDouble(); vos.get(i).setValue3(StringUtils.round(temp1 * 1000, 2));// 维护损失电量 } } else { // vos.get(i-1).setTime(gzssls.get(i).getPointTime()*1000); vos.get(i).setValue3(0d);// 维护损失电量 } } } } } catch (Exception e) { // TODO: handle exception } /* * 限电损失 */ try { if (null != xdss) { List xdssls = edosUtil.getHistoryDatasSnap(xdss, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 3600L); int count = 0; double temp1 = 0; for (int i = 0; i < length; i++) { if (i < xdssls.size() && StringUtils.notEmp(xdssls.get(i + 1).getPointTime())) { vos.get(i).setTime(xdssls.get(i + 1).getPointTime()); if (vos.get(i).getTime() <= DateUtils.now().getTime()) { if (i != 0) { temp1 = xdssls.get(i + 1).getPointValueInDouble(); double temp2 = xdssls.get(i).getPointValueInDouble(); temp1 = temp1 - temp2; // temp1 = new BigDecimal(temp1).divide(new // BigDecimal(10000), 2, // RoundingMode.HALF_EVEN).doubleValue(); // temp1 = new BigDecimal(temp1).divide( // new BigDecimal(100000), 2, // RoundingMode.HALF_EVEN).multiply( // new BigDecimal(100)).doubleValue(); vos.get(i).setValue4(StringUtils.round(temp1 * 1000, 2));// 限电损失电量 count++; } else { temp1 = xdssls.get(i + 1).getPointValueInDouble(); vos.get(i).setValue4(StringUtils.round(temp1 * 1000, 2));// 限电损失电量 } } else { // vos.get(i).setTime(xdssls.get(i).getPointTime()*1000); vos.get(i).setValue4(0d);// 限电损失电量 } } } } } catch (Exception e) { // TODO: handle exception } /* * 欠发损失 */ try { if (null != qfss) { List qfssls = edosUtil.getHistoryDatasSnap(qfss, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 3600L); int count = 0; double temp1 = 0; for (int i = 0; i < length; i++) { if (i < qfssls.size() && StringUtils.notEmp(qfssls.get(i + 1).getPointTime())) { vos.get(i).setTime(qfssls.get(i + 1).getPointTime()); if (vos.get(i).getTime() <= DateUtils.now().getTime()) { if (i != 0) { temp1 = qfssls.get(i + 1).getPointValueInDouble(); double temp2 = qfssls.get(i).getPointValueInDouble(); temp1 = temp1 - temp2; // temp1 = new BigDecimal(temp1).divide(new // BigDecimal(10000), 2, // RoundingMode.HALF_EVEN).doubleValue(); // temp1 = new BigDecimal(temp1).divide( // new BigDecimal(100000), 2, // RoundingMode.HALF_EVEN).multiply( // new BigDecimal(100)).doubleValue(); vos.get(i).setValue5(StringUtils.round(temp1, 2));// 欠发损失电量 count++; } else { temp1 = qfssls.get(i + 1).getPointValueInDouble(); vos.get(i).setValue5(StringUtils.round(temp1, 2));// 欠发损失电量 } } else { vos.get(i - 1).setTime(qfssls.get(i).getPointTime() * 1000); vos.get(i).setValue5(0d);// 欠发损失电量 } } } } } catch (Exception e) { // TODO: handle exception } /* * 风速 */ try { if (null != fs) { List fsls = edosUtil.getHistoryDatasSnap(fs, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 3600L); int count = 0; double temp1 = 0; for (int i = 0; i < 24; i++) { if (i < fsls.size() && StringUtils.notEmp(fsls.get(i + 1).getPointTime())) { vos.get(i).setTime(fsls.get(i + 1).getPointTime()); if (vos.get(i).getTime() <= DateUtils.now().getTime()) { temp1 = fsls.get(i + 1).getPointValueInDouble(); // double temp2 // =fsls.get(i-1).getPointValueInDouble(); // temp1=temp1-temp2; // temp1 = new BigDecimal(temp1).divide(new // BigDecimal(1), 2, // RoundingMode.HALF_EVEN).doubleValue(); // temp1 = new BigDecimal(temp1).divide( // new BigDecimal(100000), 2, // RoundingMode.HALF_EVEN).multiply( // new BigDecimal(100)).doubleValue(); vos.get(i).setValue6(StringUtils.round(temp1, 2));// 风速 count++; // else // { // temp1 = qfssls.get(i).getPointValueInDouble(); // } } else { // vos.get(i-1).setTime(qfssls.get(i).getPointTime()*1000); vos.get(i).setValue6(0d);// 风速 } } } } } catch (Exception e) { // TODO: handle exception } // //////////////////////////////////////////////// return vos; } public List pvgoodness(String companys, String wpid, String recorddate, String target, String sort) { Map modelMap = CacheContext.modelMap; Map wtmap = CacheContext.wtmap; List resultList = new ArrayList<>(); LambdaQueryWrapper qw = new LambdaQueryWrapper<>(); qw.eq(ProEconEquipmentInfoDay6::getRecordDate, DateUtils.parseDate(recorddate)); if (StringUtils.isNotEmpty(companys)) { if (companys.endsWith("ZGS")) { qw.eq(ProEconEquipmentInfoDay6::getCompanyId, companys); } if (companys.endsWith("RGN")) { qw.eq(ProEconEquipmentInfoDay6::getRegionId, companys); } } if (StringUtils.isNotEmpty(wpid)) { qw.eq(ProEconEquipmentInfoDay6::getWindpowerstationId, wpid); } List equipmentInfoDay6s = proEconEquipmentInfoDay6Service.list(qw); equipmentInfoDay6s.stream().forEach(i -> { PvVo vo = new PvVo(); vo.setWtid(i.getWindturbineId()); vo.setWtname(wtmap.get(i.getWindturbineId()).getAname()); vo.setModel(modelMap.get(wtmap.get(i.getWindturbineId()).getModelId()).getAname()); vo.setRxtxl(DoubleUtils.keepPrecision(i.getRxtxl(), 2)); vo.setRlsl(DoubleUtils.keepPrecision(i.getRlsl(), 2)); vo.setRzhxl(DoubleUtils.keepPrecision(i.getRnbqzhxl(), 2)); vo.setYxtxl(DoubleUtils.keepPrecision(i.getYxtxl(), 2)); vo.setYlsl(DoubleUtils.keepPrecision(i.getYlsl(), 2)); vo.setYzhxl(DoubleUtils.keepPrecision(i.getYnbqzhxl(), 2)); vo.setNxtxl(DoubleUtils.keepPrecision(i.getNxtxl(), 2)); vo.setNlsl(DoubleUtils.keepPrecision(i.getNlsl(), 2)); vo.setNzhxl(DoubleUtils.keepPrecision(i.getNnbqzhxl(), 2)); resultList.add(vo); }); if (StringUtils.isNotEmpty(target)) { if (sort.equals("1")) SortUtils.sort(resultList, target, SortUtils.ASC); SortUtils.sort(resultList, target, SortUtils.DESC); } return resultList; } public List pvgoodnesshis(String wpid, String wtid, String beginDate, String endDate, String target, String sort) { Map modelMap = CacheContext.modelMap; Map wtmap = CacheContext.wtmap; List resultList = new ArrayList<>(); LambdaQueryWrapper qw = new LambdaQueryWrapper<>(); qw.le(ProEconEquipmentInfoDay6::getRecordDate, DateUtils.parseDate(endDate)); qw.ge(ProEconEquipmentInfoDay6::getRecordDate, DateUtils.parseDate(beginDate)); if (StringUtils.isNotEmpty(wpid)) { qw.eq(ProEconEquipmentInfoDay6::getWindpowerstationId, wpid); } if (StringUtils.isNotEmpty(wtid)) { qw.eq(ProEconEquipmentInfoDay6::getWindturbineId, wtid); } List equipmentInfoDay6s = proEconEquipmentInfoDay6Service.list(qw); equipmentInfoDay6s.stream().forEach(i -> { PvVo vo = new PvVo(); vo.setWtid(i.getWindturbineId()); vo.setWtname(wtmap.get(i.getWindturbineId()).getAname()); vo.setDate(i.getRecordDate()); vo.setModel(modelMap.get(wtmap.get(i.getWindturbineId()).getModelId()).getAname()); vo.setRxtxl(DoubleUtils.keepPrecision(i.getRxtxl(), 2)); vo.setRlsl(DoubleUtils.keepPrecision(i.getRlsl(), 2)); vo.setRzhxl(DoubleUtils.keepPrecision(i.getRnbqzhxl(), 2)); vo.setYxtxl(DoubleUtils.keepPrecision(i.getYxtxl(), 2)); vo.setYlsl(DoubleUtils.keepPrecision(i.getYlsl(), 2)); vo.setYzhxl(DoubleUtils.keepPrecision(i.getYnbqzhxl(), 2)); vo.setNxtxl(DoubleUtils.keepPrecision(i.getNxtxl(), 2)); vo.setNlsl(DoubleUtils.keepPrecision(i.getNlsl(), 2)); vo.setNzhxl(DoubleUtils.keepPrecision(i.getNnbqzhxl(), 2)); resultList.add(vo); }); if (StringUtils.isNotEmpty(target)) { if (sort.equals("1")) SortUtils.sort(resultList, target, SortUtils.ASC); SortUtils.sort(resultList, target, SortUtils.DESC); } return resultList; } }