| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977 |
- 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<ProEconWindturbineGoodness> 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<ProEconWindturbineGoodness> pageInfo = new Page<>(pageNum, pageSize);
- if (StringUtils.notEmp(type) && StringUtils.notEmp(recorddate)) {
- Date date = com.gyee.common.util.DateUtils.parseDate(recorddate);
- //构造条件构造器
- LambdaQueryWrapper<ProEconWindturbineGoodness> 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<DataVo> findWtRealPowerChar(String wtId, Date recorddate) throws Exception {
- List<DataVo> vos = new ArrayList<DataVo>();
- 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<String, ProBasicEquipmentPoint> 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<PointData> 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<PointData> 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<PointData> 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<List<EchartDataVo>> 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<String> xtime = new ArrayList<>();
- List<EchartDataVo> vos = new ArrayList<>();
- List<List<EchartDataVo>> resultvos = new ArrayList<>();
- Map<String, String> map = new HashMap<>();
- int length = 240;
- String plotBands = null;
- StringBuilder sb = new StringBuilder("");
- Map<String, ProBasicEquipmentPoint> wtpointmap = CacheContext.wtpAimap.get(wtId);
- ProBasicEquipmentPoint fjzt = wtpointmap.get(ContantXk.SBZT);
- String beginTime = null;
- String endTime = null;
- String time = null;
- if (null != fjzt) {
- List<PointData> 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<String, String> getPlotBand(String wtId, String begin, String end) throws Exception {
- Map<String, ProBasicEquipmentPoint> 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<String, String> tempmap = new HashMap<String, String>();
- // 发电量
- 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<PointData> beginfdlls = edosUtil.getHistoryDatasSnap(fdlAi,
- begindate.getTime() / 1000, begindate.getTime() / 1000,
- (long) 1, 3600L);
- if (!beginfdlls.isEmpty()) {
- beginfdl = beginfdlls.get(0).getPointValueInDouble();
- }
- List<PointData> 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<PointData> beginllfdls = edosUtil.getHistoryDatasSnap(llfdlAi,
- begindate.getTime() / 1000, begindate.getTime() / 1000,
- (long) 1, 3600L);
- if (!beginllfdls.isEmpty()) {
- beginllfdl = beginllfdls.get(0).getPointValueInDouble();
- }
- List<PointData> 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<PointData> 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<PointData> 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<PointData> 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<DataVo> findRealPowerCharBy24(String wtId, Date recorddate) throws Exception {
- List<DataVo> vos = new ArrayList<DataVo>();
- 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<String, ProBasicEquipmentPoint> 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<PointData> 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<PointData> 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<PointData> 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<PointData> 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<PointData> 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<PointData> 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<PvVo> pvgoodness(String companys, String wpid, String recorddate, String target, String sort) {
- Map<String, ProEconEquipmentmodel> modelMap = CacheContext.modelMap;
- Map<String, ProBasicEquipment> wtmap = CacheContext.wtmap;
- List<PvVo> resultList = new ArrayList<>();
- LambdaQueryWrapper<ProEconEquipmentInfoDay6> 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<ProEconEquipmentInfoDay6> 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<PvVo> pvgoodnesshis(String wpid, String wtid, String beginDate, String endDate, String target, String sort) {
- Map<String, ProEconEquipmentmodel> modelMap = CacheContext.modelMap;
- Map<String, ProBasicEquipment> wtmap = CacheContext.wtmap;
- List<PvVo> resultList = new ArrayList<>();
- LambdaQueryWrapper<ProEconEquipmentInfoDay6> 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<ProEconEquipmentInfoDay6> 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;
- }
- }
|