EconomyPointHomePageService.java 107 KB

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