EquipmentInfo4Service.java 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223
  1. package com.gyee.generation.service;//package com.gyee.generation.service;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.gyee.common.contant.ContantXk;
  4. import com.gyee.common.model.PointData;
  5. import com.gyee.common.model.StringUtils;
  6. import com.gyee.generation.init.CacheContext;
  7. import com.gyee.generation.model.auto.*;
  8. import com.gyee.generation.service.auto.*;
  9. import com.gyee.generation.util.DateUtils;
  10. import com.gyee.generation.util.realtimesource.IEdosUtil;
  11. import com.gyee.generation.util.statisticcs.Initial;
  12. import org.springframework.stereotype.Service;
  13. import javax.annotation.Resource;
  14. import java.math.BigDecimal;
  15. import java.math.RoundingMode;
  16. import java.util.*;
  17. import java.util.stream.Collectors;
  18. @Service
  19. public class EquipmentInfo4Service {
  20. // private static final Logger logger = LoggerFactory.getLogger(EquipmentInfo4Service.class);
  21. @Resource
  22. private IEdosUtil edosUtil;
  23. @Resource
  24. private IProEconEquipmentInfoDay4Service proEconEquipmentInfoDay4Service;
  25. @Resource
  26. private IProEconEquipmentInfoDay2Service proEconEquipmentInfoDay2Service;
  27. @Resource
  28. private IProEconEquipmentInfoDay3Service proEconEquipmentInfoDay3Service;
  29. @Resource
  30. private IProEconInOrOutSpeedTotalService proEconInOrOutSpeedTotalService;
  31. @Resource
  32. private IProEconCurveFittingSubService proEconCurveFittingSubService;
  33. @Resource
  34. private IProEconCurveFittMonthSubService proEconCurveFittMonthSubService;
  35. @Resource
  36. private IProEconCurveFittYearSubService proEconCurveFittYearSubService;
  37. @Resource
  38. private IProEconCurveFittingMainService proEconCurveFittingMainService;
  39. @Resource
  40. private IProEconCurveFittMonthMainService proEconCurveFittMonthMainService;
  41. @Resource
  42. private IProEconCurveFittYearMainService proEconCurveFittYearMainService;
  43. @Resource
  44. private IProEconStateTransitionRatesService proEconStateTransitionRatesService;
  45. @Resource
  46. private IProEconFaultLiminatedefectsService proEconFaultLiminatedefectsService;
  47. @Resource
  48. private IProEconWindturbineGoodnessService proEconWindturbineGoodnessService;
  49. public void calEquipmentInfoDay(Date recordDate) throws Exception {
  50. Calendar c = Calendar.getInstance();
  51. c.setTime(recordDate);
  52. Date end = c.getTime();
  53. Date begin = DateUtils.truncate(c.getTime());
  54. //判断是否有重复记录,先删除重复记录
  55. QueryWrapper<ProEconEquipmentInfoDay4> queryWrapper = new QueryWrapper<>();
  56. queryWrapper.eq("record_date",begin);
  57. List<String> idls = proEconEquipmentInfoDay4Service.list(queryWrapper).stream()
  58. .map(ProEconEquipmentInfoDay4::getId)
  59. .collect(Collectors.toList());
  60. if (idls.size() > 0) {
  61. proEconEquipmentInfoDay4Service.removeByIds(idls);
  62. }
  63. //获取曲线风机切入风速
  64. Map<String, ProEconInOrOutSpeedTotal> peioomap = new HashMap<>();
  65. QueryWrapper<ProEconInOrOutSpeedTotal> queryWrapper2 = new QueryWrapper<>();
  66. queryWrapper2.eq("record_date",begin);
  67. List<ProEconInOrOutSpeedTotal> peioostls = proEconInOrOutSpeedTotalService.list(queryWrapper2);
  68. // .stream().filter(i ->
  69. // i.getRecordDate().compareTo(begin) == 0
  70. // ).collect(Collectors.toList());
  71. if (!peioostls.isEmpty()) {
  72. for (ProEconInOrOutSpeedTotal peioo : peioostls) {
  73. peioomap.put(peioo.getWindturbineId(), peioo);
  74. }
  75. }
  76. Map<String,ProEconWindturbineGoodness> wgmap=new HashMap<>();
  77. QueryWrapper<ProEconWindturbineGoodness> queryWrapper3 = new QueryWrapper<>();
  78. queryWrapper3.eq("record_date",DateUtils.truncate(begin));
  79. List<ProEconWindturbineGoodness> wgls = proEconWindturbineGoodnessService.list(queryWrapper3);
  80. // .stream()
  81. // .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(begin))==0
  82. // && CacheContext.wtmap.containsKey(i.getWindturbineId()))
  83. // .collect(Collectors.toList());
  84. if(!wgls.isEmpty())
  85. {
  86. for(ProEconWindturbineGoodness wg:wgls)
  87. {
  88. wgmap.put(wg.getWindturbineId(),wg);
  89. }
  90. }
  91. // //功率一致性接口调用
  92. // Map<String, Map<String, Double>> glqxyizxMap = coefficientService.coefficient(begin);
  93. // //拟合优度接口调用
  94. // Map<String, Map<String, Double>> nhydMap = goodnessOfFitService.goodnessOfFit(begin);
  95. List<ProEconEquipmentInfoDay4> dayls=new ArrayList<>();
  96. for (ProBasicEquipment wt : CacheContext.wtls) {
  97. if (CacheContext.wtpAimap.containsKey(wt.getId())) {
  98. ProEconEquipmentInfoDay4 pewp = new ProEconEquipmentInfoDay4();
  99. Initial.initial(pewp);
  100. pewp.setCompanyId(wt.getCompanyId());
  101. pewp.setWindpowerstationId(wt.getWindpowerstationId());
  102. pewp.setLineId(wt.getLineId());
  103. pewp.setProjectId(wt.getProjectId());
  104. pewp.setRegionId(wt.getRegionId());
  105. pewp.setRecordDate(DateUtils.truncate(recordDate));
  106. pewp.setWindturbineId(wt.getId());
  107. //昨日的统计结果
  108. List<ProEconEquipmentInfoDay4> pepidls = new ArrayList<>();
  109. Calendar cl = Calendar.getInstance();
  110. cl.setTime(recordDate);
  111. cl.add(Calendar.DAY_OF_MONTH,-1);
  112. if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
  113. QueryWrapper<ProEconEquipmentInfoDay4> queryWrapper4 = new QueryWrapper<>();
  114. queryWrapper4.eq("record_date",DateUtils.truncate(cl.getTime()))
  115. .eq("windturbine_id",wt.getId());
  116. pepidls = proEconEquipmentInfoDay4Service.list(queryWrapper4);
  117. // .stream()
  118. // .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
  119. // && i.getWindturbineId().equals(wt.getId())
  120. // )
  121. // .collect(Collectors.toList());
  122. }
  123. //获得当日设备统计2表数据
  124. ProEconEquipmentInfoDay2 pepid2 = null;
  125. List<ProEconEquipmentInfoDay2> pepid2ls;
  126. QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper5 = new QueryWrapper<>();
  127. queryWrapper5.eq("record_date",DateUtils.truncate(cl.getTime())).eq("windturbine_id",wt.getId());
  128. pepid2ls = proEconEquipmentInfoDay2Service.list(queryWrapper5);
  129. // .stream()
  130. // .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
  131. // && i.getWindturbineId().equals(wt.getId())
  132. // ).collect(Collectors.toList());
  133. if (!pepid2ls.isEmpty()) {
  134. pepid2 = pepid2ls.get(0);
  135. }
  136. //获得当日设备统计3表数据
  137. ProEconEquipmentInfoDay3 pepid3 = null;
  138. List<ProEconEquipmentInfoDay3> pepid3ls;
  139. QueryWrapper<ProEconEquipmentInfoDay3> queryWrapper6 = new QueryWrapper<>();
  140. queryWrapper6.eq("record_date",DateUtils.truncate(cl.getTime())).eq("windturbine_id",wt.getId());
  141. pepid3ls = proEconEquipmentInfoDay3Service.list(queryWrapper6);
  142. // .stream()
  143. // .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
  144. // && i.getWindturbineId().equals(wt.getId())
  145. // ).collect(Collectors.toList());
  146. if (!pepid3ls.isEmpty()) {
  147. pepid3 = pepid3ls.get(0);
  148. }
  149. calDetiall(peioomap, pewp, end, begin, wt, pepidls, pepid2, pepid3, wgmap);
  150. dayls.add(pewp);
  151. // proEconEquipmentInfoDay1Service.save(pewp);
  152. }
  153. }
  154. proEconEquipmentInfoDay4Service.saveBatch(dayls);
  155. }
  156. private void calDetiall(Map<String, ProEconInOrOutSpeedTotal> peioomap, ProEconEquipmentInfoDay4 pewp, Date end, Date begin,
  157. ProBasicEquipment wt, List<ProEconEquipmentInfoDay4> pepidls, ProEconEquipmentInfoDay2 pepid2, ProEconEquipmentInfoDay3 pepid3,
  158. Map<String,ProEconWindturbineGoodness> wgmap) throws Exception {
  159. //*****************************************日信息统计*********************************************************/
  160. Map<String, ProBasicEquipmentPoint> wtpointmap = CacheContext.wtpAimap.get(wt.getId());
  161. ProEconInOrOutSpeedTotal peiost;
  162. //获得功率一致性系数
  163. if (wgmap.containsKey(wt.getId())) {
  164. ProEconWindturbineGoodness wg = wgmap.get(wt.getId());
  165. pewp.setRglyzxxs(wg.getDayCoefficient());
  166. }
  167. //获得拟合优度
  168. if (wgmap.containsKey(wt.getId())) {
  169. ProEconWindturbineGoodness wg = wgmap.get(wt.getId());
  170. pewp.setRnhyd(wg.getDayGoodness());
  171. }
  172. if (StringUtils.notEmp(pepid2)) {
  173. //获得日有效风时数
  174. pewp.setRyxfss(StringUtils.round(24 - pepid2.getRgzxsmx() - pepid2.getRjxxsmx(), 2));
  175. }
  176. if (StringUtils.notEmp(pepid2) && StringUtils.notEmp(pepid3)) {
  177. //故障小时
  178. double rgzxsmx = pepid2.getRgzxsmx();
  179. //故障次数
  180. double rgzcsmx = pepid3.getRgzcsmx();
  181. if (rgzcsmx != 0) {
  182. double mtbf = new BigDecimal(24).divide(new BigDecimal(rgzcsmx), 2, RoundingMode.HALF_EVEN).doubleValue();
  183. double mttr = new BigDecimal(rgzxsmx).divide(new BigDecimal(rgzcsmx), 2, RoundingMode.HALF_EVEN).doubleValue();
  184. double mttf = mtbf - mttr;
  185. pewp.setRmtbf(mtbf);
  186. pewp.setRmttr(mttr);
  187. pewp.setRmttf(mttf);
  188. } else {
  189. double mtbf = 24.0;
  190. double mttr = 0.0;
  191. double mttf = mtbf - mttr;
  192. pewp.setRmtbf(mtbf);
  193. pewp.setRmttr(mttr);
  194. pewp.setRmttf(mttf);
  195. }
  196. }
  197. if (peioomap.containsKey(wt.getId())) {
  198. //切入切出统计
  199. peiost = peioomap.get(wt.getId());
  200. //日小风切入风速
  201. pewp.setRxfqrfs(peiost.getDayInputSmall());
  202. //日小风切出风速
  203. pewp.setRxfqcfs(peiost.getDayOutputSmall());
  204. //日大风切入风速
  205. pewp.setRdfqrfs(peiost.getDayInputBig());
  206. //日大风切出风速
  207. pewp.setRdfqcfs(peiost.getDayOutputBig());
  208. if (StringUtils.notEmp(peiost)) {
  209. ProBasicEquipmentPoint point = wtpointmap.get(ContantXk.CJ_SSFS);
  210. //风速历史查询,每分钟一个点
  211. List<PointData> fsls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000);
  212. if (StringUtils.notEmp(peiost) && !fsls.isEmpty()) {
  213. double dayjfsc = 0.0;
  214. for (PointData po : fsls) {
  215. // //小风切入风速
  216. // double xfqr = peiost.getDayInputSmall();
  217. // //小于小风切入算静风时长累计
  218. if (po.getPointValueInDouble() < 3) {
  219. dayjfsc++;
  220. }
  221. }
  222. //将分钟转化为小时
  223. dayjfsc = new BigDecimal(dayjfsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
  224. pewp.setRjfsc(dayjfsc);
  225. }
  226. if (CacheContext.modelMap.containsKey(wt.getModelId())) {
  227. ProEconEquipmentmodel model = CacheContext.modelMap.get(wt.getModelId());
  228. point = wtpointmap.get(ContantXk.CJ_SSGL);
  229. List<PointData> glls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000);
  230. double powerProduction = model.getPowerProduction();
  231. if (!glls.isEmpty() && glls.size() == fsls.size()) {
  232. for (int i = 0; i < glls.size(); i++) {
  233. //如果功率达到装机容量
  234. if (glls.get(i).getPointValueInDouble() >= powerProduction) {
  235. if (pewp.getRedfs() == 0) {
  236. //额定风速赋值
  237. pewp.setRedfs(fsls.get(i).getPointValueInDouble());
  238. } else if (pewp.getRedfs() > fsls.get(i).getPointValueInDouble()) {
  239. //额定风速赋值,比较风速大小,取最小值
  240. pewp.setRedfs(fsls.get(i).getPointValueInDouble());
  241. }
  242. }
  243. }
  244. }
  245. if (pewp.getRedfs() == 0) {
  246. //如果没有满发,额定风速赋值保证功率达到满发的对应风速
  247. pewp.setRedfs(11.0);
  248. }
  249. point = wtpointmap.get(ContantXk.BZGL);
  250. List<PointData> bzglls = edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000);
  251. if (!bzglls.isEmpty() && glls.size() == bzglls.size()) {
  252. double number = 0.0;
  253. for (int i = 0; i < bzglls.size(); i++) {
  254. double bzgl = bzglls.get(i).getPointValueInDouble();
  255. double sjgl = glls.get(i).getPointValueInDouble();
  256. //日对风偏差次数(-50 +50之间)
  257. if (Math.abs(bzgl - sjgl) < 50) {
  258. number++;
  259. }
  260. }
  261. pewp.setRdfpcl(number);
  262. }
  263. }
  264. }
  265. }
  266. QueryWrapper<ProEconCurveFittingMain> queryWrapper = new QueryWrapper<>();
  267. queryWrapper.eq("record_date",begin).eq("windturbine_id",wt.getId());
  268. List<ProEconCurveFittingMain> pecfmls = proEconCurveFittingMainService.list(queryWrapper);
  269. // .stream().filter(i -> i.getRecordDate().compareTo(begin) == 0
  270. // && i.getWindturbineId().equals(wt.getId())
  271. // ).collect(Collectors.toList());
  272. if (!pecfmls.isEmpty()) {
  273. ProEconCurveFittingMain pecfm = pecfmls.get(0);
  274. pewp.setRqxpcbzysj(pecfm.getDeviationRate1());
  275. pewp.setRqxpcbbzsj(pecfm.getDeviationRate2());
  276. pewp.setRqxpcbzybz(pecfm.getDeviationRate3());
  277. pewp.setRqxpcbbg(pecfm.getStandardDeviationRate());
  278. pewp.setRqxpcbtb(pecfm.getYearDeviationRate());
  279. pewp.setRqxpcbhb(pecfm.getMonthDeviationRate());
  280. }
  281. //**************************************************日三率统计****************************************************************/
  282. QueryWrapper<ProEconStateTransitionRates> queryWrapper2 = new QueryWrapper<>();
  283. queryWrapper2.eq("record_date",begin).eq("windturbine_id",wt.getId());
  284. List<ProEconStateTransitionRates> pestrls = proEconStateTransitionRatesService.list(queryWrapper2);
  285. // .stream()
  286. // .filter(i -> i.getRecordDate().compareTo(begin) == 0 && i.getWindturbineId().equals(wt.getId())
  287. // ).collect(Collectors.toList());
  288. //大于3米20分钟转换及时次数
  289. DoubleSummaryStatistics timerate8_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate8).summaryStatistics();
  290. //大于3米20分钟转换及时次数合计
  291. double timerate8_sum = timerate8_summary.getSum();
  292. //大于3米状态转换总次数次数
  293. DoubleSummaryStatistics timerate14_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate14).summaryStatistics();
  294. //大于3米状态转换总次数合计
  295. double timerate14_sum = timerate14_summary.getSum();
  296. if (timerate14_sum != 0) {
  297. //日状态转换及时率
  298. double temp = new BigDecimal(timerate8_sum).divide(new BigDecimal(timerate14_sum), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
  299. pewp.setRztzhjsl(temp);
  300. } else {
  301. pewp.setRztzhjsl(100.0);
  302. }
  303. //20分钟复位及时次数
  304. DoubleSummaryStatistics timerate19_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate19).summaryStatistics();
  305. //20分钟复位及时次数合计
  306. double timerate19_sum = timerate19_summary.getSum();
  307. //总复位次数
  308. DoubleSummaryStatistics timerate20_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate20).summaryStatistics();
  309. //总复位次数合计
  310. double timerate20_sum = timerate20_summary.getSum();
  311. if (timerate20_sum != 0) {
  312. //日复位及时率
  313. double temp = new BigDecimal(timerate19_sum).divide(new BigDecimal(timerate20_sum), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
  314. pewp.setRfwjsl(temp);
  315. } else {
  316. pewp.setRfwjsl(100.0);
  317. }
  318. QueryWrapper<ProEconFaultLiminatedefects> queryWrapper3 = new QueryWrapper<>();
  319. queryWrapper3.ge("date_time",begin).le("date_time",end).eq("windturbine_id",wt.getId());
  320. List<ProEconFaultLiminatedefects> peflls=proEconFaultLiminatedefectsService.list(queryWrapper3);
  321. // .stream()
  322. // .filter(i -> i.getDateTime().compareTo(begin) == 0 && i.getWindturbineId().equals(wt.getId())
  323. // ).collect(Collectors.toList());
  324. //消缺及时次数
  325. DoubleSummaryStatistics right_summary = peflls.stream().mapToDouble(ProEconFaultLiminatedefects::getRightCount).summaryStatistics();
  326. //消缺及时次数合计
  327. double right_sum = right_summary.getSum();
  328. //故障次数次数
  329. DoubleSummaryStatistics fault_summary = peflls.stream().mapToDouble(ProEconFaultLiminatedefects::getFaultCount).summaryStatistics();
  330. //故障次数次数合计
  331. double fault_sum = fault_summary.getSum();
  332. if (fault_sum != 0) {
  333. //日消缺及时率
  334. double temp = new BigDecimal(right_sum).divide(new BigDecimal(fault_sum), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
  335. pewp.setRgzxqjsl(temp);
  336. } else {
  337. pewp.setRgzxqjsl(100.0);
  338. }
  339. //**************************************************日三率统计****************************************************************/
  340. QueryWrapper<ProEconCurveFittingSub> queryWrapper6 = new QueryWrapper<>();
  341. queryWrapper6.eq("record_date",begin).isNotNull("speed")
  342. .lt("speed",5.0)
  343. .ge("speed",3.0)
  344. .eq("windturbine_id",wt.getId());
  345. List<ProEconCurveFittingSub> pointls=proEconCurveFittingSubService.list(queryWrapper6);
  346. // .stream().filter(x-> x.getSpeed() !=null
  347. // && Double.valueOf(x.getSpeed())>=3.0
  348. // && Double.valueOf(x.getSpeed())<5.0
  349. // && x.getRecordDate().compareTo(begin) == 0
  350. // && x.getWindturbineId().equals(wt.getId())
  351. // ).collect(Collectors.toList());
  352. DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(ProEconCurveFittingSub::getDeviationRate1).summaryStatistics();
  353. pewp.setR35mqxpcl(summaryStatistics.getAverage());
  354. queryWrapper6 = new QueryWrapper<>();
  355. queryWrapper6.eq("record_date",begin).isNotNull("speed")
  356. .lt("speed",11.0)
  357. .ge("speed",5.0)
  358. .eq("windturbine_id",wt.getId());
  359. pointls=proEconCurveFittingSubService.list(queryWrapper6);
  360. // .stream().filter(x-> x.getSpeed() !=null
  361. // && Double.valueOf(x.getSpeed())>=5.0
  362. // && Double.valueOf(x.getSpeed())<11.0
  363. // && x.getRecordDate().compareTo(begin) == 0
  364. // && x.getWindturbineId().equals(wt.getId())
  365. // ).collect(Collectors.toList());
  366. summaryStatistics=pointls.stream().mapToDouble(ProEconCurveFittingSub::getDeviationRate1).summaryStatistics();
  367. pewp.setR511mqxpcl(summaryStatistics.getAverage());
  368. queryWrapper6 = new QueryWrapper<>();
  369. queryWrapper6.eq("record_date",begin).isNotNull("speed")
  370. .ge("speed",11.0)
  371. .eq("windturbine_id",wt.getId());
  372. pointls=proEconCurveFittingSubService.list(queryWrapper6);
  373. // .stream().filter(x-> x.getSpeed() !=null
  374. // && Double.valueOf(x.getSpeed())>=11.0
  375. // && x.getRecordDate().compareTo(begin) == 0
  376. // && x.getWindturbineId().equals(wt.getId())
  377. // ).collect(Collectors.toList());
  378. summaryStatistics=pointls.stream().mapToDouble(ProEconCurveFittingSub::getDeviationRate1).summaryStatistics();
  379. pewp.setR11mycqxpcl(summaryStatistics.getAverage());
  380. //*******************************************日信息统计*********************************************************/
  381. //*******************************************月信息统计*********************************************************/
  382. Calendar c = Calendar.getInstance();
  383. c.setTime(begin);
  384. String year = String.valueOf(c.get(Calendar.YEAR));
  385. String month = String.valueOf(c.get(Calendar.MONTH) + 1);
  386. if (pepidls.isEmpty()) {
  387. setEquipmentInfoDay4Month(pewp);
  388. } else {
  389. ProEconEquipmentInfoDay4 pepid = pepidls.get(0);
  390. //获得功率一致性系数
  391. if (wgmap.containsKey(wt.getId())) {
  392. ProEconWindturbineGoodness wg = wgmap.get(wt.getId());
  393. pewp.setYglyzxxs(wg.getMonthCoefficient());
  394. }
  395. //获得拟合优度
  396. if (wgmap.containsKey(wt.getId())) {
  397. ProEconWindturbineGoodness wg = wgmap.get(wt.getId());
  398. pewp.setYnhyd(wg.getMonthGoodness());
  399. }
  400. if (StringUtils.notEmp(pepid2)) {
  401. //获得日有效风时数
  402. pewp.setYyxfss(StringUtils.round(c.get(Calendar.DAY_OF_MONTH) * 24 - pepid2.getYgzxsmx() - pepid2.getYjxxsmx(), 2));
  403. }
  404. if (StringUtils.notEmp(pepid2) && StringUtils.notEmp(pepid3)) {
  405. //故障小时
  406. double ygzxsmx = pepid2.getYgzxsmx();
  407. //故障次数
  408. double ygzcsmx = pepid3.getYgzcsmx();
  409. if (ygzcsmx != 0) {
  410. double mtbf = new BigDecimal(c.get(Calendar.DAY_OF_MONTH) * 24).divide(new BigDecimal(ygzcsmx), 2, RoundingMode.HALF_EVEN).doubleValue();
  411. double mttr = new BigDecimal(ygzxsmx).divide(new BigDecimal(ygzcsmx), 2, RoundingMode.HALF_EVEN).doubleValue();
  412. double mttf = mtbf - mttr;
  413. pewp.setYmtbf(mtbf);
  414. pewp.setYmttr(mttr);
  415. pewp.setYmttf(mttf);
  416. } else {
  417. double mtbf = c.get(Calendar.DAY_OF_MONTH) * 24;
  418. double mttr = 0.0;
  419. double mttf = mtbf - mttr;
  420. pewp.setYmtbf(mtbf);
  421. pewp.setYmttr(mttr);
  422. pewp.setYmttf(mttf);
  423. }
  424. }
  425. if (peioomap.containsKey(wt.getId())) {
  426. //切入切出统计
  427. peiost = peioomap.get(wt.getId());
  428. //月小风切入风速
  429. pewp.setYxfqrfs(peiost.getMonthInputSmall());
  430. //月小风切出风速
  431. pewp.setYxfqcfs(peiost.getMonthOutputSmall());
  432. //月大风切入风速
  433. pewp.setYdfqrfs(peiost.getMonthInputBig());
  434. //月大风切出风速
  435. pewp.setYdfqcfs(peiost.getMonthOutputBig());
  436. if (StringUtils.notEmp(peiost)) {
  437. //静风时长累计
  438. pewp.setYjfsc(pewp.getYjfsc() + pepid.getRjfsc());
  439. if (pewp.getYedfs() == 0) {
  440. //如果没有满发,额定风速赋值保证功率达到满发的对应风速
  441. pewp.setYedfs(11.0);
  442. }
  443. if (pewp.getRedfs() < pepid.getYedfs()) {
  444. pewp.setYedfs(pewp.getRedfs());
  445. } else {
  446. pewp.setYedfs(pepid.getYedfs());
  447. }
  448. //月对风偏差次数(-50 +50之间)
  449. pewp.setYdfpcl(pepid.getYdfpcl() + pewp.getRdfpcl());
  450. }
  451. }
  452. QueryWrapper<ProEconCurveFittMonthMain> queryWrapper4 = new QueryWrapper<>();
  453. queryWrapper4.eq("year",year).eq("month",month).eq("windturbine_id",wt.getId());
  454. List<ProEconCurveFittMonthMain> pecfmmls = proEconCurveFittMonthMainService.list(queryWrapper4);
  455. // .stream().filter(i -> i.getYear().equals(year) && i.getMonth().equals(month)
  456. // && i.getWindturbineId().equals(wt.getId())
  457. // ).collect(Collectors.toList());
  458. if (!pecfmmls.isEmpty()) {
  459. ProEconCurveFittMonthMain pecfm = pecfmmls.get(0);
  460. pewp.setYqxpcbzysj(pecfm.getDeviationRate1());
  461. pewp.setYqxpcbbzsj(pecfm.getDeviationRate2());
  462. pewp.setYqxpcbzybz(pecfm.getDeviationRate3());
  463. pewp.setYqxpcbbg(pecfm.getStandardDeviationRate());
  464. pewp.setYqxpcbtb(pecfm.getYearDeviationRate());
  465. pewp.setYqxpcbhb(pecfm.getMonthDeviationRate());
  466. }
  467. //************************************************月三率统计****************************************************************/
  468. Calendar cal = Calendar.getInstance();
  469. cal.setTime(begin);
  470. cal.set(Calendar.DAY_OF_MONTH, 1);
  471. Date monthbiegin = c.getTime();
  472. queryWrapper2 = new QueryWrapper<>();
  473. queryWrapper2.ge("record_date",monthbiegin).le("record_date",end).eq("windturbine_id",wt.getId());
  474. pestrls =proEconStateTransitionRatesService.list(queryWrapper2);
  475. // .stream()
  476. // .filter(i ->
  477. // (i.getRecordDate().compareTo(monthbiegin) == 0 || i.getRecordDate().after(monthbiegin))
  478. // && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
  479. // && i.getWindturbineId().equals(wt.getId())
  480. // ).collect(Collectors.toList());
  481. //大于3米20分钟转换及时次数
  482. timerate8_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate8).summaryStatistics();
  483. //大于3米20分钟转换及时次数合计
  484. timerate8_sum = timerate8_summary.getSum();
  485. //大于3米状态转换总次数次数
  486. timerate14_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate14).summaryStatistics();
  487. //大于3米状态转换总次数合计
  488. timerate14_sum = timerate14_summary.getSum();
  489. if (timerate14_sum != 0) {
  490. //月状态转换及时率
  491. double temp = new BigDecimal(timerate8_sum).divide(new BigDecimal(timerate14_sum), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
  492. pewp.setYztzhjsl(temp);
  493. } else {
  494. pewp.setYztzhjsl(100.0);
  495. }
  496. //20分钟复位及时次数
  497. timerate19_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate19).summaryStatistics();
  498. //20分钟复位及时次数合计
  499. timerate19_sum = timerate19_summary.getSum();
  500. //总复位次数
  501. timerate20_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate20).summaryStatistics();
  502. //总复位次数合计
  503. timerate20_sum = timerate20_summary.getSum();
  504. if (timerate20_sum != 0) {
  505. //月复位及时率
  506. double temp = new BigDecimal(timerate19_sum).divide(new BigDecimal(timerate20_sum), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
  507. pewp.setYfwjsl(temp);
  508. } else {
  509. pewp.setYfwjsl(100.0);
  510. }
  511. queryWrapper3 = new QueryWrapper<>();
  512. queryWrapper3.ge("date_time",monthbiegin).le("date_time",end).eq("windturbine_id",wt.getId());
  513. peflls=proEconFaultLiminatedefectsService.list(queryWrapper3);
  514. // .stream()
  515. // .filter(i ->
  516. // (i.getDateTime().compareTo(monthbiegin) == 0 || i.getDateTime().after(monthbiegin))
  517. // && (i.getDateTime().compareTo(end) == 0 || i.getDateTime().before(end))
  518. // && i.getWindturbineId().equals(wt.getId())
  519. // ).collect(Collectors.toList());
  520. //消缺及时次数
  521. right_summary = peflls.stream().mapToDouble(ProEconFaultLiminatedefects::getRightCount).summaryStatistics();
  522. //消缺及时次数合计
  523. right_sum = right_summary.getSum();
  524. //故障次数次数
  525. fault_summary = peflls.stream().mapToDouble(ProEconFaultLiminatedefects::getFaultCount).summaryStatistics();
  526. //故障次数次数合计
  527. fault_sum = fault_summary.getSum();
  528. if (fault_sum != 0) {
  529. //月消缺及时率
  530. double temp = new BigDecimal(right_sum).divide(new BigDecimal(fault_sum), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
  531. pewp.setYgzxqjsl(temp);
  532. } else {
  533. pewp.setYgzxqjsl(100.0);
  534. }
  535. //**************************************************月三率统计****************************************************************/
  536. QueryWrapper<ProEconCurveFittMonthSub> queryWrapper7 = new QueryWrapper<>();
  537. queryWrapper7.isNotNull("speed")
  538. .lt("speed",5.0)
  539. .ge("speed",3.0)
  540. .eq("year",year)
  541. .eq("month",month)
  542. .eq("windturbine_id",wt.getId());
  543. List<ProEconCurveFittMonthSub> monthpointls=proEconCurveFittMonthSubService.list(queryWrapper7);
  544. // .stream().filter(x-> x.getSpeed() !=null
  545. // && Double.valueOf(x.getSpeed())>=3.0
  546. // && Double.valueOf(x.getSpeed())<5.0
  547. // && x.getYear().equals(year)
  548. // && x.getMonth().equals(month)
  549. // && x.getWindturbineId().equals(wt.getId())
  550. // ).collect(Collectors.toList());
  551. summaryStatistics=monthpointls.stream().mapToDouble(ProEconCurveFittMonthSub::getDeviationRate1).summaryStatistics();
  552. pewp.setY35mqxpcl(summaryStatistics.getAverage());
  553. queryWrapper7 = new QueryWrapper<>();
  554. queryWrapper7.isNotNull("speed")
  555. .lt("speed",11.0)
  556. .ge("speed",5.0)
  557. .eq("year",year)
  558. .eq("month",month)
  559. .eq("windturbine_id",wt.getId());
  560. monthpointls=proEconCurveFittMonthSubService.list(queryWrapper7);
  561. // monthpointls=proEconCurveFittMonthSubService.list().stream().filter(x-> x.getSpeed() !=null
  562. // && Double.valueOf(x.getSpeed())>=5.0
  563. // && Double.valueOf(x.getSpeed())<11.0
  564. // && x.getYear().equals(year)
  565. // && x.getMonth().equals(month)
  566. // && x.getWindturbineId().equals(wt.getId())
  567. // ).collect(Collectors.toList());
  568. summaryStatistics=monthpointls.stream().mapToDouble(ProEconCurveFittMonthSub::getDeviationRate1).summaryStatistics();
  569. pewp.setY511mqxpcl(summaryStatistics.getAverage());
  570. queryWrapper7 = new QueryWrapper<>();
  571. queryWrapper7.isNotNull("speed")
  572. // .lt("speed",11.0)
  573. .ge("speed",11.0)
  574. .eq("year",year)
  575. .eq("month",month)
  576. .eq("windturbine_id",wt.getId());
  577. monthpointls=proEconCurveFittMonthSubService.list(queryWrapper7);
  578. // monthpointls=proEconCurveFittMonthSubService.list().stream().filter(x-> x.getSpeed() !=null
  579. // && Double.valueOf(x.getSpeed())>=11.0
  580. // && x.getYear().equals(year)
  581. // && x.getMonth().equals(month)
  582. // && x.getWindturbineId().equals(wt.getId())
  583. // ).collect(Collectors.toList());
  584. summaryStatistics=monthpointls.stream().mapToDouble(ProEconCurveFittMonthSub::getDeviationRate1).summaryStatistics();
  585. pewp.setY11mycqxpcl(summaryStatistics.getAverage());
  586. }
  587. //*******************************************月信息统计*********************************************************/
  588. //*******************************************年信息统计*********************************************************/
  589. if (pepidls.isEmpty()) {
  590. setEquipmentInfoDay4Year(pewp);
  591. } else {
  592. ProEconEquipmentInfoDay4 pepid = pepidls.get(0);
  593. //获得功率一致性系数
  594. if (wgmap.containsKey(wt.getId())) {
  595. ProEconWindturbineGoodness wg = wgmap.get(wt.getId());
  596. pewp.setNglyzxxs(wg.getYearCoefficient());
  597. }
  598. //获得拟合优度
  599. if (wgmap.containsKey(wt.getId())) {
  600. ProEconWindturbineGoodness wg = wgmap.get(wt.getId());
  601. pewp.setNnhyd(wg.getYearGoodness());
  602. }
  603. if (StringUtils.notEmp(pepid2)) {
  604. //获得日有效风时数
  605. pewp.setNyxfss(StringUtils.round(c.get(Calendar.DAY_OF_YEAR) * 24 - pepid2.getNgzxsmx() - pepid2.getNjxxsmx(), 2));
  606. }
  607. if (StringUtils.notEmp(pepid2) && StringUtils.notEmp(pepid3)) {
  608. //故障小时
  609. double ngzxsmx = pepid2.getYgzxsmx();
  610. //故障次数
  611. double ngzcsmx = pepid3.getYgzcsmx();
  612. if (ngzcsmx != 0) {
  613. double mtbf = new BigDecimal(c.get(Calendar.DAY_OF_YEAR) * 24).divide(new BigDecimal(ngzcsmx), 2, RoundingMode.HALF_EVEN).doubleValue();
  614. double mttr = new BigDecimal(ngzxsmx).divide(new BigDecimal(ngzcsmx), 2, RoundingMode.HALF_EVEN).doubleValue();
  615. double mttf = mtbf - mttr;
  616. pewp.setNmtbf(mtbf);
  617. pewp.setNmttr(mttr);
  618. pewp.setNmttf(mttf);
  619. } else {
  620. double mtbf = c.get(Calendar.DAY_OF_YEAR) * 24;
  621. double mttr = 0.0;
  622. double mttf = mtbf - mttr;
  623. pewp.setNmtbf(mtbf);
  624. pewp.setNmttr(mttr);
  625. pewp.setNmttf(mttf);
  626. }
  627. }
  628. if (peioomap.containsKey(wt.getId())) {
  629. //切入切出统计
  630. peiost = peioomap.get(wt.getId());
  631. //年小风切入风速
  632. pewp.setNxfqrfs(peiost.getYearInputSmall());
  633. //年小风切出风速
  634. pewp.setNxfqcfs(peiost.getYearOutputSmall());
  635. //年大风切入风速
  636. pewp.setNdfqrfs(peiost.getYearInputBig());
  637. //年大风切出风速
  638. pewp.setNdfqcfs(peiost.getYearOutputBig());
  639. if (StringUtils.notEmp(peiost)) {
  640. //静风时长累计
  641. pewp.setNjfsc(pewp.getNjfsc() + pepid.getRjfsc());
  642. if (pewp.getNedfs() == 0) {
  643. //如果没有满发,额定风速赋值保证功率达到满发的对应风速
  644. pewp.setNedfs(11.0);
  645. }
  646. if (pewp.getRedfs() < pepid.getNedfs()) {
  647. pewp.setNedfs(pewp.getRedfs());
  648. } else {
  649. pewp.setNedfs(pepid.getNedfs());
  650. }
  651. //月对风偏差次数(-50 +50之间)
  652. pewp.setNdfpcl(pepid.getNdfpcl() + pewp.getRdfpcl());
  653. }
  654. }
  655. QueryWrapper<ProEconCurveFittYearMain> queryWrapper8 = new QueryWrapper<>();
  656. queryWrapper8.eq("year",year).eq("windturbine_id",wt.getId());
  657. List<ProEconCurveFittYearMain> pecfYmls = proEconCurveFittYearMainService.list(queryWrapper8);
  658. // .stream().filter(i -> i.getYear().equals(year)
  659. // && i.getWindturbineId().equals(wt.getId())
  660. // ).collect(Collectors.toList());
  661. if (!pecfYmls.isEmpty()) {
  662. ProEconCurveFittYearMain pecfm = pecfYmls.get(0);
  663. pewp.setNqxpcbzysj(pecfm.getDeviationRate1());
  664. pewp.setNqxpcbbzsj(pecfm.getDeviationRate2());
  665. pewp.setNqxpcbzybz(pecfm.getDeviationRate3());
  666. pewp.setNqxpcbbg(pecfm.getStandardDeviationRate());
  667. pewp.setNqxpcbtb(pecfm.getYearDeviationRate());
  668. pewp.setNqxpcbhb(pecfm.getMonthDeviationRate());
  669. }
  670. //************************************************年三率统计****************************************************************/
  671. Calendar cal = Calendar.getInstance();
  672. cal.setTime(begin);
  673. cal.set(Calendar.DAY_OF_YEAR, 1);
  674. Date yearbiegin = c.getTime();
  675. queryWrapper2 = new QueryWrapper<>();
  676. queryWrapper2.ge("record_date",yearbiegin).le("record_date",end).eq("windturbine_id",wt.getId());
  677. pestrls =proEconStateTransitionRatesService.list(queryWrapper2);
  678. // .stream()
  679. // .filter(i ->
  680. // (i.getRecordDate().compareTo(yearbiegin) == 0 || i.getRecordDate().after(yearbiegin))
  681. // && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
  682. // && i.getWindturbineId().equals(wt.getId())
  683. // ).collect(Collectors.toList());
  684. //大于3米20分钟转换及时次数
  685. timerate8_summary =pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate8).summaryStatistics();
  686. //大于3米20分钟转换及时次数合计
  687. timerate8_sum = timerate8_summary.getSum();
  688. //大于3米状态转换总次数次数
  689. timerate14_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate14).summaryStatistics();
  690. //大于3米状态转换总次数合计
  691. timerate14_sum = timerate14_summary.getSum();
  692. if (timerate14_sum != 0) {
  693. //年状态转换及时率
  694. double temp = new BigDecimal(timerate8_sum).divide(new BigDecimal(timerate14_sum), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
  695. pewp.setNztzhjsl(temp);
  696. } else {
  697. pewp.setNztzhjsl(100.0);
  698. }
  699. //20分钟复位及时次数
  700. timerate19_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate19).summaryStatistics();
  701. //20分钟复位及时次数合计
  702. timerate19_sum = timerate19_summary.getSum();
  703. //总复位次数
  704. timerate20_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate20).summaryStatistics();
  705. //总复位次数合计
  706. timerate20_sum = timerate20_summary.getSum();
  707. if (timerate20_sum != 0) {
  708. //年复位及时率
  709. double temp = new BigDecimal(timerate19_sum).divide(new BigDecimal(timerate20_sum), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
  710. pewp.setNfwjsl(temp);
  711. } else {
  712. pewp.setNfwjsl(100.0);
  713. }
  714. queryWrapper3 = new QueryWrapper<>();
  715. queryWrapper3.ge("date_time",yearbiegin).le("date_time",end).eq("windturbine_id",wt.getId());
  716. peflls=proEconFaultLiminatedefectsService.list(queryWrapper3);
  717. // .stream()
  718. // .filter(i ->
  719. // (i.getDateTime().compareTo(yearbiegin) == 0 || i.getDateTime().after(yearbiegin))
  720. // && (i.getDateTime().compareTo(end) == 0 || i.getDateTime().before(end))
  721. // && i.getWindturbineId().equals(wt.getId())
  722. // ).collect(Collectors.toList());
  723. //消缺及时次数
  724. right_summary = peflls.stream().mapToDouble(ProEconFaultLiminatedefects::getRightCount).summaryStatistics();
  725. //消缺及时次数合计
  726. right_sum = right_summary.getSum();
  727. //故障次数次数
  728. fault_summary = peflls.stream().mapToDouble(ProEconFaultLiminatedefects::getFaultCount).summaryStatistics();
  729. //故障次数次数合计
  730. fault_sum = fault_summary.getSum();
  731. if (fault_sum != 0) {
  732. //年消缺及时率
  733. double temp = new BigDecimal(right_sum).divide(new BigDecimal(fault_sum), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
  734. pewp.setNgzxqjsl(temp);
  735. } else {
  736. pewp.setNgzxqjsl(100.0);
  737. }
  738. //**************************************************年三率统计****************************************************************/
  739. QueryWrapper<ProEconCurveFittYearSub> queryWrapper7 = new QueryWrapper<>();
  740. queryWrapper.isNotNull("speed")
  741. .lt("speed",5.0)
  742. .ge("speed",3.0)
  743. .eq("year",year)
  744. .eq("windturbine_id",wt.getId());
  745. List<ProEconCurveFittYearSub> yearpointls=proEconCurveFittYearSubService.list(queryWrapper7);
  746. // .stream().filter(x-> x.getSpeed() !=null
  747. // && Double.valueOf(x.getSpeed())>=3.0
  748. // && Double.valueOf(x.getSpeed())<5.0
  749. // && x.getYear().equals(year)
  750. // && x.getWindturbineId().equals(wt.getId())
  751. // ).collect(Collectors.toList());
  752. summaryStatistics=yearpointls.stream().mapToDouble(ProEconCurveFittYearSub::getDeviationRate1).summaryStatistics();
  753. pewp.setN35mqxpcl(summaryStatistics.getAverage());
  754. queryWrapper7 = new QueryWrapper<>();
  755. queryWrapper7.isNotNull("speed")
  756. .lt("speed",11.0)
  757. .ge("speed",5.0)
  758. .eq("year",year)
  759. .eq("windturbine_id",wt.getId());
  760. yearpointls=proEconCurveFittYearSubService.list(queryWrapper7);
  761. // .stream().filter(x-> x.getSpeed() !=null
  762. // && Double.valueOf(x.getSpeed())>=5.0
  763. // && Double.valueOf(x.getSpeed())<11.0
  764. // && x.getYear().equals(year)
  765. // && x.getWindturbineId().equals(wt.getId())
  766. // ).collect(Collectors.toList());
  767. summaryStatistics=yearpointls.stream().mapToDouble(ProEconCurveFittYearSub::getDeviationRate1).summaryStatistics();
  768. pewp.setN511mqxpcl(summaryStatistics.getAverage());
  769. queryWrapper7 = new QueryWrapper<>();
  770. queryWrapper.isNotNull("speed")
  771. .ge("speed",11.0)
  772. .eq("year",year)
  773. .eq("windturbine_id",wt.getId());
  774. yearpointls=proEconCurveFittYearSubService.list(queryWrapper7);
  775. // yearpointls=proEconCurveFittYearSubService.list().stream().filter(x-> x.getSpeed() !=null
  776. // && Double.valueOf(x.getSpeed())>=11.0
  777. // && x.getYear().equals(year)
  778. // && x.getWindturbineId().equals(wt.getId())
  779. // ).collect(Collectors.toList());
  780. summaryStatistics=yearpointls.stream().mapToDouble(ProEconCurveFittYearSub::getDeviationRate1).summaryStatistics();
  781. pewp.setN11mycqxpcl(summaryStatistics.getAverage());
  782. }
  783. }
  784. private static void setEquipmentInfoDay4Year(ProEconEquipmentInfoDay4 pewp) {
  785. //* 年静风时长
  786. pewp.setNjfsc(pewp.getRjfsc());
  787. //* 年有效风时数
  788. pewp.setNyxfss(pewp.getRyxfss());
  789. //* 年小风切入风速
  790. pewp.setNxfqrfs(pewp.getRxfqrfs());
  791. //* 年大风切入风速
  792. pewp.setNdfqrfs(pewp.getRdfqrfs());
  793. //* 年小风切出风速
  794. pewp.setNxfqcfs(pewp.getRxfqcfs());
  795. //* 年大风切出风速
  796. pewp.setNdfqcfs(pewp.getRdfqcfs());
  797. //* 年额定风速
  798. pewp.setNedfs(pewp.getRedfs());
  799. //* 年功率一致性系数
  800. pewp.setNglyzxxs(pewp.getRglyzxxs());
  801. //* 年拟合优度
  802. pewp.setNnhyd(pewp.getRnhyd());
  803. //* 年曲线偏差率最优保证
  804. pewp.setNqxpcbzybz(pewp.getRqxpcbzybz());
  805. //* 年曲线偏差率最优实际
  806. pewp.setNqxpcbzysj(pewp.getRqxpcbzysj());
  807. //* 年曲线偏差率保证实际
  808. pewp.setNqxpcbbzsj(pewp.getRqxpcbbzsj());
  809. //* 年曲线偏差率同比
  810. pewp.setNqxpcbtb(pewp.getRqxpcbtb());
  811. //* 年曲线偏差率环比
  812. pewp.setNqxpcbhb(pewp.getRqxpcbhb());
  813. //* 年曲线偏差率标杆
  814. pewp.setNqxpcbbg(pewp.getRqxpcbbg());
  815. //* 年3-5米曲线偏差率
  816. pewp.setN35mqxpcl(pewp.getR35mqxpcl());
  817. //* 年5-11米曲线偏差率
  818. pewp.setN511mqxpcl(pewp.getR511mqxpcl());
  819. //* 年11米以上曲线偏差率
  820. pewp.setN11mycqxpcl(pewp.getR11mycqxpcl());
  821. //* 年对风偏差率(-50 +50之间)
  822. pewp.setNdfpcl(pewp.getRdfpcl());
  823. //* 年MTBF
  824. pewp.setNmtbf(pewp.getRmtbf());
  825. //* 年MTTR
  826. pewp.setNmttr(pewp.getRmttr());
  827. //* 年MTTF
  828. pewp.setNmttf(pewp.getRmttf());
  829. //* 年复位及时率
  830. pewp.setNfwjsl(pewp.getRfwjsl());
  831. //* 年状态转换及时率
  832. pewp.setNztzhjsl(pewp.getRztzhjsl());
  833. //* 年故障消缺及时率
  834. pewp.setNgzxqjsl(pewp.getRgzxqjsl());
  835. }
  836. private static void setEquipmentInfoDay4Month(ProEconEquipmentInfoDay4 pewp) {
  837. //* 月静风时长
  838. pewp.setYjfsc(pewp.getRjfsc());
  839. //* 月有效风时数
  840. pewp.setYyxfss(pewp.getRyxfss());
  841. //* 月小风切入风速
  842. pewp.setYxfqrfs(pewp.getRxfqrfs());
  843. //* 月大风切入风速
  844. pewp.setYdfqrfs(pewp.getRdfqrfs());
  845. //* 月小风切出风速
  846. pewp.setYxfqcfs(pewp.getRxfqcfs());
  847. //* 月大风切出风速
  848. pewp.setYdfqcfs(pewp.getRdfqcfs());
  849. //* 月额定风速
  850. pewp.setYedfs(pewp.getRedfs());
  851. //* 月功率一致性系数
  852. pewp.setYglyzxxs(pewp.getRglyzxxs());
  853. //* 月拟合优度
  854. pewp.setYnhyd(pewp.getRnhyd());
  855. //* 月曲线偏差率最优保证
  856. pewp.setYqxpcbzybz(pewp.getRqxpcbzybz());
  857. //* 月曲线偏差率最优实际
  858. pewp.setYqxpcbzysj(pewp.getRqxpcbzysj());
  859. //* 月曲线偏差率保证实际
  860. pewp.setYqxpcbbzsj(pewp.getRqxpcbbzsj());
  861. //* 月曲线偏差率同比
  862. pewp.setYqxpcbtb(pewp.getRqxpcbtb());
  863. //* 月曲线偏差率环比
  864. pewp.setYqxpcbhb(pewp.getRqxpcbhb());
  865. //* 月曲线偏差率标杆
  866. pewp.setYqxpcbbg(pewp.getRqxpcbbg());
  867. //* 月3-5米曲线偏差率
  868. pewp.setY35mqxpcl(pewp.getR35mqxpcl());
  869. //* 月5-11米曲线偏差率
  870. pewp.setY511mqxpcl(pewp.getR511mqxpcl());
  871. //* 月11米以上曲线偏差率
  872. pewp.setY11mycqxpcl(pewp.getR11mycqxpcl());
  873. //* 月对风偏差率(-50 +50之间)
  874. pewp.setYdfpcl(pewp.getRdfpcl());
  875. //* 月MTBF
  876. pewp.setYmtbf(pewp.getRmtbf());
  877. //* 月MTTR
  878. pewp.setYmttr(pewp.getRmttr());
  879. //* 月MTTF
  880. pewp.setYmttf(pewp.getRmttf());
  881. //* 月复位及时率
  882. pewp.setYfwjsl(pewp.getRfwjsl());
  883. //* 月状态转换及时率
  884. pewp.setYztzhjsl(pewp.getRztzhjsl());
  885. // //* 月故障消缺及时率
  886. pewp.setYgzxqjsl(pewp.getRgzxqjsl());
  887. }
  888. }