EquipmentInfo1Service.java 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922
  1. package com.gyee.generation.service;//package com.gyee.generation.service;
  2. import com.gyee.common.contant.ContantXk;
  3. import com.gyee.common.model.PointData;
  4. import com.gyee.common.model.StringUtils;
  5. import com.gyee.generation.init.CacheContext;
  6. import com.gyee.generation.model.auto.ProBasicEquipment;
  7. import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
  8. import com.gyee.generation.model.auto.ProEconEquipmentInfoDay1;
  9. import com.gyee.generation.service.auto.IProEconEquipmentInfoDay1Service;
  10. import com.gyee.generation.util.DateUtils;
  11. import com.gyee.generation.util.realtimesource.IEdosUtil;
  12. import com.gyee.generation.util.statisticcs.Initial;
  13. import org.springframework.stereotype.Service;
  14. import javax.annotation.Resource;
  15. import java.math.BigDecimal;
  16. import java.math.RoundingMode;
  17. import java.util.*;
  18. import java.util.stream.Collectors;
  19. @Service
  20. public class EquipmentInfo1Service {
  21. // private static final Logger logger = LoggerFactory.getLogger(EquipmentInfo1Service.class);
  22. @Resource
  23. private IEdosUtil edosUtil;
  24. @Resource
  25. private IProEconEquipmentInfoDay1Service proEconEquipmentInfoDay1Service;
  26. /**
  27. * 计算设备日信息
  28. */
  29. public void calEquipmentInfoDay(Date recordDate) throws Exception {
  30. Calendar c=Calendar.getInstance();
  31. c.setTime(recordDate);
  32. Date end=c.getTime();
  33. Date begin= DateUtils.truncDay(c.getTime());
  34. //判断是否有重复记录,先删除重复记录
  35. List<String> idls = proEconEquipmentInfoDay1Service.list().stream()
  36. .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
  37. && CacheContext.wtmap.containsKey(i.getWindturbineId())).map(ProEconEquipmentInfoDay1::getId)
  38. .collect(Collectors.toList());
  39. if (idls.size() > 0) {
  40. proEconEquipmentInfoDay1Service.removeByIds(idls);
  41. }
  42. for(ProBasicEquipment wt:CacheContext.wtls)
  43. {
  44. if(CacheContext.wtpAimap.containsKey(wt.getId()))
  45. {
  46. Map<String, ProBasicEquipmentPoint> pointmap=CacheContext.wtpAimap.get(wt.getId());
  47. ProEconEquipmentInfoDay1 pewp=new ProEconEquipmentInfoDay1();
  48. Initial.initial(pewp);
  49. pewp.setCompanyId(wt.getCompanyId());
  50. pewp.setWindpowerstationId(wt.getWindpowerstationId());
  51. pewp.setLineId(wt.getLineId());
  52. pewp.setProjectId(wt.getProjectId());
  53. pewp.setRegionId(wt.getRegionId());
  54. pewp.setRecordDate(DateUtils.truncDay(recordDate));
  55. //昨日的统计结果
  56. List<ProEconEquipmentInfoDay1> pepid1ls =new ArrayList<>();
  57. Calendar cl=Calendar.getInstance();
  58. cl.setTime(recordDate);
  59. if(cl.get(Calendar.DAY_OF_MONTH)!=1)
  60. {
  61. pepid1ls = proEconEquipmentInfoDay1Service.list().stream()
  62. .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(cl.getTime())) == 0
  63. && CacheContext.wtmap.containsKey(i.getWindturbineId())
  64. ).collect(Collectors.toList());
  65. }
  66. extracted(recordDate, end, begin, pointmap, pewp,pepid1ls);
  67. proEconEquipmentInfoDay1Service.save(pewp);
  68. }
  69. }
  70. }
  71. private void extracted(Date recordDate, Date end, Date begin,Map<String, ProBasicEquipmentPoint> pointmap, ProEconEquipmentInfoDay1 pewp,List<ProEconEquipmentInfoDay1> pepid1ls) throws Exception {
  72. //*******************************************日信息统计*********************************************************/
  73. if(pointmap.containsKey(ContantXk.SSPJFS))
  74. {
  75. ProBasicEquipmentPoint point= pointmap.get(ContantXk.SSPJFS);
  76. List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
  77. if(!pointls.isEmpty())
  78. {
  79. DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
  80. //日最大风速
  81. pewp.setRzdfs(summaryStatistics.getMax());
  82. //日最小风速
  83. pewp.setRzxfs(summaryStatistics.getMin());
  84. //日平均风速
  85. pewp.setRpjfs(summaryStatistics.getAverage());
  86. }
  87. }
  88. if(pointmap.containsKey(ContantXk.SSZGL))
  89. {
  90. ProBasicEquipmentPoint point= pointmap.get(ContantXk.SSZGL);
  91. List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
  92. if(!pointls.isEmpty())
  93. {
  94. DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
  95. //日最大功率
  96. pewp.setRzdgl(summaryStatistics.getMax());
  97. //日最小功率
  98. pewp.setRzxgl(summaryStatistics.getMin());
  99. //日平均功率
  100. pewp.setRpjgl(summaryStatistics.getAverage());
  101. }
  102. }
  103. if(pointmap.containsKey(ContantXk.RFDL))
  104. {
  105. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RFDL);
  106. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  107. if(StringUtils.notEmp(pointValue))
  108. {
  109. //日发电量
  110. pewp.setRfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  111. }
  112. }
  113. if(pointmap.containsKey(ContantXk.RKYDL))
  114. {
  115. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RKYDL);
  116. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  117. if(StringUtils.notEmp(pointValue))
  118. {
  119. //日可用电量
  120. pewp.setRkydl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  121. }
  122. }
  123. if(pointmap.containsKey(ContantXk.RLLFDL))
  124. {
  125. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RLLFDL);
  126. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  127. if(StringUtils.notEmp(pointValue))
  128. {
  129. //日理论发电量
  130. pewp.setRllfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  131. }
  132. }
  133. if(pointmap.containsKey(ContantXk.RGZSSDL))
  134. {
  135. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RGZSSDL);
  136. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  137. if(StringUtils.notEmp(pointValue))
  138. {
  139. //日故障损失电量
  140. pewp.setRgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  141. }
  142. }
  143. if(pointmap.containsKey(ContantXk.RCNSLGZSSDL))
  144. {
  145. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RCNSLGZSSDL);
  146. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  147. if(StringUtils.notEmp(pointValue))
  148. {
  149. //日场内受累故障损失电量
  150. pewp.setRcnslgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  151. }
  152. }
  153. if(pointmap.containsKey(ContantXk.RJXSSDL))
  154. {
  155. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RJXSSDL);
  156. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  157. if(StringUtils.notEmp(pointValue))
  158. {
  159. //日检修损失电量
  160. pewp.setRjxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  161. }
  162. }
  163. if(pointmap.containsKey(ContantXk.RCNSLJXSSDL))
  164. {
  165. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RCNSLJXSSDL);
  166. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  167. if(StringUtils.notEmp(pointValue))
  168. {
  169. //日场内受累检修损失电量
  170. pewp.setRcnsljxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  171. }
  172. }
  173. if(pointmap.containsKey(ContantXk.RDJSSDL))
  174. {
  175. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RDJSSDL);
  176. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  177. if(StringUtils.notEmp(pointValue))
  178. {
  179. //日待机损失电量
  180. pewp.setRdjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  181. }
  182. }
  183. if(pointmap.containsKey(ContantXk.RQXJCLSSDL))
  184. {
  185. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RQXJCLSSDL);
  186. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  187. if(StringUtils.notEmp(pointValue))
  188. {
  189. //日缺陷降出力损失电量
  190. pewp.setRqxjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  191. }
  192. }
  193. if(pointmap.containsKey(ContantXk.RSDTJSSDL))
  194. {
  195. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RSDTJSSDL);
  196. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  197. if(StringUtils.notEmp(pointValue))
  198. {
  199. //日手动停机损失电量
  200. pewp.setRsdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  201. }
  202. }
  203. if(pointmap.containsKey(ContantXk.RXNSSDL))
  204. {
  205. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RXNSSDL);
  206. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  207. if(StringUtils.notEmp(pointValue))
  208. {
  209. //日性能损失电量
  210. pewp.setRxnssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  211. }
  212. }
  213. if(pointmap.containsKey(ContantXk.RXDTJSSDL))
  214. {
  215. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RXDTJSSDL);
  216. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  217. if(StringUtils.notEmp(pointValue))
  218. {
  219. //日限电停机损失电量
  220. pewp.setRxdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  221. }
  222. }
  223. if(pointmap.containsKey(ContantXk.RXDJCLSSDL))
  224. {
  225. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RXDJCLSSDL);
  226. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  227. if(StringUtils.notEmp(pointValue))
  228. {
  229. //日限电降出力损失电量
  230. pewp.setRxdjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  231. }
  232. }
  233. if(pointmap.containsKey(ContantXk.RCWSLDWSSDL))
  234. {
  235. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RCWSLDWSSDL);
  236. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  237. if(StringUtils.notEmp(pointValue))
  238. {
  239. //日场外受累电网损失电量
  240. pewp.setRcwsldwssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  241. }
  242. }
  243. if(pointmap.containsKey(ContantXk.RCWSLTQSSDL))
  244. {
  245. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RCWSLTQSSDL);
  246. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  247. if(StringUtils.notEmp(pointValue))
  248. {
  249. //日场外受累天气损失电量
  250. pewp.setRcwsltqssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  251. }
  252. }
  253. if(pointmap.containsKey(ContantXk.RZFDL))
  254. {
  255. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RZFDL);
  256. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  257. if(StringUtils.notEmp(pointValue))
  258. {
  259. //日增发电量
  260. pewp.setRzfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  261. }
  262. }
  263. if(pointmap.containsKey(ContantXk.RQFDL))
  264. {
  265. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RQFDL);
  266. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  267. if(StringUtils.notEmp(pointValue))
  268. {
  269. //日欠发电量
  270. pewp.setRqfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  271. }
  272. }
  273. if(pointmap.containsKey(ContantXk.RZHD))
  274. {
  275. ProBasicEquipmentPoint point= pointmap.get(ContantXk.RZHD);
  276. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  277. if(StringUtils.notEmp(pointValue))
  278. {
  279. //日自耗电
  280. pewp.setRzhd(StringUtils.round(pointValue.getPointValueInDouble(),2));
  281. }
  282. }
  283. //*******************************************日信息统计*********************************************************/
  284. //*******************************************月信息统计*********************************************************/
  285. if(pepid1ls.isEmpty())
  286. {
  287. setPowerandSpeedMonth(pewp);
  288. }else
  289. {
  290. ProEconEquipmentInfoDay1 pepid=pepid1ls.get(0);
  291. //如果昨日大于今日最大功率
  292. if(pepid.getYzdgl()> pewp.getRzdgl())
  293. {
  294. pewp.setYzdgl(pepid.getYzdgl());
  295. }else {
  296. pewp.setYzdgl(pewp.getRzdgl());
  297. }
  298. //如果昨日大于今日最大风速
  299. if(pepid.getYzdfs()> pewp.getRzdfs())
  300. {
  301. pewp.setYzdfs(pepid.getYzdfs());
  302. }else
  303. {
  304. pewp.setYzdfs(pewp.getRzdfs());
  305. }
  306. //如果昨日小于今日最小功率
  307. if(pepid.getYzxgl()< pewp.getRzxgl())
  308. {
  309. pewp.setYzxgl(pepid.getYzxgl());
  310. }else
  311. {
  312. pewp.setYzxgl(pewp.getRzxgl());
  313. }
  314. //如果昨日小于今日最小风速
  315. if(pepid.getYzxfs()< pewp.getRzxfs())
  316. {
  317. pewp.setYzxfs(pepid.getYzxfs());
  318. }else
  319. {
  320. pewp.setYzxfs(pewp.getRzxfs());
  321. }
  322. double pjfs = BigDecimal.valueOf(pewp.getYpjfs() + pepid.getRpjfs()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
  323. pewp.setYzxfs(pjfs);
  324. double pjgl = BigDecimal.valueOf(pewp.getYpjgl() + pepid.getRpjgl()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
  325. pewp.setYzxgl(pjgl);
  326. }
  327. if(pointmap.containsKey(ContantXk.YFDL))
  328. {
  329. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YFDL);
  330. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  331. if(StringUtils.notEmp(pointValue))
  332. {
  333. //月发电量
  334. pewp.setYfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  335. }
  336. }
  337. if(pointmap.containsKey(ContantXk.YKYDL))
  338. {
  339. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YKYDL);
  340. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  341. if(StringUtils.notEmp(pointValue))
  342. {
  343. //月可用电量
  344. pewp.setYkydl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  345. }
  346. }
  347. if(pointmap.containsKey(ContantXk.YLLFDL))
  348. {
  349. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YLLFDL);
  350. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  351. if(StringUtils.notEmp(pointValue))
  352. {
  353. //月理论发电量
  354. pewp.setYllfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  355. }
  356. }
  357. if(pointmap.containsKey(ContantXk.YGZSSDL))
  358. {
  359. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YGZSSDL);
  360. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  361. if(StringUtils.notEmp(pointValue))
  362. {
  363. //月故障损失电量
  364. pewp.setYgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  365. }
  366. }
  367. if(pointmap.containsKey(ContantXk.YCNSLGZSSDL))
  368. {
  369. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YCNSLGZSSDL);
  370. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  371. if(StringUtils.notEmp(pointValue))
  372. {
  373. //月场内受累故障损失电量
  374. pewp.setYcnslgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  375. }
  376. }
  377. if(pointmap.containsKey(ContantXk.YJXSSDL))
  378. {
  379. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YJXSSDL);
  380. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  381. if(StringUtils.notEmp(pointValue))
  382. {
  383. //月检修损失电量
  384. pewp.setYjxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  385. }
  386. }
  387. if(pointmap.containsKey(ContantXk.YCNSLJXSSDL))
  388. {
  389. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YCNSLJXSSDL);
  390. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  391. if(StringUtils.notEmp(pointValue))
  392. {
  393. //月场内受累检修损失电量
  394. pewp.setYcnsljxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  395. }
  396. }
  397. if(pointmap.containsKey(ContantXk.YDJSSDL))
  398. {
  399. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YDJSSDL);
  400. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  401. if(StringUtils.notEmp(pointValue))
  402. {
  403. //月待机损失电量
  404. pewp.setYdjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  405. }
  406. }
  407. if(pointmap.containsKey(ContantXk.YQXJCLSSDL))
  408. {
  409. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YQXJCLSSDL);
  410. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  411. if(StringUtils.notEmp(pointValue))
  412. {
  413. //月缺陷降出力损失电量
  414. pewp.setYqxjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  415. }
  416. }
  417. if(pointmap.containsKey(ContantXk.YSDTJSSDL))
  418. {
  419. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YSDTJSSDL);
  420. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  421. if(StringUtils.notEmp(pointValue))
  422. {
  423. //月手动停机损失电量
  424. pewp.setYsdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  425. }
  426. }
  427. if(pointmap.containsKey(ContantXk.YXNSSDL))
  428. {
  429. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YXNSSDL);
  430. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  431. if(StringUtils.notEmp(pointValue))
  432. {
  433. //月性能损失电量
  434. pewp.setYxnssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  435. }
  436. }
  437. if(pointmap.containsKey(ContantXk.YXDTJSSDL))
  438. {
  439. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YXDTJSSDL);
  440. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  441. if(StringUtils.notEmp(pointValue))
  442. {
  443. //月限电停机损失电量
  444. pewp.setYxdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  445. }
  446. }
  447. if(pointmap.containsKey(ContantXk.YXDJCLSSDL))
  448. {
  449. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YXDJCLSSDL);
  450. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  451. if(StringUtils.notEmp(pointValue))
  452. {
  453. //月限电降出力损失电量
  454. pewp.setYxdjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  455. }
  456. }
  457. if(pointmap.containsKey(ContantXk.YCWSLDWSSDL))
  458. {
  459. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YCWSLDWSSDL);
  460. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  461. if(StringUtils.notEmp(pointValue))
  462. {
  463. //月场外受累电网损失电量
  464. pewp.setYcwsldwssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  465. }
  466. }
  467. if(pointmap.containsKey(ContantXk.YCWSLTQSSDL))
  468. {
  469. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YCWSLTQSSDL);
  470. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  471. if(StringUtils.notEmp(pointValue))
  472. {
  473. //月场外受累天气损失电量
  474. pewp.setYcwsltqssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  475. }
  476. }
  477. if(pointmap.containsKey(ContantXk.YZFDL))
  478. {
  479. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YZFDL);
  480. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  481. if(StringUtils.notEmp(pointValue))
  482. {
  483. //月增发电量
  484. pewp.setYzfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  485. }
  486. }
  487. if(pointmap.containsKey(ContantXk.YQFDL))
  488. {
  489. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YQFDL);
  490. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  491. if(StringUtils.notEmp(pointValue))
  492. {
  493. //月欠发电量
  494. pewp.setYqfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  495. }
  496. }
  497. if(pointmap.containsKey(ContantXk.YZHD))
  498. {
  499. ProBasicEquipmentPoint point= pointmap.get(ContantXk.YZHD);
  500. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  501. if(StringUtils.notEmp(pointValue))
  502. {
  503. //月自耗电
  504. pewp.setYzhd(StringUtils.round(pointValue.getPointValueInDouble(),2));
  505. }
  506. }
  507. //*******************************************月信息统计*********************************************************/
  508. //*******************************************年信息统计*********************************************************/
  509. if(pepid1ls.isEmpty())
  510. {
  511. setPowerandSpeedYear(pewp);
  512. }else
  513. {
  514. ProEconEquipmentInfoDay1 pepid=pepid1ls.get(0);
  515. //如果昨日大于今日最大功率
  516. if(pepid.getNzdgl()> pewp.getRzdgl())
  517. {
  518. pewp.setNzdgl(pepid.getNzdgl());
  519. }else {
  520. pewp.setNzdgl(pewp.getRzdgl());
  521. }
  522. //如果昨日大于今日最大风速
  523. if(pepid.getNzdfs()> pewp.getRzdfs())
  524. {
  525. pewp.setNzdfs(pepid.getNzdfs());
  526. }else
  527. {
  528. pewp.setNzdfs(pewp.getRzdfs());
  529. }
  530. //如果昨日小于今日最小功率
  531. if(pepid.getNzxgl()< pewp.getRzxgl())
  532. {
  533. pewp.setNzxgl(pepid.getNzxgl());
  534. }else
  535. {
  536. pewp.setNzxgl(pewp.getRzxgl());
  537. }
  538. //如果昨日小于今日最小风速
  539. if(pepid.getNzxfs()< pewp.getRzxfs())
  540. {
  541. pewp.setNzxfs(pepid.getNzxfs());
  542. }else
  543. {
  544. pewp.setNzxfs(pewp.getRzxfs());
  545. }
  546. double pjfs = BigDecimal.valueOf(pewp.getNpjfs() + pepid.getRpjfs()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
  547. pewp.setNzxfs(pjfs);
  548. double pjgl = BigDecimal.valueOf(pewp.getNpjgl() + pepid.getRpjgl()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
  549. pewp.setNzxgl(pjgl);
  550. }
  551. if(pointmap.containsKey(ContantXk.NFDL))
  552. {
  553. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NFDL);
  554. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  555. if(StringUtils.notEmp(pointValue))
  556. {
  557. //年发电量
  558. pewp.setNfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  559. }
  560. }
  561. if(pointmap.containsKey(ContantXk.NKYDL))
  562. {
  563. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NKYDL);
  564. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  565. if(StringUtils.notEmp(pointValue))
  566. {
  567. //年可用电量
  568. pewp.setNkydl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  569. }
  570. }
  571. if(pointmap.containsKey(ContantXk.NLLFDL))
  572. {
  573. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NLLFDL);
  574. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  575. if(StringUtils.notEmp(pointValue))
  576. {
  577. //年理论发电量
  578. pewp.setNllfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  579. }
  580. }
  581. if(pointmap.containsKey(ContantXk.NGZSSDL))
  582. {
  583. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NGZSSDL);
  584. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  585. if(StringUtils.notEmp(pointValue))
  586. {
  587. //年故障损失电量
  588. pewp.setNgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  589. }
  590. }
  591. if(pointmap.containsKey(ContantXk.NCNSLGZSSDL))
  592. {
  593. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NCNSLGZSSDL);
  594. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  595. if(StringUtils.notEmp(pointValue))
  596. {
  597. //年场内受累故障损失电量
  598. pewp.setNcnslgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  599. }
  600. }
  601. if(pointmap.containsKey(ContantXk.NJXSSDL))
  602. {
  603. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NJXSSDL);
  604. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  605. if(StringUtils.notEmp(pointValue))
  606. {
  607. //年检修损失电量
  608. pewp.setNjxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  609. }
  610. }
  611. if(pointmap.containsKey(ContantXk.NCNSLJXSSDL))
  612. {
  613. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NCNSLJXSSDL);
  614. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  615. if(StringUtils.notEmp(pointValue))
  616. {
  617. //年场内受累检修损失电量
  618. pewp.setNcnsljxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  619. }
  620. }
  621. if(pointmap.containsKey(ContantXk.NDJSSDL))
  622. {
  623. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NDJSSDL);
  624. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  625. if(StringUtils.notEmp(pointValue))
  626. {
  627. //年待机损失电量
  628. pewp.setNdjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  629. }
  630. }
  631. if(pointmap.containsKey(ContantXk.NQXJCLSSDL))
  632. {
  633. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NQXJCLSSDL);
  634. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  635. if(StringUtils.notEmp(pointValue))
  636. {
  637. //年缺陷降出力损失电量
  638. pewp.setNqxjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  639. }
  640. }
  641. if(pointmap.containsKey(ContantXk.NSDTJSSDL))
  642. {
  643. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NSDTJSSDL);
  644. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  645. if(StringUtils.notEmp(pointValue))
  646. {
  647. //年手动停机损失电量
  648. pewp.setNsdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  649. }
  650. }
  651. if(pointmap.containsKey(ContantXk.NXNSSDL))
  652. {
  653. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NXNSSDL);
  654. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  655. if(StringUtils.notEmp(pointValue))
  656. {
  657. //年性能损失电量
  658. pewp.setNxnssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  659. }
  660. }
  661. if(pointmap.containsKey(ContantXk.NXDTJSSDL))
  662. {
  663. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NXDTJSSDL);
  664. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  665. if(StringUtils.notEmp(pointValue))
  666. {
  667. //年限电停机损失电量
  668. pewp.setNxdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  669. }
  670. }
  671. if(pointmap.containsKey(ContantXk.NXDJCLSSDL))
  672. {
  673. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NXDJCLSSDL);
  674. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  675. if(StringUtils.notEmp(pointValue))
  676. {
  677. //年限电降出力损失电量
  678. pewp.setNxdjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  679. }
  680. }
  681. if(pointmap.containsKey(ContantXk.NCWSLDWSSDL))
  682. {
  683. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NCWSLDWSSDL);
  684. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  685. if(StringUtils.notEmp(pointValue))
  686. {
  687. //年场外受累电网损失电量
  688. pewp.setNcwsldwssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  689. }
  690. }
  691. if(pointmap.containsKey(ContantXk.NCWSLTQSSDL))
  692. {
  693. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NCWSLTQSSDL);
  694. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  695. if(StringUtils.notEmp(pointValue))
  696. {
  697. //年场外受累天气损失电量
  698. pewp.setNcwsltqssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  699. }
  700. }
  701. if(pointmap.containsKey(ContantXk.NZFDL))
  702. {
  703. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NZFDL);
  704. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  705. if(StringUtils.notEmp(pointValue))
  706. {
  707. //年增发电量
  708. pewp.setNzfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  709. }
  710. }
  711. if(pointmap.containsKey(ContantXk.NQFDL))
  712. {
  713. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NQFDL);
  714. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  715. if(StringUtils.notEmp(pointValue))
  716. {
  717. //年欠发电量
  718. pewp.setNqfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
  719. }
  720. }
  721. if(pointmap.containsKey(ContantXk.NZHD))
  722. {
  723. ProBasicEquipmentPoint point= pointmap.get(ContantXk.NZHD);
  724. PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
  725. if(StringUtils.notEmp(pointValue))
  726. {
  727. //年自耗电
  728. pewp.setNzhd(StringUtils.round(pointValue.getPointValueInDouble(),2));
  729. }
  730. }
  731. }
  732. private void setPowerandSpeedYear(ProEconEquipmentInfoDay1 pewp) {
  733. //年最大风速
  734. pewp.setNzdfs(pewp.getRzdfs());
  735. //年最小风速
  736. pewp.setNzxfs(pewp.getRzxfs());
  737. //年平均风速
  738. pewp.setNpjfs(pewp.getRpjfs());
  739. //年最大功率
  740. pewp.setNzdgl(pewp.getRzdgl());
  741. //年最小功率
  742. pewp.setNzxgl(pewp.getRzxgl());
  743. //年平均功率
  744. pewp.setNpjgl(pewp.getRpjgl());
  745. }
  746. private void setPowerandSpeedMonth(ProEconEquipmentInfoDay1 pewp) {
  747. //月最大风速
  748. pewp.setYzdfs(pewp.getRzdfs());
  749. //月最小风速
  750. pewp.setYzxfs(pewp.getRzxfs());
  751. //月平均风速
  752. pewp.setYpjfs(pewp.getRpjfs());
  753. //月最大功率
  754. pewp.setYzdgl(pewp.getRzdgl());
  755. //月最小功率
  756. pewp.setYzxgl(pewp.getRzxgl());
  757. //月平均功率
  758. pewp.setYpjgl(pewp.getRpjgl());
  759. }
  760. }