EconomyPointHomePageService.java 105 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105
  1. package com.gyee.runeconomy.service.homepage;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.gyee.common.util.DateUtils;
  4. import com.gyee.common.vo.healthmanager.CompareVo;
  5. import com.gyee.runeconomy.dto.response.EconHomePagePointRateDTO;
  6. import com.gyee.runeconomy.dto.response.ProEconPointCodeDTO;
  7. import com.gyee.runeconomy.init.CacheContext;
  8. import com.gyee.runeconomy.model.StationInfoMin;
  9. import com.gyee.runeconomy.model.auto.*;
  10. import com.gyee.runeconomy.model.vo.*;
  11. import com.gyee.runeconomy.service.auto.*;
  12. import org.hibernate.query.criteria.internal.expression.function.AggregationFunction;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.stereotype.Service;
  15. import javax.annotation.Resource;
  16. import java.math.BigDecimal;
  17. import java.math.RoundingMode;
  18. import java.text.DecimalFormat;
  19. import java.text.ParseException;
  20. import java.text.SimpleDateFormat;
  21. import java.time.*;
  22. import java.time.format.DateTimeFormatter;
  23. import java.time.temporal.TemporalAdjusters;
  24. import java.util.*;
  25. import java.util.stream.Collectors;
  26. /**
  27. * 经济运行首页服务类
  28. */
  29. @Service
  30. public class EconomyPointHomePageService {
  31. @Autowired
  32. private IProEconPowerstationInfoDay1Service proEconPowerstationInfoDay1Service;//场站五损电量
  33. @Autowired
  34. private IProEconPowerstationInfoDay2Service proEconPowerstationInfoDay2Service;//场站五损时间
  35. @Autowired
  36. private IProEconPowerstationInfoDay4Service proEconPowerstationInfoDay4Service;//场站三率mtbf
  37. @Autowired
  38. private IProEconPowerstationInfoDay5Service proEconPowerstationInfoDay5Service;//电表发电量
  39. @Autowired
  40. private IProEconPowerstationInfoDay6Service proEconPowerstationInfoDay6Service;//测风塔出线功率
  41. @Autowired
  42. private IProEconPowerstationInfoDay7Service proEconPowerstationInfoDay7Service;//光伏
  43. @Autowired
  44. private IProBasicCompanyService proBasicCompanyService;
  45. @Autowired
  46. private IProBasicPowerstationService proBasicPowerstationService;
  47. @Autowired
  48. private IProEconPointCodeService proEconPointCodeService;
  49. @Resource
  50. private IProEconPowerstationInfoDay2Service iProEconPowerstationInfoDay2Service;
  51. @Resource
  52. private IProBasicProjectPlanService iProBasicProjectPlanService;
  53. @Resource
  54. private IStationInfoMinService iStationInfoMinService;
  55. @Resource
  56. private IStationInfoDayService iStationInfoDayService;
  57. @Resource
  58. private ITurbineInfoDayService iTurbineInfoDayService;
  59. /**
  60. * 指标率相应类
  61. */
  62. private EconHomePagePointRateDTO dto = null;
  63. /**
  64. * 五损
  65. */
  66. private Map<String, ProEconPowerstationInfoDay1> wsmap = new HashMap<>();
  67. /**
  68. * 三率
  69. */
  70. private Map<String, ProEconPowerstationInfoDay4> slmap = new HashMap<>();
  71. private Map<String, ProEconPowerstationInfoDay7> gfslmap = new HashMap<>();
  72. /**
  73. * 电量
  74. */
  75. private Map<String, ProEconPowerstationInfoDay5> dlmap = new HashMap<>();
  76. /**
  77. * 功率
  78. */
  79. private Map<String, ProEconPowerstationInfoDay6> glmap = new HashMap<>();
  80. /**
  81. * 五损时间
  82. */
  83. private Map<String, ProEconPowerstationInfoDay2> wstimemap = new HashMap<>();
  84. /**
  85. * 综合场用电率
  86. */
  87. private List<ProEconPowerstationInfoDay5> zhcydllist = new ArrayList<>();
  88. /**
  89. * 电量统计分析
  90. */
  91. private List<ProEconPowerstationInfoDay1> dltjfxlist = new ArrayList<>();
  92. private List<ProEconPowerstationInfoDay4> threeRateCurvelist = new ArrayList<>();//三率曲线数据
  93. private List<ProEconPowerstationInfoDay7> gfthreeRateCurvelist = new ArrayList<>();
  94. private BigDecimal capacity = null;
  95. private Integer quantity = null;
  96. private Map<String, BigDecimal> wsdlfx = null;//五损电量分析
  97. private List<Map<String, Object>> zhcydl = null;//综合场用电率
  98. private List<Map<String, Object>> dltjfxList = null;//电量统计分析
  99. private List<Map<String, Object>> slqxList = null;//三率曲线
  100. private Map<String, Object> fdinfomap = null;//发电(风能利用率、发电量、欠发电量)
  101. private List<Map<String, Object>> stainfo = null;//场站性息
  102. private Map<String, BigDecimal> yfdlCal = new HashMap<>();
  103. private Map<String, BigDecimal> yllfdlCal = new HashMap<>();
  104. private Map<Integer, BigDecimal> nfdlCal = new HashMap<>();
  105. private Map<Integer, BigDecimal> nllfdlCal = new HashMap<>();
  106. private LocalDate lastCalDate;
  107. private Map<LocalDate, BigDecimal> fnlyl = new HashMap<>();
  108. /**
  109. * 经济运行首页聚合方法
  110. *
  111. * @param foreignKeyId
  112. * @param staType
  113. * @param dateType
  114. * @return
  115. */
  116. public Map<String, Object> getEconomyPointHomePageInfo2(String foreignKeyId, String regionId1, String companyId1, String staType, String dateType, String pointCode) throws ParseException {
  117. Map<String, Object> allmap = new HashMap<>();
  118. List<GeneratingCapacityVo> ls = new ArrayList<>();
  119. LocalDate now = LocalDate.now();
  120. QueryWrapper<ProEconPowerstationInfoDay1> qw = new QueryWrapper<>();
  121. qw.lambda().eq(ProEconPowerstationInfoDay1::getRecordDate, now)
  122. .eq(ProEconPowerstationInfoDay1::getForeignKeyId, CacheContext.wpls.get(0).getId());
  123. List<ProEconPowerstationInfoDay1> day1s = proEconPowerstationInfoDay1Service.list(qw);
  124. // for (ProEconPowerstationInfoDay1 day1 : day1s) {
  125. // GeneratingCapacityVo rfdl = new GeneratingCapacityVo();
  126. // rfdl.setName("日发电量");
  127. // rfdl.setValue(day1.getRfdl());
  128. // rfdl.setTotal(day1.getRllfdl());
  129. // rfdl.setBfb(new BigDecimal("5.00"));
  130. // ls.add(rfdl);
  131. //
  132. // GeneratingCapacityVo yfdl = new GeneratingCapacityVo();
  133. // yfdl.setName("月发电量");
  134. // yfdl.setValue(day1.getYfdl());
  135. // yfdl.setTotal(day1.getYllfdl());
  136. // yfdl.setBfb(new BigDecimal("5.00"));
  137. // ls.add(yfdl);
  138. //
  139. // GeneratingCapacityVo nfdl = new GeneratingCapacityVo();
  140. // nfdl.setName("年发电量");
  141. // nfdl.setValue(day1.getNfdl());
  142. // nfdl.setTotal(day1.getNllfdl());
  143. // nfdl.setBfb(new BigDecimal("5.00"));
  144. // ls.add(nfdl);
  145. // }
  146. //
  147. // Map<String, Object> zbtqdb = new HashMap<>();
  148. // List<ColumnVo> ls1 = new ArrayList<>();
  149. // ColumnVo cl1 = new ColumnVo();
  150. // cl1.setName("指标名称");
  151. // cl1.setField("wtId");
  152. // ColumnVo cl2 = new ColumnVo();
  153. // cl2.setName(String.valueOf(LocalDate.now().getYear()));
  154. // cl2.setField("recodedate");
  155. // ColumnVo cl3 = new ColumnVo();
  156. // cl3.setName(String.valueOf(LocalDate.now().getYear() - 1));
  157. // cl3.setField("recodedate2");
  158. // ColumnVo cl4 = new ColumnVo();
  159. // cl4.setName("涨跌%");
  160. // cl4.setField("operation");
  161. // ls1.add(cl1);
  162. // ls1.add(cl2);
  163. // ls1.add(cl3);
  164. // ls1.add(cl4);
  165. //
  166. // List<ColumnVo> ls2 = new ArrayList<>();
  167. //
  168. // zbtqdb.put("column", ls1);
  169. // zbtqdb.put("data", ls2);
  170. // allmap.put("fdl", ls);
  171. // allmap.put("zbtqdb", zbtqdb);
  172. return allmap;
  173. }
  174. /**
  175. * 经济运行首页聚合方法
  176. *
  177. * @param foreignKeyId
  178. * @param staType
  179. * @param dateType
  180. * @return
  181. */
  182. public Map<String, Object> getEconomyPointHomePageInfo(String foreignKeyId, String regionId1, String companyId1, String staType, String dateType, String pointCode) throws ParseException {
  183. Map<String, Object> allmap = new HashMap<>();
  184. //获取当前时间
  185. String strdate = DateUtils.toDate1(new Date());
  186. Date date = DateUtils.parseDate(strdate);
  187. dto = new EconHomePagePointRateDTO();
  188. /** 五损 */
  189. wsmap = proEconPowerstationInfoDay1Service.getEconFiveLoss(foreignKeyId, staType, dateType, date);
  190. /** 三率 */
  191. gfslmap = proEconPowerstationInfoDay7Service.getEconThreeRate(foreignKeyId, staType, dateType, date);
  192. slmap = proEconPowerstationInfoDay4Service.getEconThreeRate(foreignKeyId, staType, dateType, date);
  193. /** 综合场用电量 */
  194. dlmap = proEconPowerstationInfoDay5Service.getEconElectricQuantity(foreignKeyId, staType, dateType, date);
  195. /** 场功率 */
  196. glmap = proEconPowerstationInfoDay6Service.getEconPowerOfField(foreignKeyId, staType, dateType, date);
  197. /** 五损时间 */
  198. wstimemap = proEconPowerstationInfoDay2Service.getEconFiveLossTime(foreignKeyId, staType, dateType, date);
  199. /** 装机容量 */
  200. capacity = new BigDecimal(proBasicCompanyService.getProBasicCompanyCapacity("", foreignKeyId));
  201. /**装机数量*/
  202. quantity = proBasicCompanyService.getProBasicCompanyQuantity("", foreignKeyId);
  203. //综合场用电量
  204. zhcydllist = proEconPowerstationInfoDay5Service.getEconZhcydldb(foreignKeyId, staType, dateType, date);
  205. //电量统计分析
  206. dltjfxlist = proEconPowerstationInfoDay1Service.getEconFiveLosslist(foreignKeyId, staType, dateType, date);
  207. //三率曲线
  208. threeRateCurvelist = proEconPowerstationInfoDay4Service.getEconThreeRateCurve(foreignKeyId, staType, dateType, date);
  209. gfthreeRateCurvelist = proEconPowerstationInfoDay7Service.getEconThreeRateCurve(foreignKeyId, staType, dateType, date);
  210. powerstationFnlyl(foreignKeyId, staType, date);//地图场站性息
  211. wsdlfx = new HashMap<>();//五损电量分析
  212. zhcydl = new ArrayList<>();//综合场用电率
  213. dltjfxList = new ArrayList<>();//电量统计分析
  214. fdinfomap = new HashMap<>();//(风能利用率、发电量、欠发电量)
  215. slqxList = new ArrayList<>();//三率曲线
  216. switch (dateType) {
  217. case "r":
  218. currFiveInfo();
  219. currThreeRateInfo(staType);
  220. currOtherInfo();
  221. currFiveDlFx();
  222. currZhcydl();
  223. currDltjfx();
  224. currThreeRateCurve(staType);
  225. currfdinfo();
  226. break;
  227. case "y":
  228. monthFiveInfo();
  229. monthThreeRateInfo(staType);
  230. monthOtherInfo();
  231. monthFiveDlFx();
  232. monthZhcydl();
  233. monthDltjfx();
  234. monthThreeRateCurve(staType);
  235. monthfdinfo();
  236. break;
  237. case "n":
  238. yearFiveInfo();
  239. yearThreeRateInfo(staType);
  240. yearOtherInfo();
  241. yearFiveDlFx();
  242. yearZhcydl();
  243. yearDltjfx();
  244. yearThreeRateCurve(staType);
  245. yearfdinfo();
  246. break;
  247. }
  248. allmap.put("zbl", dto);//页面第一行的
  249. allmap.put("stainfo", stainfo);//场站性息(装机容量)
  250. allmap.put("sldlfx", wsdlfx);//损失电量分析
  251. allmap.put("zhcydl", zhcydl);//综合场用电率
  252. allmap.put("dltjfx", dltjfxList);//电量统计分析
  253. allmap.put("fdlinfo", fdinfomap);//发电量 欠发电量 风能利用率
  254. allmap.put("slqx", slqxList);//三率曲线
  255. // allmap.put("zbphl", pointCodeDTO);//排行榜
  256. return allmap;
  257. }
  258. /**
  259. * 指标排行榜
  260. *
  261. * @param foreignKeyId
  262. * @param dateType
  263. * @param pointCode
  264. * @return
  265. */
  266. public List<ProEconPointCodeDTO> getEconomyPointRanking(String foreignKeyId, String dateType, String pointCode, boolean popup, String statype) {
  267. //获取当前时间
  268. String strdate = DateUtils.toDate1(new Date());
  269. Date date = DateUtils.parseDate(strdate);
  270. List<ProEconPointCodeDTO> pointCodeDTO = proEconPointCodeService.getEconPointRanking("", foreignKeyId, pointCode, date, dateType, popup, statype);
  271. return pointCodeDTO;
  272. }
  273. /**
  274. * (风能利用率、发电量、欠发电量)
  275. */
  276. private void powerstationFnlyl(String foreignKeyId, String staType, Date date) {
  277. stainfo = new ArrayList<>();
  278. //电量统计分析
  279. Map<String, ProEconPowerstationInfoDay1> stamap = new HashMap<>();//场站站五损电量
  280. List<ProBasicPowerstation> powerstationList = proBasicPowerstationService.getProBasicPowerstationlist("", foreignKeyId, staType);
  281. List<String> prids = powerstationList.stream().map(ProBasicPowerstation::getId).collect(Collectors.toList());
  282. List<ProEconPowerstationInfoDay1> stafnlyl = proEconPowerstationInfoDay1Service.getEconFiveLosslist(prids, date);
  283. stafnlyl.stream().forEach(s -> {
  284. stamap.put(s.getForeignKeyId(), s);
  285. });
  286. powerstationList.stream().forEach(p -> {
  287. Map<String, Object> info = new HashMap<>();
  288. ProEconPowerstationInfoDay1 day1 = stamap.get(p.getId());
  289. info.put("aname", p.getAname());
  290. info.put("name", p.getName());
  291. info.put("nemCode", p.getNemCode());
  292. info.put("capacity", (p.getJrwindCapacity() + p.getJrCapacity()) / 10000);
  293. info.put("xPoint", p.getXEmPoint());
  294. info.put("yPoint", p.getYEmPoint());
  295. if (null != day1) {
  296. info.put("fdl", day1.getRfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  297. info.put("fnlyl", compare0(day1.getRllfdl()) ? compare100(day1.getRfdl().divide(day1.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
  298. } else {
  299. info.put("fdl", 0);
  300. info.put("fnlyl", 0);
  301. }
  302. stainfo.add(info);
  303. });
  304. }
  305. /**
  306. * (风能利用率、发电量、欠发电量)
  307. */
  308. private void currfdinfo() {
  309. ProEconPowerstationInfoDay1 fdinfo = wsmap.get("currFiveInfo");
  310. if (null != fdinfo) {
  311. fdinfomap.put("fdl", fdinfo.getRfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  312. fdinfomap.put("qfdl", fdinfo.getRqfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  313. fdinfomap.put("fnlyl", compare0(fdinfo.getRllfdl()) ? compare100(fdinfo.getRfdl().divide(fdinfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
  314. } else {
  315. fdinfomap.put("fdl", new BigDecimal(0));
  316. fdinfomap.put("qfdl", new BigDecimal(0));
  317. fdinfomap.put("fnlyl", new BigDecimal(0));
  318. }
  319. }
  320. private void monthfdinfo() {
  321. ProEconPowerstationInfoDay1 fdinfo = wsmap.get("currFiveInfo");
  322. if (null != fdinfo) {
  323. fdinfomap.put("fdl", fdinfo.getYfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  324. fdinfomap.put("qfdl", fdinfo.getYqfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  325. 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));
  326. } else {
  327. fdinfomap.put("fdl", new BigDecimal(0));
  328. fdinfomap.put("qfdl", new BigDecimal(0));
  329. fdinfomap.put("fnlyl", new BigDecimal(0));
  330. }
  331. }
  332. private void yearfdinfo() {
  333. ProEconPowerstationInfoDay1 fdinfo = wsmap.get("currFiveInfo");
  334. if (null != fdinfo) {
  335. fdinfomap.put("fdl", fdinfo.getNfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  336. fdinfomap.put("qfdl", fdinfo.getNqfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  337. 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));
  338. } else {
  339. fdinfomap.put("fdl", new BigDecimal(0));
  340. fdinfomap.put("qfdl", new BigDecimal(0));
  341. fdinfomap.put("fnlyl", new BigDecimal(0));
  342. }
  343. }
  344. /**
  345. * 三率曲线
  346. */
  347. private void currThreeRateCurve(String staType) {
  348. if (staType.equals("-2")) {
  349. gfthreeRateCurvelist.stream().forEach(i -> {
  350. Map<String, Object> m = new HashMap<>();
  351. m.put("fwjsl", i.getRxtxlpr());
  352. m.put("ztzhjsl", i.getRlsl());
  353. m.put("gzxqjsl", i.getRnbqzhxl());
  354. m.put("date", DateUtils.toDate1(i.getRecordDate()));
  355. slqxList.add(m);
  356. });
  357. } else {
  358. threeRateCurvelist.stream().forEach(i -> {
  359. Map<String, Object> m = new HashMap<>();
  360. m.put("fwjsl", i.getRfwjsl());
  361. m.put("ztzhjsl", i.getRztzhjsl());
  362. m.put("gzxqjsl", i.getRgzxqjsl());
  363. m.put("date", DateUtils.toDate1(i.getRecordDate()));
  364. slqxList.add(m);
  365. });
  366. }
  367. }
  368. private void monthThreeRateCurve(String staType) {
  369. if (staType.equals("-2")) {
  370. gfthreeRateCurvelist.stream().forEach(i -> {
  371. Map<String, Object> m = new HashMap<>();
  372. m.put("fwjsl", i.getYxtxlpr());
  373. m.put("ztzhjsl", i.getYlsl());
  374. m.put("gzxqjsl", i.getYnbqzhxl());
  375. m.put("date", DateUtils.toDate1(i.getRecordDate()));
  376. slqxList.add(m);
  377. });
  378. } else {
  379. threeRateCurvelist.stream().forEach(i -> {
  380. Map<String, Object> m = new HashMap<>();
  381. m.put("fwjsl", i.getYfwjsl());
  382. m.put("ztzhjsl", i.getYztzhjsl());
  383. m.put("gzxqjsl", i.getYgzxqjsl());
  384. m.put("date", DateUtils.toDate1(i.getRecordDate()));
  385. slqxList.add(m);
  386. });
  387. }
  388. }
  389. private void yearThreeRateCurve(String staType) {
  390. if (staType.equals("-2")) {
  391. gfthreeRateCurvelist.stream().forEach(i -> {
  392. Map<String, Object> m = new HashMap<>();
  393. m.put("fwjsl", i.getNxtxlpr());
  394. m.put("ztzhjsl", i.getNlsl());
  395. m.put("gzxqjsl", i.getNnbqzhxl());
  396. m.put("date", DateUtils.toDate1(i.getRecordDate()));
  397. slqxList.add(m);
  398. });
  399. } else {
  400. threeRateCurvelist.stream().forEach(i -> {
  401. Map<String, Object> m = new HashMap<>();
  402. m.put("fwjsl", i.getNfwjsl());
  403. m.put("ztzhjsl", i.getNztzhjsl());
  404. m.put("gzxqjsl", i.getNgzxqjsl());
  405. m.put("date", DateUtils.toDate1(i.getRecordDate()));
  406. slqxList.add(m);
  407. });
  408. }
  409. }
  410. /**
  411. * 电量统计分析
  412. */
  413. private void currDltjfx() {
  414. dltjfxlist.stream().forEach(i -> {
  415. Map<String, Object> m = new HashMap<>();
  416. m.put("fdl", i.getRfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //发电量
  417. m.put("sldl", (i.getRcwsldwssdl().add(i.getRcwsltqssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //受累
  418. m.put("jxdl", i.getRjxssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //检修
  419. m.put("xddl", (i.getRxdtjssdl().add(i.getRxdjclssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));//限电
  420. m.put("gzdl", i.getRgzssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //故障
  421. m.put("xndl", i.getRxnssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));//性能
  422. m.put("date", DateUtils.toDate1(i.getRecordDate()));
  423. dltjfxList.add(m);
  424. });
  425. }
  426. private void monthDltjfx() {
  427. dltjfxlist.stream().forEach(i -> {
  428. Map<String, Object> m = new HashMap<>();
  429. m.put("fdl", i.getYfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //发电量
  430. m.put("sldl", (i.getYcwsldwssdl().add(i.getRcwsltqssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //受累
  431. m.put("jxdl", i.getYjxssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //检修
  432. m.put("xddl", (i.getYxdtjssdl().add(i.getRxdjclssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));//限电
  433. m.put("gzdl", (i.getYgzssdl()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //故障
  434. m.put("xndl", (i.getYxnssdl()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));//性能
  435. m.put("date", DateUtils.toDate1(i.getRecordDate()));
  436. dltjfxList.add(m);
  437. });
  438. }
  439. private void yearDltjfx() {
  440. dltjfxlist.stream().forEach(i -> {
  441. Map<String, Object> m = new HashMap<>();
  442. m.put("fdl", i.getNfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //发电量
  443. m.put("sldl", (i.getNcwsldwssdl().add(i.getRcwsltqssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //受累
  444. m.put("jxdl", (i.getNjxssdl()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //检修
  445. m.put("xddl", (i.getNxdtjssdl().add(i.getRxdjclssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));//限电
  446. m.put("gzdl", (i.getNgzssdl()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP)); //故障
  447. m.put("xndl", (i.getNxnssdl()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));//性能
  448. m.put("date", DateUtils.toDate1(i.getRecordDate()));
  449. dltjfxList.add(m);
  450. });
  451. }
  452. /**
  453. * 综合厂用电率
  454. */
  455. private void currZhcydl() {
  456. zhcydllist.stream().forEach(i -> {
  457. Map<String, Object> m = new HashMap<>();
  458. if (compare0(i.getRfdldb())) {
  459. m.put("key", DateUtils.toDate1(i.getRecordDate()));
  460. m.put("value", compare0(i.getRfdldb()) ? compare100(i.getRzhcydldb().divide(i.getRfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
  461. } else {
  462. m.put("key", DateUtils.toDate1(i.getRecordDate()));
  463. m.put("value", 0);
  464. }
  465. zhcydl.add(m);
  466. });
  467. }
  468. private void monthZhcydl() {
  469. zhcydllist.stream().forEach(i -> {
  470. Map<String, Object> m = new HashMap<>();
  471. if (compare0(i.getYfdldb())) {
  472. m.put("key", DateUtils.toDate1(i.getRecordDate()));
  473. m.put("value", compare0(i.getYfdldb()) ? compare100(i.getYzhcydldb().divide(i.getYfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
  474. } else {
  475. m.put("key", DateUtils.toDate1(i.getRecordDate()));
  476. m.put("value", 0);
  477. }
  478. zhcydl.add(m);
  479. });
  480. }
  481. private void yearZhcydl() {
  482. zhcydllist.stream().forEach(i -> {
  483. Map<String, Object> m = new HashMap<>();
  484. if (compare0(i.getNfdldb())) {
  485. m.put("key", DateUtils.toDate1(i.getRecordDate()));
  486. m.put("value", compare0(i.getNfdldb()) ? compare100(i.getNzhcydldb().divide(i.getNfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0));
  487. } else {
  488. m.put("key", DateUtils.toDate1(i.getRecordDate()));
  489. m.put("value", 0);
  490. }
  491. zhcydl.add(m);
  492. });
  493. }
  494. /**
  495. * 损失电量分析
  496. */
  497. private void currFiveDlFx() {
  498. ProEconPowerstationInfoDay1 fiveInfo = wsmap.get("currFiveInfo");
  499. if (null != fiveInfo) {
  500. //发电量
  501. wsdlfx.put("fdl", fiveInfo.getRfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  502. //受累
  503. wsdlfx.put("sldl", (fiveInfo.getRcwsldwssdl().add(fiveInfo.getRcwsltqssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  504. //检修
  505. wsdlfx.put("jxdl", fiveInfo.getRjxssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  506. //限电
  507. wsdlfx.put("xddl", (fiveInfo.getRxdtjssdl().add(fiveInfo.getRxdjclssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  508. //故障
  509. wsdlfx.put("gzdl", fiveInfo.getRgzssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  510. //性能
  511. wsdlfx.put("xndl", fiveInfo.getRxnssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  512. } else {
  513. //发电量
  514. wsdlfx.put("fdl", new BigDecimal(0));
  515. //受累
  516. wsdlfx.put("sldl", new BigDecimal(0));
  517. //检修
  518. wsdlfx.put("jxdl", new BigDecimal(0));
  519. //限电
  520. wsdlfx.put("xddl", new BigDecimal(0));
  521. //故障
  522. wsdlfx.put("gzdl", new BigDecimal(0));
  523. //性能
  524. wsdlfx.put("xndl", new BigDecimal(0));
  525. }
  526. }
  527. private void monthFiveDlFx() {
  528. ProEconPowerstationInfoDay1 fiveInfo = wsmap.get("currFiveInfo");
  529. if (null != fiveInfo) {
  530. //发电量
  531. wsdlfx.put("fdl", fiveInfo.getYfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  532. //受累
  533. wsdlfx.put("sldl", (fiveInfo.getYcwsldwssdl().add(fiveInfo.getYcwsltqssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  534. //检修
  535. wsdlfx.put("jxdl", fiveInfo.getYjxssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  536. //限电
  537. wsdlfx.put("xddl", (fiveInfo.getYxdtjssdl().add(fiveInfo.getYxdjclssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  538. //故障
  539. wsdlfx.put("gzdl", fiveInfo.getYgzssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  540. //性能
  541. wsdlfx.put("xndl", fiveInfo.getYxnssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  542. } else {
  543. //发电量
  544. wsdlfx.put("fdl", new BigDecimal(0));
  545. //受累
  546. wsdlfx.put("sldl", new BigDecimal(0));
  547. //检修
  548. wsdlfx.put("jxdl", new BigDecimal(0));
  549. //限电
  550. wsdlfx.put("xddl", new BigDecimal(0));
  551. //故障
  552. wsdlfx.put("gzdl", new BigDecimal(0));
  553. //性能
  554. wsdlfx.put("xndl", new BigDecimal(0));
  555. }
  556. }
  557. private void yearFiveDlFx() {
  558. ProEconPowerstationInfoDay1 fiveInfo = wsmap.get("currFiveInfo");
  559. if (null != fiveInfo) {
  560. //发电量
  561. wsdlfx.put("fdl", fiveInfo.getNfdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  562. //受累
  563. wsdlfx.put("sldl", (fiveInfo.getNcwsldwssdl().add(fiveInfo.getNcwsltqssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  564. //检修
  565. wsdlfx.put("jxdl", fiveInfo.getNjxssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  566. //限电
  567. wsdlfx.put("xddl", (fiveInfo.getNxdtjssdl().add(fiveInfo.getNxdjclssdl())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  568. //故障
  569. wsdlfx.put("gzdl", fiveInfo.getNgzssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  570. //性能
  571. wsdlfx.put("xndl", fiveInfo.getNxnssdl().divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP));
  572. } else {
  573. //发电量
  574. wsdlfx.put("fdl", new BigDecimal(0));
  575. //受累
  576. wsdlfx.put("sldl", new BigDecimal(0));
  577. //检修
  578. wsdlfx.put("jxdl", new BigDecimal(0));
  579. //限电
  580. wsdlfx.put("xddl", new BigDecimal(0));
  581. //故障
  582. wsdlfx.put("gzdl", new BigDecimal(0));
  583. //性能
  584. wsdlfx.put("xndl", new BigDecimal(0));
  585. }
  586. }
  587. /**
  588. * 五损经济指标
  589. */
  590. private void currFiveInfo() {
  591. ProEconPowerstationInfoDay1 currFiveInfo = wsmap.get("currFiveInfo");
  592. ProEconPowerstationInfoDay1 ringFiveInfo = wsmap.get("ringFiveInfo");
  593. ProEconPowerstationInfoDay1 withFiveInfo = wsmap.get("withFiveInfo");
  594. if (null != currFiveInfo && compare0(currFiveInfo.getRllfdl())) {
  595. BigDecimal currgzsll = compare100(currFiveInfo.getRgzssdl().divide(currFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  596. BigDecimal currjxsll = compare100(currFiveInfo.getRjxssdl().divide(currFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  597. BigDecimal currxdsll = compare100((currFiveInfo.getRxdtjssdl().add(currFiveInfo.getRxdjclssdl())).divide(currFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  598. BigDecimal currslsll = compare100((currFiveInfo.getRcwsldwssdl().add(currFiveInfo.getRcwsltqssdl())).divide(currFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  599. BigDecimal currxnsll = compare100(currFiveInfo.getRxnssdl().divide(currFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  600. dto.setCurrGzsll(currgzsll);
  601. dto.setCurrJxsll(currjxsll);
  602. dto.setCurrXdsll(currxdsll);
  603. dto.setCurrSlsll(currslsll);
  604. dto.setCurrXNsll(currxnsll);
  605. if (null != ringFiveInfo && compare0(ringFiveInfo.getRllfdl())) {
  606. BigDecimal ringgzsll = compare100(ringFiveInfo.getRgzssdl().divide(ringFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  607. BigDecimal ringjxsll = compare100(ringFiveInfo.getRjxssdl().divide(ringFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  608. BigDecimal ringxdsll = compare100((ringFiveInfo.getRxdtjssdl().add(ringFiveInfo.getRxdjclssdl())).divide(ringFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  609. BigDecimal ringslsll = compare100((ringFiveInfo.getRcwsldwssdl().add(ringFiveInfo.getRcwsltqssdl())).divide(ringFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  610. BigDecimal ringxnsll = compare100(ringFiveInfo.getRxnssdl().divide(ringFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  611. if (compare0(ringgzsll)) {
  612. BigDecimal ringGzslzzl = currgzsll.subtract(ringgzsll).divide(ringgzsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  613. dto.setRingGzslzzl(ringGzslzzl);
  614. }
  615. if (compare0(ringjxsll)) {
  616. BigDecimal ringjxslzzl = currjxsll.subtract(ringjxsll).divide(ringjxsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  617. dto.setRingJxslzzl(ringjxslzzl);
  618. }
  619. if (compare0(ringxdsll)) {
  620. BigDecimal ringxdslzzl = currxdsll.subtract(ringxdsll).divide(ringxdsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  621. dto.setRingXdslzzl(ringxdslzzl);
  622. }
  623. if (compare0(ringslsll)) {
  624. BigDecimal ringslslzzl = currslsll.subtract(ringslsll).divide(ringslsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  625. dto.setRingSlslzzl(ringslslzzl);
  626. }
  627. if (compare0(ringxnsll)) {
  628. BigDecimal ringxnslzzl = currxnsll.subtract(ringxnsll).divide(ringxnsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  629. dto.setRingXnslzzl(ringxnslzzl);
  630. }
  631. }
  632. if (null != withFiveInfo && compare0(withFiveInfo.getRllfdl())) {
  633. BigDecimal withgzsll = compare100(withFiveInfo.getRgzssdl().divide(withFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  634. BigDecimal withjxsll = compare100(withFiveInfo.getRjxssdl().divide(withFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  635. BigDecimal withxdsll = compare100((withFiveInfo.getRxdtjssdl().add(withFiveInfo.getRxdjclssdl())).divide(withFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  636. BigDecimal withslsll = compare100((withFiveInfo.getRcwsldwssdl().add(withFiveInfo.getRcwsltqssdl())).divide(withFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  637. BigDecimal withxnsll = compare100(withFiveInfo.getRxnssdl().divide(withFiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  638. if (compare0(withgzsll)) {
  639. BigDecimal withGzslzzl = compare100(currgzsll.subtract(withgzsll).divide(withgzsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  640. dto.setWithGzslzzl(withGzslzzl);
  641. }
  642. if (compare0(withjxsll)) {
  643. BigDecimal withjxslzzl = compare100(currjxsll.subtract(withjxsll).divide(withjxsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  644. dto.setWithJxslzzl(withjxslzzl);
  645. }
  646. if (compare0(withxdsll)) {
  647. BigDecimal withxdslzzl = compare100(currxdsll.subtract(withxdsll).divide(withxdsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  648. dto.setWithXdslzzl(withxdslzzl);
  649. }
  650. if (compare0(withslsll)) {
  651. BigDecimal withslslzzl = compare100(currslsll.subtract(withslsll).divide(withslsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  652. dto.setWithSlslzzl(withslslzzl);
  653. }
  654. if (compare0(withxnsll)) {
  655. BigDecimal withxnslzzl = compare100(currxnsll.subtract(withxnsll).divide(withxnsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  656. dto.setWithXnslzzl(withxnslzzl);
  657. }
  658. }
  659. }
  660. }
  661. private void monthFiveInfo() {
  662. ProEconPowerstationInfoDay1 currFiveInfo = wsmap.get("currFiveInfo");
  663. ProEconPowerstationInfoDay1 ringFiveInfo = wsmap.get("ringFiveInfo");
  664. ProEconPowerstationInfoDay1 withFiveInfo = wsmap.get("withFiveInfo");
  665. if (null != currFiveInfo && compare0(currFiveInfo.getYllfdl())) {
  666. BigDecimal currgzsll = compare100(currFiveInfo.getYgzssdl().divide(currFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  667. BigDecimal currjxsll = compare100(currFiveInfo.getYjxssdl().divide(currFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  668. BigDecimal currxdsll = compare100((currFiveInfo.getYxdtjssdl().add(currFiveInfo.getYxdjclssdl())).divide(currFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  669. BigDecimal currslsll = compare100((currFiveInfo.getYcwsldwssdl().add(currFiveInfo.getYcwsltqssdl())).divide(currFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  670. BigDecimal currxnsll = compare100(currFiveInfo.getYxnssdl().divide(currFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  671. dto.setCurrGzsll(currgzsll);
  672. dto.setCurrJxsll(currjxsll);
  673. dto.setCurrXdsll(currxdsll);
  674. dto.setCurrSlsll(currslsll);
  675. dto.setCurrXNsll(currxnsll);
  676. if (null != ringFiveInfo && compare0(ringFiveInfo.getYllfdl())) {
  677. BigDecimal ringgzsll = compare100(ringFiveInfo.getYgzssdl().divide(ringFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  678. BigDecimal ringjxsll = compare100(ringFiveInfo.getYjxssdl().divide(ringFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  679. BigDecimal ringxdsll = compare100((ringFiveInfo.getYxdtjssdl().add(ringFiveInfo.getYxdjclssdl())).divide(ringFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  680. BigDecimal ringslsll = compare100((ringFiveInfo.getYcwsldwssdl().add(ringFiveInfo.getYcwsltqssdl())).divide(ringFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  681. BigDecimal ringxnsll = compare100(ringFiveInfo.getYxnssdl().divide(ringFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  682. if (compare0(ringgzsll)) {
  683. BigDecimal ringGzslzzl = compare100(currgzsll.subtract(ringgzsll).divide(ringgzsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  684. dto.setRingGzslzzl(ringGzslzzl);
  685. }
  686. if (compare0(ringjxsll)) {
  687. BigDecimal ringjxslzzl = compare100(currjxsll.subtract(ringjxsll).divide(ringjxsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  688. dto.setRingJxslzzl(ringjxslzzl);
  689. }
  690. if (compare0(ringxdsll)) {
  691. BigDecimal ringxdslzzl = compare100(currxdsll.subtract(ringxdsll).divide(ringxdsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  692. dto.setRingXdslzzl(ringxdslzzl);
  693. }
  694. if (compare0(ringslsll)) {
  695. BigDecimal ringslslzzl = compare100(currslsll.subtract(ringslsll).divide(ringslsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  696. dto.setRingSlslzzl(ringslslzzl);
  697. }
  698. if (compare0(ringxnsll)) {
  699. BigDecimal ringxnslzzl = compare100(currxnsll.subtract(ringxnsll).divide(ringxnsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  700. dto.setRingXnslzzl(ringxnslzzl);
  701. }
  702. }
  703. if (null != withFiveInfo && compare0(withFiveInfo.getYllfdl())) {
  704. BigDecimal withgzsll = compare100(withFiveInfo.getYgzssdl().divide(withFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  705. BigDecimal withjxsll = compare100(withFiveInfo.getYjxssdl().divide(withFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  706. BigDecimal withxdsll = compare100((withFiveInfo.getYxdtjssdl().add(withFiveInfo.getYxdjclssdl())).divide(withFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  707. BigDecimal withslsll = compare100((withFiveInfo.getYcwsldwssdl().add(withFiveInfo.getYcwsltqssdl())).divide(withFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  708. BigDecimal withxnsll = compare100(withFiveInfo.getYxnssdl().divide(withFiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  709. if (compare0(withgzsll)) {
  710. BigDecimal withGzslzzl = compare100(currgzsll.subtract(withgzsll).divide(withgzsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  711. dto.setWithGzslzzl(withGzslzzl);
  712. }
  713. if (compare0(withjxsll)) {
  714. BigDecimal withjxslzzl = compare100(currjxsll.subtract(withjxsll).divide(withjxsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  715. dto.setWithJxslzzl(withjxslzzl);
  716. }
  717. if (compare0(withxdsll)) {
  718. BigDecimal withxdslzzl = compare100(currxdsll.subtract(withxdsll).divide(withxdsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  719. dto.setWithXdslzzl(withxdslzzl);
  720. }
  721. if (compare0(withslsll)) {
  722. BigDecimal withslslzzl = compare100(currslsll.subtract(withslsll).divide(withslsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  723. dto.setWithSlslzzl(withslslzzl);
  724. }
  725. if (compare0(withxnsll)) {
  726. BigDecimal withxnslzzl = compare100(currxnsll.subtract(withxnsll).divide(withxnsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  727. dto.setWithXnslzzl(withxnslzzl);
  728. }
  729. }
  730. }
  731. }
  732. private void yearFiveInfo() {
  733. ProEconPowerstationInfoDay1 currFiveInfo = wsmap.get("currFiveInfo");
  734. ProEconPowerstationInfoDay1 ringFiveInfo = wsmap.get("ringFiveInfo");
  735. ProEconPowerstationInfoDay1 withFiveInfo = wsmap.get("withFiveInfo");
  736. if (null != currFiveInfo && compare0(currFiveInfo.getNllfdl())) {
  737. BigDecimal currgzsll = compare100(currFiveInfo.getNgzssdl().divide(currFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  738. BigDecimal currjxsll = compare100(currFiveInfo.getNjxssdl().divide(currFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  739. BigDecimal currxdsll = compare100((currFiveInfo.getNxdtjssdl().add(currFiveInfo.getNxdjclssdl())).divide(currFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  740. BigDecimal currslsll = compare100((currFiveInfo.getNcwsldwssdl().add(currFiveInfo.getNcwsltqssdl())).divide(currFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  741. BigDecimal currxnsll = compare100(currFiveInfo.getNxnssdl().divide(currFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  742. dto.setCurrGzsll(currgzsll);
  743. dto.setCurrJxsll(currjxsll);
  744. dto.setCurrXdsll(currxdsll);
  745. dto.setCurrSlsll(currslsll);
  746. dto.setCurrXNsll(currxnsll);
  747. if (null != ringFiveInfo && compare0(ringFiveInfo.getNllfdl())) {
  748. BigDecimal ringgzsll = compare100(ringFiveInfo.getNgzssdl().divide(ringFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  749. BigDecimal ringjxsll = compare100(ringFiveInfo.getNjxssdl().divide(ringFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  750. BigDecimal ringxdsll = compare100((ringFiveInfo.getNxdtjssdl().add(ringFiveInfo.getNxdjclssdl())).divide(ringFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  751. BigDecimal ringslsll = compare100((ringFiveInfo.getNcwsldwssdl().add(ringFiveInfo.getNcwsltqssdl())).divide(ringFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  752. BigDecimal ringxnsll = compare100(ringFiveInfo.getNxnssdl().divide(ringFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  753. if (compare0(ringgzsll)) {
  754. BigDecimal ringGzslzzl = compare100(currgzsll.subtract(ringgzsll).divide(ringgzsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  755. dto.setRingGzslzzl(ringGzslzzl);
  756. }
  757. if (compare0(ringjxsll)) {
  758. BigDecimal ringjxslzzl = compare100(currjxsll.subtract(ringjxsll).divide(ringjxsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  759. dto.setRingJxslzzl(ringjxslzzl);
  760. }
  761. if (compare0(ringxdsll)) {
  762. BigDecimal ringxdslzzl = compare100(currxdsll.subtract(ringxdsll).divide(ringxdsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  763. dto.setRingXdslzzl(ringxdslzzl);
  764. }
  765. if (compare0(ringslsll)) {
  766. BigDecimal ringslslzzl = compare100(currslsll.subtract(ringslsll).divide(ringslsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  767. dto.setRingSlslzzl(ringslslzzl);
  768. }
  769. if (compare0(ringxnsll)) {
  770. BigDecimal ringxnslzzl = compare100(currxnsll.subtract(ringxnsll).divide(ringxnsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  771. dto.setRingXnslzzl(ringxnslzzl);
  772. }
  773. }
  774. if (null != withFiveInfo && compare0(withFiveInfo.getNllfdl())) {
  775. BigDecimal withgzsll = compare100(withFiveInfo.getNgzssdl().divide(withFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  776. BigDecimal withjxsll = compare100(withFiveInfo.getNjxssdl().divide(withFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  777. BigDecimal withxdsll = compare100((withFiveInfo.getNxdtjssdl().add(withFiveInfo.getNxdjclssdl())).divide(withFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  778. BigDecimal withslsll = compare100((withFiveInfo.getNcwsldwssdl().add(withFiveInfo.getNcwsltqssdl())).divide(withFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  779. BigDecimal withxnsll = compare100(withFiveInfo.getNxnssdl().divide(withFiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  780. if (compare0(withgzsll)) {
  781. BigDecimal withGzslzzl = compare100(currgzsll.subtract(withgzsll).divide(withgzsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  782. dto.setWithGzslzzl(withGzslzzl);
  783. }
  784. if (compare0(withjxsll)) {
  785. BigDecimal withjxslzzl = compare100(currjxsll.subtract(withjxsll).divide(withjxsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  786. dto.setWithJxslzzl(withjxslzzl);
  787. }
  788. if (compare0(withxdsll)) {
  789. BigDecimal withxdslzzl = compare100(currxdsll.subtract(withxdsll).divide(withxdsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  790. dto.setWithXdslzzl(withxdslzzl);
  791. }
  792. if (compare0(withslsll)) {
  793. BigDecimal withslslzzl = compare100(currslsll.subtract(withslsll).divide(withslsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  794. dto.setWithSlslzzl(withslslzzl);
  795. }
  796. if (compare0(withxnsll)) {
  797. BigDecimal withxnslzzl = compare100(currxnsll.subtract(withxnsll).divide(withxnsll, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
  798. dto.setWithXnslzzl(withxnslzzl);
  799. }
  800. }
  801. }
  802. }
  803. /**
  804. * 三率经济指标
  805. */
  806. private void currThreeRateInfo(String staType) {
  807. if (staType.equals("-2")) {
  808. ProEconPowerstationInfoDay7 currThreeInfo = gfslmap.get("currThreeInfo");
  809. ProEconPowerstationInfoDay7 ringThreeInfo = gfslmap.get("ringThreeInfo");
  810. ProEconPowerstationInfoDay7 withThreeInfo = gfslmap.get("withThreeInfo");
  811. if (null != currThreeInfo) {
  812. dto.setCurrFwjsl(currThreeInfo.getRxtxlpr());
  813. dto.setCurrZtzhl(currThreeInfo.getRlsl());
  814. dto.setCurrXqjsl(currThreeInfo.getRnbqzhxl());
  815. if (null != ringThreeInfo) {
  816. if (compare0(ringThreeInfo.getRxtxlpr())) {
  817. 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));
  818. }
  819. if (compare0(ringThreeInfo.getRlsl())) {
  820. 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));
  821. }
  822. if (compare0(ringThreeInfo.getRnbqzhxl())) {
  823. 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));
  824. }
  825. }
  826. if (null != withThreeInfo) {
  827. if (compare0(withThreeInfo.getRxtxlpr())) {
  828. 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));
  829. }
  830. if (compare0(withThreeInfo.getRlsl())) {
  831. 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));
  832. }
  833. if (compare0(withThreeInfo.getRnbqzhxl())) {
  834. 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));
  835. }
  836. }
  837. }
  838. } else {
  839. ProEconPowerstationInfoDay4 currThreeInfo = slmap.get("currThreeInfo");
  840. ProEconPowerstationInfoDay4 ringThreeInfo = slmap.get("ringThreeInfo");
  841. ProEconPowerstationInfoDay4 withThreeInfo = slmap.get("withThreeInfo");
  842. if (null != currThreeInfo) {
  843. dto.setCurrFwjsl(currThreeInfo.getRfwjsl());
  844. dto.setCurrZtzhl(currThreeInfo.getRztzhjsl());
  845. dto.setCurrXqjsl(currThreeInfo.getRgzxqjsl());
  846. if (null != ringThreeInfo) {
  847. if (compare0(ringThreeInfo.getRfwjsl())) {
  848. 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));
  849. }
  850. if (compare0(ringThreeInfo.getRztzhjsl())) {
  851. 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));
  852. }
  853. if (compare0(ringThreeInfo.getRgzxqjsl())) {
  854. 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));
  855. }
  856. }
  857. if (null != withThreeInfo) {
  858. if (compare0(withThreeInfo.getRfwjsl())) {
  859. 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));
  860. }
  861. if (compare0(withThreeInfo.getRztzhjsl())) {
  862. 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));
  863. }
  864. if (compare0(withThreeInfo.getRgzxqjsl())) {
  865. 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));
  866. }
  867. }
  868. }
  869. }
  870. }
  871. private void monthThreeRateInfo(String staType) {
  872. if (staType.equals("-2")) {
  873. ProEconPowerstationInfoDay7 currThreeInfo = gfslmap.get("currThreeInfo");
  874. ProEconPowerstationInfoDay7 ringThreeInfo = gfslmap.get("ringThreeInfo");
  875. ProEconPowerstationInfoDay7 withThreeInfo = gfslmap.get("withThreeInfo");
  876. if (null != currThreeInfo) {
  877. dto.setCurrFwjsl(currThreeInfo.getYxtxlpr());
  878. dto.setCurrZtzhl(currThreeInfo.getYlsl());
  879. dto.setCurrXqjsl(currThreeInfo.getYnbqzhxl());
  880. if (null != ringThreeInfo) {
  881. if (compare0(ringThreeInfo.getYxtxlpr())) {
  882. 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));
  883. }
  884. if (compare0(ringThreeInfo.getYlsl())) {
  885. 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));
  886. }
  887. if (compare0(ringThreeInfo.getYnbqzhxl())) {
  888. 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));
  889. }
  890. }
  891. if (null != withThreeInfo) {
  892. if (compare0(withThreeInfo.getYxtxlpr())) {
  893. 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));
  894. }
  895. if (compare0(withThreeInfo.getYlsl())) {
  896. 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));
  897. }
  898. if (compare0(withThreeInfo.getYnbqzhxl())) {
  899. 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));
  900. }
  901. }
  902. }
  903. } else {
  904. ProEconPowerstationInfoDay4 currThreeInfo = slmap.get("currThreeInfo");
  905. ProEconPowerstationInfoDay4 ringThreeInfo = slmap.get("ringThreeInfo");
  906. ProEconPowerstationInfoDay4 withThreeInfo = slmap.get("withThreeInfo");
  907. if (null != currThreeInfo) {
  908. dto.setCurrFwjsl(currThreeInfo.getYfwjsl());
  909. dto.setCurrZtzhl(currThreeInfo.getYztzhjsl());
  910. dto.setCurrXqjsl(currThreeInfo.getYgzxqjsl());
  911. if (null != ringThreeInfo) {
  912. if (compare0(ringThreeInfo.getYfwjsl())) {
  913. 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));
  914. }
  915. if (compare0(ringThreeInfo.getYztzhjsl())) {
  916. 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));
  917. }
  918. if (compare0(ringThreeInfo.getYgzxqjsl())) {
  919. 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));
  920. }
  921. }
  922. if (null != withThreeInfo) {
  923. if (compare0(withThreeInfo.getYfwjsl())) {
  924. 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));
  925. }
  926. if (compare0(withThreeInfo.getYztzhjsl())) {
  927. 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));
  928. }
  929. if (compare0(withThreeInfo.getYgzxqjsl())) {
  930. 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));
  931. }
  932. }
  933. }
  934. }
  935. }
  936. private void yearThreeRateInfo(String staType) {
  937. if (staType.equals("-2")) {
  938. ProEconPowerstationInfoDay7 currThreeInfo = gfslmap.get("currThreeInfo");
  939. ProEconPowerstationInfoDay7 ringThreeInfo = gfslmap.get("ringThreeInfo");
  940. ProEconPowerstationInfoDay7 withThreeInfo = gfslmap.get("withThreeInfo");
  941. if (null != currThreeInfo) {
  942. dto.setCurrFwjsl(currThreeInfo.getNxtxlpr());
  943. dto.setCurrZtzhl(currThreeInfo.getNlsl());
  944. dto.setCurrXqjsl(currThreeInfo.getNnbqzhxl());
  945. if (null != ringThreeInfo) {
  946. if (compare0(ringThreeInfo.getNxtxlpr())) {
  947. 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));
  948. }
  949. if (compare0(ringThreeInfo.getNlsl())) {
  950. 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));
  951. }
  952. if (compare0(ringThreeInfo.getNnbqzhxl())) {
  953. 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));
  954. }
  955. }
  956. if (null != withThreeInfo) {
  957. if (compare0(withThreeInfo.getNxtxlpr())) {
  958. 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));
  959. }
  960. if (compare0(withThreeInfo.getNlsl())) {
  961. 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));
  962. }
  963. if (compare0(withThreeInfo.getNnbqzhxl())) {
  964. 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));
  965. }
  966. }
  967. }
  968. } else {
  969. ProEconPowerstationInfoDay4 currThreeInfo = slmap.get("currThreeInfo");
  970. ProEconPowerstationInfoDay4 ringThreeInfo = slmap.get("ringThreeInfo");
  971. ProEconPowerstationInfoDay4 withThreeInfo = slmap.get("withThreeInfo");
  972. if (null != currThreeInfo) {
  973. dto.setCurrFwjsl(currThreeInfo.getNfwjsl());
  974. dto.setCurrZtzhl(currThreeInfo.getNztzhjsl());
  975. dto.setCurrXqjsl(currThreeInfo.getNgzxqjsl());
  976. if (null != ringThreeInfo) {
  977. if (compare0(ringThreeInfo.getNfwjsl())) {
  978. 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));
  979. }
  980. if (compare0(ringThreeInfo.getNztzhjsl())) {
  981. 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));
  982. }
  983. if (compare0(ringThreeInfo.getNgzxqjsl())) {
  984. 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));
  985. }
  986. }
  987. if (null != withThreeInfo) {
  988. if (compare0(withThreeInfo.getNfwjsl())) {
  989. 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));
  990. }
  991. if (compare0(withThreeInfo.getNztzhjsl())) {
  992. 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));
  993. }
  994. if (compare0(withThreeInfo.getNgzxqjsl())) {
  995. 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));
  996. }
  997. }
  998. }
  999. }
  1000. }
  1001. /**
  1002. * 其它经济指标
  1003. */
  1004. private void currOtherInfo() {
  1005. ProEconPowerstationInfoDay5 currDlInfo = dlmap.get("currDlInfo");
  1006. ProEconPowerstationInfoDay5 ringDlInfo = dlmap.get("ringDlInfo");
  1007. ProEconPowerstationInfoDay5 withDlInfo = dlmap.get("withDlInfo");
  1008. ProEconPowerstationInfoDay6 currGlInfo = glmap.get("currGlInfo");
  1009. ProEconPowerstationInfoDay6 ringGlInfo = glmap.get("ringGlInfo");
  1010. ProEconPowerstationInfoDay6 withGlInfo = glmap.get("withGlInfo");
  1011. ProEconPowerstationInfoDay2 currTimeInfo = wstimemap.get("currTimeInfo");
  1012. ProEconPowerstationInfoDay2 ringTimeInfo = wstimemap.get("ringTimeInfo");
  1013. ProEconPowerstationInfoDay2 withTimeInfo = wstimemap.get("withTimeInfo");
  1014. if (null != currDlInfo && compare0(currDlInfo.getRfdldb())) {
  1015. BigDecimal currZhcydl = compare0(currDlInfo.getRfdldb()) ? compare100(currDlInfo.getRzhcydldb().divide(currDlInfo.getRfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))) : new BigDecimal(0);
  1016. dto.setCurrZhcydl(currZhcydl);
  1017. if (null != ringDlInfo && compare0(currDlInfo.getRfdldb())) {
  1018. if (compare0(ringDlInfo.getRfdldb())) {
  1019. BigDecimal ringZhcydl = ringDlInfo.getRzhcydldb().divide(ringDlInfo.getRfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1020. if (compare0(ringZhcydl)) {
  1021. BigDecimal ringZhcydzzl = (currZhcydl.subtract(ringZhcydl)).divide(ringZhcydl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1022. dto.setRingZhcydzzl(ringZhcydzzl);
  1023. }
  1024. }
  1025. }
  1026. if (null != withDlInfo && compare0(currDlInfo.getRfdldb())) {
  1027. if (compare0(withDlInfo.getRfdldb())) {
  1028. BigDecimal withZhcydl = withDlInfo.getRzhcydldb().divide(withDlInfo.getRfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1029. if (compare0(withZhcydl)) {
  1030. BigDecimal withZhcydzzl = (currZhcydl.subtract(withZhcydl)).divide(withZhcydl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1031. dto.setWithZhcydzzl(withZhcydzzl);
  1032. }
  1033. }
  1034. }
  1035. }
  1036. if (null != currGlInfo && compare0(capacity)) {
  1037. BigDecimal currGlqxfhl = currGlInfo.getRpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1038. dto.setCurrGlqxfhl(currGlqxfhl);
  1039. if (null != ringGlInfo) {
  1040. BigDecimal ringGlqxfhl = ringGlInfo.getRpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1041. if (compare0(ringGlqxfhl)) {
  1042. BigDecimal ringGlqxfhzzl = (currGlqxfhl.subtract(ringGlqxfhl)).divide(ringGlqxfhl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1043. dto.setRingGlqxfhzzl(ringGlqxfhzzl);
  1044. }
  1045. }
  1046. if (null != withGlInfo) {
  1047. BigDecimal withGlqxfhl = withGlInfo.getRpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1048. if (compare0(withGlqxfhl)) {
  1049. BigDecimal withGlqxfhzzl = (currGlqxfhl.subtract(withGlqxfhl)).divide(withGlqxfhl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1050. dto.setWithGlqxfhzzl(withGlqxfhzzl);
  1051. }
  1052. }
  1053. }
  1054. if (null != currTimeInfo) {
  1055. double currhours = DateUtils.hoursDiff1(new Date(), DateUtils.getStartOfDay(new Date()));
  1056. BigDecimal currhours2 = new BigDecimal(0.00).valueOf(currhours);
  1057. currhours2 = compare0(currhours2) ? currhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
  1058. currhours2 = compare0(currhours2) ? currhours2 : new BigDecimal(1);
  1059. BigDecimal currSbklyl = currhours2.subtract((currTimeInfo.getRhjgzxsmx().add(currTimeInfo.getRhjjxtjxs()))).divide(currhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1060. dto.setCurrSbklyl(currSbklyl);
  1061. if (null != ringTimeInfo) {
  1062. int ringhours = DateUtils.hoursDiff(new Date(), DateUtils.getMonthFirstZero());
  1063. BigDecimal ringhours2 = new BigDecimal(0.00).valueOf((int) ringhours);
  1064. ringhours2 = compare0(ringhours2) ? ringhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
  1065. BigDecimal ringSbklyl = ringhours2.subtract((ringTimeInfo.getRhjgzxsmx().add(ringTimeInfo.getRhjjxtjxs()))).divide(ringhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1066. if (compare0(ringSbklyl)) {
  1067. BigDecimal ringSbklyzzl = (currSbklyl.subtract(ringSbklyl)).divide(ringSbklyl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1068. dto.setRingSbklyzzl(ringSbklyzzl);
  1069. }
  1070. }
  1071. if (null != withTimeInfo) {
  1072. int withhours = DateUtils.hoursDiff(new Date(), DateUtils.getYearFirstZero());
  1073. BigDecimal withhours2 = new BigDecimal(0.00).valueOf((int) withhours);
  1074. withhours2 = compare0(withhours2) ? withhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
  1075. BigDecimal withSbklyl = withhours2.subtract((withTimeInfo.getRhjgzxsmx().add(withTimeInfo.getRhjjxtjxs()))).divide(withhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1076. if (compare0(withSbklyl)) {
  1077. BigDecimal withSbklyzzl = (currSbklyl.subtract(withSbklyl)).divide(withSbklyl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1078. dto.setWithSbklyzzl(withSbklyzzl);
  1079. }
  1080. }
  1081. }
  1082. }
  1083. private void monthOtherInfo() {
  1084. ProEconPowerstationInfoDay5 currDlInfo = dlmap.get("currDlInfo");
  1085. ProEconPowerstationInfoDay5 ringDlInfo = dlmap.get("ringDlInfo");
  1086. ProEconPowerstationInfoDay5 withDlInfo = dlmap.get("withDlInfo");
  1087. ProEconPowerstationInfoDay6 currGlInfo = glmap.get("currGlInfo");
  1088. ProEconPowerstationInfoDay6 ringGlInfo = glmap.get("ringGlInfo");
  1089. ProEconPowerstationInfoDay6 withGlInfo = glmap.get("withGlInfo");
  1090. ProEconPowerstationInfoDay2 currTimeInfo = wstimemap.get("currTimeInfo");
  1091. ProEconPowerstationInfoDay2 ringTimeInfo = wstimemap.get("ringTimeInfo");
  1092. ProEconPowerstationInfoDay2 withTimeInfo = wstimemap.get("withTimeInfo");
  1093. if (null != currDlInfo && compare0(currDlInfo.getYfdldb())) {
  1094. BigDecimal currZhcydl = currDlInfo.getYzhcydldb().divide(currDlInfo.getYfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1095. dto.setCurrZhcydl(currZhcydl);
  1096. if (null != ringDlInfo && compare0(ringDlInfo.getYfdldb())) {
  1097. BigDecimal ringZhcydl = ringDlInfo.getYzhcydldb().divide(ringDlInfo.getYfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1098. if (compare0(ringZhcydl)) {
  1099. BigDecimal ringZhcydzzl = (currZhcydl.subtract(ringZhcydl)).divide(ringZhcydl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1100. dto.setRingZhcydzzl(ringZhcydzzl);
  1101. }
  1102. }
  1103. if (null != withDlInfo && compare0(withDlInfo.getYfdldb())) {
  1104. BigDecimal withZhcydl = withDlInfo.getYzhcydldb().divide(withDlInfo.getYfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1105. if (compare0(withZhcydl)) {
  1106. BigDecimal withZhcydzzl = (currZhcydl.subtract(withZhcydl)).divide(withZhcydl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1107. dto.setWithZhcydzzl(withZhcydzzl);
  1108. }
  1109. }
  1110. }
  1111. if (null != currGlInfo && compare0(capacity)) {
  1112. BigDecimal currGlqxfhl = currGlInfo.getYpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1113. dto.setCurrGlqxfhl(currGlqxfhl);
  1114. if (null != ringGlInfo) {
  1115. BigDecimal ringGlqxfhl = ringGlInfo.getYpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1116. if (compare0(ringGlqxfhl)) {
  1117. BigDecimal ringGlqxfhzzl = (currGlqxfhl.subtract(ringGlqxfhl)).divide(ringGlqxfhl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1118. dto.setRingGlqxfhzzl(ringGlqxfhzzl);
  1119. }
  1120. }
  1121. if (null != withGlInfo) {
  1122. BigDecimal withGlqxfhl = withGlInfo.getYpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1123. if (compare0(withGlqxfhl)) {
  1124. BigDecimal withGlqxfhzzl = (currGlqxfhl.subtract(withGlqxfhl)).divide(withGlqxfhl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1125. dto.setWithGlqxfhzzl(withGlqxfhzzl);
  1126. }
  1127. }
  1128. }
  1129. if (null != currTimeInfo) {
  1130. int currhours = DateUtils.hoursDiff(new Date(), DateUtils.getStartOfDay(new Date()));
  1131. BigDecimal currhours2 = new BigDecimal(0.00).valueOf((int) currhours);
  1132. currhours2 = compare0(currhours2) ? currhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
  1133. BigDecimal currSbklyl = currhours2.subtract((currTimeInfo.getYhjgzxsmx().add(currTimeInfo.getYhjjxtjxs()))).divide(currhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1134. dto.setCurrSbklyl(currSbklyl);
  1135. if (null != ringTimeInfo) {
  1136. int ringhours = DateUtils.hoursDiff(new Date(), DateUtils.getMonthFirstZero());
  1137. BigDecimal ringhours2 = new BigDecimal(0.00).valueOf((int) ringhours);
  1138. ringhours2 = compare0(ringhours2) ? ringhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
  1139. BigDecimal ringSbklyl = ringhours2.subtract((ringTimeInfo.getYhjgzxsmx().add(ringTimeInfo.getYhjjxtjxs()))).divide(ringhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1140. if (compare0(ringSbklyl)) {
  1141. BigDecimal ringSbklyzzl = (currSbklyl.subtract(ringSbklyl)).divide(ringSbklyl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1142. dto.setRingSbklyzzl(ringSbklyzzl);
  1143. }
  1144. }
  1145. if (null != withTimeInfo) {
  1146. int withhours = DateUtils.hoursDiff(new Date(), DateUtils.getYearFirstZero());
  1147. BigDecimal withhours2 = new BigDecimal(0.00).valueOf((int) withhours);
  1148. withhours2 = compare0(withhours2) ? withhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
  1149. BigDecimal withSbklyl = withhours2.subtract((withTimeInfo.getYhjgzxsmx().add(withTimeInfo.getYhjjxtjxs()))).divide(withhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1150. if (compare0(withSbklyl)) {
  1151. BigDecimal withSbklyzzl = (currSbklyl.subtract(withSbklyl)).divide(withSbklyl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1152. dto.setWithSbklyzzl(withSbklyzzl);
  1153. }
  1154. }
  1155. }
  1156. }
  1157. private void yearOtherInfo() {
  1158. ProEconPowerstationInfoDay5 currDlInfo = dlmap.get("currDlInfo");
  1159. ProEconPowerstationInfoDay5 ringDlInfo = dlmap.get("ringDlInfo");
  1160. ProEconPowerstationInfoDay5 withDlInfo = dlmap.get("withDlInfo");
  1161. ProEconPowerstationInfoDay6 currGlInfo = glmap.get("currGlInfo");
  1162. ProEconPowerstationInfoDay6 ringGlInfo = glmap.get("ringGlInfo");
  1163. ProEconPowerstationInfoDay6 withGlInfo = glmap.get("withGlInfo");
  1164. ProEconPowerstationInfoDay2 currTimeInfo = wstimemap.get("currTimeInfo");
  1165. ProEconPowerstationInfoDay2 ringTimeInfo = wstimemap.get("ringTimeInfo");
  1166. ProEconPowerstationInfoDay2 withTimeInfo = wstimemap.get("withTimeInfo");
  1167. if (null != currDlInfo && compare0(currDlInfo.getNfdldb())) {
  1168. BigDecimal currZhcydl = compare0(currDlInfo.getNfdldb()) ? currDlInfo.getNzhcydldb().divide(currDlInfo.getNfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")) : new BigDecimal(0);
  1169. dto.setCurrZhcydl(currZhcydl);
  1170. if (null != ringDlInfo && compare0(currDlInfo.getNfdldb())) {
  1171. BigDecimal ringZhcydl = ringDlInfo.getNzhcydldb().divide(ringDlInfo.getNfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1172. if (compare0(ringZhcydl)) {
  1173. BigDecimal ringZhcydzzl = (currZhcydl.subtract(ringZhcydl)).divide(ringZhcydl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1174. dto.setRingZhcydzzl(ringZhcydzzl);
  1175. }
  1176. }
  1177. if (null != withDlInfo && compare0(currDlInfo.getNfdldb())) {
  1178. BigDecimal withZhcydl = withDlInfo.getNzhcydldb().divide(withDlInfo.getNfdldb(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1179. if (compare0(withZhcydl)) {
  1180. BigDecimal withZhcydzzl = (currZhcydl.subtract(withZhcydl)).divide(withZhcydl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1181. dto.setWithZhcydzzl(withZhcydzzl);
  1182. }
  1183. }
  1184. }
  1185. if (null != currGlInfo && compare0(capacity)) {
  1186. BigDecimal currGlqxfhl = currGlInfo.getNpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1187. dto.setCurrGlqxfhl(currGlqxfhl);
  1188. if (null != ringGlInfo) {
  1189. BigDecimal ringGlqxfhl = ringGlInfo.getNpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1190. if (compare0(ringGlqxfhl)) {
  1191. BigDecimal ringGlqxfhzzl = (currGlqxfhl.subtract(ringGlqxfhl)).divide(ringGlqxfhl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1192. dto.setRingGlqxfhzzl(ringGlqxfhzzl);
  1193. }
  1194. }
  1195. if (null != withGlInfo) {
  1196. BigDecimal withGlqxfhl = withGlInfo.getNpjglcx().divide(capacity, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1197. if (compare0(withGlqxfhl)) {
  1198. BigDecimal withGlqxfhzzl = (currGlqxfhl.subtract(withGlqxfhl)).divide(withGlqxfhl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1199. dto.setWithGlqxfhzzl(withGlqxfhzzl);
  1200. }
  1201. }
  1202. }
  1203. if (null != currTimeInfo) {
  1204. int currhours = DateUtils.hoursDiff(new Date(), DateUtils.getStartOfDay(new Date()));
  1205. BigDecimal currhours2 = new BigDecimal(0).valueOf((int) currhours);
  1206. currhours2 = compare0(currhours2) ? currhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
  1207. BigDecimal currSbklyl = currhours2.subtract((currTimeInfo.getNhjgzxsmx().add(currTimeInfo.getNhjjxtjxs()))).divide(currhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1208. dto.setCurrSbklyl(currSbklyl);
  1209. if (null != ringTimeInfo) {
  1210. int ringhours = DateUtils.hoursDiff(new Date(), DateUtils.getMonthFirstZero());
  1211. BigDecimal ringhours2 = new BigDecimal(0).valueOf((int) ringhours);
  1212. ringhours2 = compare0(ringhours2) ? ringhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
  1213. BigDecimal ringSbklyl = ringhours2.subtract((ringTimeInfo.getNhjgzxsmx().add(ringTimeInfo.getNhjjxtjxs()))).divide(ringhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1214. if (compare0(ringSbklyl)) {
  1215. BigDecimal ringSbklyzzl = (currSbklyl.subtract(ringSbklyl)).divide(ringSbklyl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1216. dto.setRingSbklyzzl(ringSbklyzzl);
  1217. }
  1218. }
  1219. if (null != withTimeInfo) {
  1220. int withhours = DateUtils.hoursDiff(new Date(), DateUtils.getYearFirstZero());
  1221. BigDecimal withhours2 = new BigDecimal(0).valueOf((int) withhours);
  1222. withhours2 = compare0(withhours2) ? withhours2.multiply(new BigDecimal(quantity)) : new BigDecimal(1 * quantity);
  1223. BigDecimal withSbklyl = withhours2.subtract((withTimeInfo.getNhjgzxsmx().add(withTimeInfo.getNhjjxtjxs()))).divide(withhours2, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1224. if (compare0(withSbklyl)) {
  1225. BigDecimal withSbklyzzl = (currSbklyl.subtract(withSbklyl)).divide(withSbklyl, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
  1226. dto.setWithSbklyzzl(withSbklyzzl);
  1227. }
  1228. }
  1229. }
  1230. }
  1231. private BigDecimal compare100(BigDecimal a) {
  1232. BigDecimal b = new BigDecimal(100);
  1233. if (b.compareTo(a) == -1) {
  1234. a = new BigDecimal(100);
  1235. ;
  1236. }
  1237. return a;
  1238. }
  1239. private boolean compare0(BigDecimal a) {
  1240. BigDecimal b = new BigDecimal(0.00);
  1241. if (b.compareTo(a.setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
  1242. return false;
  1243. }
  1244. return true;
  1245. }
  1246. public Map<String, Object> getHomeRight(String companyId, String periodType) {
  1247. Map<String, Object> allmap = new HashMap<>();
  1248. Map<String, Object> sbklyl = new HashMap<>();
  1249. LocalDate nowStart = null;
  1250. LocalDate nowEnd = LocalDate.now();
  1251. LocalDate lastYearStartDate = null;
  1252. LocalDate lastYearEndDate = null;
  1253. if ("year".equals(periodType)) {
  1254. nowStart = nowEnd.with(TemporalAdjusters.firstDayOfYear());
  1255. lastYearStartDate = nowEnd.minusYears(1).with(TemporalAdjusters.firstDayOfYear());
  1256. lastYearEndDate = nowEnd.minusYears(1).atStartOfDay().toLocalDate();
  1257. } else if ("month".equals(periodType)) {
  1258. nowStart = nowEnd.with(TemporalAdjusters.firstDayOfMonth());
  1259. lastYearStartDate = nowEnd.minusYears(1).with(TemporalAdjusters.firstDayOfMonth());
  1260. lastYearEndDate = nowEnd.minusYears(1).atStartOfDay().toLocalDate();
  1261. } else if ("week".equals(periodType)) {
  1262. nowStart = nowEnd.with(DayOfWeek.MONDAY);
  1263. lastYearStartDate = nowEnd.minusYears(1).with(DayOfWeek.MONDAY);
  1264. lastYearEndDate = nowEnd.minusYears(1).atStartOfDay().toLocalDate();
  1265. }
  1266. Map<String, Object> zbtqdb = new HashMap<>();
  1267. String[] title = {"排名", "名称", "风能利用率%", "去年同期%", "涨跌%"};
  1268. List<ColumnVo> ls1 = getTitle(title);
  1269. String[] title2 = {"排名", "名称", "设备利用率%", "去年同期%", "涨跌%"};
  1270. List<ColumnVo> ls3 = getTitle(title2);
  1271. List<HomeRightVo> ls2 = new ArrayList<>();
  1272. HomeRightVo hv = new HomeRightVo();
  1273. hv.setIndex("1");
  1274. hv.setName(CacheContext.wplsf.get(0).getName());
  1275. List<TurbineInfoDay> currentResults1 = getFnlyl("*", nowStart, nowEnd);
  1276. if (null == currentResults1 || currentResults1.isEmpty()) {
  1277. hv.setFnlyl("0.00");
  1278. } else {
  1279. List<TurbineInfoDay> currentResults = getFnlyl("AVG(fnlyl) AS fnlyl", nowStart, nowEnd);
  1280. hv.setFnlyl(String.format("%.2f", currentResults.get(0).getFnlyl()));
  1281. }
  1282. List<TurbineInfoDay> lastYearResults1 = getFnlyl("*", lastYearStartDate, lastYearEndDate);
  1283. if (null == lastYearResults1 || lastYearResults1.isEmpty()) {
  1284. hv.setYearTq("0.00");
  1285. } else {
  1286. List<TurbineInfoDay> lastYearResults = getFnlyl("AVG(fnlyl) AS fnlyl", lastYearStartDate, lastYearEndDate);
  1287. hv.setYearTq(String.format("%.2f", lastYearResults.get(0).getFnlyl()));
  1288. }
  1289. if (Double.parseDouble(hv.getFnlyl()) == 0 && Double.parseDouble(hv.getYearTq()) == 0) {
  1290. hv.setOperation("0.00");
  1291. } else if (Double.parseDouble(hv.getYearTq()) == 0) {
  1292. hv.setOperation("100");
  1293. } else if (Double.parseDouble(hv.getFnlyl()) == 0) {
  1294. hv.setOperation("-100");
  1295. } else {
  1296. Double operation = calDivide(Double.parseDouble(hv.getFnlyl()) - Double.parseDouble(hv.getYearTq()), Double.valueOf(hv.getYearTq()));
  1297. hv.setOperation(String.valueOf(operation));
  1298. }
  1299. ls2.add(hv);
  1300. zbtqdb.put("column", ls1);
  1301. zbtqdb.put("data", ls2);
  1302. sbklyl.put("column", ls3);
  1303. allmap.put("fnlyl", zbtqdb);
  1304. List<HomeRightVo> ls4 = new ArrayList<>();
  1305. HomeRightVo hv2 = new HomeRightVo();
  1306. hv2.setIndex("1");
  1307. hv2.setName(CacheContext.wplsf.get(0).getName());
  1308. List<TurbineInfoDay> currentSbResults1 = getFnlyl("*", nowStart, nowEnd);
  1309. if (null == currentSbResults1 || currentSbResults1.isEmpty()) {
  1310. hv2.setFnlyl("0.00");
  1311. } else {
  1312. List<TurbineInfoDay> currentSbResults = getFnlyl("AVG(klyl) AS klyl", nowStart, nowEnd);
  1313. hv2.setFnlyl(String.format("%.2f", currentSbResults.get(0).getKlyl()));
  1314. }
  1315. List<TurbineInfoDay> lastYearQwSb1 = getFnlyl("*", lastYearStartDate, lastYearEndDate);
  1316. if (null == lastYearQwSb1 || lastYearQwSb1.isEmpty()) {
  1317. hv2.setYearTq("0.00");
  1318. } else {
  1319. List<TurbineInfoDay> lastYearQwSb = getFnlyl("AVG(klyl) AS klyl", lastYearStartDate, lastYearEndDate);
  1320. hv2.setYearTq(String.format("%.2f", lastYearQwSb.get(0).getKlyl()));
  1321. }
  1322. if (Double.parseDouble(hv2.getFnlyl()) == 0 && Double.parseDouble(hv2.getYearTq()) == 0) {
  1323. hv2.setOperation("0.00");
  1324. } else if (Double.parseDouble(hv2.getYearTq()) == 0) {
  1325. hv2.setOperation("100");
  1326. } else if (Double.parseDouble(hv2.getFnlyl()) == 0) {
  1327. hv2.setOperation("-100");
  1328. } else {
  1329. Double aDouble1 = calDivide(Double.parseDouble(hv2.getFnlyl()) - Double.parseDouble(hv2.getYearTq()), Double.valueOf(hv2.getYearTq()));
  1330. hv2.setOperation(String.valueOf(aDouble1));
  1331. }
  1332. ls4.add(hv2);
  1333. sbklyl.put("data", ls4);
  1334. allmap.put("sbklyl", sbklyl);
  1335. return allmap;
  1336. }
  1337. private List<TurbineInfoDay> getFnlyl(String select, LocalDate start, LocalDate end) {
  1338. QueryWrapper<TurbineInfoDay> currentQw = new QueryWrapper<>();
  1339. currentQw.clear();
  1340. currentQw.select(select)
  1341. .ge("record_date", start)
  1342. .lt("record_date", end);
  1343. return iTurbineInfoDayService.list(currentQw);
  1344. }
  1345. public List<ColumnVo> getTitle(String[] title) {
  1346. List<ColumnVo> ls1 = new ArrayList<>();
  1347. ColumnVo cl1 = new ColumnVo(title[0], "index");
  1348. ColumnVo cl2 = new ColumnVo(title[1], "name");
  1349. ColumnVo cl3 = new ColumnVo(title[2], "fnlyl");
  1350. ColumnVo cl4 = new ColumnVo(title[3], "yearTq");
  1351. ColumnVo cl5 = new ColumnVo(title[4], "operation");
  1352. ls1.add(cl1);
  1353. ls1.add(cl2);
  1354. ls1.add(cl3);
  1355. ls1.add(cl4);
  1356. ls1.add(cl5);
  1357. return ls1;
  1358. }
  1359. public Map<String, Object> getHomeMiddle(String companyId) throws ParseException {
  1360. Double rfdl = dayFdlCal(LocalDate.now());
  1361. Integer month = LocalDate.now().getMonthValue();
  1362. int year = LocalDate.now().getYear();
  1363. Map<String, Object> allmap = new HashMap<>();
  1364. PlanDataVo pd = new PlanDataVo();
  1365. Double week = weekFdlCal();
  1366. pd.setZfdlsj(week);
  1367. String s = year + "-" + month;
  1368. BigDecimal monCache = yfdlCal.get(s);
  1369. pd.setYfdlsj(monCache.add(new BigDecimal(rfdl)).doubleValue());
  1370. BigDecimal yearCache = nfdlCal.get(year);
  1371. pd.setNfdlsj(yearCache.add(new BigDecimal(rfdl)).doubleValue());
  1372. //计划发电量
  1373. List<ProBasicProjectPlan> list = iProBasicProjectPlanService.list();
  1374. List<ProBasicProjectPlan> pp = list.stream()
  1375. .filter(ls -> String.valueOf(month).equals(ls.getMonth())
  1376. && ls.getYear().equals(String.valueOf(year)) && ls.getProjectId().equals(companyId))
  1377. .collect(Collectors.toList());
  1378. if (pp.isEmpty()) {
  1379. pd.setZfdljh(0.0);
  1380. pd.setYfdljh(0.0);
  1381. } else {
  1382. pd.setZfdljh(pp.get(0).getGeneratingCapacity() / 4);
  1383. pd.setYfdljh(pp.get(0).getGeneratingCapacity());
  1384. }
  1385. Double zjd = calDivide(pd.getZfdlsj(), pd.getZfdljh());
  1386. pd.setZjd(zjd * 100);
  1387. pd.setZwcl(zjd);
  1388. Double yjd = calDivide(pd.getYfdlsj(), pd.getYfdljh());
  1389. pd.setYjd(yjd * 100);
  1390. pd.setYwcl(yjd);
  1391. List<ProBasicProjectPlan> pp2 = list.stream()
  1392. .filter(ls -> ls.getYear().equals(String.valueOf(year)) && ls.getProjectId().equals(companyId) && ls.getMonth() == null)
  1393. .collect(Collectors.toList());
  1394. if (pp2.isEmpty()) {
  1395. pd.setNfdljh(0.0);
  1396. } else {
  1397. pd.setNfdljh(pp2.get(0).getGeneratingCapacity());
  1398. }
  1399. Double njd = calDivide(pd.getNfdlsj(), pd.getNfdljh());
  1400. pd.setNjd(njd * 100);
  1401. pd.setNwcl(njd);
  1402. allmap.put("planData", pd);
  1403. QueryWrapper<TurbineInfoDay> qw2 = new QueryWrapper<>();
  1404. qw2.lambda().eq(TurbineInfoDay::getStationId, companyId);
  1405. List<TurbineInfoDay> days3 = iTurbineInfoDayService.list(qw2);
  1406. int yearThis = LocalDate.now().getYear();
  1407. int yearLast = yearThis - 1;
  1408. String start = yearThis + "-01-01";
  1409. String end = yearThis + "-12-31";
  1410. String start2 = yearLast + "-01-01";
  1411. String end2 = yearLast + "-12-31";
  1412. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  1413. Date start1 = sdf.parse(start);
  1414. Date end1 = sdf.parse(end);
  1415. Date start3 = sdf.parse(start2);
  1416. Date end3 = sdf.parse(end2);
  1417. List<TurbineInfoDay> thisYear = days3.stream().filter(rec -> rec.getRecordDate().after(start1) && rec.getRecordDate().before(end1)).collect(Collectors.toList());
  1418. List<TurbineInfoDay> lastYear = days3.stream().filter(rec -> rec.getRecordDate().after(start3) && rec.getRecordDate().before(end3)).collect(Collectors.toList());
  1419. Map<Integer, List<TurbineInfoDay>> day1sMap = thisYear.stream().collect(Collectors.groupingBy(record -> record.getRecordDate().getMonth() + 1));
  1420. List<PowertrendVo> xdl = new ArrayList<>();
  1421. List<PowertrendVo> ssdl = new ArrayList<>();
  1422. List<PowertrendVo> fdl = new ArrayList<>();
  1423. PowertrendVo ptxdl = new PowertrendVo();
  1424. PowertrendVo ptssdl = new PowertrendVo();
  1425. PowertrendVo ptfdl = new PowertrendVo();
  1426. ptxdl.setTitle("限电量");
  1427. ptssdl.setTitle("损失电量");
  1428. ptfdl.setTitle("发电量");
  1429. ptxdl.setYAxisIndex(0);
  1430. ptssdl.setYAxisIndex(0);
  1431. ptfdl.setYAxisIndex(0);
  1432. List<ValueVo> vexdl = value(year, 12);
  1433. List<ValueVo> vessdl = value(year, 12);
  1434. List<ValueVo> vefdl = value(year, 12);
  1435. for (Integer mon : day1sMap.keySet()) {
  1436. List<TurbineInfoDay> day1s1 = day1sMap.get(mon);
  1437. List<TurbineInfoDay> day1s2 = day1s1.stream().sorted(Comparator.comparing(TurbineInfoDay::getRecordDate).reversed()).collect(Collectors.toList());
  1438. LocalDate localDate = day1s2.get(0).getRecordDate().toInstant().atZone(ZoneOffset.UTC).toLocalDate();
  1439. int year1 = localDate.getYear();
  1440. String text = year1 + "-" + mon;
  1441. for (ValueVo vv : vexdl) {
  1442. if (vv.getText().equals(text)) {
  1443. double bxdl = day1s2.stream().mapToDouble(TurbineInfoDay::getXdss).sum();
  1444. String format = String.format("%.2f", bxdl / 1000);
  1445. vv.setValue(new BigDecimal(format));
  1446. }
  1447. }
  1448. for (ValueVo vv : vessdl) {
  1449. if (vv.getText().equals(text)) {
  1450. double xd = day1s2.stream().mapToDouble(TurbineInfoDay::getXdss).sum();
  1451. double fjh = day1s2.stream().mapToDouble(TurbineInfoDay::getFjhjxss).sum();
  1452. double jh = day1s2.stream().mapToDouble(TurbineInfoDay::getJhjxss).sum();
  1453. double xn = day1s2.stream().mapToDouble(TurbineInfoDay::getXnss).sum();
  1454. String format = String.format("%.2f", (xd + fjh + jh + xn) / 1000);
  1455. vv.setValue(new BigDecimal(format));
  1456. }
  1457. }
  1458. for (ValueVo vv : vefdl) {
  1459. if (vv.getText().equals(text)) {
  1460. double bfdl = day1s2.stream().mapToDouble(TurbineInfoDay::getXdss).sum();
  1461. String format = String.format("%.2f", bfdl / 1000);
  1462. vv.setValue(new BigDecimal(format));
  1463. }
  1464. }
  1465. }
  1466. ptxdl.setValue(vexdl);
  1467. ptssdl.setValue(vessdl);
  1468. ptfdl.setValue(vefdl);
  1469. xdl.add(ptxdl);
  1470. ssdl.add(ptssdl);
  1471. fdl.add(ptfdl);
  1472. PowertrendVo ptxdl2 = new PowertrendVo();
  1473. PowertrendVo ptssdl2 = new PowertrendVo();
  1474. PowertrendVo ptfdl2 = new PowertrendVo();
  1475. ptxdl2.setTitle("去年同期限电量");
  1476. ptssdl2.setTitle("去年同期损失电量");
  1477. ptfdl2.setTitle("去年同期发电量");
  1478. ptxdl.setYAxisIndex(0);
  1479. ptssdl.setYAxisIndex(0);
  1480. ptfdl.setYAxisIndex(0);
  1481. if (lastYear.isEmpty()) {
  1482. List<ValueVo> value = value(year - 1, month);
  1483. ptxdl2.setValue(value);
  1484. ptssdl2.setValue(value);
  1485. ptfdl2.setValue(value);
  1486. } else {
  1487. List<ValueVo> vxdl2 = value(year - 1, 12);
  1488. List<ValueVo> vssdl2 = value(year - 1, 12);
  1489. List<ValueVo> vfdl2 = value(year - 1, 12);
  1490. Map<Integer, List<TurbineInfoDay>> day1sMap2 = lastYear.stream().collect(Collectors.groupingBy(record -> record.getRecordDate().getMonth() + 1));
  1491. for (Integer mon2 : day1sMap2.keySet()) {
  1492. List<TurbineInfoDay> day1s3 = day1sMap2.get(mon2);
  1493. List<TurbineInfoDay> day1s4 = day1s3.stream().sorted(Comparator.comparing(TurbineInfoDay::getRecordDate).reversed()).collect(Collectors.toList());
  1494. LocalDate localDate = day1s3.get(0).getRecordDate().toInstant().atZone(ZoneOffset.UTC).toLocalDate();
  1495. int year1 = localDate.getYear();
  1496. String text = year1 + "-" + mon2;
  1497. for (ValueVo vv : vxdl2) {
  1498. if (vv.getText().equals(text)) {
  1499. double bxdl2 = day1s4.stream().mapToDouble(TurbineInfoDay::getXdss).sum();
  1500. String format = String.format("%.2f", bxdl2 / 1000);
  1501. vv.setValue(new BigDecimal(format));
  1502. }
  1503. }
  1504. for (ValueVo vv : vssdl2) {
  1505. if (vv.getText().equals(text)) {
  1506. double xd = day1s4.stream().mapToDouble(TurbineInfoDay::getXdss).sum();
  1507. double fjh = day1s4.stream().mapToDouble(TurbineInfoDay::getFjhjxss).sum();
  1508. double jh = day1s4.stream().mapToDouble(TurbineInfoDay::getJhjxss).sum();
  1509. double xn = day1s4.stream().mapToDouble(TurbineInfoDay::getXnss).sum();
  1510. String format = String.format("%.2f", (xd + fjh + jh + xn) / 1000);
  1511. vv.setValue(new BigDecimal(format));
  1512. }
  1513. }
  1514. for (ValueVo vv : vfdl2) {
  1515. if (vv.getText().equals(text)) {
  1516. double bfl2 = day1s4.stream().mapToDouble(TurbineInfoDay::getXdss).sum();
  1517. String format = String.format("%.2f", bfl2 / 1000);
  1518. vv.setValue(new BigDecimal(format));
  1519. }
  1520. }
  1521. }
  1522. ptxdl2.setValue(vxdl2);
  1523. ptssdl2.setValue(vssdl2);
  1524. ptfdl2.setValue(vfdl2);
  1525. }
  1526. xdl.add(ptxdl2);
  1527. ssdl.add(ptssdl2);
  1528. fdl.add(ptfdl2);
  1529. allmap.put("Powertrend", xdl);
  1530. allmap.put("Powerloss", ssdl);
  1531. allmap.put("Powersend", fdl);
  1532. return allmap;
  1533. }
  1534. /**
  1535. * 除法
  1536. */
  1537. private Double calDivide(Double divide, Double divisor) {
  1538. if (divide == 0 || divisor == 0) {
  1539. return 0.0;
  1540. } else {
  1541. BigDecimal divide1 = BigDecimal.valueOf(divide);
  1542. BigDecimal divisor1 = BigDecimal.valueOf(divisor);
  1543. BigDecimal result = divide1.divide(divisor1, 2, RoundingMode.HALF_UP);
  1544. DecimalFormat df = new DecimalFormat("#0.00");
  1545. String formattedResult = df.format(result);
  1546. return Double.parseDouble(formattedResult);
  1547. }
  1548. }
  1549. private List<ValueVo> value(int year, int month) {
  1550. List<ValueVo> lv = new ArrayList<>();
  1551. for (int i = 1; i <= month; i++) {
  1552. ValueVo vo = new ValueVo();
  1553. vo.setText(year + "-" + i);
  1554. vo.setValue(new BigDecimal(0));
  1555. lv.add(vo);
  1556. }
  1557. return lv;
  1558. }
  1559. public Map<String, Object> getGeneratingCapacity(String companyId) {
  1560. LocalDate now = LocalDate.now();
  1561. Map<String, Object> allmap = new HashMap<>();
  1562. Map<String, Object> zbtqdb = new HashMap<>();
  1563. List<ColumnVo> ls1 = new ArrayList<>();
  1564. ColumnVo cl1 = new ColumnVo();
  1565. cl1.setName("指标名称");
  1566. cl1.setField("wtId");
  1567. ColumnVo cl2 = new ColumnVo();
  1568. cl2.setName(String.valueOf(LocalDate.now().getYear()));
  1569. cl2.setField("recodedate");
  1570. ColumnVo cl3 = new ColumnVo();
  1571. cl3.setName(String.valueOf(LocalDate.now().getYear() - 1));
  1572. cl3.setField("recodedate2");
  1573. ColumnVo cl4 = new ColumnVo();
  1574. cl4.setName("涨跌%");
  1575. cl4.setField("operation");
  1576. ls1.add(cl1);
  1577. ls1.add(cl2);
  1578. ls1.add(cl3);
  1579. ls1.add(cl4);
  1580. List<GeneratingCapacityVo> ls = new ArrayList<>();
  1581. Double dayFdl = dayFdlCal(now);
  1582. Double dayLlfdl = dayLldlCal(now);
  1583. GeneratingCapacityVo rfdl = new GeneratingCapacityVo();
  1584. rfdl.setName("日发电量");
  1585. rfdl.setValue(Double.valueOf(String.format("%.2f", dayFdl)));
  1586. rfdl.setTotal(dayLlfdl);
  1587. Double rbfb = calDivide(dayFdl, dayLlfdl);
  1588. rfdl.setBfb(new BigDecimal(rbfb * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
  1589. ls.add(rfdl);
  1590. GeneratingCapacityVo yfdl = new GeneratingCapacityVo();
  1591. yfdl.setName("月发电量");
  1592. String s = LocalDate.now().getYear() + "-" + LocalDate.now().getMonthValue();
  1593. BigDecimal monCache = yfdlCal.get(s);
  1594. yfdl.setValue(monCache.add(BigDecimal.valueOf(rfdl.getValue())).setScale(2, RoundingMode.HALF_UP).doubleValue());
  1595. double yllfdl = yllfdlCal.get(s).add(BigDecimal.valueOf(rfdl.getTotal())).doubleValue();
  1596. yfdl.setTotal(Double.parseDouble(String.format("%.2f", yllfdl)));
  1597. Double ybfb = calDivide(yfdl.getValue(), yfdl.getTotal());
  1598. yfdl.setBfb(new BigDecimal(ybfb * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
  1599. ls.add(yfdl);
  1600. GeneratingCapacityVo nfdl = new GeneratingCapacityVo();
  1601. nfdl.setName("年发电量");
  1602. nfdl.setValue(nfdlCal.get(LocalDate.now().getYear()).add(BigDecimal.valueOf(rfdl.getValue())).setScale(2, RoundingMode.HALF_UP).doubleValue());
  1603. double nllfdl = nllfdlCal.get(LocalDate.now().getYear()).add(BigDecimal.valueOf(rfdl.getTotal())).doubleValue();
  1604. nfdl.setTotal(Double.parseDouble(String.format("%.2f", nllfdl)));
  1605. Double nbfb = calDivide(nfdl.getValue(), nfdl.getTotal());
  1606. nfdl.setBfb(new BigDecimal(nbfb * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
  1607. ls.add(nfdl);
  1608. QueryWrapper<StationInfoDay> thisYear = new QueryWrapper<>();
  1609. 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")
  1610. .apply("to_char(record_date,'yyyy') = '" + (LocalDate.now().getYear()) + "'")
  1611. .groupBy("station_id");
  1612. List<StationInfoDay> list = iStationInfoDayService.list(thisYear);
  1613. QueryWrapper<StationInfoDay> lastYear = new QueryWrapper<>();
  1614. 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")
  1615. .apply("record_date<= '" + LocalDate.now().minusYears(1) + "'")
  1616. .groupBy("station_id");
  1617. List<StationInfoDay> list2 = iStationInfoDayService.list(lastYear);
  1618. List<ComparetqVo> ls2 = new ArrayList<>();
  1619. ComparetqVo cv = new ComparetqVo();
  1620. cv.setWtId("年发电量");
  1621. ComparetqVo cv1 = new ComparetqVo();
  1622. cv1.setWtId("年上网电量");
  1623. ComparetqVo cv2 = new ComparetqVo();
  1624. cv2.setWtId("年购网电量");
  1625. ComparetqVo cv4 = new ComparetqVo();
  1626. cv4.setWtId("年厂用电量");
  1627. cv.setRecodedate(nfdl.getValue());
  1628. if (null == list2 || list2.isEmpty()) {
  1629. cv1.setRecodedate2(0);
  1630. cv1.setOperation(100);
  1631. cv2.setRecodedate2(0);
  1632. cv2.setOperation(100);
  1633. cv4.setRecodedate2(0);
  1634. cv4.setOperation(100);
  1635. } else {
  1636. cv1.setRecodedate2(list2.get(0).getSwdl());
  1637. cv2.setRecodedate2(list2.get(0).getGwdl());
  1638. cv4.setRecodedate2(list2.get(0).getCydl());
  1639. }
  1640. if (null == list || list.isEmpty()) {
  1641. cv1.setRecodedate(0);
  1642. cv1.setOperation(-100);
  1643. cv2.setRecodedate(0);
  1644. cv2.setOperation(-100);
  1645. cv4.setRecodedate(0);
  1646. cv4.setOperation(-100);
  1647. } else {
  1648. cv1.setRecodedate(list.get(0).getSwdl());
  1649. cv1.setOperation(100);
  1650. cv2.setRecodedate(list.get(0).getGwdl());
  1651. cv2.setOperation(100);
  1652. cv4.setRecodedate(list.get(0).getCydl());
  1653. cv4.setOperation(100);
  1654. }
  1655. ls2.add(cv);
  1656. ls2.add(cv1);
  1657. ls2.add(cv2);
  1658. ls2.add(cv4);
  1659. zbtqdb.put("column", ls1);
  1660. zbtqdb.put("data", ls2);
  1661. allmap.put("fdl", ls);
  1662. allmap.put("zbtqdb", zbtqdb);
  1663. return allmap;
  1664. }
  1665. /**
  1666. * 缓存月、年发电量
  1667. */
  1668. public void calFdl() {
  1669. if (LocalDate.now().equals(lastCalDate)) {
  1670. return;
  1671. }
  1672. LocalDate yesterday = LocalDate.now().atStartOfDay().toLocalDate();
  1673. QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
  1674. currentqw.select("station_id,SUM(rfdl) AS rfdl,sum(llfdl) as llfdl")
  1675. .ge("record_date", LocalDate.now().with(TemporalAdjusters.firstDayOfYear())) // 大于等于今年的第一天
  1676. .lt("record_date", yesterday) // 小于今天0点的日期
  1677. .like("station_id", "_FDC_%")
  1678. .groupBy("station_id");
  1679. List<TurbineInfoDay> yearData = iTurbineInfoDayService.list(currentqw);
  1680. Integer intYear = LocalDate.now().getYear();
  1681. Double nfdlc = calDivide(yearData.get(0).getRfdl(), 1000.0);
  1682. Double nllfdlc = calDivide(yearData.get(0).getLlfdl(), 1000.0);
  1683. nfdlCal.put(intYear, new BigDecimal(nfdlc));
  1684. nllfdlCal.put(intYear, new BigDecimal(nllfdlc));
  1685. currentqw.clear();
  1686. currentqw.select("station_id,MAX(record_date) AS record_date,SUM(rfdl) AS rfdl,SUM(llfdl) as llfdl")
  1687. .ge("record_date", LocalDate.now().with(TemporalAdjusters.firstDayOfMonth())) // 大于等于本月的第一天
  1688. .lt("record_date", yesterday) // 小于今天0点的日期
  1689. .like("station_id", "_FDC_%")
  1690. .groupBy("station_id");
  1691. List<TurbineInfoDay> monthData = iTurbineInfoDayService.list(currentqw);
  1692. String yearAndMonth = LocalDate.now().getYear() + "-" + LocalDate.now().getMonthValue();
  1693. Double yfdlc = calDivide(monthData.get(0).getRfdl(), 1000.0);
  1694. Double yllfdlc = calDivide(monthData.get(0).getLlfdl(), 1000.0);
  1695. yfdlCal.put(yearAndMonth, new BigDecimal(yfdlc));
  1696. yllfdlCal.put(yearAndMonth, new BigDecimal(yllfdlc));
  1697. currentqw.clear();
  1698. lastCalDate = LocalDate.now();
  1699. }
  1700. private Double weekFdlCal() {
  1701. LocalDate week = LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
  1702. LocalDate yesterday = LocalDate.now().atStartOfDay().toLocalDate();
  1703. if (week.equals(LocalDate.now())) {
  1704. return dayFdlCal(LocalDate.now());
  1705. }
  1706. QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
  1707. currentqw.select("station_id,SUM(rfdl) AS rfdl")
  1708. .ge("record_date", LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY))) // 大于等于本周一的日期
  1709. .lt("record_date", yesterday)
  1710. .groupBy("station_id");
  1711. List<TurbineInfoDay> weekData = iTurbineInfoDayService.list(currentqw);
  1712. if (null == weekData || weekData.isEmpty()) {
  1713. return 0.0;
  1714. }
  1715. Double weekfdlc = calDivide(weekData.get(0).getRfdl(), 1000.0);
  1716. Double dayFdl = dayFdlCal(LocalDate.now());
  1717. return weekfdlc + dayFdl;
  1718. }
  1719. private Double dayFdlCal(LocalDate now) {
  1720. QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
  1721. qw.select("station_id,SUM(rfdl) AS rfdl").eq("record_date", now).groupBy("station_id");
  1722. List<TurbineInfoDay> dayData = iTurbineInfoDayService.list(qw);
  1723. if (null == dayData || dayData.isEmpty()) {
  1724. return 0.0;
  1725. }
  1726. return calDivide(dayData.get(0).getRfdl(), 1000.0);
  1727. }
  1728. private Double dayLldlCal(LocalDate now) {
  1729. QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
  1730. qw.select("station_id,SUM(llfdl) AS llfdl").eq("record_date", now).groupBy("station_id");
  1731. List<TurbineInfoDay> dayData = iTurbineInfoDayService.list(qw);
  1732. if (null == dayData || dayData.isEmpty()) {
  1733. return 0.0;
  1734. }
  1735. return calDivide(dayData.get(0).getLlfdl(), 1000.0);
  1736. }
  1737. }