12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105 |
- package com.gyee.runeconomy.service.homepage;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.gyee.common.util.DateUtils;
- import com.gyee.common.vo.healthmanager.CompareVo;
- import com.gyee.runeconomy.dto.response.EconHomePagePointRateDTO;
- import com.gyee.runeconomy.dto.response.ProEconPointCodeDTO;
- import com.gyee.runeconomy.init.CacheContext;
- import com.gyee.runeconomy.model.StationInfoMin;
- import com.gyee.runeconomy.model.auto.*;
- import com.gyee.runeconomy.model.vo.*;
- import com.gyee.runeconomy.service.auto.*;
- import org.hibernate.query.criteria.internal.expression.function.AggregationFunction;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import javax.annotation.Resource;
- import java.math.BigDecimal;
- import java.math.RoundingMode;
- import java.text.DecimalFormat;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.time.*;
- import java.time.format.DateTimeFormatter;
- import java.time.temporal.TemporalAdjusters;
- import java.util.*;
- import java.util.stream.Collectors;
- /**
- * 经济运行首页服务类
- */
- @Service
- public class EconomyPointHomePageService {
- @Autowired
- private IProEconPowerstationInfoDay1Service proEconPowerstationInfoDay1Service;//场站五损电量
- @Autowired
- private IProEconPowerstationInfoDay2Service proEconPowerstationInfoDay2Service;//场站五损时间
- @Autowired
- private IProEconPowerstationInfoDay4Service proEconPowerstationInfoDay4Service;//场站三率mtbf
- @Autowired
- private IProEconPowerstationInfoDay5Service proEconPowerstationInfoDay5Service;//电表发电量
- @Autowired
- private IProEconPowerstationInfoDay6Service proEconPowerstationInfoDay6Service;//测风塔出线功率
- @Autowired
- private IProEconPowerstationInfoDay7Service proEconPowerstationInfoDay7Service;//光伏
- @Autowired
- private IProBasicCompanyService proBasicCompanyService;
- @Autowired
- private IProBasicPowerstationService proBasicPowerstationService;
- @Autowired
- private IProEconPointCodeService proEconPointCodeService;
- @Resource
- private IProEconPowerstationInfoDay2Service iProEconPowerstationInfoDay2Service;
- @Resource
- private IProBasicProjectPlanService iProBasicProjectPlanService;
- @Resource
- private IStationInfoMinService iStationInfoMinService;
- @Resource
- private IStationInfoDayService iStationInfoDayService;
- @Resource
- private ITurbineInfoDayService iTurbineInfoDayService;
- /**
- * 指标率相应类
- */
- private EconHomePagePointRateDTO dto = null;
- /**
- * 五损
- */
- private Map<String, ProEconPowerstationInfoDay1> wsmap = new HashMap<>();
- /**
- * 三率
- */
- private Map<String, ProEconPowerstationInfoDay4> slmap = new HashMap<>();
- private Map<String, ProEconPowerstationInfoDay7> gfslmap = new HashMap<>();
- /**
- * 电量
- */
- private Map<String, ProEconPowerstationInfoDay5> dlmap = new HashMap<>();
- /**
- * 功率
- */
- private Map<String, ProEconPowerstationInfoDay6> glmap = new HashMap<>();
- /**
- * 五损时间
- */
- private Map<String, ProEconPowerstationInfoDay2> wstimemap = new HashMap<>();
- /**
- * 综合场用电率
- */
- private List<ProEconPowerstationInfoDay5> zhcydllist = new ArrayList<>();
- /**
- * 电量统计分析
- */
- private List<ProEconPowerstationInfoDay1> dltjfxlist = new ArrayList<>();
- private List<ProEconPowerstationInfoDay4> threeRateCurvelist = new ArrayList<>();//三率曲线数据
- private List<ProEconPowerstationInfoDay7> gfthreeRateCurvelist = new ArrayList<>();
- private BigDecimal capacity = null;
- private Integer quantity = null;
- private Map<String, BigDecimal> wsdlfx = null;//五损电量分析
- private List<Map<String, Object>> zhcydl = null;//综合场用电率
- private List<Map<String, Object>> dltjfxList = null;//电量统计分析
- private List<Map<String, Object>> slqxList = null;//三率曲线
- private Map<String, Object> fdinfomap = null;//发电(风能利用率、发电量、欠发电量)
- private List<Map<String, Object>> stainfo = null;//场站性息
- private Map<String, BigDecimal> yfdlCal = new HashMap<>();
- private Map<String, BigDecimal> yllfdlCal = new HashMap<>();
- private Map<Integer, BigDecimal> nfdlCal = new HashMap<>();
- private Map<Integer, BigDecimal> nllfdlCal = new HashMap<>();
- private LocalDate lastCalDate;
- private Map<LocalDate, BigDecimal> fnlyl = new HashMap<>();
- /**
- * 经济运行首页聚合方法
- *
- * @param foreignKeyId
- * @param staType
- * @param dateType
- * @return
- */
- public Map<String, Object> getEconomyPointHomePageInfo2(String foreignKeyId, String regionId1, String companyId1, String staType, String dateType, String pointCode) throws ParseException {
- Map<String, Object> allmap = new HashMap<>();
- List<GeneratingCapacityVo> ls = new ArrayList<>();
- LocalDate now = LocalDate.now();
- QueryWrapper<ProEconPowerstationInfoDay1> qw = new QueryWrapper<>();
- qw.lambda().eq(ProEconPowerstationInfoDay1::getRecordDate, now)
- .eq(ProEconPowerstationInfoDay1::getForeignKeyId, CacheContext.wpls.get(0).getId());
- List<ProEconPowerstationInfoDay1> day1s = proEconPowerstationInfoDay1Service.list(qw);
- // for (ProEconPowerstationInfoDay1 day1 : day1s) {
- // GeneratingCapacityVo rfdl = new GeneratingCapacityVo();
- // rfdl.setName("日发电量");
- // rfdl.setValue(day1.getRfdl());
- // rfdl.setTotal(day1.getRllfdl());
- // rfdl.setBfb(new BigDecimal("5.00"));
- // ls.add(rfdl);
- //
- // GeneratingCapacityVo yfdl = new GeneratingCapacityVo();
- // yfdl.setName("月发电量");
- // yfdl.setValue(day1.getYfdl());
- // yfdl.setTotal(day1.getYllfdl());
- // yfdl.setBfb(new BigDecimal("5.00"));
- // ls.add(yfdl);
- //
- // GeneratingCapacityVo nfdl = new GeneratingCapacityVo();
- // nfdl.setName("年发电量");
- // nfdl.setValue(day1.getNfdl());
- // nfdl.setTotal(day1.getNllfdl());
- // nfdl.setBfb(new BigDecimal("5.00"));
- // ls.add(nfdl);
- // }
- //
- // Map<String, Object> zbtqdb = new HashMap<>();
- // List<ColumnVo> ls1 = new ArrayList<>();
- // ColumnVo cl1 = new ColumnVo();
- // cl1.setName("指标名称");
- // cl1.setField("wtId");
- // ColumnVo cl2 = new ColumnVo();
- // cl2.setName(String.valueOf(LocalDate.now().getYear()));
- // cl2.setField("recodedate");
- // ColumnVo cl3 = new ColumnVo();
- // cl3.setName(String.valueOf(LocalDate.now().getYear() - 1));
- // cl3.setField("recodedate2");
- // ColumnVo cl4 = new ColumnVo();
- // cl4.setName("涨跌%");
- // cl4.setField("operation");
- // ls1.add(cl1);
- // ls1.add(cl2);
- // ls1.add(cl3);
- // ls1.add(cl4);
- //
- // List<ColumnVo> ls2 = new ArrayList<>();
- //
- // zbtqdb.put("column", ls1);
- // zbtqdb.put("data", ls2);
- // allmap.put("fdl", ls);
- // allmap.put("zbtqdb", zbtqdb);
- return allmap;
- }
- /**
- * 经济运行首页聚合方法
- *
- * @param foreignKeyId
- * @param staType
- * @param dateType
- * @return
- */
- public Map<String, Object> getEconomyPointHomePageInfo(String foreignKeyId, String regionId1, String companyId1, String staType, String dateType, String pointCode) throws ParseException {
- Map<String, Object> allmap = new HashMap<>();
- //获取当前时间
- String strdate = DateUtils.toDate1(new Date());
- Date date = DateUtils.parseDate(strdate);
- dto = new EconHomePagePointRateDTO();
- /** 五损 */
- wsmap = proEconPowerstationInfoDay1Service.getEconFiveLoss(foreignKeyId, staType, dateType, date);
- /** 三率 */
- gfslmap = proEconPowerstationInfoDay7Service.getEconThreeRate(foreignKeyId, staType, dateType, date);
- slmap = proEconPowerstationInfoDay4Service.getEconThreeRate(foreignKeyId, staType, dateType, date);
- /** 综合场用电量 */
- dlmap = proEconPowerstationInfoDay5Service.getEconElectricQuantity(foreignKeyId, staType, dateType, date);
- /** 场功率 */
- glmap = proEconPowerstationInfoDay6Service.getEconPowerOfField(foreignKeyId, staType, dateType, date);
- /** 五损时间 */
- wstimemap = proEconPowerstationInfoDay2Service.getEconFiveLossTime(foreignKeyId, staType, dateType, date);
- /** 装机容量 */
- capacity = new BigDecimal(proBasicCompanyService.getProBasicCompanyCapacity("", foreignKeyId));
- /**装机数量*/
- quantity = proBasicCompanyService.getProBasicCompanyQuantity("", foreignKeyId);
- //综合场用电量
- zhcydllist = proEconPowerstationInfoDay5Service.getEconZhcydldb(foreignKeyId, staType, dateType, date);
- //电量统计分析
- dltjfxlist = proEconPowerstationInfoDay1Service.getEconFiveLosslist(foreignKeyId, staType, dateType, date);
- //三率曲线
- threeRateCurvelist = proEconPowerstationInfoDay4Service.getEconThreeRateCurve(foreignKeyId, staType, dateType, date);
- gfthreeRateCurvelist = proEconPowerstationInfoDay7Service.getEconThreeRateCurve(foreignKeyId, staType, dateType, date);
- powerstationFnlyl(foreignKeyId, staType, date);//地图场站性息
- wsdlfx = new HashMap<>();//五损电量分析
- zhcydl = new ArrayList<>();//综合场用电率
- dltjfxList = new ArrayList<>();//电量统计分析
- fdinfomap = new HashMap<>();//(风能利用率、发电量、欠发电量)
- slqxList = new ArrayList<>();//三率曲线
- switch (dateType) {
- case "r":
- currFiveInfo();
- currThreeRateInfo(staType);
- currOtherInfo();
- currFiveDlFx();
- currZhcydl();
- currDltjfx();
- currThreeRateCurve(staType);
- currfdinfo();
- break;
- case "y":
- monthFiveInfo();
- monthThreeRateInfo(staType);
- monthOtherInfo();
- monthFiveDlFx();
- monthZhcydl();
- monthDltjfx();
- monthThreeRateCurve(staType);
- monthfdinfo();
- break;
- case "n":
- yearFiveInfo();
- yearThreeRateInfo(staType);
- yearOtherInfo();
- yearFiveDlFx();
- yearZhcydl();
- yearDltjfx();
- yearThreeRateCurve(staType);
- yearfdinfo();
- break;
- }
- allmap.put("zbl", dto);//页面第一行的
- allmap.put("stainfo", stainfo);//场站性息(装机容量)
- allmap.put("sldlfx", wsdlfx);//损失电量分析
- allmap.put("zhcydl", zhcydl);//综合场用电率
- allmap.put("dltjfx", dltjfxList);//电量统计分析
- allmap.put("fdlinfo", fdinfomap);//发电量 欠发电量 风能利用率
- allmap.put("slqx", slqxList);//三率曲线
- // allmap.put("zbphl", pointCodeDTO);//排行榜
- return allmap;
- }
- /**
- * 指标排行榜
- *
- * @param foreignKeyId
- * @param dateType
- * @param pointCode
- * @return
- */
- public List<ProEconPointCodeDTO> getEconomyPointRanking(String foreignKeyId, String dateType, String pointCode, boolean popup, String statype) {
- //获取当前时间
- String strdate = DateUtils.toDate1(new Date());
- Date date = DateUtils.parseDate(strdate);
- List<ProEconPointCodeDTO> pointCodeDTO = proEconPointCodeService.getEconPointRanking("", foreignKeyId, pointCode, date, dateType, popup, statype);
- return pointCodeDTO;
- }
- /**
- * (风能利用率、发电量、欠发电量)
- */
- private void powerstationFnlyl(String foreignKeyId, String staType, Date date) {
- stainfo = new ArrayList<>();
- //电量统计分析
- Map<String, ProEconPowerstationInfoDay1> stamap = new HashMap<>();//场站站五损电量
- List<ProBasicPowerstation> powerstationList = proBasicPowerstationService.getProBasicPowerstationlist("", foreignKeyId, staType);
- List<String> prids = powerstationList.stream().map(ProBasicPowerstation::getId).collect(Collectors.toList());
- List<ProEconPowerstationInfoDay1> stafnlyl = proEconPowerstationInfoDay1Service.getEconFiveLosslist(prids, date);
- stafnlyl.stream().forEach(s -> {
- stamap.put(s.getForeignKeyId(), s);
- });
- powerstationList.stream().forEach(p -> {
- Map<String, Object> info = new HashMap<>();
- ProEconPowerstationInfoDay1 day1 = stamap.get(p.getId());
- info.put("aname", p.getAname());
- info.put("name", p.getName());
- info.put("nemCode", p.getNemCode());
- info.put("capacity", (p.getJrwindCapacity() + p.getJrCapacity()) / 10000);
- info.put("xPoint", p.getXEmPoint());
- info.put("yPoint", p.getYEmPoint());
- if (null != day1) {
- info.put("fdl", day1.getRfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- info.put("fnlyl", compare0(day1.getRllfdl()) ? compare100(day1.getRfdl().divide(day1.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- } else {
- info.put("fdl", 0);
- info.put("fnlyl", 0);
- }
- stainfo.add(info);
- });
- }
- /**
- * (风能利用率、发电量、欠发电量)
- */
- private void currfdinfo() {
- ProEconPowerstationInfoDay1 fdinfo = wsmap.get("currFiveInfo");
- if (null != fdinfo) {
- fdinfomap.put("fdl", fdinfo.getRfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- fdinfomap.put("qfdl", fdinfo.getRqfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- fdinfomap.put("fnlyl", compare0(fdinfo.getRllfdl()) ? compare100(fdinfo.getRfdl().divide(fdinfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- } else {
- fdinfomap.put("fdl", new BigDecimal(0));
- fdinfomap.put("qfdl", new BigDecimal(0));
- fdinfomap.put("fnlyl", new BigDecimal(0));
- }
- }
- private void monthfdinfo() {
- ProEconPowerstationInfoDay1 fdinfo = wsmap.get("currFiveInfo");
- if (null != fdinfo) {
- fdinfomap.put("fdl", fdinfo.getYfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- fdinfomap.put("qfdl", fdinfo.getYqfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- fdinfomap.put("fnlyl", compare0(fdinfo.getYllfdl()) ? compare0(fdinfo.getYllfdl()) ? compare100(fdinfo.getYfdl().divide(fdinfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0) : new BigDecimal(0));
- } else {
- fdinfomap.put("fdl", new BigDecimal(0));
- fdinfomap.put("qfdl", new BigDecimal(0));
- fdinfomap.put("fnlyl", new BigDecimal(0));
- }
- }
- private void yearfdinfo() {
- ProEconPowerstationInfoDay1 fdinfo = wsmap.get("currFiveInfo");
- if (null != fdinfo) {
- fdinfomap.put("fdl", fdinfo.getNfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- fdinfomap.put("qfdl", fdinfo.getNqfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- fdinfomap.put("fnlyl", compare0(fdinfo.getNllfdl()) ? compare0(fdinfo.getNllfdl()) ? compare100(fdinfo.getNfdl().divide(fdinfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0) : new BigDecimal(0));
- } else {
- fdinfomap.put("fdl", new BigDecimal(0));
- fdinfomap.put("qfdl", new BigDecimal(0));
- fdinfomap.put("fnlyl", new BigDecimal(0));
- }
- }
- /**
- * 三率曲线
- */
- private void currThreeRateCurve(String staType) {
- if (staType.equals("-2")) {
- gfthreeRateCurvelist.stream().forEach(i -> {
- Map<String, Object> m = new HashMap<>();
- m.put("fwjsl", i.getRxtxlpr());
- m.put("ztzhjsl", i.getRlsl());
- m.put("gzxqjsl", i.getRnbqzhxl());
- m.put("date", DateUtils.toDate1(i.getRecordDate()));
- slqxList.add(m);
- });
- } else {
- threeRateCurvelist.stream().forEach(i -> {
- Map<String, Object> m = new HashMap<>();
- m.put("fwjsl", i.getRfwjsl());
- m.put("ztzhjsl", i.getRztzhjsl());
- m.put("gzxqjsl", i.getRgzxqjsl());
- m.put("date", DateUtils.toDate1(i.getRecordDate()));
- slqxList.add(m);
- });
- }
- }
- private void monthThreeRateCurve(String staType) {
- if (staType.equals("-2")) {
- gfthreeRateCurvelist.stream().forEach(i -> {
- Map<String, Object> m = new HashMap<>();
- m.put("fwjsl", i.getYxtxlpr());
- m.put("ztzhjsl", i.getYlsl());
- m.put("gzxqjsl", i.getYnbqzhxl());
- m.put("date", DateUtils.toDate1(i.getRecordDate()));
- slqxList.add(m);
- });
- } else {
- threeRateCurvelist.stream().forEach(i -> {
- Map<String, Object> m = new HashMap<>();
- m.put("fwjsl", i.getYfwjsl());
- m.put("ztzhjsl", i.getYztzhjsl());
- m.put("gzxqjsl", i.getYgzxqjsl());
- m.put("date", DateUtils.toDate1(i.getRecordDate()));
- slqxList.add(m);
- });
- }
- }
- private void yearThreeRateCurve(String staType) {
- if (staType.equals("-2")) {
- gfthreeRateCurvelist.stream().forEach(i -> {
- Map<String, Object> m = new HashMap<>();
- m.put("fwjsl", i.getNxtxlpr());
- m.put("ztzhjsl", i.getNlsl());
- m.put("gzxqjsl", i.getNnbqzhxl());
- m.put("date", DateUtils.toDate1(i.getRecordDate()));
- slqxList.add(m);
- });
- } else {
- threeRateCurvelist.stream().forEach(i -> {
- Map<String, Object> m = new HashMap<>();
- m.put("fwjsl", i.getNfwjsl());
- m.put("ztzhjsl", i.getNztzhjsl());
- m.put("gzxqjsl", i.getNgzxqjsl());
- m.put("date", DateUtils.toDate1(i.getRecordDate()));
- slqxList.add(m);
- });
- }
- }
- /**
- * 电量统计分析
- */
- private void currDltjfx() {
- dltjfxlist.stream().forEach(i -> {
- Map<String, Object> m = new HashMap<>();
- m.put("fdl", i.getRfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //发电量
- m.put("sldl", (i.getRcwsldwssdl().add(i.getRcwsltqssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //受累
- m.put("jxdl", i.getRjxssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //检修
- m.put("xddl", (i.getRxdtjssdl().add(i.getRxdjclssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));//限电
- m.put("gzdl", i.getRgzssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //故障
- m.put("xndl", i.getRxnssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));//性能
- m.put("date", DateUtils.toDate1(i.getRecordDate()));
- dltjfxList.add(m);
- });
- }
- private void monthDltjfx() {
- dltjfxlist.stream().forEach(i -> {
- Map<String, Object> m = new HashMap<>();
- m.put("fdl", i.getYfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //发电量
- m.put("sldl", (i.getYcwsldwssdl().add(i.getRcwsltqssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //受累
- m.put("jxdl", i.getYjxssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //检修
- m.put("xddl", (i.getYxdtjssdl().add(i.getRxdjclssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));//限电
- m.put("gzdl", (i.getYgzssdl()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //故障
- m.put("xndl", (i.getYxnssdl()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));//性能
- m.put("date", DateUtils.toDate1(i.getRecordDate()));
- dltjfxList.add(m);
- });
- }
- private void yearDltjfx() {
- dltjfxlist.stream().forEach(i -> {
- Map<String, Object> m = new HashMap<>();
- m.put("fdl", i.getNfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //发电量
- m.put("sldl", (i.getNcwsldwssdl().add(i.getRcwsltqssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //受累
- m.put("jxdl", (i.getNjxssdl()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //检修
- m.put("xddl", (i.getNxdtjssdl().add(i.getRxdjclssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));//限电
- m.put("gzdl", (i.getNgzssdl()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //故障
- m.put("xndl", (i.getNxnssdl()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));//性能
- m.put("date", DateUtils.toDate1(i.getRecordDate()));
- dltjfxList.add(m);
- });
- }
- /**
- * 综合厂用电率
- */
- private void currZhcydl() {
- zhcydllist.stream().forEach(i -> {
- Map<String, Object> m = new HashMap<>();
- if (compare0(i.getRfdldb())) {
- m.put("key", DateUtils.toDate1(i.getRecordDate()));
- m.put("value", compare0(i.getRfdldb()) ? compare100(i.getRzhcydldb().divide(i.getRfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- } else {
- m.put("key", DateUtils.toDate1(i.getRecordDate()));
- m.put("value", 0);
- }
- zhcydl.add(m);
- });
- }
- private void monthZhcydl() {
- zhcydllist.stream().forEach(i -> {
- Map<String, Object> m = new HashMap<>();
- if (compare0(i.getYfdldb())) {
- m.put("key", DateUtils.toDate1(i.getRecordDate()));
- m.put("value", compare0(i.getYfdldb()) ? compare100(i.getYzhcydldb().divide(i.getYfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- } else {
- m.put("key", DateUtils.toDate1(i.getRecordDate()));
- m.put("value", 0);
- }
- zhcydl.add(m);
- });
- }
- private void yearZhcydl() {
- zhcydllist.stream().forEach(i -> {
- Map<String, Object> m = new HashMap<>();
- if (compare0(i.getNfdldb())) {
- m.put("key", DateUtils.toDate1(i.getRecordDate()));
- m.put("value", compare0(i.getNfdldb()) ? compare100(i.getNzhcydldb().divide(i.getNfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- } else {
- m.put("key", DateUtils.toDate1(i.getRecordDate()));
- m.put("value", 0);
- }
- zhcydl.add(m);
- });
- }
- /**
- * 损失电量分析
- */
- private void currFiveDlFx() {
- ProEconPowerstationInfoDay1 fiveInfo = wsmap.get("currFiveInfo");
- if (null != fiveInfo) {
- //发电量
- wsdlfx.put("fdl", fiveInfo.getRfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- //受累
- wsdlfx.put("sldl", (fiveInfo.getRcwsldwssdl().add(fiveInfo.getRcwsltqssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- //检修
- wsdlfx.put("jxdl", fiveInfo.getRjxssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- //限电
- wsdlfx.put("xddl", (fiveInfo.getRxdtjssdl().add(fiveInfo.getRxdjclssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- //故障
- wsdlfx.put("gzdl", fiveInfo.getRgzssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- //性能
- wsdlfx.put("xndl", fiveInfo.getRxnssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- } else {
- //发电量
- wsdlfx.put("fdl", new BigDecimal(0));
- //受累
- wsdlfx.put("sldl", new BigDecimal(0));
- //检修
- wsdlfx.put("jxdl", new BigDecimal(0));
- //限电
- wsdlfx.put("xddl", new BigDecimal(0));
- //故障
- wsdlfx.put("gzdl", new BigDecimal(0));
- //性能
- wsdlfx.put("xndl", new BigDecimal(0));
- }
- }
- private void monthFiveDlFx() {
- ProEconPowerstationInfoDay1 fiveInfo = wsmap.get("currFiveInfo");
- if (null != fiveInfo) {
- //发电量
- wsdlfx.put("fdl", fiveInfo.getYfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- //受累
- wsdlfx.put("sldl", (fiveInfo.getYcwsldwssdl().add(fiveInfo.getYcwsltqssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- //检修
- wsdlfx.put("jxdl", fiveInfo.getYjxssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- //限电
- wsdlfx.put("xddl", (fiveInfo.getYxdtjssdl().add(fiveInfo.getYxdjclssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- //故障
- wsdlfx.put("gzdl", fiveInfo.getYgzssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- //性能
- wsdlfx.put("xndl", fiveInfo.getYxnssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- } else {
- //发电量
- wsdlfx.put("fdl", new BigDecimal(0));
- //受累
- wsdlfx.put("sldl", new BigDecimal(0));
- //检修
- wsdlfx.put("jxdl", new BigDecimal(0));
- //限电
- wsdlfx.put("xddl", new BigDecimal(0));
- //故障
- wsdlfx.put("gzdl", new BigDecimal(0));
- //性能
- wsdlfx.put("xndl", new BigDecimal(0));
- }
- }
- private void yearFiveDlFx() {
- ProEconPowerstationInfoDay1 fiveInfo = wsmap.get("currFiveInfo");
- if (null != fiveInfo) {
- //发电量
- wsdlfx.put("fdl", fiveInfo.getNfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- //受累
- wsdlfx.put("sldl", (fiveInfo.getNcwsldwssdl().add(fiveInfo.getNcwsltqssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- //检修
- wsdlfx.put("jxdl", fiveInfo.getNjxssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- //限电
- wsdlfx.put("xddl", (fiveInfo.getNxdtjssdl().add(fiveInfo.getNxdjclssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- //故障
- wsdlfx.put("gzdl", fiveInfo.getNgzssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- //性能
- wsdlfx.put("xndl", fiveInfo.getNxnssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
- } else {
- //发电量
- wsdlfx.put("fdl", new BigDecimal(0));
- //受累
- wsdlfx.put("sldl", new BigDecimal(0));
- //检修
- wsdlfx.put("jxdl", new BigDecimal(0));
- //限电
- wsdlfx.put("xddl", new BigDecimal(0));
- //故障
- wsdlfx.put("gzdl", new BigDecimal(0));
- //性能
- wsdlfx.put("xndl", new BigDecimal(0));
- }
- }
- /**
- * 五损经济指标
- */
- private void currFiveInfo() {
- ProEconPowerstationInfoDay1 currFiveInfo = wsmap.get("currFiveInfo");
- ProEconPowerstationInfoDay1 ringFiveInfo = wsmap.get("ringFiveInfo");
- ProEconPowerstationInfoDay1 withFiveInfo = wsmap.get("withFiveInfo");
- if (null != currFiveInfo && compare0(currFiveInfo.getRllfdl())) {
- BigDecimal currgzsll = compare100(currFiveInfo.getRgzssdl().divide(currFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal currjxsll = compare100(currFiveInfo.getRjxssdl().divide(currFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal currxdsll = compare100((currFiveInfo.getRxdtjssdl().add(currFiveInfo.getRxdjclssdl())).divide(currFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal currslsll = compare100((currFiveInfo.getRcwsldwssdl().add(currFiveInfo.getRcwsltqssdl())).divide(currFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal currxnsll = compare100(currFiveInfo.getRxnssdl().divide(currFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setCurrGzsll(currgzsll);
- dto.setCurrJxsll(currjxsll);
- dto.setCurrXdsll(currxdsll);
- dto.setCurrSlsll(currslsll);
- dto.setCurrXNsll(currxnsll);
- if (null != ringFiveInfo && compare0(ringFiveInfo.getRllfdl())) {
- BigDecimal ringgzsll = compare100(ringFiveInfo.getRgzssdl().divide(ringFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal ringjxsll = compare100(ringFiveInfo.getRjxssdl().divide(ringFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal ringxdsll = compare100((ringFiveInfo.getRxdtjssdl().add(ringFiveInfo.getRxdjclssdl())).divide(ringFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal ringslsll = compare100((ringFiveInfo.getRcwsldwssdl().add(ringFiveInfo.getRcwsltqssdl())).divide(ringFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal ringxnsll = compare100(ringFiveInfo.getRxnssdl().divide(ringFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- if (compare0(ringgzsll)) {
- BigDecimal ringGzslzzl = currgzsll.subtract(ringgzsll).divide(ringgzsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setRingGzslzzl(ringGzslzzl);
- }
- if (compare0(ringjxsll)) {
- BigDecimal ringjxslzzl = currjxsll.subtract(ringjxsll).divide(ringjxsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setRingJxslzzl(ringjxslzzl);
- }
- if (compare0(ringxdsll)) {
- BigDecimal ringxdslzzl = currxdsll.subtract(ringxdsll).divide(ringxdsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setRingXdslzzl(ringxdslzzl);
- }
- if (compare0(ringslsll)) {
- BigDecimal ringslslzzl = currslsll.subtract(ringslsll).divide(ringslsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setRingSlslzzl(ringslslzzl);
- }
- if (compare0(ringxnsll)) {
- BigDecimal ringxnslzzl = currxnsll.subtract(ringxnsll).divide(ringxnsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setRingXnslzzl(ringxnslzzl);
- }
- }
- if (null != withFiveInfo && compare0(withFiveInfo.getRllfdl())) {
- BigDecimal withgzsll = compare100(withFiveInfo.getRgzssdl().divide(withFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal withjxsll = compare100(withFiveInfo.getRjxssdl().divide(withFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal withxdsll = compare100((withFiveInfo.getRxdtjssdl().add(withFiveInfo.getRxdjclssdl())).divide(withFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal withslsll = compare100((withFiveInfo.getRcwsldwssdl().add(withFiveInfo.getRcwsltqssdl())).divide(withFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal withxnsll = compare100(withFiveInfo.getRxnssdl().divide(withFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- if (compare0(withgzsll)) {
- BigDecimal withGzslzzl = compare100(currgzsll.subtract(withgzsll).divide(withgzsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setWithGzslzzl(withGzslzzl);
- }
- if (compare0(withjxsll)) {
- BigDecimal withjxslzzl = compare100(currjxsll.subtract(withjxsll).divide(withjxsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setWithJxslzzl(withjxslzzl);
- }
- if (compare0(withxdsll)) {
- BigDecimal withxdslzzl = compare100(currxdsll.subtract(withxdsll).divide(withxdsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setWithXdslzzl(withxdslzzl);
- }
- if (compare0(withslsll)) {
- BigDecimal withslslzzl = compare100(currslsll.subtract(withslsll).divide(withslsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setWithSlslzzl(withslslzzl);
- }
- if (compare0(withxnsll)) {
- BigDecimal withxnslzzl = compare100(currxnsll.subtract(withxnsll).divide(withxnsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setWithXnslzzl(withxnslzzl);
- }
- }
- }
- }
- private void monthFiveInfo() {
- ProEconPowerstationInfoDay1 currFiveInfo = wsmap.get("currFiveInfo");
- ProEconPowerstationInfoDay1 ringFiveInfo = wsmap.get("ringFiveInfo");
- ProEconPowerstationInfoDay1 withFiveInfo = wsmap.get("withFiveInfo");
- if (null != currFiveInfo && compare0(currFiveInfo.getYllfdl())) {
- BigDecimal currgzsll = compare100(currFiveInfo.getYgzssdl().divide(currFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal currjxsll = compare100(currFiveInfo.getYjxssdl().divide(currFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal currxdsll = compare100((currFiveInfo.getYxdtjssdl().add(currFiveInfo.getYxdjclssdl())).divide(currFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal currslsll = compare100((currFiveInfo.getYcwsldwssdl().add(currFiveInfo.getYcwsltqssdl())).divide(currFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal currxnsll = compare100(currFiveInfo.getYxnssdl().divide(currFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setCurrGzsll(currgzsll);
- dto.setCurrJxsll(currjxsll);
- dto.setCurrXdsll(currxdsll);
- dto.setCurrSlsll(currslsll);
- dto.setCurrXNsll(currxnsll);
- if (null != ringFiveInfo && compare0(ringFiveInfo.getYllfdl())) {
- BigDecimal ringgzsll = compare100(ringFiveInfo.getYgzssdl().divide(ringFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal ringjxsll = compare100(ringFiveInfo.getYjxssdl().divide(ringFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal ringxdsll = compare100((ringFiveInfo.getYxdtjssdl().add(ringFiveInfo.getYxdjclssdl())).divide(ringFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal ringslsll = compare100((ringFiveInfo.getYcwsldwssdl().add(ringFiveInfo.getYcwsltqssdl())).divide(ringFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal ringxnsll = compare100(ringFiveInfo.getYxnssdl().divide(ringFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- if (compare0(ringgzsll)) {
- BigDecimal ringGzslzzl = compare100(currgzsll.subtract(ringgzsll).divide(ringgzsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setRingGzslzzl(ringGzslzzl);
- }
- if (compare0(ringjxsll)) {
- BigDecimal ringjxslzzl = compare100(currjxsll.subtract(ringjxsll).divide(ringjxsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setRingJxslzzl(ringjxslzzl);
- }
- if (compare0(ringxdsll)) {
- BigDecimal ringxdslzzl = compare100(currxdsll.subtract(ringxdsll).divide(ringxdsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setRingXdslzzl(ringxdslzzl);
- }
- if (compare0(ringslsll)) {
- BigDecimal ringslslzzl = compare100(currslsll.subtract(ringslsll).divide(ringslsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setRingSlslzzl(ringslslzzl);
- }
- if (compare0(ringxnsll)) {
- BigDecimal ringxnslzzl = compare100(currxnsll.subtract(ringxnsll).divide(ringxnsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setRingXnslzzl(ringxnslzzl);
- }
- }
- if (null != withFiveInfo && compare0(withFiveInfo.getYllfdl())) {
- BigDecimal withgzsll = compare100(withFiveInfo.getYgzssdl().divide(withFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal withjxsll = compare100(withFiveInfo.getYjxssdl().divide(withFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal withxdsll = compare100((withFiveInfo.getYxdtjssdl().add(withFiveInfo.getYxdjclssdl())).divide(withFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal withslsll = compare100((withFiveInfo.getYcwsldwssdl().add(withFiveInfo.getYcwsltqssdl())).divide(withFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal withxnsll = compare100(withFiveInfo.getYxnssdl().divide(withFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- if (compare0(withgzsll)) {
- BigDecimal withGzslzzl = compare100(currgzsll.subtract(withgzsll).divide(withgzsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setWithGzslzzl(withGzslzzl);
- }
- if (compare0(withjxsll)) {
- BigDecimal withjxslzzl = compare100(currjxsll.subtract(withjxsll).divide(withjxsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setWithJxslzzl(withjxslzzl);
- }
- if (compare0(withxdsll)) {
- BigDecimal withxdslzzl = compare100(currxdsll.subtract(withxdsll).divide(withxdsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setWithXdslzzl(withxdslzzl);
- }
- if (compare0(withslsll)) {
- BigDecimal withslslzzl = compare100(currslsll.subtract(withslsll).divide(withslsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setWithSlslzzl(withslslzzl);
- }
- if (compare0(withxnsll)) {
- BigDecimal withxnslzzl = compare100(currxnsll.subtract(withxnsll).divide(withxnsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setWithXnslzzl(withxnslzzl);
- }
- }
- }
- }
- private void yearFiveInfo() {
- ProEconPowerstationInfoDay1 currFiveInfo = wsmap.get("currFiveInfo");
- ProEconPowerstationInfoDay1 ringFiveInfo = wsmap.get("ringFiveInfo");
- ProEconPowerstationInfoDay1 withFiveInfo = wsmap.get("withFiveInfo");
- if (null != currFiveInfo && compare0(currFiveInfo.getNllfdl())) {
- BigDecimal currgzsll = compare100(currFiveInfo.getNgzssdl().divide(currFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal currjxsll = compare100(currFiveInfo.getNjxssdl().divide(currFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal currxdsll = compare100((currFiveInfo.getNxdtjssdl().add(currFiveInfo.getNxdjclssdl())).divide(currFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal currslsll = compare100((currFiveInfo.getNcwsldwssdl().add(currFiveInfo.getNcwsltqssdl())).divide(currFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal currxnsll = compare100(currFiveInfo.getNxnssdl().divide(currFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setCurrGzsll(currgzsll);
- dto.setCurrJxsll(currjxsll);
- dto.setCurrXdsll(currxdsll);
- dto.setCurrSlsll(currslsll);
- dto.setCurrXNsll(currxnsll);
- if (null != ringFiveInfo && compare0(ringFiveInfo.getNllfdl())) {
- BigDecimal ringgzsll = compare100(ringFiveInfo.getNgzssdl().divide(ringFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal ringjxsll = compare100(ringFiveInfo.getNjxssdl().divide(ringFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal ringxdsll = compare100((ringFiveInfo.getNxdtjssdl().add(ringFiveInfo.getNxdjclssdl())).divide(ringFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal ringslsll = compare100((ringFiveInfo.getNcwsldwssdl().add(ringFiveInfo.getNcwsltqssdl())).divide(ringFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal ringxnsll = compare100(ringFiveInfo.getNxnssdl().divide(ringFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- if (compare0(ringgzsll)) {
- BigDecimal ringGzslzzl = compare100(currgzsll.subtract(ringgzsll).divide(ringgzsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setRingGzslzzl(ringGzslzzl);
- }
- if (compare0(ringjxsll)) {
- BigDecimal ringjxslzzl = compare100(currjxsll.subtract(ringjxsll).divide(ringjxsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setRingJxslzzl(ringjxslzzl);
- }
- if (compare0(ringxdsll)) {
- BigDecimal ringxdslzzl = compare100(currxdsll.subtract(ringxdsll).divide(ringxdsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setRingXdslzzl(ringxdslzzl);
- }
- if (compare0(ringslsll)) {
- BigDecimal ringslslzzl = compare100(currslsll.subtract(ringslsll).divide(ringslsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setRingSlslzzl(ringslslzzl);
- }
- if (compare0(ringxnsll)) {
- BigDecimal ringxnslzzl = compare100(currxnsll.subtract(ringxnsll).divide(ringxnsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setRingXnslzzl(ringxnslzzl);
- }
- }
- if (null != withFiveInfo && compare0(withFiveInfo.getNllfdl())) {
- BigDecimal withgzsll = compare100(withFiveInfo.getNgzssdl().divide(withFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal withjxsll = compare100(withFiveInfo.getNjxssdl().divide(withFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal withxdsll = compare100((withFiveInfo.getNxdtjssdl().add(withFiveInfo.getNxdjclssdl())).divide(withFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal withslsll = compare100((withFiveInfo.getNcwsldwssdl().add(withFiveInfo.getNcwsltqssdl())).divide(withFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- BigDecimal withxnsll = compare100(withFiveInfo.getNxnssdl().divide(withFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- if (compare0(withgzsll)) {
- BigDecimal withGzslzzl = compare100(currgzsll.subtract(withgzsll).divide(withgzsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setWithGzslzzl(withGzslzzl);
- }
- if (compare0(withjxsll)) {
- BigDecimal withjxslzzl = compare100(currjxsll.subtract(withjxsll).divide(withjxsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setWithJxslzzl(withjxslzzl);
- }
- if (compare0(withxdsll)) {
- BigDecimal withxdslzzl = compare100(currxdsll.subtract(withxdsll).divide(withxdsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setWithXdslzzl(withxdslzzl);
- }
- if (compare0(withslsll)) {
- BigDecimal withslslzzl = compare100(currslsll.subtract(withslsll).divide(withslsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setWithSlslzzl(withslslzzl);
- }
- if (compare0(withxnsll)) {
- BigDecimal withxnslzzl = compare100(currxnsll.subtract(withxnsll).divide(withxnsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
- dto.setWithXnslzzl(withxnslzzl);
- }
- }
- }
- }
- /**
- * 三率经济指标
- */
- private void currThreeRateInfo(String staType) {
- if (staType.equals("-2")) {
- ProEconPowerstationInfoDay7 currThreeInfo = gfslmap.get("currThreeInfo");
- ProEconPowerstationInfoDay7 ringThreeInfo = gfslmap.get("ringThreeInfo");
- ProEconPowerstationInfoDay7 withThreeInfo = gfslmap.get("withThreeInfo");
- if (null != currThreeInfo) {
- dto.setCurrFwjsl(currThreeInfo.getRxtxlpr());
- dto.setCurrZtzhl(currThreeInfo.getRlsl());
- dto.setCurrXqjsl(currThreeInfo.getRnbqzhxl());
- if (null != ringThreeInfo) {
- if (compare0(ringThreeInfo.getRxtxlpr())) {
- dto.setRingFwjszzl(compare0(ringThreeInfo.getRxtxlpr()) ? compare100((currThreeInfo.getRxtxlpr().subtract(ringThreeInfo.getRxtxlpr())).divide(ringThreeInfo.getRxtxlpr(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(ringThreeInfo.getRlsl())) {
- dto.setRingZtzhzzl(compare0(ringThreeInfo.getRlsl()) ? compare100((currThreeInfo.getRlsl().subtract(ringThreeInfo.getRlsl())).divide(ringThreeInfo.getRlsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(ringThreeInfo.getRnbqzhxl())) {
- dto.setRingXqjszzl(compare0(ringThreeInfo.getRnbqzhxl()) ? compare100((currThreeInfo.getRnbqzhxl().subtract(ringThreeInfo.getRnbqzhxl())).divide(ringThreeInfo.getRnbqzhxl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- }
- if (null != withThreeInfo) {
- if (compare0(withThreeInfo.getRxtxlpr())) {
- dto.setWithFwjszzl(compare0(withThreeInfo.getRxtxlpr()) ? compare100((currThreeInfo.getRxtxlpr().subtract(withThreeInfo.getRxtxlpr())).divide(withThreeInfo.getRxtxlpr(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(withThreeInfo.getRlsl())) {
- dto.setWithZtzhzzl(compare0(withThreeInfo.getRlsl()) ? compare100((currThreeInfo.getRlsl().subtract(withThreeInfo.getRlsl())).divide(withThreeInfo.getRlsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(withThreeInfo.getRnbqzhxl())) {
- dto.setWithXqjszzl(compare0(withThreeInfo.getRnbqzhxl()) ? compare100((currThreeInfo.getRnbqzhxl().subtract(withThreeInfo.getRnbqzhxl())).divide(withThreeInfo.getRnbqzhxl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- }
- }
- } else {
- ProEconPowerstationInfoDay4 currThreeInfo = slmap.get("currThreeInfo");
- ProEconPowerstationInfoDay4 ringThreeInfo = slmap.get("ringThreeInfo");
- ProEconPowerstationInfoDay4 withThreeInfo = slmap.get("withThreeInfo");
- if (null != currThreeInfo) {
- dto.setCurrFwjsl(currThreeInfo.getRfwjsl());
- dto.setCurrZtzhl(currThreeInfo.getRztzhjsl());
- dto.setCurrXqjsl(currThreeInfo.getRgzxqjsl());
- if (null != ringThreeInfo) {
- if (compare0(ringThreeInfo.getRfwjsl())) {
- dto.setRingFwjszzl(compare0(ringThreeInfo.getRfwjsl()) ? compare100((currThreeInfo.getRfwjsl().subtract(ringThreeInfo.getRfwjsl())).divide(ringThreeInfo.getRfwjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(ringThreeInfo.getRztzhjsl())) {
- dto.setRingZtzhzzl(compare0(ringThreeInfo.getRztzhjsl()) ? compare100((currThreeInfo.getRztzhjsl().subtract(ringThreeInfo.getRztzhjsl())).divide(ringThreeInfo.getRztzhjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(ringThreeInfo.getRgzxqjsl())) {
- dto.setRingXqjszzl(compare0(ringThreeInfo.getRgzxqjsl()) ? compare100((currThreeInfo.getRgzxqjsl().subtract(ringThreeInfo.getRgzxqjsl())).divide(ringThreeInfo.getRgzxqjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- }
- if (null != withThreeInfo) {
- if (compare0(withThreeInfo.getRfwjsl())) {
- dto.setWithFwjszzl(compare0(withThreeInfo.getRfwjsl()) ? compare100((currThreeInfo.getRfwjsl().subtract(withThreeInfo.getRfwjsl())).divide(withThreeInfo.getRfwjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(withThreeInfo.getRztzhjsl())) {
- dto.setWithZtzhzzl(compare0(withThreeInfo.getRfwjsl()) ? compare100((currThreeInfo.getRztzhjsl().subtract(withThreeInfo.getRztzhjsl())).divide(withThreeInfo.getRztzhjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(withThreeInfo.getRgzxqjsl())) {
- dto.setWithXqjszzl(compare0(withThreeInfo.getRfwjsl()) ? compare100((currThreeInfo.getRgzxqjsl().subtract(withThreeInfo.getRgzxqjsl())).divide(withThreeInfo.getRgzxqjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- }
- }
- }
- }
- private void monthThreeRateInfo(String staType) {
- if (staType.equals("-2")) {
- ProEconPowerstationInfoDay7 currThreeInfo = gfslmap.get("currThreeInfo");
- ProEconPowerstationInfoDay7 ringThreeInfo = gfslmap.get("ringThreeInfo");
- ProEconPowerstationInfoDay7 withThreeInfo = gfslmap.get("withThreeInfo");
- if (null != currThreeInfo) {
- dto.setCurrFwjsl(currThreeInfo.getYxtxlpr());
- dto.setCurrZtzhl(currThreeInfo.getYlsl());
- dto.setCurrXqjsl(currThreeInfo.getYnbqzhxl());
- if (null != ringThreeInfo) {
- if (compare0(ringThreeInfo.getYxtxlpr())) {
- dto.setRingFwjszzl(compare0(ringThreeInfo.getYxtxlpr()) ? compare100((currThreeInfo.getYxtxlpr().subtract(ringThreeInfo.getYxtxlpr())).divide(ringThreeInfo.getYxtxlpr(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(ringThreeInfo.getYlsl())) {
- dto.setRingZtzhzzl(compare0(ringThreeInfo.getYlsl()) ? compare100((currThreeInfo.getYlsl().subtract(ringThreeInfo.getYlsl())).divide(ringThreeInfo.getYlsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(ringThreeInfo.getYnbqzhxl())) {
- dto.setRingXqjszzl(compare0(ringThreeInfo.getYnbqzhxl()) ? compare100((currThreeInfo.getYnbqzhxl().subtract(ringThreeInfo.getYnbqzhxl())).divide(ringThreeInfo.getYnbqzhxl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- }
- if (null != withThreeInfo) {
- if (compare0(withThreeInfo.getYxtxlpr())) {
- dto.setWithFwjszzl(compare0(withThreeInfo.getYxtxlpr()) ? compare100((currThreeInfo.getYxtxlpr().subtract(withThreeInfo.getYxtxlpr())).divide(withThreeInfo.getYxtxlpr(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(withThreeInfo.getYlsl())) {
- dto.setWithZtzhzzl(compare0(withThreeInfo.getYlsl()) ? compare100((currThreeInfo.getYlsl().subtract(withThreeInfo.getYlsl())).divide(withThreeInfo.getYlsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(withThreeInfo.getYnbqzhxl())) {
- dto.setWithXqjszzl(compare0(withThreeInfo.getYnbqzhxl()) ? compare100((currThreeInfo.getYnbqzhxl().subtract(withThreeInfo.getYnbqzhxl())).divide(withThreeInfo.getYnbqzhxl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- }
- }
- } else {
- ProEconPowerstationInfoDay4 currThreeInfo = slmap.get("currThreeInfo");
- ProEconPowerstationInfoDay4 ringThreeInfo = slmap.get("ringThreeInfo");
- ProEconPowerstationInfoDay4 withThreeInfo = slmap.get("withThreeInfo");
- if (null != currThreeInfo) {
- dto.setCurrFwjsl(currThreeInfo.getYfwjsl());
- dto.setCurrZtzhl(currThreeInfo.getYztzhjsl());
- dto.setCurrXqjsl(currThreeInfo.getYgzxqjsl());
- if (null != ringThreeInfo) {
- if (compare0(ringThreeInfo.getYfwjsl())) {
- dto.setRingFwjszzl(compare0(ringThreeInfo.getYfwjsl()) ? compare100((currThreeInfo.getYfwjsl().subtract(ringThreeInfo.getYfwjsl())).divide(ringThreeInfo.getYfwjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(ringThreeInfo.getYztzhjsl())) {
- dto.setRingZtzhzzl(compare0(ringThreeInfo.getYztzhjsl()) ? compare100((currThreeInfo.getYztzhjsl().subtract(ringThreeInfo.getYztzhjsl())).divide(ringThreeInfo.getYztzhjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(ringThreeInfo.getYgzxqjsl())) {
- dto.setRingXqjszzl(compare0(ringThreeInfo.getYgzxqjsl()) ? compare100((currThreeInfo.getYgzxqjsl().subtract(ringThreeInfo.getYgzxqjsl())).divide(ringThreeInfo.getYgzxqjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- }
- if (null != withThreeInfo) {
- if (compare0(withThreeInfo.getYfwjsl())) {
- dto.setWithFwjszzl(compare0(withThreeInfo.getYfwjsl()) ? compare100((currThreeInfo.getYfwjsl().subtract(withThreeInfo.getYfwjsl())).divide(withThreeInfo.getYfwjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(withThreeInfo.getYztzhjsl())) {
- dto.setWithZtzhzzl(compare0(withThreeInfo.getYztzhjsl()) ? compare100((currThreeInfo.getYztzhjsl().subtract(withThreeInfo.getYztzhjsl())).divide(withThreeInfo.getYztzhjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- if (compare0(withThreeInfo.getYgzxqjsl())) {
- dto.setWithXqjszzl(compare0(withThreeInfo.getYgzxqjsl()) ? compare100((currThreeInfo.getYgzxqjsl().subtract(withThreeInfo.getYgzxqjsl())).divide(withThreeInfo.getYgzxqjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
- }
- }
- }
- }
- }
- private void yearThreeRateInfo(String staType) {
- if (staType.equals("-2")) {
- ProEconPowerstationInfoDay7 currThreeInfo = gfslmap.get("currThreeInfo");
- ProEconPowerstationInfoDay7 ringThreeInfo = gfslmap.get("ringThreeInfo");
- ProEconPowerstationInfoDay7 withThreeInfo = gfslmap.get("withThreeInfo");
- if (null != currThreeInfo) {
- dto.setCurrFwjsl(currThreeInfo.getNxtxlpr());
- dto.setCurrZtzhl(currThreeInfo.getNlsl());
- dto.setCurrXqjsl(currThreeInfo.getNnbqzhxl());
- if (null != ringThreeInfo) {
- if (compare0(ringThreeInfo.getNxtxlpr())) {
- dto.setRingFwjszzl(compare0(ringThreeInfo.getNxtxlpr()) ? (currThreeInfo.getNxtxlpr().subtract(ringThreeInfo.getNxtxlpr())).divide(ringThreeInfo.getNxtxlpr(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")) : new BigDecimal(0));
- }
- if (compare0(ringThreeInfo.getNlsl())) {
- dto.setRingZtzhzzl(compare0(ringThreeInfo.getNlsl()) ? (currThreeInfo.getNlsl().subtract(ringThreeInfo.getNlsl())).divide(ringThreeInfo.getNlsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")) : new BigDecimal(0));
- }
- if (compare0(ringThreeInfo.getNnbqzhxl())) {
- dto.setRingXqjszzl(compare0(ringThreeInfo.getNnbqzhxl()) ? (currThreeInfo.getNnbqzhxl().subtract(ringThreeInfo.getNnbqzhxl())).divide(ringThreeInfo.getNnbqzhxl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")) : new BigDecimal(0));
- }
- }
- if (null != withThreeInfo) {
- if (compare0(withThreeInfo.getNxtxlpr())) {
- dto.setWithFwjszzl(compare0(withThreeInfo.getNxtxlpr()) ? (currThreeInfo.getNxtxlpr().subtract(withThreeInfo.getNxtxlpr())).divide(withThreeInfo.getNxtxlpr(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")) : new BigDecimal(0));
- }
- if (compare0(withThreeInfo.getNlsl())) {
- dto.setWithZtzhzzl(compare0(withThreeInfo.getNlsl()) ? (currThreeInfo.getNlsl().subtract(withThreeInfo.getNlsl())).divide(withThreeInfo.getNlsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")) : new BigDecimal(0));
- }
- if (compare0(withThreeInfo.getNnbqzhxl())) {
- dto.setWithXqjszzl(compare0(withThreeInfo.getNnbqzhxl()) ? (currThreeInfo.getNnbqzhxl().subtract(withThreeInfo.getNnbqzhxl())).divide(withThreeInfo.getNnbqzhxl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")) : new BigDecimal(0));
- }
- }
- }
- } else {
- ProEconPowerstationInfoDay4 currThreeInfo = slmap.get("currThreeInfo");
- ProEconPowerstationInfoDay4 ringThreeInfo = slmap.get("ringThreeInfo");
- ProEconPowerstationInfoDay4 withThreeInfo = slmap.get("withThreeInfo");
- if (null != currThreeInfo) {
- dto.setCurrFwjsl(currThreeInfo.getNfwjsl());
- dto.setCurrZtzhl(currThreeInfo.getNztzhjsl());
- dto.setCurrXqjsl(currThreeInfo.getNgzxqjsl());
- if (null != ringThreeInfo) {
- if (compare0(ringThreeInfo.getNfwjsl())) {
- dto.setRingFwjszzl(compare0(ringThreeInfo.getNfwjsl()) ? (currThreeInfo.getNfwjsl().subtract(ringThreeInfo.getNfwjsl())).divide(ringThreeInfo.getNfwjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")) : new BigDecimal(0));
- }
- if (compare0(ringThreeInfo.getNztzhjsl())) {
- dto.setRingZtzhzzl(compare0(ringThreeInfo.getNztzhjsl()) ? (currThreeInfo.getNztzhjsl().subtract(ringThreeInfo.getNztzhjsl())).divide(ringThreeInfo.getNztzhjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")) : new BigDecimal(0));
- }
- if (compare0(ringThreeInfo.getNgzxqjsl())) {
- dto.setRingXqjszzl(compare0(ringThreeInfo.getNgzxqjsl()) ? (currThreeInfo.getNgzxqjsl().subtract(ringThreeInfo.getNgzxqjsl())).divide(ringThreeInfo.getNgzxqjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")) : new BigDecimal(0));
- }
- }
- if (null != withThreeInfo) {
- if (compare0(withThreeInfo.getNfwjsl())) {
- dto.setWithFwjszzl(compare0(withThreeInfo.getNfwjsl()) ? (currThreeInfo.getNfwjsl().subtract(withThreeInfo.getNfwjsl())).divide(withThreeInfo.getNfwjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")) : new BigDecimal(0));
- }
- if (compare0(withThreeInfo.getNztzhjsl())) {
- dto.setWithZtzhzzl(compare0(withThreeInfo.getNztzhjsl()) ? (currThreeInfo.getNztzhjsl().subtract(withThreeInfo.getNztzhjsl())).divide(withThreeInfo.getNztzhjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")) : new BigDecimal(0));
- }
- if (compare0(withThreeInfo.getNgzxqjsl())) {
- dto.setWithXqjszzl(compare0(withThreeInfo.getNgzxqjsl()) ? (currThreeInfo.getNgzxqjsl().subtract(withThreeInfo.getNgzxqjsl())).divide(withThreeInfo.getNgzxqjsl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")) : new BigDecimal(0));
- }
- }
- }
- }
- }
- /**
- * 其它经济指标
- */
- private void currOtherInfo() {
- ProEconPowerstationInfoDay5 currDlInfo = dlmap.get("currDlInfo");
- ProEconPowerstationInfoDay5 ringDlInfo = dlmap.get("ringDlInfo");
- ProEconPowerstationInfoDay5 withDlInfo = dlmap.get("withDlInfo");
- ProEconPowerstationInfoDay6 currGlInfo = glmap.get("currGlInfo");
- ProEconPowerstationInfoDay6 ringGlInfo = glmap.get("ringGlInfo");
- ProEconPowerstationInfoDay6 withGlInfo = glmap.get("withGlInfo");
- ProEconPowerstationInfoDay2 currTimeInfo = wstimemap.get("currTimeInfo");
- ProEconPowerstationInfoDay2 ringTimeInfo = wstimemap.get("ringTimeInfo");
- ProEconPowerstationInfoDay2 withTimeInfo = wstimemap.get("withTimeInfo");
- if (null != currDlInfo && compare0(currDlInfo.getRfdldb())) {
- BigDecimal currZhcydl = compare0(currDlInfo.getRfdldb()) ? compare100(currDlInfo.getRzhcydldb().divide(currDlInfo.getRfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0);
- dto.setCurrZhcydl(currZhcydl);
- if (null != ringDlInfo && compare0(currDlInfo.getRfdldb())) {
- if (compare0(ringDlInfo.getRfdldb())) {
- BigDecimal ringZhcydl = ringDlInfo.getRzhcydldb().divide(ringDlInfo.getRfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(ringZhcydl)) {
- BigDecimal ringZhcydzzl = (currZhcydl.subtract(ringZhcydl)).divide(ringZhcydl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setRingZhcydzzl(ringZhcydzzl);
- }
- }
- }
- if (null != withDlInfo && compare0(currDlInfo.getRfdldb())) {
- if (compare0(withDlInfo.getRfdldb())) {
- BigDecimal withZhcydl = withDlInfo.getRzhcydldb().divide(withDlInfo.getRfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(withZhcydl)) {
- BigDecimal withZhcydzzl = (currZhcydl.subtract(withZhcydl)).divide(withZhcydl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setWithZhcydzzl(withZhcydzzl);
- }
- }
- }
- }
- if (null != currGlInfo && compare0(capacity)) {
- BigDecimal currGlqxfhl = currGlInfo.getRpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setCurrGlqxfhl(currGlqxfhl);
- if (null != ringGlInfo) {
- BigDecimal ringGlqxfhl = ringGlInfo.getRpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(ringGlqxfhl)) {
- BigDecimal ringGlqxfhzzl = (currGlqxfhl.subtract(ringGlqxfhl)).divide(ringGlqxfhl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setRingGlqxfhzzl(ringGlqxfhzzl);
- }
- }
- if (null != withGlInfo) {
- BigDecimal withGlqxfhl = withGlInfo.getRpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(withGlqxfhl)) {
- BigDecimal withGlqxfhzzl = (currGlqxfhl.subtract(withGlqxfhl)).divide(withGlqxfhl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setWithGlqxfhzzl(withGlqxfhzzl);
- }
- }
- }
- if (null != currTimeInfo) {
- double currhours = DateUtils.hoursDiff1(new Date(), DateUtils.getStartOfDay(new Date()));
- BigDecimal currhours2 = new BigDecimal(0.00).valueOf(currhours);
- currhours2 = compare0(currhours2) ? currhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
- currhours2 = compare0(currhours2) ? currhours2 : new BigDecimal(1);
- BigDecimal currSbklyl = currhours2.subtract((currTimeInfo.getRhjgzxsmx().add(currTimeInfo.getRhjjxtjxs()))).divide(currhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setCurrSbklyl(currSbklyl);
- if (null != ringTimeInfo) {
- int ringhours = DateUtils.hoursDiff(new Date(), DateUtils.getMonthFirstZero());
- BigDecimal ringhours2 = new BigDecimal(0.00).valueOf((int) ringhours);
- ringhours2 = compare0(ringhours2) ? ringhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
- BigDecimal ringSbklyl = ringhours2.subtract((ringTimeInfo.getRhjgzxsmx().add(ringTimeInfo.getRhjjxtjxs()))).divide(ringhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(ringSbklyl)) {
- BigDecimal ringSbklyzzl = (currSbklyl.subtract(ringSbklyl)).divide(ringSbklyl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setRingSbklyzzl(ringSbklyzzl);
- }
- }
- if (null != withTimeInfo) {
- int withhours = DateUtils.hoursDiff(new Date(), DateUtils.getYearFirstZero());
- BigDecimal withhours2 = new BigDecimal(0.00).valueOf((int) withhours);
- withhours2 = compare0(withhours2) ? withhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
- BigDecimal withSbklyl = withhours2.subtract((withTimeInfo.getRhjgzxsmx().add(withTimeInfo.getRhjjxtjxs()))).divide(withhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(withSbklyl)) {
- BigDecimal withSbklyzzl = (currSbklyl.subtract(withSbklyl)).divide(withSbklyl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setWithSbklyzzl(withSbklyzzl);
- }
- }
- }
- }
- private void monthOtherInfo() {
- ProEconPowerstationInfoDay5 currDlInfo = dlmap.get("currDlInfo");
- ProEconPowerstationInfoDay5 ringDlInfo = dlmap.get("ringDlInfo");
- ProEconPowerstationInfoDay5 withDlInfo = dlmap.get("withDlInfo");
- ProEconPowerstationInfoDay6 currGlInfo = glmap.get("currGlInfo");
- ProEconPowerstationInfoDay6 ringGlInfo = glmap.get("ringGlInfo");
- ProEconPowerstationInfoDay6 withGlInfo = glmap.get("withGlInfo");
- ProEconPowerstationInfoDay2 currTimeInfo = wstimemap.get("currTimeInfo");
- ProEconPowerstationInfoDay2 ringTimeInfo = wstimemap.get("ringTimeInfo");
- ProEconPowerstationInfoDay2 withTimeInfo = wstimemap.get("withTimeInfo");
- if (null != currDlInfo && compare0(currDlInfo.getYfdldb())) {
- BigDecimal currZhcydl = currDlInfo.getYzhcydldb().divide(currDlInfo.getYfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setCurrZhcydl(currZhcydl);
- if (null != ringDlInfo && compare0(ringDlInfo.getYfdldb())) {
- BigDecimal ringZhcydl = ringDlInfo.getYzhcydldb().divide(ringDlInfo.getYfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(ringZhcydl)) {
- BigDecimal ringZhcydzzl = (currZhcydl.subtract(ringZhcydl)).divide(ringZhcydl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setRingZhcydzzl(ringZhcydzzl);
- }
- }
- if (null != withDlInfo && compare0(withDlInfo.getYfdldb())) {
- BigDecimal withZhcydl = withDlInfo.getYzhcydldb().divide(withDlInfo.getYfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(withZhcydl)) {
- BigDecimal withZhcydzzl = (currZhcydl.subtract(withZhcydl)).divide(withZhcydl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setWithZhcydzzl(withZhcydzzl);
- }
- }
- }
- if (null != currGlInfo && compare0(capacity)) {
- BigDecimal currGlqxfhl = currGlInfo.getYpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setCurrGlqxfhl(currGlqxfhl);
- if (null != ringGlInfo) {
- BigDecimal ringGlqxfhl = ringGlInfo.getYpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(ringGlqxfhl)) {
- BigDecimal ringGlqxfhzzl = (currGlqxfhl.subtract(ringGlqxfhl)).divide(ringGlqxfhl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setRingGlqxfhzzl(ringGlqxfhzzl);
- }
- }
- if (null != withGlInfo) {
- BigDecimal withGlqxfhl = withGlInfo.getYpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(withGlqxfhl)) {
- BigDecimal withGlqxfhzzl = (currGlqxfhl.subtract(withGlqxfhl)).divide(withGlqxfhl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setWithGlqxfhzzl(withGlqxfhzzl);
- }
- }
- }
- if (null != currTimeInfo) {
- int currhours = DateUtils.hoursDiff(new Date(), DateUtils.getStartOfDay(new Date()));
- BigDecimal currhours2 = new BigDecimal(0.00).valueOf((int) currhours);
- currhours2 = compare0(currhours2) ? currhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
- BigDecimal currSbklyl = currhours2.subtract((currTimeInfo.getYhjgzxsmx().add(currTimeInfo.getYhjjxtjxs()))).divide(currhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setCurrSbklyl(currSbklyl);
- if (null != ringTimeInfo) {
- int ringhours = DateUtils.hoursDiff(new Date(), DateUtils.getMonthFirstZero());
- BigDecimal ringhours2 = new BigDecimal(0.00).valueOf((int) ringhours);
- ringhours2 = compare0(ringhours2) ? ringhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
- BigDecimal ringSbklyl = ringhours2.subtract((ringTimeInfo.getYhjgzxsmx().add(ringTimeInfo.getYhjjxtjxs()))).divide(ringhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(ringSbklyl)) {
- BigDecimal ringSbklyzzl = (currSbklyl.subtract(ringSbklyl)).divide(ringSbklyl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setRingSbklyzzl(ringSbklyzzl);
- }
- }
- if (null != withTimeInfo) {
- int withhours = DateUtils.hoursDiff(new Date(), DateUtils.getYearFirstZero());
- BigDecimal withhours2 = new BigDecimal(0.00).valueOf((int) withhours);
- withhours2 = compare0(withhours2) ? withhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
- BigDecimal withSbklyl = withhours2.subtract((withTimeInfo.getYhjgzxsmx().add(withTimeInfo.getYhjjxtjxs()))).divide(withhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(withSbklyl)) {
- BigDecimal withSbklyzzl = (currSbklyl.subtract(withSbklyl)).divide(withSbklyl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setWithSbklyzzl(withSbklyzzl);
- }
- }
- }
- }
- private void yearOtherInfo() {
- ProEconPowerstationInfoDay5 currDlInfo = dlmap.get("currDlInfo");
- ProEconPowerstationInfoDay5 ringDlInfo = dlmap.get("ringDlInfo");
- ProEconPowerstationInfoDay5 withDlInfo = dlmap.get("withDlInfo");
- ProEconPowerstationInfoDay6 currGlInfo = glmap.get("currGlInfo");
- ProEconPowerstationInfoDay6 ringGlInfo = glmap.get("ringGlInfo");
- ProEconPowerstationInfoDay6 withGlInfo = glmap.get("withGlInfo");
- ProEconPowerstationInfoDay2 currTimeInfo = wstimemap.get("currTimeInfo");
- ProEconPowerstationInfoDay2 ringTimeInfo = wstimemap.get("ringTimeInfo");
- ProEconPowerstationInfoDay2 withTimeInfo = wstimemap.get("withTimeInfo");
- if (null != currDlInfo && compare0(currDlInfo.getNfdldb())) {
- BigDecimal currZhcydl = compare0(currDlInfo.getNfdldb()) ? currDlInfo.getNzhcydldb().divide(currDlInfo.getNfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")) : new BigDecimal(0);
- dto.setCurrZhcydl(currZhcydl);
- if (null != ringDlInfo && compare0(currDlInfo.getNfdldb())) {
- BigDecimal ringZhcydl = ringDlInfo.getNzhcydldb().divide(ringDlInfo.getNfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(ringZhcydl)) {
- BigDecimal ringZhcydzzl = (currZhcydl.subtract(ringZhcydl)).divide(ringZhcydl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setRingZhcydzzl(ringZhcydzzl);
- }
- }
- if (null != withDlInfo && compare0(currDlInfo.getNfdldb())) {
- BigDecimal withZhcydl = withDlInfo.getNzhcydldb().divide(withDlInfo.getNfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(withZhcydl)) {
- BigDecimal withZhcydzzl = (currZhcydl.subtract(withZhcydl)).divide(withZhcydl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setWithZhcydzzl(withZhcydzzl);
- }
- }
- }
- if (null != currGlInfo && compare0(capacity)) {
- BigDecimal currGlqxfhl = currGlInfo.getNpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setCurrGlqxfhl(currGlqxfhl);
- if (null != ringGlInfo) {
- BigDecimal ringGlqxfhl = ringGlInfo.getNpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(ringGlqxfhl)) {
- BigDecimal ringGlqxfhzzl = (currGlqxfhl.subtract(ringGlqxfhl)).divide(ringGlqxfhl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setRingGlqxfhzzl(ringGlqxfhzzl);
- }
- }
- if (null != withGlInfo) {
- BigDecimal withGlqxfhl = withGlInfo.getNpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(withGlqxfhl)) {
- BigDecimal withGlqxfhzzl = (currGlqxfhl.subtract(withGlqxfhl)).divide(withGlqxfhl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setWithGlqxfhzzl(withGlqxfhzzl);
- }
- }
- }
- if (null != currTimeInfo) {
- int currhours = DateUtils.hoursDiff(new Date(), DateUtils.getStartOfDay(new Date()));
- BigDecimal currhours2 = new BigDecimal(0).valueOf((int) currhours);
- currhours2 = compare0(currhours2) ? currhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
- BigDecimal currSbklyl = currhours2.subtract((currTimeInfo.getNhjgzxsmx().add(currTimeInfo.getNhjjxtjxs()))).divide(currhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setCurrSbklyl(currSbklyl);
- if (null != ringTimeInfo) {
- int ringhours = DateUtils.hoursDiff(new Date(), DateUtils.getMonthFirstZero());
- BigDecimal ringhours2 = new BigDecimal(0).valueOf((int) ringhours);
- ringhours2 = compare0(ringhours2) ? ringhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
- BigDecimal ringSbklyl = ringhours2.subtract((ringTimeInfo.getNhjgzxsmx().add(ringTimeInfo.getNhjjxtjxs()))).divide(ringhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(ringSbklyl)) {
- BigDecimal ringSbklyzzl = (currSbklyl.subtract(ringSbklyl)).divide(ringSbklyl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setRingSbklyzzl(ringSbklyzzl);
- }
- }
- if (null != withTimeInfo) {
- int withhours = DateUtils.hoursDiff(new Date(), DateUtils.getYearFirstZero());
- BigDecimal withhours2 = new BigDecimal(0).valueOf((int) withhours);
- withhours2 = compare0(withhours2) ? withhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
- BigDecimal withSbklyl = withhours2.subtract((withTimeInfo.getNhjgzxsmx().add(withTimeInfo.getNhjjxtjxs()))).divide(withhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- if (compare0(withSbklyl)) {
- BigDecimal withSbklyzzl = (currSbklyl.subtract(withSbklyl)).divide(withSbklyl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
- dto.setWithSbklyzzl(withSbklyzzl);
- }
- }
- }
- }
- private BigDecimal compare100(BigDecimal a) {
- BigDecimal b = new BigDecimal(100);
- if (b.compareTo(a) == -1) {
- a = new BigDecimal(100);
- ;
- }
- return a;
- }
- private boolean compare0(BigDecimal a) {
- BigDecimal b = new BigDecimal(0.00);
- if (b.compareTo(a.setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
- return false;
- }
- return true;
- }
- public Map<String, Object> getHomeRight(String companyId, String periodType) {
- Map<String, Object> allmap = new HashMap<>();
- Map<String, Object> sbklyl = new HashMap<>();
- LocalDate nowStart = null;
- LocalDate nowEnd = LocalDate.now();
- LocalDate lastYearStartDate = null;
- LocalDate lastYearEndDate = null;
- if ("year".equals(periodType)) {
- nowStart = nowEnd.with(TemporalAdjusters.firstDayOfYear());
- lastYearStartDate = nowEnd.minusYears(1).with(TemporalAdjusters.firstDayOfYear());
- lastYearEndDate = nowEnd.minusYears(1).atStartOfDay().toLocalDate();
- } else if ("month".equals(periodType)) {
- nowStart = nowEnd.with(TemporalAdjusters.firstDayOfMonth());
- lastYearStartDate = nowEnd.minusYears(1).with(TemporalAdjusters.firstDayOfMonth());
- lastYearEndDate = nowEnd.minusYears(1).atStartOfDay().toLocalDate();
- } else if ("week".equals(periodType)) {
- nowStart = nowEnd.with(DayOfWeek.MONDAY);
- lastYearStartDate = nowEnd.minusYears(1).with(DayOfWeek.MONDAY);
- lastYearEndDate = nowEnd.minusYears(1).atStartOfDay().toLocalDate();
- }
- Map<String, Object> zbtqdb = new HashMap<>();
- String[] title = {"排名", "名称", "风能利用率%", "去年同期%", "涨跌%"};
- List<ColumnVo> ls1 = getTitle(title);
- String[] title2 = {"排名", "名称", "设备利用率%", "去年同期%", "涨跌%"};
- List<ColumnVo> ls3 = getTitle(title2);
- List<HomeRightVo> ls2 = new ArrayList<>();
- HomeRightVo hv = new HomeRightVo();
- hv.setIndex("1");
- hv.setName(CacheContext.wplsf.get(0).getName());
- List<TurbineInfoDay> currentResults1 = getFnlyl("*", nowStart, nowEnd);
- if (null == currentResults1 || currentResults1.isEmpty()) {
- hv.setFnlyl("0.00");
- } else {
- List<TurbineInfoDay> currentResults = getFnlyl("AVG(fnlyl) AS fnlyl", nowStart, nowEnd);
- hv.setFnlyl(String.format("%.2f", currentResults.get(0).getFnlyl()));
- }
- List<TurbineInfoDay> lastYearResults1 = getFnlyl("*", lastYearStartDate, lastYearEndDate);
- if (null == lastYearResults1 || lastYearResults1.isEmpty()) {
- hv.setYearTq("0.00");
- } else {
- List<TurbineInfoDay> lastYearResults = getFnlyl("AVG(fnlyl) AS fnlyl", lastYearStartDate, lastYearEndDate);
- hv.setYearTq(String.format("%.2f", lastYearResults.get(0).getFnlyl()));
- }
- if (Double.parseDouble(hv.getFnlyl()) == 0 && Double.parseDouble(hv.getYearTq()) == 0) {
- hv.setOperation("0.00");
- } else if (Double.parseDouble(hv.getYearTq()) == 0) {
- hv.setOperation("100");
- } else if (Double.parseDouble(hv.getFnlyl()) == 0) {
- hv.setOperation("-100");
- } else {
- Double operation = calDivide(Double.parseDouble(hv.getFnlyl()) - Double.parseDouble(hv.getYearTq()), Double.valueOf(hv.getYearTq()));
- hv.setOperation(String.valueOf(operation));
- }
- ls2.add(hv);
- zbtqdb.put("column", ls1);
- zbtqdb.put("data", ls2);
- sbklyl.put("column", ls3);
- allmap.put("fnlyl", zbtqdb);
- List<HomeRightVo> ls4 = new ArrayList<>();
- HomeRightVo hv2 = new HomeRightVo();
- hv2.setIndex("1");
- hv2.setName(CacheContext.wplsf.get(0).getName());
- List<TurbineInfoDay> currentSbResults1 = getFnlyl("*", nowStart, nowEnd);
- if (null == currentSbResults1 || currentSbResults1.isEmpty()) {
- hv2.setFnlyl("0.00");
- } else {
- List<TurbineInfoDay> currentSbResults = getFnlyl("AVG(klyl) AS klyl", nowStart, nowEnd);
- hv2.setFnlyl(String.format("%.2f", currentSbResults.get(0).getKlyl()));
- }
- List<TurbineInfoDay> lastYearQwSb1 = getFnlyl("*", lastYearStartDate, lastYearEndDate);
- if (null == lastYearQwSb1 || lastYearQwSb1.isEmpty()) {
- hv2.setYearTq("0.00");
- } else {
- List<TurbineInfoDay> lastYearQwSb = getFnlyl("AVG(klyl) AS klyl", lastYearStartDate, lastYearEndDate);
- hv2.setYearTq(String.format("%.2f", lastYearQwSb.get(0).getKlyl()));
- }
- if (Double.parseDouble(hv2.getFnlyl()) == 0 && Double.parseDouble(hv2.getYearTq()) == 0) {
- hv2.setOperation("0.00");
- } else if (Double.parseDouble(hv2.getYearTq()) == 0) {
- hv2.setOperation("100");
- } else if (Double.parseDouble(hv2.getFnlyl()) == 0) {
- hv2.setOperation("-100");
- } else {
- Double aDouble1 = calDivide(Double.parseDouble(hv2.getFnlyl()) - Double.parseDouble(hv2.getYearTq()), Double.valueOf(hv2.getYearTq()));
- hv2.setOperation(String.valueOf(aDouble1));
- }
- ls4.add(hv2);
- sbklyl.put("data", ls4);
- allmap.put("sbklyl", sbklyl);
- return allmap;
- }
- private List<TurbineInfoDay> getFnlyl(String select, LocalDate start, LocalDate end) {
- QueryWrapper<TurbineInfoDay> currentQw = new QueryWrapper<>();
- currentQw.clear();
- currentQw.select(select)
- .ge("record_date", start)
- .lt("record_date", end);
- return iTurbineInfoDayService.list(currentQw);
- }
- public List<ColumnVo> getTitle(String[] title) {
- List<ColumnVo> ls1 = new ArrayList<>();
- ColumnVo cl1 = new ColumnVo(title[0], "index");
- ColumnVo cl2 = new ColumnVo(title[1], "name");
- ColumnVo cl3 = new ColumnVo(title[2], "fnlyl");
- ColumnVo cl4 = new ColumnVo(title[3], "yearTq");
- ColumnVo cl5 = new ColumnVo(title[4], "operation");
- ls1.add(cl1);
- ls1.add(cl2);
- ls1.add(cl3);
- ls1.add(cl4);
- ls1.add(cl5);
- return ls1;
- }
- public Map<String, Object> getHomeMiddle(String companyId) throws ParseException {
- Double rfdl = dayFdlCal(LocalDate.now());
- Integer month = LocalDate.now().getMonthValue();
- int year = LocalDate.now().getYear();
- Map<String, Object> allmap = new HashMap<>();
- PlanDataVo pd = new PlanDataVo();
- Double week = weekFdlCal();
- pd.setZfdlsj(week);
- String s = year + "-" + month;
- BigDecimal monCache = yfdlCal.get(s);
- pd.setYfdlsj(monCache.add(new BigDecimal(rfdl)).doubleValue());
- BigDecimal yearCache = nfdlCal.get(year);
- pd.setNfdlsj(yearCache.add(new BigDecimal(rfdl)).doubleValue());
- //计划发电量
- List<ProBasicProjectPlan> list = iProBasicProjectPlanService.list();
- List<ProBasicProjectPlan> pp = list.stream()
- .filter(ls -> String.valueOf(month).equals(ls.getMonth())
- && ls.getYear().equals(String.valueOf(year)) && ls.getProjectId().equals(companyId))
- .collect(Collectors.toList());
- if (pp.isEmpty()) {
- pd.setZfdljh(0.0);
- pd.setYfdljh(0.0);
- } else {
- pd.setZfdljh(pp.get(0).getGeneratingCapacity() / 4);
- pd.setYfdljh(pp.get(0).getGeneratingCapacity());
- }
- Double zjd = calDivide(pd.getZfdlsj(), pd.getZfdljh());
- pd.setZjd(zjd * 100);
- pd.setZwcl(zjd);
- Double yjd = calDivide(pd.getYfdlsj(), pd.getYfdljh());
- pd.setYjd(yjd * 100);
- pd.setYwcl(yjd);
- List<ProBasicProjectPlan> pp2 = list.stream()
- .filter(ls -> ls.getYear().equals(String.valueOf(year)) && ls.getProjectId().equals(companyId) && ls.getMonth() == null)
- .collect(Collectors.toList());
- if (pp2.isEmpty()) {
- pd.setNfdljh(0.0);
- } else {
- pd.setNfdljh(pp2.get(0).getGeneratingCapacity());
- }
- Double njd = calDivide(pd.getNfdlsj(), pd.getNfdljh());
- pd.setNjd(njd * 100);
- pd.setNwcl(njd);
- allmap.put("planData", pd);
- QueryWrapper<TurbineInfoDay> qw2 = new QueryWrapper<>();
- qw2.lambda().eq(TurbineInfoDay::getStationId, companyId);
- List<TurbineInfoDay> days3 = iTurbineInfoDayService.list(qw2);
- int yearThis = LocalDate.now().getYear();
- int yearLast = yearThis - 1;
- String start = yearThis + "-01-01";
- String end = yearThis + "-12-31";
- String start2 = yearLast + "-01-01";
- String end2 = yearLast + "-12-31";
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- Date start1 = sdf.parse(start);
- Date end1 = sdf.parse(end);
- Date start3 = sdf.parse(start2);
- Date end3 = sdf.parse(end2);
- List<TurbineInfoDay> thisYear = days3.stream().filter(rec -> rec.getRecordDate().after(start1) && rec.getRecordDate().before(end1)).collect(Collectors.toList());
- List<TurbineInfoDay> lastYear = days3.stream().filter(rec -> rec.getRecordDate().after(start3) && rec.getRecordDate().before(end3)).collect(Collectors.toList());
- Map<Integer, List<TurbineInfoDay>> day1sMap = thisYear.stream().collect(Collectors.groupingBy(record -> record.getRecordDate().getMonth() + 1));
- List<PowertrendVo> xdl = new ArrayList<>();
- List<PowertrendVo> ssdl = new ArrayList<>();
- List<PowertrendVo> fdl = new ArrayList<>();
- PowertrendVo ptxdl = new PowertrendVo();
- PowertrendVo ptssdl = new PowertrendVo();
- PowertrendVo ptfdl = new PowertrendVo();
- ptxdl.setTitle("限电量");
- ptssdl.setTitle("损失电量");
- ptfdl.setTitle("发电量");
- ptxdl.setYAxisIndex(0);
- ptssdl.setYAxisIndex(0);
- ptfdl.setYAxisIndex(0);
- List<ValueVo> vexdl = value(year, 12);
- List<ValueVo> vessdl = value(year, 12);
- List<ValueVo> vefdl = value(year, 12);
- for (Integer mon : day1sMap.keySet()) {
- List<TurbineInfoDay> day1s1 = day1sMap.get(mon);
- List<TurbineInfoDay> day1s2 = day1s1.stream().sorted(Comparator.comparing(TurbineInfoDay::getRecordDate).reversed()).collect(Collectors.toList());
- LocalDate localDate = day1s2.get(0).getRecordDate().toInstant().atZone(ZoneOffset.UTC).toLocalDate();
- int year1 = localDate.getYear();
- String text = year1 + "-" + mon;
- for (ValueVo vv : vexdl) {
- if (vv.getText().equals(text)) {
- double bxdl = day1s2.stream().mapToDouble(TurbineInfoDay::getXdss).sum();
- String format = String.format("%.2f", bxdl / 1000);
- vv.setValue(new BigDecimal(format));
- }
- }
- for (ValueVo vv : vessdl) {
- if (vv.getText().equals(text)) {
- double xd = day1s2.stream().mapToDouble(TurbineInfoDay::getXdss).sum();
- double fjh = day1s2.stream().mapToDouble(TurbineInfoDay::getFjhjxss).sum();
- double jh = day1s2.stream().mapToDouble(TurbineInfoDay::getJhjxss).sum();
- double xn = day1s2.stream().mapToDouble(TurbineInfoDay::getXnss).sum();
- String format = String.format("%.2f", (xd + fjh + jh + xn) / 1000);
- vv.setValue(new BigDecimal(format));
- }
- }
- for (ValueVo vv : vefdl) {
- if (vv.getText().equals(text)) {
- double bfdl = day1s2.stream().mapToDouble(TurbineInfoDay::getXdss).sum();
- String format = String.format("%.2f", bfdl / 1000);
- vv.setValue(new BigDecimal(format));
- }
- }
- }
- ptxdl.setValue(vexdl);
- ptssdl.setValue(vessdl);
- ptfdl.setValue(vefdl);
- xdl.add(ptxdl);
- ssdl.add(ptssdl);
- fdl.add(ptfdl);
- PowertrendVo ptxdl2 = new PowertrendVo();
- PowertrendVo ptssdl2 = new PowertrendVo();
- PowertrendVo ptfdl2 = new PowertrendVo();
- ptxdl2.setTitle("去年同期限电量");
- ptssdl2.setTitle("去年同期损失电量");
- ptfdl2.setTitle("去年同期发电量");
- ptxdl.setYAxisIndex(0);
- ptssdl.setYAxisIndex(0);
- ptfdl.setYAxisIndex(0);
- if (lastYear.isEmpty()) {
- List<ValueVo> value = value(year - 1, month);
- ptxdl2.setValue(value);
- ptssdl2.setValue(value);
- ptfdl2.setValue(value);
- } else {
- List<ValueVo> vxdl2 = value(year - 1, 12);
- List<ValueVo> vssdl2 = value(year - 1, 12);
- List<ValueVo> vfdl2 = value(year - 1, 12);
- Map<Integer, List<TurbineInfoDay>> day1sMap2 = lastYear.stream().collect(Collectors.groupingBy(record -> record.getRecordDate().getMonth() + 1));
- for (Integer mon2 : day1sMap2.keySet()) {
- List<TurbineInfoDay> day1s3 = day1sMap2.get(mon2);
- List<TurbineInfoDay> day1s4 = day1s3.stream().sorted(Comparator.comparing(TurbineInfoDay::getRecordDate).reversed()).collect(Collectors.toList());
- LocalDate localDate = day1s3.get(0).getRecordDate().toInstant().atZone(ZoneOffset.UTC).toLocalDate();
- int year1 = localDate.getYear();
- String text = year1 + "-" + mon2;
- for (ValueVo vv : vxdl2) {
- if (vv.getText().equals(text)) {
- double bxdl2 = day1s4.stream().mapToDouble(TurbineInfoDay::getXdss).sum();
- String format = String.format("%.2f", bxdl2 / 1000);
- vv.setValue(new BigDecimal(format));
- }
- }
- for (ValueVo vv : vssdl2) {
- if (vv.getText().equals(text)) {
- double xd = day1s4.stream().mapToDouble(TurbineInfoDay::getXdss).sum();
- double fjh = day1s4.stream().mapToDouble(TurbineInfoDay::getFjhjxss).sum();
- double jh = day1s4.stream().mapToDouble(TurbineInfoDay::getJhjxss).sum();
- double xn = day1s4.stream().mapToDouble(TurbineInfoDay::getXnss).sum();
- String format = String.format("%.2f", (xd + fjh + jh + xn) / 1000);
- vv.setValue(new BigDecimal(format));
- }
- }
- for (ValueVo vv : vfdl2) {
- if (vv.getText().equals(text)) {
- double bfl2 = day1s4.stream().mapToDouble(TurbineInfoDay::getXdss).sum();
- String format = String.format("%.2f", bfl2 / 1000);
- vv.setValue(new BigDecimal(format));
- }
- }
- }
- ptxdl2.setValue(vxdl2);
- ptssdl2.setValue(vssdl2);
- ptfdl2.setValue(vfdl2);
- }
- xdl.add(ptxdl2);
- ssdl.add(ptssdl2);
- fdl.add(ptfdl2);
- allmap.put("Powertrend", xdl);
- allmap.put("Powerloss", ssdl);
- allmap.put("Powersend", fdl);
- return allmap;
- }
- /**
- * 除法
- */
- private Double calDivide(Double divide, Double divisor) {
- if (divide == 0 || divisor == 0) {
- return 0.0;
- } else {
- BigDecimal divide1 = BigDecimal.valueOf(divide);
- BigDecimal divisor1 = BigDecimal.valueOf(divisor);
- BigDecimal result = divide1.divide(divisor1, 2, RoundingMode.HALF_UP);
- DecimalFormat df = new DecimalFormat("#0.00");
- String formattedResult = df.format(result);
- return Double.parseDouble(formattedResult);
- }
- }
- private List<ValueVo> value(int year, int month) {
- List<ValueVo> lv = new ArrayList<>();
- for (int i = 1; i <= month; i++) {
- ValueVo vo = new ValueVo();
- vo.setText(year + "-" + i);
- vo.setValue(new BigDecimal(0));
- lv.add(vo);
- }
- return lv;
- }
- public Map<String, Object> getGeneratingCapacity(String companyId) {
- LocalDate now = LocalDate.now();
- Map<String, Object> allmap = new HashMap<>();
- Map<String, Object> zbtqdb = new HashMap<>();
- List<ColumnVo> ls1 = new ArrayList<>();
- ColumnVo cl1 = new ColumnVo();
- cl1.setName("指标名称");
- cl1.setField("wtId");
- ColumnVo cl2 = new ColumnVo();
- cl2.setName(String.valueOf(LocalDate.now().getYear()));
- cl2.setField("recodedate");
- ColumnVo cl3 = new ColumnVo();
- cl3.setName(String.valueOf(LocalDate.now().getYear() - 1));
- cl3.setField("recodedate2");
- ColumnVo cl4 = new ColumnVo();
- cl4.setName("涨跌%");
- cl4.setField("operation");
- ls1.add(cl1);
- ls1.add(cl2);
- ls1.add(cl3);
- ls1.add(cl4);
- List<GeneratingCapacityVo> ls = new ArrayList<>();
- Double dayFdl = dayFdlCal(now);
- Double dayLlfdl = dayLldlCal(now);
- GeneratingCapacityVo rfdl = new GeneratingCapacityVo();
- rfdl.setName("日发电量");
- rfdl.setValue(Double.valueOf(String.format("%.2f", dayFdl)));
- rfdl.setTotal(dayLlfdl);
- Double rbfb = calDivide(dayFdl, dayLlfdl);
- rfdl.setBfb(new BigDecimal(rbfb * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
- ls.add(rfdl);
- GeneratingCapacityVo yfdl = new GeneratingCapacityVo();
- yfdl.setName("月发电量");
- String s = LocalDate.now().getYear() + "-" + LocalDate.now().getMonthValue();
- BigDecimal monCache = yfdlCal.get(s);
- yfdl.setValue(monCache.add(BigDecimal.valueOf(rfdl.getValue())).setScale(2, RoundingMode.HALF_UP).doubleValue());
- double yllfdl = yllfdlCal.get(s).add(BigDecimal.valueOf(rfdl.getTotal())).doubleValue();
- yfdl.setTotal(Double.parseDouble(String.format("%.2f", yllfdl)));
- Double ybfb = calDivide(yfdl.getValue(), yfdl.getTotal());
- yfdl.setBfb(new BigDecimal(ybfb * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
- ls.add(yfdl);
- GeneratingCapacityVo nfdl = new GeneratingCapacityVo();
- nfdl.setName("年发电量");
- nfdl.setValue(nfdlCal.get(LocalDate.now().getYear()).add(BigDecimal.valueOf(rfdl.getValue())).setScale(2, RoundingMode.HALF_UP).doubleValue());
- double nllfdl = nllfdlCal.get(LocalDate.now().getYear()).add(BigDecimal.valueOf(rfdl.getTotal())).doubleValue();
- nfdl.setTotal(Double.parseDouble(String.format("%.2f", nllfdl)));
- Double nbfb = calDivide(nfdl.getValue(), nfdl.getTotal());
- nfdl.setBfb(new BigDecimal(nbfb * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
- ls.add(nfdl);
- QueryWrapper<StationInfoDay> thisYear = new QueryWrapper<>();
- thisYear.select("station_id,max(record_date) as record_date,sum(swdl) as swdl,sum(gwdl) as gwdl,sum(cydl) as cydl,sum(zhcydl) as zhcydl")
- .apply("to_char(record_date,'yyyy') = '" + (LocalDate.now().getYear()) + "'")
- .groupBy("station_id");
- List<StationInfoDay> list = iStationInfoDayService.list(thisYear);
- QueryWrapper<StationInfoDay> lastYear = new QueryWrapper<>();
- lastYear.select("station_id,max(record_date) as record_date,sum(swdl) as swdl,sum(gwdl) as gwdl,sum(cydl) as cydl,sum(zhcydl) as zhcydl")
- .apply("record_date<= '" + LocalDate.now().minusYears(1) + "'")
- .groupBy("station_id");
- List<StationInfoDay> list2 = iStationInfoDayService.list(lastYear);
- List<ComparetqVo> ls2 = new ArrayList<>();
- ComparetqVo cv = new ComparetqVo();
- cv.setWtId("年发电量");
- ComparetqVo cv1 = new ComparetqVo();
- cv1.setWtId("年上网电量");
- ComparetqVo cv2 = new ComparetqVo();
- cv2.setWtId("年购网电量");
- ComparetqVo cv4 = new ComparetqVo();
- cv4.setWtId("年厂用电量");
- cv.setRecodedate(nfdl.getValue());
- if (null == list2 || list2.isEmpty()) {
- cv1.setRecodedate2(0);
- cv1.setOperation(100);
- cv2.setRecodedate2(0);
- cv2.setOperation(100);
- cv4.setRecodedate2(0);
- cv4.setOperation(100);
- } else {
- cv1.setRecodedate2(list2.get(0).getSwdl());
- cv2.setRecodedate2(list2.get(0).getGwdl());
- cv4.setRecodedate2(list2.get(0).getCydl());
- }
- if (null == list || list.isEmpty()) {
- cv1.setRecodedate(0);
- cv1.setOperation(-100);
- cv2.setRecodedate(0);
- cv2.setOperation(-100);
- cv4.setRecodedate(0);
- cv4.setOperation(-100);
- } else {
- cv1.setRecodedate(list.get(0).getSwdl());
- cv1.setOperation(100);
- cv2.setRecodedate(list.get(0).getGwdl());
- cv2.setOperation(100);
- cv4.setRecodedate(list.get(0).getCydl());
- cv4.setOperation(100);
- }
- ls2.add(cv);
- ls2.add(cv1);
- ls2.add(cv2);
- ls2.add(cv4);
- zbtqdb.put("column", ls1);
- zbtqdb.put("data", ls2);
- allmap.put("fdl", ls);
- allmap.put("zbtqdb", zbtqdb);
- return allmap;
- }
- /**
- * 缓存月、年发电量
- */
- public void calFdl() {
- if (LocalDate.now().equals(lastCalDate)) {
- return;
- }
- LocalDate yesterday = LocalDate.now().atStartOfDay().toLocalDate();
- QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
- currentqw.select("station_id,SUM(rfdl) AS rfdl,sum(llfdl) as llfdl")
- .ge("record_date", LocalDate.now().with(TemporalAdjusters.firstDayOfYear())) // 大于等于今年的第一天
- .lt("record_date", yesterday) // 小于今天0点的日期
- .like("station_id", "_FDC_%")
- .groupBy("station_id");
- List<TurbineInfoDay> yearData = iTurbineInfoDayService.list(currentqw);
- Integer intYear = LocalDate.now().getYear();
- Double nfdlc = calDivide(yearData.get(0).getRfdl(), 1000.0);
- Double nllfdlc = calDivide(yearData.get(0).getLlfdl(), 1000.0);
- nfdlCal.put(intYear, new BigDecimal(nfdlc));
- nllfdlCal.put(intYear, new BigDecimal(nllfdlc));
- currentqw.clear();
- currentqw.select("station_id,MAX(record_date) AS record_date,SUM(rfdl) AS rfdl,SUM(llfdl) as llfdl")
- .ge("record_date", LocalDate.now().with(TemporalAdjusters.firstDayOfMonth())) // 大于等于本月的第一天
- .lt("record_date", yesterday) // 小于今天0点的日期
- .like("station_id", "_FDC_%")
- .groupBy("station_id");
- List<TurbineInfoDay> monthData = iTurbineInfoDayService.list(currentqw);
- String yearAndMonth = LocalDate.now().getYear() + "-" + LocalDate.now().getMonthValue();
- Double yfdlc = calDivide(monthData.get(0).getRfdl(), 1000.0);
- Double yllfdlc = calDivide(monthData.get(0).getLlfdl(), 1000.0);
- yfdlCal.put(yearAndMonth, new BigDecimal(yfdlc));
- yllfdlCal.put(yearAndMonth, new BigDecimal(yllfdlc));
- currentqw.clear();
- lastCalDate = LocalDate.now();
- }
- private Double weekFdlCal() {
- LocalDate week = LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
- LocalDate yesterday = LocalDate.now().atStartOfDay().toLocalDate();
- if (week.equals(LocalDate.now())) {
- return dayFdlCal(LocalDate.now());
- }
- QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
- currentqw.select("station_id,SUM(rfdl) AS rfdl")
- .ge("record_date", LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY))) // 大于等于本周一的日期
- .lt("record_date", yesterday)
- .groupBy("station_id");
- List<TurbineInfoDay> weekData = iTurbineInfoDayService.list(currentqw);
- if (null == weekData || weekData.isEmpty()) {
- return 0.0;
- }
- Double weekfdlc = calDivide(weekData.get(0).getRfdl(), 1000.0);
- Double dayFdl = dayFdlCal(LocalDate.now());
- return weekfdlc + dayFdl;
- }
- private Double dayFdlCal(LocalDate now) {
- QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
- qw.select("station_id,SUM(rfdl) AS rfdl").eq("record_date", now).groupBy("station_id");
- List<TurbineInfoDay> dayData = iTurbineInfoDayService.list(qw);
- if (null == dayData || dayData.isEmpty()) {
- return 0.0;
- }
- return calDivide(dayData.get(0).getRfdl(), 1000.0);
- }
- private Double dayLldlCal(LocalDate now) {
- QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
- qw.select("station_id,SUM(llfdl) AS llfdl").eq("record_date", now).groupBy("station_id");
- List<TurbineInfoDay> dayData = iTurbineInfoDayService.list(qw);
- if (null == dayData || dayData.isEmpty()) {
- return 0.0;
- }
- return calDivide(dayData.get(0).getLlfdl(), 1000.0);
- }
- }
|