ComprehensiveelectricityService.java 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. package com.gyee.runeconomy.service.Comprehensive;
  2. import com.gyee.common.contant.ContantXk;
  3. import com.gyee.common.model.StringUtils;
  4. import com.gyee.common.util.DateUtils;
  5. import com.gyee.common.util.SortUtils;
  6. import com.gyee.runeconomy.dto.ComprehensiveVo;
  7. import com.gyee.runeconomy.init.CacheContext;
  8. import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
  9. import com.gyee.runeconomy.model.auto.ProBasicPowerstationPoint;
  10. import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay5;
  11. import com.gyee.runeconomy.model.auto.StationInfoDay;
  12. import com.gyee.runeconomy.service.auto.IProBasicPowerstationPointService;
  13. import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay5Service;
  14. import com.gyee.runeconomy.service.auto.IStationInfoDayService;
  15. import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
  16. import org.springframework.stereotype.Service;
  17. import javax.annotation.Resource;
  18. import java.util.*;
  19. import java.util.stream.Collectors;
  20. @Service
  21. public class ComprehensiveelectricityService {
  22. @Resource
  23. private IProEconPowerstationInfoDay5Service proEconPowerstationInfoDay5Service;
  24. @Resource
  25. private IProBasicPowerstationPointService proBasicPowerstationPointService;
  26. @Resource
  27. private IEdosUtil edosUtil;
  28. @Resource
  29. private IStationInfoDayService iStationInfoDayService;
  30. public Map<String, Object> Comprehensive2(String wpId, String year) throws Exception {
  31. List<ProBasicPowerstation> wpls = CacheContext.wpls.stream().filter(g -> wpId.equals(g.getId())).collect(Collectors.toList());
  32. List<ComprehensiveVo> vos = new ArrayList<ComprehensiveVo>();
  33. Map<String, Object> map = new LinkedHashMap<>();
  34. //当前年份
  35. Calendar cal = Calendar.getInstance();
  36. int dqnf = cal.get(Calendar.YEAR);//本年
  37. //参数所传年份
  38. int currentyear = Integer.parseInt(year);
  39. // 设置为本年一月一号0点
  40. Calendar calendar1 = Calendar.getInstance();
  41. calendar1.setTime(new Date());
  42. calendar1.set(Calendar.YEAR, currentyear); // 根据当前年份变化
  43. calendar1.set(Calendar.MONTH, Calendar.JANUARY); // 0表示一月
  44. calendar1.set(Calendar.DAY_OF_MONTH, 1);
  45. calendar1.set(Calendar.HOUR_OF_DAY, 0);
  46. calendar1.set(Calendar.MINUTE, 0);
  47. calendar1.set(Calendar.SECOND, 0);
  48. calendar1.set(Calendar.MILLISECOND, 0);
  49. Date firstDayZeroHour = calendar1.getTime();
  50. // 获取firstDayZeroHour的月份
  51. Calendar calFirstDayZeroHour = Calendar.getInstance();
  52. calFirstDayZeroHour.setTime(firstDayZeroHour);
  53. int calFirstMonth = calFirstDayZeroHour.get(Calendar.MONTH) + 1;
  54. //当前时间月份
  55. Calendar calendar = Calendar.getInstance();
  56. int currentMonth = calendar.get(Calendar.MONTH);
  57. currentMonth = currentMonth + 1;
  58. // 设置为年初一月一号0点,同比计算取值时间(减去一年,比今年计算少一年)
  59. Calendar calendar3 = Calendar.getInstance();
  60. calendar3.setTime(new Date());
  61. calendar3.set(Calendar.YEAR, currentyear - 1); // 根据当前年份变化
  62. calendar3.set(Calendar.MONTH, Calendar.JANUARY); // 0表示一月
  63. calendar3.set(Calendar.DAY_OF_MONTH, 1);
  64. calendar3.set(Calendar.HOUR_OF_DAY, 0);
  65. calendar3.set(Calendar.MINUTE, 0);
  66. calendar3.set(Calendar.SECOND, 0);
  67. calendar3.set(Calendar.MILLISECOND, 0);
  68. Date tbjssj = calendar3.getTime();
  69. // 去年十二月一号0点值,环比计算取值时间(初始设置为去年十二月,每循环一次增加一月)
  70. Calendar calendar2 = Calendar.getInstance();
  71. calendar2.setTime(new Date());
  72. // 设置年份为传递的currentyear的前一年
  73. calendar2.set(Calendar.YEAR, currentyear - 1);
  74. // 设置月份为十二月
  75. calendar2.set(Calendar.MONTH, Calendar.DECEMBER); // 11表示十二月
  76. // 设置日期为每月的第一天
  77. calendar2.set(Calendar.DAY_OF_MONTH, 1);
  78. calendar2.set(Calendar.HOUR_OF_DAY, 0);
  79. calendar2.set(Calendar.MINUTE, 0);
  80. calendar2.set(Calendar.SECOND, 0);
  81. calendar2.set(Calendar.MILLISECOND, 0);
  82. Date hbjssj = calendar2.getTime();
  83. double zhcydlsum = 0.0;
  84. double sjdlsum = 0.0;
  85. double swdlsum = 0.0;
  86. double gwdlsum = 0.0;
  87. double zhcydllsum = 0.0;
  88. for (int i = 1; i <= 12; i++) {
  89. //综合场用电量
  90. double zhcydl = 0.0;
  91. double zhcydltb = 0.0;
  92. double zhcydlhb = 0.0;
  93. //实际电量
  94. double sjdl = 0.0;
  95. double sjdltb = 0.0;
  96. double sjdlhb = 0.0;
  97. //上网电量
  98. double swdl = 0.0;
  99. double swdltb = 0.0;
  100. double swdlhb = 0.0;
  101. //购网电量
  102. double gwdl = 0.0;
  103. double gwdltb = 0.0;
  104. double gwdlhb = 0.0;
  105. //综合场用电率
  106. double zhcydll = 0.0;
  107. double zhcydlltb = 0.0;
  108. double zhcydllhb = 0.0;
  109. for (ProBasicPowerstation wp : wpls) {
  110. //当前场站本年循环所有指标取值集合
  111. double rfdlsj = 0.0;
  112. List<ProEconPowerstationInfoDay5> zbls = proEconPowerstationInfoDay5Service.getmax(wp.getId(), firstDayZeroHour);
  113. List<ProEconPowerstationInfoDay5> tbzbls = proEconPowerstationInfoDay5Service.getmax(wp.getId(), tbjssj);
  114. List<ProEconPowerstationInfoDay5> hbzbls = proEconPowerstationInfoDay5Service.getmax(wp.getId(), hbjssj);
  115. ProBasicPowerstationPoint rfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.RFDL);
  116. rfdlsj = edosUtil.getRealData(rfdlvalue).getPointValueInDouble();
  117. if (!zbls.isEmpty() && zbls != null) {
  118. //综合场用电量取值
  119. zhcydl = zbls.get(0).getYzhcydldb().doubleValue() / 10000;
  120. zhcydlsum += zhcydl;
  121. //发电量取值
  122. if (calFirstMonth == currentMonth && currentyear == dqnf) {
  123. // sjdl = (zbls.get(0).getYfdldb().doubleValue() / 10000) + (rfdlsj / 10000);
  124. sjdl = (zbls.get(0).getYfdldb().doubleValue() / 10000);
  125. } else {
  126. sjdl = zbls.get(0).getYfdldb().doubleValue() / 10000;
  127. }
  128. sjdlsum += sjdl;
  129. //上网电量取值
  130. swdl = zbls.get(0).getYswdldb().doubleValue() / 10000;
  131. swdlsum += swdl;
  132. //购网电量取值
  133. gwdl = zbls.get(0).getYgwgwdldb().doubleValue() / 10000;
  134. gwdlsum += gwdl;
  135. //综合场用电率计算 —— 综合场用电率=(发电量-上网电量+购网电量)/发电量
  136. if (sjdl != 0) {
  137. zhcydll = (sjdl - swdl + gwdl) / sjdl;
  138. } else {
  139. zhcydll = (sjdl - swdl + gwdl) / 1;
  140. }
  141. zhcydllsum += zhcydll;
  142. }
  143. if (!tbzbls.isEmpty() && tbzbls != null) {
  144. zhcydltb = tbzbls.get(0).getYzhcydldb().doubleValue() / 10000;
  145. sjdltb = tbzbls.get(0).getYfdldb().doubleValue() / 10000;
  146. swdltb = tbzbls.get(0).getYswdldb().doubleValue() / 10000;
  147. gwdltb = tbzbls.get(0).getYgwgwdldb().doubleValue() / 10000;
  148. if (sjdltb != 0) {
  149. zhcydlltb = (sjdltb - swdltb + gwdltb) / sjdltb;
  150. } else {
  151. zhcydlltb = (sjdltb - swdltb + gwdltb) / 1;
  152. }
  153. }
  154. if (!hbzbls.isEmpty() && hbzbls != null) {
  155. zhcydlhb = hbzbls.get(0).getYzhcydldb().doubleValue() / 10000;
  156. sjdlhb = hbzbls.get(0).getYfdldb().doubleValue() / 10000;
  157. swdlhb = hbzbls.get(0).getYswdldb().doubleValue() / 10000;
  158. gwdlhb = hbzbls.get(0).getYgwgwdldb().doubleValue() / 10000;
  159. if (sjdlhb != 0) {
  160. zhcydllhb = (sjdlhb - swdlhb + gwdlhb) / sjdlhb;
  161. } else {
  162. zhcydllhb = (sjdlhb - swdlhb + gwdlhb) / 1;
  163. }
  164. }
  165. //添加各指标
  166. ComprehensiveVo vo = new ComprehensiveVo();
  167. //添加综合厂用电量数据
  168. vo.setZhcydl(StringUtils.round(zhcydl, 2));
  169. if (zhcydltb != 0) {
  170. // vo.setZhcydltb(StringUtils.round((zhcydl - zhcydltb) / zhcydltb * 100, 0));
  171. vo.setZhcydltb(StringUtils.round(zhcydltb, 2));
  172. } else {
  173. vo.setZhcydltb(0.0);
  174. }
  175. if (zhcydlhb != 0) {
  176. // vo.setZhcydlhb(StringUtils.round((zhcydl - zhcydlhb) / zhcydlhb * 100, 0));
  177. vo.setZhcydlhb(StringUtils.round(zhcydlhb, 2));
  178. } else {
  179. vo.setZhcydlhb(0.0);
  180. }
  181. //添加时间戳
  182. vo.setHours(i);
  183. //添加实际电量数据
  184. vo.setSjdl(StringUtils.round(sjdl, 2));
  185. if (sjdltb != 0) {
  186. // vo.setSjdltb(StringUtils.round((sjdl - sjdltb) / sjdltb * 100, 0));
  187. vo.setSjdltb(StringUtils.round(sjdltb, 2));
  188. } else {
  189. vo.setSjdltb(0.0);
  190. }
  191. if (sjdlhb != 0) {
  192. // vo.setSjdlhb(StringUtils.round((sjdl - sjdlhb) / sjdlhb * 100, 0));
  193. vo.setSjdlhb(StringUtils.round(sjdlhb, 2));
  194. } else {
  195. vo.setSjdlhb(0.0);
  196. }
  197. //添加上网电量数据
  198. vo.setSwdl(StringUtils.round(swdl, 2));
  199. if (swdltb != 0) {
  200. // vo.setSwdltb(StringUtils.round((swdl - swdltb) / swdltb * 100, 0));
  201. vo.setSwdltb(StringUtils.round(swdltb, 2));
  202. } else {
  203. vo.setSwdltb(0.0);
  204. }
  205. if (swdlhb != 0) {
  206. // vo.setSwdlhb(StringUtils.round((swdl - swdlhb) / swdlhb * 100, 0));
  207. vo.setSwdlhb(StringUtils.round(swdlhb, 2));
  208. } else {
  209. vo.setSwdlhb(0.0);
  210. }
  211. //添加购网电量数据
  212. vo.setGwdl(StringUtils.round(gwdl, 2));
  213. if (gwdltb != 0) {
  214. // vo.setGwdltb(StringUtils.round((gwdl - gwdltb) / gwdltb * 100, 0));
  215. vo.setGwdltb(StringUtils.round(gwdltb, 2));
  216. } else {
  217. vo.setGwdltb(0.0);
  218. }
  219. if (gwdlhb != 0) {
  220. // vo.setGwdlhb(StringUtils.round((gwdl - gwdlhb) / gwdlhb * 100, 0));
  221. vo.setGwdlhb(StringUtils.round(gwdlhb, 2));
  222. } else {
  223. vo.setGwdlhb(0.0);
  224. }
  225. //添加综合厂用电率数据
  226. vo.setZhcydll(StringUtils.round(zhcydll * 100, 0));
  227. if (zhcydlltb != 0) {
  228. // vo.setZhcydlltb(StringUtils.round((zhcydll - zhcydlltb) / zhcydlltb * 100, 0));
  229. vo.setZhcydlltb(StringUtils.round(zhcydlltb, 2));
  230. } else {
  231. vo.setZhcydlltb(0.0);
  232. }
  233. if (zhcydllhb != 0) {
  234. // vo.setZhcydllhb(StringUtils.round((zhcydll - zhcydllhb) / zhcydllhb * 100, 0));
  235. vo.setZhcydllhb(StringUtils.round(zhcydllhb, 2));
  236. } else {
  237. vo.setZhcydllhb(0.0);
  238. }
  239. vos.add(vo);
  240. SortUtils.sort(vos, "hours", SortUtils.ASC);
  241. map.put("value", vos);
  242. }
  243. firstDayZeroHour = DateUtils.addMonths(firstDayZeroHour, 1);
  244. calFirstDayZeroHour.setTime(firstDayZeroHour);
  245. calFirstMonth = calFirstDayZeroHour.get(Calendar.MONTH) + 1;
  246. hbjssj = DateUtils.addMonths(hbjssj, 1);
  247. tbjssj = DateUtils.addMonths(tbjssj, 1);
  248. }
  249. map.put("zhcydlsum", StringUtils.round(zhcydlsum, 2));
  250. map.put("sjdlsum", StringUtils.round(sjdlsum, 2));
  251. map.put("swdlsum", StringUtils.round(swdlsum, 2));
  252. map.put("gwdlsum", StringUtils.round(gwdlsum, 2));
  253. map.put("zhcydllsum", StringUtils.round(zhcydllsum * 100, 0));
  254. return map;
  255. }
  256. public Map<String, Object> Comprehensive(String wpId, String year) throws Exception {
  257. List<ProBasicPowerstation> wpls = CacheContext.wpls.stream().filter(g -> wpId.equals(g.getId())).collect(Collectors.toList());
  258. List<ComprehensiveVo> vos = new ArrayList<ComprehensiveVo>();
  259. Map<String, Object> map = new LinkedHashMap<>();
  260. //当前年份
  261. Calendar cal = Calendar.getInstance();
  262. int dqnf = cal.get(Calendar.YEAR);//本年
  263. //参数所传年份
  264. int currentyear = Integer.parseInt(year);
  265. // 设置为本年一月一号0点
  266. Calendar calendar1 = Calendar.getInstance();
  267. calendar1.setTime(new Date());
  268. calendar1.set(Calendar.YEAR, currentyear); // 根据当前年份变化
  269. calendar1.set(Calendar.MONTH, Calendar.JANUARY); // 0表示一月
  270. calendar1.set(Calendar.DAY_OF_MONTH, 1);
  271. calendar1.set(Calendar.HOUR_OF_DAY, 0);
  272. calendar1.set(Calendar.MINUTE, 0);
  273. calendar1.set(Calendar.SECOND, 0);
  274. calendar1.set(Calendar.MILLISECOND, 0);
  275. Date firstDayZeroHour = calendar1.getTime();
  276. // 获取firstDayZeroHour的月份
  277. Calendar calFirstDayZeroHour = Calendar.getInstance();
  278. calFirstDayZeroHour.setTime(firstDayZeroHour);
  279. int calFirstMonth = calFirstDayZeroHour.get(Calendar.MONTH) + 1;
  280. //当前时间月份
  281. Calendar calendar = Calendar.getInstance();
  282. int currentMonth = calendar.get(Calendar.MONTH);
  283. currentMonth = currentMonth + 1;
  284. // 设置为年初一月一号0点,同比计算取值时间(减去一年,比今年计算少一年)
  285. Calendar calendar3 = Calendar.getInstance();
  286. calendar3.setTime(new Date());
  287. calendar3.set(Calendar.YEAR, currentyear - 1); // 根据当前年份变化
  288. calendar3.set(Calendar.MONTH, Calendar.JANUARY); // 0表示一月
  289. calendar3.set(Calendar.DAY_OF_MONTH, 1);
  290. calendar3.set(Calendar.HOUR_OF_DAY, 0);
  291. calendar3.set(Calendar.MINUTE, 0);
  292. calendar3.set(Calendar.SECOND, 0);
  293. calendar3.set(Calendar.MILLISECOND, 0);
  294. Date tbjssj = calendar3.getTime();
  295. // 去年十二月一号0点值,环比计算取值时间(初始设置为去年十二月,每循环一次增加一月)
  296. Calendar calendar2 = Calendar.getInstance();
  297. calendar2.setTime(new Date());
  298. // 设置年份为传递的currentyear的前一年
  299. calendar2.set(Calendar.YEAR, currentyear - 1);
  300. // 设置月份为十二月
  301. calendar2.set(Calendar.MONTH, Calendar.DECEMBER); // 11表示十二月
  302. // 设置日期为每月的第一天
  303. calendar2.set(Calendar.DAY_OF_MONTH, 1);
  304. calendar2.set(Calendar.HOUR_OF_DAY, 0);
  305. calendar2.set(Calendar.MINUTE, 0);
  306. calendar2.set(Calendar.SECOND, 0);
  307. calendar2.set(Calendar.MILLISECOND, 0);
  308. Date hbjssj = calendar2.getTime();
  309. double zhcydlsum = 0.0;
  310. double sjdlsum = 0.0;
  311. double swdlsum = 0.0;
  312. double gwdlsum = 0.0;
  313. double zhcydllsum = 0.0;
  314. for (int i = 1; i <= 12; i++) {
  315. //综合场用电量
  316. double zhcydl = 0.0;
  317. double zhcydltb = 0.0;
  318. double zhcydlhb = 0.0;
  319. //实际电量
  320. double sjdl = 0.0;
  321. double sjdltb = 0.0;
  322. double sjdlhb = 0.0;
  323. //上网电量
  324. double swdl = 0.0;
  325. double swdltb = 0.0;
  326. double swdlhb = 0.0;
  327. //购网电量
  328. double gwdl = 0.0;
  329. double gwdltb = 0.0;
  330. double gwdlhb = 0.0;
  331. //综合场用电率
  332. double zhcydll = 0.0;
  333. double zhcydlltb = 0.0;
  334. double zhcydllhb = 0.0;
  335. for (ProBasicPowerstation wp : wpls) {
  336. //当前场站本年循环所有指标取值集合
  337. double rfdlsj = 0.0;
  338. List<StationInfoDay> zbls = iStationInfoDayService.getmax(wp.getId(), firstDayZeroHour);
  339. List<StationInfoDay> tbzbls = iStationInfoDayService.getmax(wp.getId(), tbjssj);
  340. List<StationInfoDay> hbzbls = iStationInfoDayService.getmax(wp.getId(), hbjssj);
  341. ProBasicPowerstationPoint rfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.RFDL);
  342. rfdlsj = edosUtil.getRealData(rfdlvalue).getPointValueInDouble();
  343. if (!zbls.isEmpty() && zbls != null) {
  344. //综合场用电量取值
  345. zhcydl = zbls.get(0).getZhcydl().doubleValue();
  346. zhcydlsum += zhcydl;
  347. //发电量取值
  348. if (calFirstMonth == currentMonth && currentyear == dqnf) {
  349. // sjdl = (zbls.get(0).getYfdldb().doubleValue() / 10000) + (rfdlsj / 10000);
  350. sjdl = (zbls.get(0).getRfdlFj().doubleValue() );
  351. } else {
  352. sjdl = zbls.get(0).getRfdlFj().doubleValue();
  353. }
  354. sjdlsum += sjdl;
  355. //上网电量取值
  356. swdl = zbls.get(0).getSwdl().doubleValue();
  357. swdlsum += swdl;
  358. //购网电量取值
  359. gwdl = zbls.get(0).getGwdl().doubleValue();
  360. gwdlsum += gwdl;
  361. //综合场用电率计算 —— 综合场用电率=(发电量-上网电量+购网电量)/发电量
  362. if (sjdl != 0) {
  363. zhcydll = (sjdl - swdl + gwdl) / sjdl;
  364. } else {
  365. zhcydll = (sjdl - swdl + gwdl) / 1;
  366. }
  367. zhcydllsum += zhcydll;
  368. }
  369. if (!tbzbls.isEmpty() && tbzbls != null) {
  370. zhcydltb = tbzbls.get(0).getZhcydl().doubleValue();
  371. sjdltb = tbzbls.get(0).getRfdlFj().doubleValue();
  372. swdltb = tbzbls.get(0).getSwdl().doubleValue();
  373. gwdltb = tbzbls.get(0).getGwdl().doubleValue();
  374. if (sjdltb != 0) {
  375. zhcydlltb = (sjdltb - swdltb + gwdltb) / sjdltb;
  376. } else {
  377. zhcydlltb = (sjdltb - swdltb + gwdltb) / 1;
  378. }
  379. }
  380. if (!hbzbls.isEmpty() && hbzbls != null) {
  381. zhcydlhb = hbzbls.get(0).getZhcydl().doubleValue();
  382. sjdlhb = hbzbls.get(0).getRfdlFj().doubleValue();
  383. swdlhb = hbzbls.get(0).getSwdl().doubleValue();
  384. gwdlhb = hbzbls.get(0).getGwdl().doubleValue();
  385. if (sjdlhb != 0) {
  386. zhcydllhb = (sjdlhb - swdlhb + gwdlhb) / sjdlhb;
  387. } else {
  388. zhcydllhb = (sjdlhb - swdlhb + gwdlhb) / 1;
  389. }
  390. }
  391. //添加各指标
  392. ComprehensiveVo vo = new ComprehensiveVo();
  393. //添加综合厂用电量数据
  394. vo.setZhcydl(StringUtils.round(zhcydl, 2));
  395. if (zhcydltb != 0) {
  396. // vo.setZhcydltb(StringUtils.round((zhcydl - zhcydltb) / zhcydltb * 100, 0));
  397. vo.setZhcydltb(StringUtils.round(zhcydltb, 2));
  398. } else {
  399. vo.setZhcydltb(0.0);
  400. }
  401. if (zhcydlhb != 0) {
  402. // vo.setZhcydlhb(StringUtils.round((zhcydl - zhcydlhb) / zhcydlhb * 100, 0));
  403. vo.setZhcydlhb(StringUtils.round(zhcydlhb, 2));
  404. } else {
  405. vo.setZhcydlhb(0.0);
  406. }
  407. //添加时间戳
  408. vo.setHours(i);
  409. //添加实际电量数据
  410. vo.setSjdl(StringUtils.round(sjdl, 2));
  411. if (sjdltb != 0) {
  412. // vo.setSjdltb(StringUtils.round((sjdl - sjdltb) / sjdltb * 100, 0));
  413. vo.setSjdltb(StringUtils.round(sjdltb, 2));
  414. } else {
  415. vo.setSjdltb(0.0);
  416. }
  417. if (sjdlhb != 0) {
  418. // vo.setSjdlhb(StringUtils.round((sjdl - sjdlhb) / sjdlhb * 100, 0));
  419. vo.setSjdlhb(StringUtils.round(sjdlhb, 2));
  420. } else {
  421. vo.setSjdlhb(0.0);
  422. }
  423. //添加上网电量数据
  424. vo.setSwdl(StringUtils.round(swdl, 2));
  425. if (swdltb != 0) {
  426. // vo.setSwdltb(StringUtils.round((swdl - swdltb) / swdltb * 100, 0));
  427. vo.setSwdltb(StringUtils.round(swdltb, 2));
  428. } else {
  429. vo.setSwdltb(0.0);
  430. }
  431. if (swdlhb != 0) {
  432. // vo.setSwdlhb(StringUtils.round((swdl - swdlhb) / swdlhb * 100, 0));
  433. vo.setSwdlhb(StringUtils.round(swdlhb, 2));
  434. } else {
  435. vo.setSwdlhb(0.0);
  436. }
  437. //添加购网电量数据
  438. vo.setGwdl(StringUtils.round(gwdl, 2));
  439. if (gwdltb != 0) {
  440. // vo.setGwdltb(StringUtils.round((gwdl - gwdltb) / gwdltb * 100, 0));
  441. vo.setGwdltb(StringUtils.round(gwdltb, 2));
  442. } else {
  443. vo.setGwdltb(0.0);
  444. }
  445. if (gwdlhb != 0) {
  446. // vo.setGwdlhb(StringUtils.round((gwdl - gwdlhb) / gwdlhb * 100, 0));
  447. vo.setGwdlhb(StringUtils.round(gwdlhb, 2));
  448. } else {
  449. vo.setGwdlhb(0.0);
  450. }
  451. //添加综合厂用电率数据
  452. vo.setZhcydll(StringUtils.round(zhcydll * 100, 0));
  453. if (zhcydlltb != 0) {
  454. // vo.setZhcydlltb(StringUtils.round((zhcydll - zhcydlltb) / zhcydlltb * 100, 0));
  455. vo.setZhcydlltb(StringUtils.round(zhcydlltb, 2));
  456. } else {
  457. vo.setZhcydlltb(0.0);
  458. }
  459. if (zhcydllhb != 0) {
  460. // vo.setZhcydllhb(StringUtils.round((zhcydll - zhcydllhb) / zhcydllhb * 100, 0));
  461. vo.setZhcydllhb(StringUtils.round(zhcydllhb, 2));
  462. } else {
  463. vo.setZhcydllhb(0.0);
  464. }
  465. vos.add(vo);
  466. SortUtils.sort(vos, "hours", SortUtils.ASC);
  467. map.put("value", vos);
  468. }
  469. firstDayZeroHour = DateUtils.addMonths(firstDayZeroHour, 1);
  470. calFirstDayZeroHour.setTime(firstDayZeroHour);
  471. calFirstMonth = calFirstDayZeroHour.get(Calendar.MONTH) + 1;
  472. hbjssj = DateUtils.addMonths(hbjssj, 1);
  473. tbjssj = DateUtils.addMonths(tbjssj, 1);
  474. }
  475. map.put("zhcydlsum", StringUtils.round(zhcydlsum, 2));
  476. map.put("sjdlsum", StringUtils.round(sjdlsum, 2));
  477. map.put("swdlsum", StringUtils.round(swdlsum, 2));
  478. map.put("gwdlsum", StringUtils.round(gwdlsum, 2));
  479. map.put("zhcydllsum", StringUtils.round(zhcydllsum * 100, 0));
  480. return map;
  481. }
  482. }