1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134 |
- 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;//场站性息
- /**
- * 15分钟发电量
- */
- private Map<String, GeneratingCapacityVo> generatingCapacity15min = new HashMap<>();
- 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 = generatingCapacity15min.get("日发电量").getValue();
- Integer month = LocalDate.now().getMonthValue();
- int year = LocalDate.now().getYear();
- Map<String, Object> allmap = new HashMap<>();
- PlanDataVo pd = new PlanDataVo();
- Double week = getWeekFdlCal();
- 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)) {
- BigDecimal bxdl = day1s2.stream().map(TurbineInfoDay::getXdss).reduce(BigDecimal.ZERO, BigDecimal::add);
- vv.setValue(BigDecimal.valueOf(bxdl.doubleValue() / 1000));
- }
- }
- for (ValueVo vv : vessdl) {
- if (vv.getText().equals(text)) {
- BigDecimal bssdl = day1s2.stream().map(TurbineInfoDay::getXdss).reduce(BigDecimal.ZERO, BigDecimal::add)
- .add(day1s2.stream().map(TurbineInfoDay::getJhjxss).reduce(BigDecimal.ZERO, BigDecimal::add)
- .add(day1s2.stream().map(TurbineInfoDay::getFjhjxss).reduce(BigDecimal.ZERO, BigDecimal::add)
- .add(day1s2.stream().map(TurbineInfoDay::getSlss).reduce(BigDecimal.ZERO, BigDecimal::add))
- .add(day1s2.stream().map(TurbineInfoDay::getXnss).reduce(BigDecimal.ZERO, BigDecimal::add))
- .add(day1s2.stream().map(TurbineInfoDay::getDjss).reduce(BigDecimal.ZERO, BigDecimal::add))
- .add(day1s2.stream().map(TurbineInfoDay::getGzss).reduce(BigDecimal.ZERO, BigDecimal::add))));
- vv.setValue(BigDecimal.valueOf(bssdl.doubleValue() / 1000));
- }
- }
- for (ValueVo vv : vefdl) {
- if (vv.getText().equals(text)) {
- BigDecimal bfdl = day1s2.stream().map(TurbineInfoDay::getRfdl).reduce(BigDecimal.ZERO, BigDecimal::add);
- vv.setValue(BigDecimal.valueOf(bfdl.doubleValue() / 1000));
- }
- }
- }
- 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)) {
- BigDecimal bxdl2 = day1s4.stream().map(TurbineInfoDay::getXdss).reduce(BigDecimal.ZERO, BigDecimal::add);
- vv.setValue(BigDecimal.valueOf(bxdl2.doubleValue() / 1000));
- }
- }
- for (ValueVo vv : vssdl2) {
- if (vv.getText().equals(text)) {
- BigDecimal bssl2 = day1s4.stream().map(TurbineInfoDay::getXdss).reduce(BigDecimal.ZERO, BigDecimal::add)
- .add(day1s4.stream().map(TurbineInfoDay::getJhjxss).reduce(BigDecimal.ZERO, BigDecimal::add)
- .add(day1s4.stream().map(TurbineInfoDay::getFjhjxss).reduce(BigDecimal.ZERO, BigDecimal::add)
- .add(day1s4.stream().map(TurbineInfoDay::getSlss).reduce(BigDecimal.ZERO, BigDecimal::add))
- .add(day1s4.stream().map(TurbineInfoDay::getXnss).reduce(BigDecimal.ZERO, BigDecimal::add))
- .add(day1s4.stream().map(TurbineInfoDay::getDjss).reduce(BigDecimal.ZERO, BigDecimal::add))
- .add(day1s4.stream().map(TurbineInfoDay::getGzss).reduce(BigDecimal.ZERO, BigDecimal::add))));
- vv.setValue(BigDecimal.valueOf(bssl2.doubleValue() / 1000));
- }
- }
- for (ValueVo vv : vfdl2) {
- if (vv.getText().equals(text)) {
- BigDecimal bfl2 = day1s4.stream().map(TurbineInfoDay::getRfdl).reduce(BigDecimal.ZERO, BigDecimal::add);
- vv.setValue(BigDecimal.valueOf(bfl2.doubleValue() / 1000));
- }
- }
- }
- 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) {
- Map<String, Object> allmap = new HashMap<>();
- QueryWrapper<StationInfoMin> qw = new QueryWrapper<>();
- qw.lambda().ge(StationInfoMin::getRecordDate, LocalDateTime.now().toLocalDate().atStartOfDay())
- .le(StationInfoMin::getRecordDate, LocalDateTime.now())
- .orderByDesc(StationInfoMin::getRecordDate)
- .last("LIMIT 1")
- .eq(StationInfoMin::getStationId, companyId);
- QueryWrapper<StationInfoMin> qw2 = new QueryWrapper<>();
- qw2.lambda().ge(StationInfoMin::getRecordDate, LocalDateTime.now().minusYears(1).toLocalDate().atStartOfDay())
- .le(StationInfoMin::getRecordDate, LocalDateTime.now().minusYears(1).toLocalDate())
- .orderByDesc(StationInfoMin::getRecordDate)
- .last("LIMIT 1")
- .eq(StationInfoMin::getStationId, companyId);
- 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<StationInfoMin> day1s = iStationInfoMinService.list(qw);
- List<GeneratingCapacityVo> ls = new ArrayList<>();
- if (null == day1s || day1s.isEmpty()) {
- GeneratingCapacityVo rfdl = new GeneratingCapacityVo();
- rfdl.setName("日发电量");
- rfdl.setValue(0.0);
- rfdl.setTotal(0.0);
- rfdl.setBfb(0.0);
- ls.add(rfdl);
- generatingCapacity15min.put(rfdl.getName(), rfdl);
- GeneratingCapacityVo yfdl = new GeneratingCapacityVo();
- yfdl.setName("月发电量");
- yfdl.setValue(0.0);
- yfdl.setTotal(0.0);
- yfdl.setBfb(0.0);
- ls.add(yfdl);
- generatingCapacity15min.put(yfdl.getName(), yfdl);
- GeneratingCapacityVo nfdl = new GeneratingCapacityVo();
- nfdl.setName("年发电量");
- nfdl.setValue(0.0);
- nfdl.setTotal(0.0);
- nfdl.setBfb(0.0);
- ls.add(nfdl);
- generatingCapacity15min.put(nfdl.getName(), nfdl);
- } else {
- StationInfoMin day1 = day1s.get(0);
- GeneratingCapacityVo rfdl = new GeneratingCapacityVo();
- rfdl.setName("日发电量");
- rfdl.setValue(Double.valueOf(String.format("%.2f", day1.getRfdl() / 1000)));
- Double llgl = day1.getLlgl() / 1000;
- rfdl.setTotal(calDivide(llgl / 1000, 4.0));
- Double rbfb = calDivide(rfdl.getValue(), rfdl.getTotal());
- rfdl.setBfb(new BigDecimal(rbfb * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
- ls.add(rfdl);
- generatingCapacity15min.put(rfdl.getName(), rfdl);
- GeneratingCapacityVo yfdl = new GeneratingCapacityVo();
- yfdl.setName("月发电量");
- String s = LocalDate.now().getYear() + "-" + LocalDate.now().getMonthValue();
- BigDecimal monCache = yfdlCal.get(s);
- yfdl.setValue(monCache.add(new BigDecimal(rfdl.getValue())).setScale(2, RoundingMode.HALF_UP).doubleValue());
- yfdl.setTotal(calDivide(yllfdlCal.get(s).add(new BigDecimal(rfdl.getTotal())).doubleValue(), 4.0));
- Double ybfb = calDivide(yfdl.getValue(), yfdl.getTotal());
- yfdl.setBfb(new BigDecimal(ybfb).setScale(2, RoundingMode.HALF_UP).doubleValue());
- ls.add(yfdl);
- generatingCapacity15min.put(yfdl.getName(), yfdl);
- GeneratingCapacityVo nfdl = new GeneratingCapacityVo();
- nfdl.setName("年发电量");
- nfdl.setValue(nfdlCal.get(LocalDate.now().getYear()).add(new BigDecimal(rfdl.getValue())).setScale(2, RoundingMode.HALF_UP).doubleValue());
- nfdl.setTotal(calDivide(nllfdlCal.get(LocalDate.now().getYear()).add(new BigDecimal(rfdl.getTotal())).doubleValue(), 4.0));
- Double nbfb = calDivide(nfdl.getValue(), nfdl.getTotal());
- nfdl.setBfb(new BigDecimal(nbfb).setScale(2, RoundingMode.HALF_UP).doubleValue());
- ls.add(nfdl);
- generatingCapacity15min.put(nfdl.getName(), nfdl);
- }
- List<StationInfoMin> day2s = iStationInfoMinService.list(qw2);
- 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(generatingCapacity15min.get("年发电量").getValue());
- if (null == day2s || day2s.isEmpty()) {
- cv.setRecodedate2(0);
- cv.setOperation(100);
- } else {
- cv.setRecodedate2(day2s.get(0).getRfdl() / 1000);
- cv.setOperation(calDivide(cv.getRecodedate() - cv.getRecodedate2(), cv.getRecodedate2()));
- }
- 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 (null != lastCalDate || LocalDate.now().equals(lastCalDate) || !yfdlCal.isEmpty()) {
- 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().doubleValue(), 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().doubleValue(), 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 getWeekFdlCal() {
- LocalDate week = LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
- LocalDate yesterday = LocalDate.now().atStartOfDay().toLocalDate();
- if (week.equals(LocalDate.now())) {
- return generatingCapacity15min.get("日发电量").getValue();
- }
- 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().doubleValue(), 1000.0);
- return weekfdlc + generatingCapacity15min.get("日发电量").getValue();
- }
- }
|