BenchmarkingService.java 122 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589
  1. package com.gyee.benchmarkingimpala.service;
  2. import com.alibaba.fastjson.JSON;
  3. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  4. import com.gyee.benchmarkingimpala.common.PointData;
  5. import com.gyee.benchmarkingimpala.common.StringUtils;
  6. import com.gyee.benchmarkingimpala.contant.Contant;
  7. import com.gyee.benchmarkingimpala.init.CacheContext;
  8. import com.gyee.benchmarkingimpala.model.auto.*;
  9. import com.gyee.benchmarkingimpala.model.vo.*;
  10. import com.gyee.benchmarkingimpala.service.auto.*;
  11. import com.gyee.benchmarkingimpala.util.*;
  12. import com.gyee.benchmarkingimpala.util.taos.EdosUtil;
  13. import org.springframework.stereotype.Service;
  14. import javax.annotation.Resource;
  15. import java.math.BigDecimal;
  16. import java.text.ParseException;
  17. import java.text.SimpleDateFormat;
  18. import java.util.*;
  19. import java.util.concurrent.atomic.AtomicReference;
  20. import java.util.stream.Collectors;
  21. /**
  22. * @ClassName : BenchmarkingService
  23. * @Author : xieshengjie
  24. * @Date: 2021/6/15 17:46
  25. * @Description : 对标管理service
  26. */
  27. @Service
  28. public class BenchmarkingService {
  29. private final String TYPE_DATE = "date";
  30. private final String TYPE_WIND = "wind";
  31. private final String TYPE_PROJECT = "project";
  32. private final String TYPE_LINE = "line";
  33. private final String TYPE_WINDTURBINE = "windturbine";
  34. private EdosUtil edosUtil = new EdosUtil();
  35. @Resource
  36. private IEquipmentdayinfoService equipmentdayinfoService;
  37. @Resource
  38. private IEquipmentdaydetailedService equipmentdaydetailedService;
  39. @Resource
  40. private IDutyscheduleService dutyscheduleService;
  41. @Resource
  42. private IOperationrecordService operationrecordService;
  43. @Resource
  44. private IBenchmarkingbetweenService benchmarkingbetweenService;
  45. @Resource
  46. private IWindturbineanalysisdayService windturbineanalysisdayService;
  47. @Resource
  48. private IWindturbinethewindinfoService windturbinethewindinfoService;
  49. @Resource
  50. private IWindturbinecurvefittingService windturbinecurvefittingService;
  51. @Resource
  52. private IWindpowerinfodayService windpowerinfodayService;
  53. @Resource
  54. private IWindpowerinfoday3Service windpowerinfoday3Service;
  55. @Resource
  56. private IBenchmarkService benchmarkService;
  57. @Resource
  58. private IWpmttrandmtbfdayService wpmttrandmtbfdayService;
  59. @Resource
  60. private IWindpowerspecificinfodayService windpowerspecificinfodayService;
  61. @Resource
  62. private IWindpowerstationthewindinfoService windpowerstationthewindinfoService;
  63. @Resource
  64. private IWindpowerstationService windpowerstationService;
  65. /**
  66. * 保存日信息表
  67. * @param beginDate
  68. * @param endDate
  69. */
  70. public void saveEquipmentdayinfo(String beginDate,String endDate){
  71. Map<String, Map<String, Windturbinetestingpointai2>> wtpAimap = CacheContext.wtpAimap;
  72. List<Windturbine> wtls = CacheContext.wtls.stream().filter(i->i.getWindpowerstationid().equals("MHS_FDC") || i.getWindpowerstationid().equals("NSS_FDC") || i.getWindpowerstationid().equals("QS_FDC")
  73. || i.getWindpowerstationid().equals("SBQ_FDC") || i.getWindpowerstationid().equals("XS_FDC")).collect(Collectors.toList());
  74. String[] uniformcodes = Contant.WXSS.split(",");
  75. List<String> days = getDays(beginDate, endDate);
  76. for (String d : days) {
  77. Map<String,Object> delMap = new HashMap<>();
  78. delMap.put("recorddate",DateUtils.parseDate(d));
  79. equipmentdayinfoService.removeByMap(delMap);
  80. List<Equipmentdayinfo> resultList = new ArrayList<>();
  81. Date date = DateUtils.parseDate(d);
  82. Date addDays = DateUtils.addDays(date, 1);
  83. Date begin = DateUtils.getStartOfDay(addDays);
  84. Date end = DateUtils.addSeconds(begin, 1);
  85. wtls.stream().filter(i->i.getWindpowerstationid().endsWith("FDC")).forEach(wt->{
  86. Map<String,Double> wtDataMap = new HashMap<>();
  87. Map<String, Windturbinetestingpointai2> nmap = wtpAimap.get(wt.getId());
  88. for (String uniformcode : uniformcodes) {
  89. try {
  90. Windturbinetestingpointai2 windturbinetestingpointai2 = nmap.get(uniformcode);
  91. if (windturbinetestingpointai2!=null){
  92. List<PointData> pointDatas = edosUtil.getHistoryDatasSnap(windturbinetestingpointai2, begin.getTime()/1000, end.getTime()/1000,1l,1l);
  93. Optional<PointData> first = pointDatas.stream().findFirst();
  94. Double value = first.isPresent()?first.get().getPointValueInDouble():0;
  95. wtDataMap.put(wt.getId()+"_"+uniformcode,value);
  96. }else {
  97. System.out.println(wt.getId()+"----"+uniformcode);
  98. }
  99. } catch (Exception e) {
  100. e.printStackTrace();
  101. }
  102. }
  103. Equipmentdayinfo equipmentdayinfo = new Equipmentdayinfo();
  104. equipmentdayinfo.setId(StringUtils.getUUID());
  105. equipmentdayinfo.setWindturbineid(wt.getId());
  106. equipmentdayinfo.setLineid(wt.getLineid());
  107. equipmentdayinfo.setProjectid(wt.getProjectid());
  108. equipmentdayinfo.setWindpowerstationid(wt.getWindpowerstationid());
  109. equipmentdayinfo.setRecorddate(DateUtils.parseDate(d));
  110. equipmentdayinfo.setGenecapacity(wtDataMap.get(wt.getId()+"_RFDL"));
  111. equipmentdayinfo.setSpeed(wtDataMap.get(wt.getId()+"_AI022"));
  112. //维护:RJXSSDL-ZS,RLZSSDL-ZS
  113. equipmentdayinfo.setDaynhwhssdl(wtDataMap.get(wt.getId()+"_RJXSSDL-ZS") + wtDataMap.get(wt.getId()+"_RLZSSDL-ZS"));
  114. //故障:RGZSSDL-ZS,NSZSSDL-ZS
  115. equipmentdayinfo.setDaynhgzssdl(wtDataMap.get(wt.getId()+"_RGZSSDL-ZS") + wtDataMap.get(wt.getId()+"_NSZSSDL-ZS"));
  116. //限电:RQFSSDL-ZS,RXDSSDL-ZS
  117. equipmentdayinfo.setDaynhxdssdl(wtDataMap.get(wt.getId()+"_RQFSSDL-ZS") + wtDataMap.get(wt.getId()+"_RXDSSDL-ZS"));
  118. //性能:RDJSSDL-ZS,RSTSSDL-ZS,RXNSSDL-ZS,RQXSSDL-ZS(集团项目需把发电欠发去掉)
  119. equipmentdayinfo.setDaynhqfdl(wtDataMap.get(wt.getId()+"_RDJSSDL-ZS") + wtDataMap.get(wt.getId()+"_RSTSSDL-ZS") + wtDataMap.get(wt.getId()+"_RXNSSDL-ZS") + wtDataMap.get(wt.getId()+"_RQXSSDL-ZS"));
  120. //受累:RWZSSDL-ZS,RTZSSDL-ZS
  121. equipmentdayinfo.setDaynhcfdl(wtDataMap.get(wt.getId()+"_RWZSSDL-ZS") + wtDataMap.get(wt.getId()+"_RTZSSDL-ZS"));
  122. equipmentdayinfo.setTherogenecapacity(equipmentdayinfo.getGenecapacity()+equipmentdayinfo.getDaynhwhssdl()+equipmentdayinfo.getDaynhgzssdl()+equipmentdayinfo.getDaynhxdssdl()+equipmentdayinfo.getDaynhqfdl()+equipmentdayinfo.getDaynhcfdl());
  123. resultList.add(equipmentdayinfo);
  124. });
  125. equipmentdayinfoService.saveBatch(resultList);
  126. }
  127. }
  128. /**
  129. * 保存日信息明细
  130. * @param beginDate
  131. * @param endDate
  132. */
  133. public void saveEquipmentdaydetailed(String beginDate,String endDate){
  134. Map<String, Map<String, Windturbinetestingpointai2>> wtpAimap = CacheContext.wtpAimap;
  135. List<Windturbine> wtls = CacheContext.wtls;
  136. String[] uniformcodes = Contant.WXSS.split(",");
  137. List<String> days = getDays(beginDate, endDate);
  138. for (String d : days) {
  139. Map<String,Object> delMap = new HashMap<>();
  140. delMap.put("recorddate",DateUtils.parseDate(d));
  141. equipmentdaydetailedService.removeByMap(delMap);
  142. List<Equipmentdaydetailed> resultList = new ArrayList<>();
  143. Date date = DateUtils.parseDate(d);
  144. Date addDays = DateUtils.addDays(date, 1);
  145. Date begin = DateUtils.getStartOfDay(addDays);
  146. Date end = DateUtils.addSeconds(begin, 1);
  147. wtls.stream().filter(i->i.getWindpowerstationid().endsWith("FDC")).forEach(wt->{
  148. Map<String,Double> wtDataMap = new HashMap<>();
  149. Map<String, Windturbinetestingpointai2> nmap = wtpAimap.get(wt.getId());
  150. for (String uniformcode : uniformcodes) {
  151. try {
  152. Windturbinetestingpointai2 windturbinetestingpointai2 = nmap.get(uniformcode);
  153. List<PointData> pointDatas = edosUtil.getHistoryDatasSnap(windturbinetestingpointai2, begin.getTime()/1000, end.getTime()/1000,1l,1l);
  154. Optional<PointData> first = pointDatas.stream().findFirst();
  155. Double value = first.isPresent()?first.get().getPointValueInDouble():0;
  156. wtDataMap.put(wt.getId()+"_"+uniformcode,value);
  157. } catch (Exception e) {
  158. e.printStackTrace();
  159. }
  160. }
  161. Equipmentdaydetailed equipmentdayinfo = new Equipmentdaydetailed();
  162. equipmentdayinfo.setId(StringUtils.getUUID());
  163. equipmentdayinfo.setWindturbineid(wt.getId());
  164. equipmentdayinfo.setLineid(wt.getLineid());
  165. equipmentdayinfo.setProjectid(wt.getProjectid());
  166. equipmentdayinfo.setWindpowerstationid(wt.getWindpowerstationid());
  167. equipmentdayinfo.setRecorddate(DateUtils.parseDate(d));
  168. equipmentdayinfo.setGenecapacity(wtDataMap.get(wt.getId()+"_RFDL"));
  169. equipmentdayinfo.setSpeed(wtDataMap.get(wt.getId()+"_AI022"));
  170. //维护:RJXSSDL-ZS,RLZSSDL-ZS
  171. equipmentdayinfo.setDaynhwhssdl1(wtDataMap.get(wt.getId()+"_RJXSSDL-ZS"));
  172. equipmentdayinfo.setDaynhwhssdl2(wtDataMap.get(wt.getId()+"_RLZSSDL-ZS"));
  173. //故障:RGZSSDL-ZS,NSZSSDL-ZS
  174. equipmentdayinfo.setDaynhgzssdl1(wtDataMap.get(wt.getId()+"_RGZSSDL-ZS"));
  175. equipmentdayinfo.setDaynhgzssdl2(wtDataMap.get(wt.getId()+"_NSZSSDL-ZS"));
  176. //限电:RQFSSDL-ZS,RXDSSDL-ZS
  177. equipmentdayinfo.setDaynhxdssdl1(wtDataMap.get(wt.getId()+"_RQFSSDL-ZS"));
  178. equipmentdayinfo.setDaynhxdssdl2(wtDataMap.get(wt.getId()+"_RXDSSDL-ZS"));
  179. //性能:RDJSSDL-ZS,RSTSSDL-ZS,RXNSSDL-ZS,RQXSSDL-ZS
  180. equipmentdayinfo.setDaynhqfdl1(wtDataMap.get(wt.getId()+"_RDJSSDL-ZS"));
  181. equipmentdayinfo.setDaynhqfdl2(wtDataMap.get(wt.getId()+"_RSTSSDL-ZS"));
  182. equipmentdayinfo.setDaynhqfdl3(wtDataMap.get(wt.getId()+"_RXNSSDL-ZS"));
  183. equipmentdayinfo.setDaynhqfdl4(wtDataMap.get(wt.getId()+"_RQXSSDL-ZS"));
  184. //受累:RWZSSDL-ZS,RTZSSDL-ZS
  185. equipmentdayinfo.setDaynhcfdl1(wtDataMap.get(wt.getId()+"_RWZSSDL-ZS"));
  186. equipmentdayinfo.setDaynhcfdl2(wtDataMap.get(wt.getId()+"_RTZSSDL-ZS"));
  187. equipmentdayinfo.setTherogenecapacity(equipmentdayinfo.getGenecapacity()+equipmentdayinfo.getDaynhwhssdl1()+equipmentdayinfo.getDaynhwhssdl2()
  188. +equipmentdayinfo.getDaynhgzssdl1()+equipmentdayinfo.getDaynhgzssdl2()
  189. +equipmentdayinfo.getDaynhxdssdl1()+equipmentdayinfo.getDaynhxdssdl2()
  190. +equipmentdayinfo.getDaynhqfdl1()+equipmentdayinfo.getDaynhqfdl2()+equipmentdayinfo.getDaynhqfdl3()+equipmentdayinfo.getDaynhqfdl4()
  191. +equipmentdayinfo.getDaynhcfdl1()+equipmentdayinfo.getDaynhcfdl2());
  192. resultList.add(equipmentdayinfo);
  193. });
  194. equipmentdaydetailedService.saveBatch(resultList);
  195. }
  196. }
  197. /**
  198. * 保存值际操作指令表
  199. * @param beginDate
  200. * @param endDate
  201. */
  202. public void saveOperationrecord(String beginDate,String endDate) throws ParseException {
  203. List<String> days = getDays(beginDate, endDate);
  204. for (String day : days) {
  205. Date date = DateUtils.parseDate(day);
  206. Date startOfDay = DateUtils.getStartOfDay(date);
  207. Date endOfDay = DateUtils.getEndOfDay(date);
  208. Map<String, Object> params1 = new HashMap<>();
  209. params1.put("createdate", date);
  210. List<Dutyschedule> dutyList = dutyscheduleService.listByMap(params1);
  211. params1.remove("createdate");
  212. params1.put("time",date);
  213. operationrecordService.removeByMap(params1);
  214. Map<String, Map<String, Windturbinetestingpointai2>> wtpointMap = CacheContext.wtpAimap;
  215. String[] points = Contant.opePoints.split(",");
  216. List<Windturbine> wtls = CacheContext.wtls;
  217. List<OpeVo> resuList = new ArrayList<>();
  218. for (Windturbine wt : wtls) {
  219. if (wt.getWindpowerstationid().endsWith("GDC")){
  220. continue;
  221. }
  222. for (String point : points) {
  223. Windturbinetestingpointai2 windturbinetestingpointai2 = wtpointMap.get(wt.getId()).get(point);
  224. try {
  225. List<PointData> pointDatas = edosUtil.getHistoryDatasRaw(windturbinetestingpointai2.getId(), startOfDay.getTime()/1000, endOfDay.getTime()/1000);
  226. pointDatas.stream().forEach(pointData -> {
  227. OpeVo vo = new OpeVo();
  228. vo.setWtid(wt.getId());
  229. vo.setTime(DateUtils.parseLongToDate(pointData.getPointTime()*1000));
  230. vo.setValue(pointData.getPointValueInDouble());
  231. resuList.add(vo);
  232. });
  233. } catch (Exception e) {
  234. e.printStackTrace();
  235. }
  236. }
  237. }
  238. for (Dutyschedule duty : dutyList) {
  239. for (OpeVo vo : resuList) {
  240. if (isTimeRange(duty,vo.getTime())) {
  241. Operationrecord operationrecord = new Operationrecord();
  242. operationrecord.setDutyname(duty.getName());
  243. operationrecord.setWtid(vo.getWtid());
  244. operationrecord.setTime(vo.getTime());
  245. operationrecord.setValue(vo.getValue());
  246. operationrecordService.save(operationrecord);
  247. }
  248. }
  249. }
  250. }
  251. }
  252. /**
  253. * 保存值际五损
  254. * @param beginDate
  255. * @param endDate
  256. */
  257. public void saveBeanchmarkList(String beginDate,String endDate) throws Exception {
  258. List<String> days = getDays(beginDate, endDate);
  259. for (String day : days) {
  260. Date date = DateUtils.parseDate(day);
  261. Date startOfDay = DateUtils.getStartOfDay(date);
  262. Date endOfDay = DateUtils.getEndOfDay(date);
  263. Map<String, Object> params = new HashMap<>();
  264. params.put("theday", date);
  265. benchmarkingbetweenService.removeByMap(params);
  266. Map<String, Object> params1 = new HashMap<>();
  267. params1.put("createdate", date);
  268. List<Dutyschedule> dutyList = dutyscheduleService.listByMap(params1);
  269. String[] points = Contant.benchPoints.split(",");
  270. Map<String, Windpowerstationtestingpoint2> wpmap = CacheContext.wppointmap.get("0");
  271. SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  272. Map<String, Map<String, Double>> remap = new HashMap<>();
  273. for (Dutyschedule dutyschedule : dutyList) {
  274. String[] begins = dutyschedule.getBegin().split(",");
  275. String[] ends = dutyschedule.getEnd().split(",");
  276. Map<String, Double> map = new HashMap<>();
  277. for (int i = 0; i < begins.length; i++) {
  278. Date begin = df.parse(day + " " + begins[i] + ":00");
  279. Date end = df.parse(day + " " + ends[i] + ":00");
  280. for (String point : points) {
  281. Windpowerstationtestingpoint2 windpowerstationtestingpoint2 = wpmap.get(point);
  282. List<PointData> maxs = edosUtil.getHistStat(windpowerstationtestingpoint2.getCode(), begin.getTime() / 1000, end.getTime() / 1000, (long) 1, null, 0);
  283. List<PointData> mins = edosUtil.getHistStat(windpowerstationtestingpoint2.getCode(), begin.getTime() / 1000, end.getTime() / 1000, (long) 1, null, 1);
  284. double ssdl = 0;
  285. if (StringUtils.isNotEmpty(maxs) && StringUtils.isNotEmpty(mins)) {
  286. ssdl = (maxs.get(0).getPointValueInDouble() - mins.get(0).getPointValueInDouble()) / 10000;
  287. }
  288. if (!map.containsKey(point)) {
  289. map.put(point, ssdl);
  290. } else {
  291. map.put(point, map.get(point) + ssdl);
  292. }
  293. }
  294. Windpowerstationtestingpoint2 windpowerstationtestingpoint2 = wpmap.get("RFDL");
  295. List<PointData> maxs = edosUtil.getHistStat(windpowerstationtestingpoint2.getCode(), begin.getTime() / 1000, end.getTime() / 1000, (long) 1, null, 0);
  296. List<PointData> mins = edosUtil.getHistStat(windpowerstationtestingpoint2.getCode(), begin.getTime() / 1000, end.getTime() / 1000, (long) 1, null, 1);
  297. double fdl = 0;
  298. if (StringUtils.isNotEmpty(maxs) && StringUtils.isNotEmpty(mins)) {
  299. fdl = maxs.get(0).getPointValueInDouble() - mins.get(0).getPointValueInDouble();
  300. }
  301. if (!map.containsKey("RFDL")) {
  302. map.put("RFDL", fdl);
  303. } else {
  304. map.put("RFDL", map.get("RFDL") + fdl);
  305. }
  306. remap.put(dutyschedule.getName(), map);
  307. }
  308. }
  309. Set<String> dutyset = remap.keySet();
  310. for (String duty : dutyset) {
  311. Benchmarkingbetween bench = new Benchmarkingbetween();
  312. bench.setDutyname(duty);
  313. bench.setTheday(date);
  314. Map<String, Double> pointmap = remap.get(duty);
  315. bench.setPerformanceloss(pointmap.get("RSDJZSDL") + pointmap.get("RSSTZSDL") + pointmap.get("RXNZSDL") + pointmap.get("RSQXZSDL"));
  316. bench.setFaultloss(pointmap.get("RGZZSDL") + pointmap.get("RSZZSDL"));
  317. bench.setMainloss(pointmap.get("RJXZSDL") + pointmap.get("RLZZSDL"));
  318. bench.setRationingloss(pointmap.get("RQFZSDL") + pointmap.get("RXDZSDL"));
  319. bench.setInvolvesloss(pointmap.get("RWZZSDL") + pointmap.get("RTZZSDL"));
  320. bench.setGeneratity(pointmap.get("RFDL"));
  321. bench.setTheoreticalgeneratity(bench.getPerformanceloss() + bench.getFaultloss() + bench.getMainloss() + bench.getRationingloss() + bench.getInvolvesloss() + bench.getGeneratity());
  322. benchmarkingbetweenService.save(bench);
  323. }
  324. }
  325. }
  326. /**
  327. * 判断实际操作指令时间是否属于某个值班
  328. * @param duty
  329. * @param time
  330. * @return
  331. * @throws ParseException
  332. */
  333. private boolean isTimeRange(Dutyschedule duty,Date time) throws ParseException {
  334. SimpleDateFormat df = new SimpleDateFormat("HH:mm");
  335. Date now = df.parse(df.format(time));
  336. String[] begins=duty.getBegin().split(",");
  337. String[] ends=duty.getEnd().split(",");
  338. for (int i=0 ; i<begins.length;i++) {
  339. Date begin = df.parse(begins[i]);
  340. Date end = df.parse(ends[i]);
  341. Calendar nowTime = Calendar.getInstance();
  342. nowTime.setTime(now);
  343. Calendar beginTime = Calendar.getInstance();
  344. beginTime.setTime(begin);
  345. Calendar endTime = Calendar.getInstance();
  346. endTime.setTime(end);
  347. if (nowTime.before(endTime) && nowTime.after(beginTime)) {
  348. return true;
  349. }
  350. }
  351. return false;
  352. }
  353. /**
  354. * 获取两日期间日期list
  355. *
  356. * @param beginDate
  357. * @param endDate
  358. * @return
  359. */
  360. public static List<String> getDays(String beginDate, String endDate) {
  361. List<String> days = null;
  362. if (StringUtils.isNotEmpty(beginDate) && StringUtils.isNotEmpty(endDate)) {
  363. days = DateUtils.getDays(beginDate, endDate);
  364. } else {
  365. days = new ArrayList<>();
  366. days.add(DateUtils.getYesterdayStr("yyyy-MM-dd"));
  367. }
  368. return days;
  369. }
  370. /**
  371. * 风机绩效榜
  372. * @param wpids
  373. * @param projectids
  374. * @param lineids
  375. * @param beginDate
  376. * @param endDate
  377. * @param type
  378. * @return
  379. */
  380. public List<FjjxbVo> fjjxb(String wpids, String projectids, String lineids, String beginDate, String endDate, String type,String target,String sort) {
  381. List<FjjxbVo> resultList = new ArrayList<>();
  382. QueryWrapper<Equipmentdayinfo> qw = new QueryWrapper<>();
  383. StringBuilder sb = new StringBuilder();
  384. if (type.equals("1") ){
  385. sb.append("windpowerstationid,");
  386. }else if (type.equals("2")){
  387. sb.append("projectid,");
  388. } else if (type.equals("3")){
  389. sb.append("lineid,");
  390. }else {
  391. sb.append("windturbineid,");
  392. }
  393. sb.append("sum(genecapacity) genecapacity,sum(therogenecapacity) therogenecapacity,avg(speed) speed,sum(daynhwhssdl) daynhwhssdl,sum(daynhgzssdl) daynhgzssdl,sum(daynhxdssdl) daynhxdssdl,sum(daynhqfdl) daynhqfdl,sum(daynhcfdl) daynhcfdl");
  394. qw.select(String.valueOf(sb));
  395. qw.ge("recorddate",DateUtils.parseDate(beginDate)).le("recorddate",DateUtils.parseDate(endDate));
  396. if (StringUtils.isNotEmpty(wpids)){
  397. List<String> wpList = Arrays.asList(wpids.split(","));
  398. qw.in("windpowerstationid",wpList);
  399. }
  400. if (StringUtils.isNotEmpty(projectids)){
  401. List<String> proList = Arrays.asList(projectids.split(","));
  402. qw.in("projectid",proList);
  403. }
  404. if (StringUtils.isNotEmpty(lineids)){
  405. List<String> lineList = Arrays.asList(lineids.split(","));
  406. qw.in("lineid",lineList);
  407. }
  408. if (type.equals("1")){
  409. qw.groupBy("windpowerstationid");
  410. }else if(type.equals("2")){
  411. qw.groupBy("projectid");
  412. }else if(type.equals("3")){
  413. qw.groupBy("lineid");
  414. }else{
  415. qw.groupBy("windturbineid");
  416. }
  417. List<Equipmentdayinfo> list = equipmentdayinfoService.list(qw);
  418. AtomicReference<Double> llfdl = new AtomicReference<>((double) 0);
  419. AtomicReference<Double> sjfdl = new AtomicReference<>((double) 0);
  420. AtomicReference<Double> pjfs = new AtomicReference<>((double) 0);
  421. AtomicReference<Double> wh = new AtomicReference<>((double) 0);
  422. AtomicReference<Double> gz = new AtomicReference<>((double) 0);
  423. AtomicReference<Double> xd = new AtomicReference<>((double) 0);
  424. AtomicReference<Double> xn = new AtomicReference<>((double) 0);
  425. AtomicReference<Double> sl = new AtomicReference<>((double) 0);
  426. list.stream().forEach(i->{
  427. FjjxbVo vo = new FjjxbVo();
  428. if (type.equals("1")){
  429. vo.setId(i.getWindpowerstationid());
  430. vo.setName(CacheContext.wpmap.get(i.getWindpowerstationid().trim()).getName());
  431. }else if(type.equals("2")){
  432. vo.setId(i.getProjectid());
  433. vo.setName(CacheContext.projects.stream().filter(p->p.getId().equals(i.getProjectid().trim())).findFirst().get().getName());
  434. }else if(type.equals("3")){
  435. vo.setId(i.getLineid());
  436. vo.setName(CacheContext.lines.stream().filter(l->l.getId().equals(i.getLineid().trim())).findFirst().get().getName());
  437. }else{
  438. vo.setId(i.getWindturbineid());
  439. vo.setName(CacheContext.wtls.stream().filter(w->w.getId().equals(i.getWindturbineid().trim())).findFirst().get().getName());
  440. }
  441. vo.setSjfdl(BigDecimalUtils.divide(new BigDecimal(i.getGenecapacity()),new BigDecimal(10000),2).doubleValue());
  442. vo.setLlfdl(BigDecimalUtils.divide(new BigDecimal(i.getTherogenecapacity()),new BigDecimal(10000),2).doubleValue());
  443. vo.setSpeed(BigDecimalUtils.divide(new BigDecimal(i.getSpeed()),new BigDecimal(1),2).doubleValue());
  444. vo.setFjhjx(BigDecimalUtils.divide(new BigDecimal(i.getDaynhgzssdl()),new BigDecimal(10000),2).doubleValue());
  445. vo.setJhjx(BigDecimalUtils.divide(new BigDecimal(i.getDaynhwhssdl()),new BigDecimal(10000),2).doubleValue());
  446. vo.setXd(BigDecimalUtils.divide(new BigDecimal(i.getDaynhxdssdl()),new BigDecimal(10000),2).doubleValue());
  447. vo.setSl(BigDecimalUtils.divide(new BigDecimal(i.getDaynhcfdl()),new BigDecimal(10000),2).doubleValue());
  448. vo.setXn(BigDecimalUtils.divide(new BigDecimal(i.getDaynhqfdl()),new BigDecimal(10000),2).doubleValue());
  449. // vo.setLlfdl(DoubleUtils.getRoundingNum(vo.getSjfdl()+vo.getFjhjx()+vo.getJhjx()+vo.getXd()+vo.getXn(),2));
  450. vo.setFnlly(vo.getLlfdl()!=0?keepPrecision(vo.getSjfdl()/vo.getLlfdl()*100,2):0);
  451. llfdl.updateAndGet(v -> new Double((double) (v + vo.getLlfdl())));
  452. sjfdl.updateAndGet(v -> new Double((double) (v + vo.getSjfdl())));
  453. pjfs.updateAndGet(v -> new Double((double) (v + vo.getSpeed())));
  454. wh.updateAndGet(v -> new Double((double) (v + vo.getJhjx())));
  455. gz.updateAndGet(v -> new Double((double) (v + vo.getFjhjx())));
  456. xd.updateAndGet(v -> new Double((double) (v + vo.getXd())));
  457. xn.updateAndGet(v -> new Double((double) (v + vo.getXn())));
  458. sl.updateAndGet(v -> new Double((double) (v + vo.getSl())));
  459. resultList.add(vo);
  460. });
  461. if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
  462. if (sort.equals("1")){
  463. SortUtils.sort(resultList,target,SortUtils.ASC);
  464. }else {
  465. SortUtils.sort(resultList,target,SortUtils.DESC);
  466. }
  467. }else {
  468. SortUtils.sort(resultList,"fnlly",SortUtils.ASC);
  469. }
  470. FjjxbVo vo = new FjjxbVo();
  471. vo.setId("hj");
  472. vo.setName("合计");
  473. vo.setSjfdl(keepPrecision(sjfdl.get().doubleValue(),2));
  474. vo.setLlfdl(keepPrecision(llfdl.get().doubleValue(),2));
  475. vo.setSpeed(list.size()!=0?keepPrecision(pjfs.get().doubleValue()/list.size(),2):0.0);
  476. vo.setJhjx(keepPrecision(wh.get().doubleValue(),2));
  477. vo.setFjhjx(keepPrecision(gz.get().doubleValue(),2));
  478. vo.setXd(keepPrecision(xd.get().doubleValue(),2));
  479. vo.setXn(keepPrecision(xn.get().doubleValue(),2));
  480. vo.setSl(keepPrecision(sl.get().doubleValue(),2));
  481. vo.setFnlly(vo.getLlfdl()!=0?keepPrecision(vo.getSjfdl()/vo.getLlfdl()*100,2):0.0);
  482. resultList.add(vo);
  483. return resultList;
  484. }
  485. /**
  486. * 保留两位小数
  487. * @param number
  488. * @param precision
  489. * @return
  490. */
  491. private double keepPrecision(double number, int precision) {
  492. BigDecimal bg = new BigDecimal(number);
  493. return bg.setScale(precision, BigDecimal.ROUND_HALF_UP).doubleValue();
  494. }
  495. /**
  496. * 风机绩效榜明细
  497. * @param wpids
  498. * @param projectids
  499. * @param lineids
  500. * @param beginDate
  501. * @param endDate
  502. * @param type
  503. * @return
  504. */
  505. public List<FjjxbmxVo> fjjxbmx(String wpids, String projectids, String lineids, String beginDate, String endDate, String type,String target,String sort) {
  506. List<FjjxbmxVo> resultList = new ArrayList<>();
  507. QueryWrapper<Equipmentdaydetailed> qw = new QueryWrapper<>();
  508. StringBuilder sb = new StringBuilder();
  509. if (type.equals("1") ){
  510. sb.append("windpowerstationid,");
  511. }else if (type.equals("2")){
  512. sb.append("projectid,");
  513. } else if (type.equals("3")){
  514. sb.append("lineid,");
  515. }else {
  516. sb.append("windturbineid,");
  517. }
  518. sb.append("sum(genecapacity) genecapacity,sum(therogenecapacity) therogenecapacity,avg(speed) speed,sum(daynhwhssdl1) daynhwhssdl1,sum(daynhwhssdl2) daynhwhssdl2,sum(daynhgzssdl1) daynhgzssdl1,sum(daynhgzssdl2) daynhgzssdl2,sum(daynhxdssdl1) daynhxdssdl1,sum(daynhxdssdl2) daynhxdssdl2,sum(daynhqfdl1) daynhqfdl1,sum(daynhqfdl2) daynhqfdl2,sum(daynhqfdl3) daynhqfdl3,sum(daynhqfdl4) daynhqfdl4,sum(daynhcfdl1) daynhcfdl1,sum(daynhcfdl2) daynhcfdl2 ");
  519. qw.select(String.valueOf(sb));
  520. qw.ge("recorddate",DateUtils.parseDate(beginDate)).le("recorddate",DateUtils.parseDate(endDate));
  521. if (StringUtils.isNotEmpty(wpids)){
  522. List<String> wpList = Arrays.asList(wpids.split(","));
  523. qw.in("windpowerstationid",wpList);
  524. }
  525. if (StringUtils.isNotEmpty(projectids)){
  526. List<String> proList = Arrays.asList(projectids.split(","));
  527. qw.in("projectid",proList);
  528. }
  529. if (StringUtils.isNotEmpty(lineids)){
  530. List<String> lineList = Arrays.asList(lineids.split(","));
  531. qw.in("lineid",lineList);
  532. }
  533. if (type.equals("1")){
  534. qw.groupBy("windpowerstationid");
  535. }else if(type.equals("2")){
  536. qw.groupBy("projectid");
  537. }else if(type.equals("3")){
  538. qw.groupBy("lineid");
  539. }else{
  540. qw.groupBy("windturbineid");
  541. }
  542. List<Equipmentdaydetailed> list = equipmentdaydetailedService.list(qw);
  543. AtomicReference<Double> llfdl = new AtomicReference<>((double) 0);
  544. AtomicReference<Double> sjfdl = new AtomicReference<>((double) 0);
  545. AtomicReference<Double> pjfs = new AtomicReference<>((double) 0);
  546. AtomicReference<Double> wh1 = new AtomicReference<>((double) 0);
  547. AtomicReference<Double> wh2 = new AtomicReference<>((double) 0);
  548. AtomicReference<Double> gz1 = new AtomicReference<>((double) 0);
  549. AtomicReference<Double> gz2 = new AtomicReference<>((double) 0);
  550. AtomicReference<Double> xd1 = new AtomicReference<>((double) 0);
  551. AtomicReference<Double> xd2 = new AtomicReference<>((double) 0);
  552. AtomicReference<Double> xn1 = new AtomicReference<>((double) 0);
  553. AtomicReference<Double> xn2 = new AtomicReference<>((double) 0);
  554. AtomicReference<Double> xn3 = new AtomicReference<>((double) 0);
  555. AtomicReference<Double> xn4 = new AtomicReference<>((double) 0);
  556. AtomicReference<Double> sl1 = new AtomicReference<>((double) 0);
  557. AtomicReference<Double> sl2 = new AtomicReference<>((double) 0);
  558. list.stream().forEach(i->{
  559. FjjxbmxVo vo = new FjjxbmxVo();
  560. if (type.equals("1")){
  561. vo.setId(i.getWindpowerstationid());
  562. vo.setName(CacheContext.wpmap.get(i.getWindpowerstationid().trim()).getName());
  563. }else if(type.equals("2")){
  564. vo.setId(i.getProjectid());
  565. vo.setName(CacheContext.projects.stream().filter(p->p.getId().equals(i.getProjectid().trim())).findFirst().get().getName());
  566. }else if(type.equals("3")){
  567. vo.setId(i.getLineid());
  568. vo.setName(CacheContext.lines.stream().filter(l->l.getId().equals(i.getLineid().trim())).findFirst().get().getName());
  569. }else{
  570. vo.setId(i.getWindturbineid());
  571. vo.setName(CacheContext.wtls.stream().filter(w->w.getId().equals(i.getWindturbineid().trim())).findFirst().get().getName());
  572. }
  573. vo.setSjfdl(keepPrecision(i.getGenecapacity()/10000,2));
  574. vo.setLlfdl(keepPrecision(i.getTherogenecapacity()/10000,2));
  575. vo.setSpeed(keepPrecision(i.getSpeed(),2));
  576. vo.setFjhjx1(keepPrecision(i.getDaynhgzssdl1()/10000,2));
  577. vo.setFjhjx2(keepPrecision(i.getDaynhgzssdl2()/10000,2));
  578. vo.setJhjx1(keepPrecision(i.getDaynhwhssdl1()/10000,2));
  579. vo.setJhjx2(keepPrecision(i.getDaynhwhssdl2()/10000,2));
  580. vo.setXd1(keepPrecision(i.getDaynhxdssdl1()/10000,2));
  581. vo.setXd2(keepPrecision(i.getDaynhxdssdl2()/10000,2));
  582. vo.setSl1(keepPrecision(i.getDaynhcfdl1()/10000,2));
  583. vo.setSl2(keepPrecision(i.getDaynhcfdl2()/10000,2));
  584. vo.setXn1(keepPrecision(i.getDaynhqfdl1()/10000,2));
  585. vo.setXn2(keepPrecision(i.getDaynhqfdl2()/10000,2));
  586. vo.setXn3(keepPrecision(i.getDaynhqfdl3()/10000,2));
  587. vo.setXn4(keepPrecision(i.getDaynhqfdl4()/10000,2));
  588. vo.setFnlly(vo.getLlfdl()!=0?keepPrecision(vo.getSjfdl()/vo.getLlfdl()*100,2):0.0);
  589. llfdl.updateAndGet(v -> new Double((double) (v + vo.getLlfdl())));
  590. sjfdl.updateAndGet(v -> new Double((double) (v + vo.getSjfdl())));
  591. pjfs.updateAndGet(v -> new Double((double) (v + vo.getSpeed())));
  592. wh1.updateAndGet(v -> new Double((double) (v + vo.getJhjx1())));
  593. wh2.updateAndGet(v -> new Double((double) (v + vo.getJhjx2())));
  594. gz1.updateAndGet(v -> new Double((double) (v + vo.getFjhjx1())));
  595. gz2.updateAndGet(v -> new Double((double) (v + vo.getFjhjx2())));
  596. xd1.updateAndGet(v -> new Double((double) (v + vo.getXd1())));
  597. xd2.updateAndGet(v -> new Double((double) (v + vo.getXd2())));
  598. xn1.updateAndGet(v -> new Double((double) (v + vo.getXn1())));
  599. xn2.updateAndGet(v -> new Double((double) (v + vo.getXn2())));
  600. xn3.updateAndGet(v -> new Double((double) (v + vo.getXn3())));
  601. xn4.updateAndGet(v -> new Double((double) (v + vo.getXn4())));
  602. sl1.updateAndGet(v -> new Double((double) (v + vo.getSl1())));
  603. sl2.updateAndGet(v -> new Double((double) (v + vo.getSl2())));
  604. resultList.add(vo);
  605. });
  606. if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
  607. if (sort.equals("1")){
  608. SortUtils.sort(resultList,target,SortUtils.ASC);
  609. }else {
  610. SortUtils.sort(resultList,target,SortUtils.DESC);
  611. }
  612. }else {
  613. SortUtils.sort(resultList,"fnlly",SortUtils.ASC);
  614. }
  615. FjjxbmxVo vo = new FjjxbmxVo();
  616. vo.setId("hj");
  617. vo.setName("合计");
  618. vo.setSjfdl(keepPrecision(sjfdl.get().doubleValue(),2));
  619. vo.setLlfdl(keepPrecision(llfdl.get().doubleValue(),2));
  620. vo.setSpeed(list.size()!=0?keepPrecision(pjfs.get().doubleValue()/list.size(),2):0.0);
  621. vo.setJhjx1(keepPrecision(wh1.get().doubleValue(),2));
  622. vo.setJhjx2(keepPrecision(wh2.get().doubleValue(),2));
  623. vo.setFjhjx1(keepPrecision(gz1.get().doubleValue(),2));
  624. vo.setFjhjx2(keepPrecision(gz2.get().doubleValue(),2));
  625. vo.setXd1(keepPrecision(xd1.get().doubleValue(),2));
  626. vo.setXd2(keepPrecision(xd2.get().doubleValue(),2));
  627. vo.setXn1(keepPrecision(xn1.get().doubleValue(),2));
  628. vo.setXn2(keepPrecision(xn2.get().doubleValue(),2));
  629. vo.setXn3(keepPrecision(xn3.get().doubleValue(),2));
  630. vo.setXn4(keepPrecision(xn4.get().doubleValue(),2));
  631. vo.setSl1(keepPrecision(sl1.get().doubleValue(),2));
  632. vo.setSl2(keepPrecision(sl2.get().doubleValue(),2));
  633. vo.setFnlly(vo.getLlfdl()!=0?keepPrecision(vo.getSjfdl()/vo.getLlfdl()*100,2):0.0);
  634. resultList.add(vo);
  635. return resultList;
  636. }
  637. /**
  638. * 场站列表
  639. * @return
  640. */
  641. public List<Windpowerstation> wplist() {
  642. List<Windpowerstation> wplist = CacheContext.wplist.stream().filter(i->i.getId().endsWith("FDC") && i.getCompanyid().equals("NXGD_GS")).collect(Collectors.toList());
  643. return wplist;
  644. }
  645. /**
  646. * GF场站列表
  647. * @return
  648. */
  649. public List<Windpowerstation> wpGFList() {
  650. List<Windpowerstation> wplist = CacheContext.wplist.stream().filter(i->i.getId().endsWith("GDC") && i.getCompanyid().equals("NXGD_GS")).collect(Collectors.toList());
  651. return wplist;
  652. }
  653. /**
  654. * 根据场站查询风机列表
  655. * @param wpid
  656. * @return
  657. */
  658. public List<Windturbine> wtList(String wpid) {
  659. List<Windturbine> windturbineList = CacheContext.wtls.stream().filter(i -> i.getWindpowerstationid().equals(wpid)).collect(Collectors.toList());
  660. return windturbineList;
  661. }
  662. /**
  663. * 根据场站查询项目列表
  664. * @param wpids
  665. * @return
  666. */
  667. public List<Project> projectList(String wpids) {
  668. List<Project> projects = CacheContext.projects.stream().filter(i -> wpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());
  669. return projects;
  670. }
  671. /**
  672. * 根据项目查询线路列表
  673. * @param projects
  674. * @return
  675. */
  676. public List<Line> lineList(String projects) {
  677. List<Line> lines = CacheContext.lines.stream().filter(i -> projects.contains(i.getProjectid())).collect(Collectors.toList());
  678. return lines;
  679. }
  680. /**
  681. * 五项损失率
  682. * @param wpids
  683. * @param projectids
  684. * @param lineids
  685. * @param beginDate
  686. * @param endDate
  687. * @return
  688. */
  689. public List<WxsslVo> wxssl(String wpids, String projectids, String lineids, String beginDate, String endDate,String target,String sort) {
  690. List<WxsslVo> resultList = new ArrayList<>();
  691. QueryWrapper<Equipmentdayinfo> qw = new QueryWrapper<>();
  692. StringBuilder sb = new StringBuilder();
  693. if (StringUtils.isNotEmpty(wpids) && StringUtils.isEmpty(projectids) && StringUtils.isEmpty(lineids)){
  694. sb.append("windpowerstationid,");
  695. }else if (StringUtils.isNotEmpty(wpids) && StringUtils.isNotEmpty(projectids) && StringUtils.isEmpty(lineids)){
  696. sb.append("projectid,");
  697. } else if (StringUtils.isNotEmpty(wpids) && StringUtils.isNotEmpty(projectids) && StringUtils.isNotEmpty(lineids)){
  698. sb.append("lineid,");
  699. }else {
  700. sb.append("windpowerstationid,");
  701. }
  702. sb.append("sum(genecapacity) genecapacity,sum(therogenecapacity) therogenecapacity,sum(daynhwhssdl) daynhwhssdl,sum(daynhgzssdl) daynhgzssdl,sum(daynhxdssdl) daynhxdssdl,sum(daynhqfdl) daynhqfdl,sum(daynhcfdl) daynhcfdl");
  703. qw.select(String.valueOf(sb));
  704. qw.ge("recorddate",DateUtils.parseDate(beginDate)).le("recorddate",DateUtils.parseDate(endDate));
  705. if (StringUtils.isNotEmpty(wpids)){
  706. List<String> wpList = Arrays.asList(wpids.split(","));
  707. qw.in("windpowerstationid",wpList);
  708. }
  709. if (StringUtils.isNotEmpty(projectids)){
  710. List<String> proList = Arrays.asList(projectids.split(","));
  711. qw.in("projectid",proList);
  712. }
  713. if (StringUtils.isNotEmpty(lineids)){
  714. List<String> lineList = Arrays.asList(lineids.split(","));
  715. qw.in("lineid",lineList);
  716. }
  717. if (StringUtils.isNotEmpty(wpids) && StringUtils.isEmpty(projectids) && StringUtils.isEmpty(lineids)){
  718. qw.groupBy("windpowerstationid");
  719. }else if (StringUtils.isNotEmpty(wpids) && StringUtils.isNotEmpty(projectids) && StringUtils.isEmpty(lineids)){
  720. qw.groupBy("projectid");
  721. } else if (StringUtils.isNotEmpty(wpids) && StringUtils.isNotEmpty(projectids) && StringUtils.isNotEmpty(lineids)){
  722. qw.groupBy("lineid");
  723. }else {
  724. qw.groupBy("windpowerstationid");
  725. }
  726. List<Equipmentdayinfo> list = equipmentdayinfoService.list(qw);
  727. Map<String,Double> station = windpowerstationService.list()
  728. .stream().collect(Collectors.toMap(Windpowerstation::getId,Windpowerstation::getOrdernum));
  729. list.stream().forEach(i->{
  730. WxsslVo vo = new WxsslVo();
  731. station.get(i.getWindpowerstationid());
  732. vo.setOrdernum(station.get(i.getWindpowerstationid()));
  733. if (StringUtils.isNotEmpty(wpids) && StringUtils.isEmpty(projectids) && StringUtils.isEmpty(lineids)){
  734. vo.setId(i.getWindpowerstationid());
  735. vo.setName(CacheContext.wpmap.get(i.getWindpowerstationid().trim()).getName());
  736. }else if (StringUtils.isNotEmpty(wpids) && StringUtils.isNotEmpty(projectids) && StringUtils.isEmpty(lineids)){
  737. vo.setId(i.getProjectid());
  738. vo.setName(CacheContext.projects.stream().filter(p->p.getId().equals(i.getProjectid().trim())).findFirst().get().getName());
  739. } else if (StringUtils.isNotEmpty(wpids) && StringUtils.isNotEmpty(projectids) && StringUtils.isNotEmpty(lineids)){
  740. vo.setId(i.getLineid());
  741. vo.setName(CacheContext.lines.stream().filter(l->l.getId().equals(i.getLineid().trim())).findFirst().get().getName());
  742. }else {
  743. vo.setId(i.getWindpowerstationid());
  744. vo.setName(CacheContext.wpmap.get(i.getWindpowerstationid().trim()).getName());
  745. }
  746. vo.setFdl(keepPrecision(i.getGenecapacity()/10000,2));
  747. vo.setLlfdl(keepPrecision(i.getTherogenecapacity()/10000,2));
  748. vo.setJxssdl(keepPrecision(i.getDaynhwhssdl()/10000,2));
  749. vo.setGzssdl(keepPrecision(i.getDaynhgzssdl()/10000,2));
  750. vo.setXdssdl(keepPrecision(i.getDaynhxdssdl()/10000,2));
  751. vo.setSlssdl(keepPrecision(i.getDaynhcfdl()/10000,2));
  752. vo.setXnssdl(keepPrecision(i.getDaynhqfdl()/10000,2));
  753. vo.setZssdl(keepPrecision((vo.getGzssdl()+vo.getJxssdl()+vo.getXdssdl()+vo.getXnssdl()+vo.getSlssdl())/10000,2));
  754. vo.setFnlyl(vo.getLlfdl()!=0?keepPrecision(vo.getFdl()/vo.getLlfdl()*100,2):0.0);
  755. vo.setGzssl(vo.getLlfdl()!=0?keepPrecision(vo.getGzssdl()/vo.getLlfdl()*100,2):0.0);
  756. vo.setJxssl(vo.getLlfdl()!=0?keepPrecision(vo.getJxssdl()/vo.getLlfdl()*100,2):0.0);
  757. vo.setQfl(vo.getLlfdl()!=0?keepPrecision(vo.getXdssdl()/vo.getLlfdl()*100,2):0.0);
  758. vo.setXnssl(vo.getLlfdl()!=0?keepPrecision(vo.getXnssdl()/vo.getLlfdl()*100,2):0.0);
  759. vo.setSlssl(vo.getLlfdl()!=0?keepPrecision(vo.getSlssdl()/vo.getLlfdl()*100,2):0.0);
  760. resultList.add(vo);
  761. });
  762. SortUtils.sort(resultList,"fdl",SortUtils.DESC);
  763. for (int i=0;i<resultList.size();i++){
  764. resultList.get(i).setFdlpm(i+1);
  765. }
  766. SortUtils.sort(resultList,"fnlyl",SortUtils.DESC);
  767. for (int i=0;i<resultList.size();i++){
  768. resultList.get(i).setFnlylpm(i+1);
  769. }
  770. SortUtils.sort(resultList,"zssdl",SortUtils.ASC);
  771. for (int i=0;i<resultList.size();i++){
  772. resultList.get(i).setZhpm(i+1);
  773. }
  774. SortUtils.sort(resultList,"gzssdl",SortUtils.ASC);
  775. for (int i=0;i<resultList.size();i++){
  776. resultList.get(i).setGzssdlpm(i+1);
  777. }
  778. SortUtils.sort(resultList,"gzssl",SortUtils.ASC);
  779. for (int i=0;i<resultList.size();i++){
  780. resultList.get(i).setGzsslpm(i+1);
  781. }
  782. SortUtils.sort(resultList,"jxssdl",SortUtils.ASC);
  783. for (int i=0;i<resultList.size();i++){
  784. resultList.get(i).setJxssdlpm(i+1);
  785. }
  786. SortUtils.sort(resultList,"jxssl",SortUtils.ASC);
  787. for (int i=0;i<resultList.size();i++){
  788. resultList.get(i).setJxsslpm(i+1);
  789. }
  790. SortUtils.sort(resultList,"xdssdl",SortUtils.ASC);
  791. for (int i=0;i<resultList.size();i++){
  792. resultList.get(i).setXdssdlpm(i+1);
  793. }
  794. SortUtils.sort(resultList,"qfl",SortUtils.ASC);
  795. for (int i=0;i<resultList.size();i++){
  796. resultList.get(i).setQflpm(i+1);
  797. }
  798. SortUtils.sort(resultList,"xnssdl",SortUtils.ASC);
  799. for (int i=0;i<resultList.size();i++){
  800. resultList.get(i).setXnssdlpm(i+1);
  801. }
  802. SortUtils.sort(resultList,"xnssl",SortUtils.ASC);
  803. for (int i=0;i<resultList.size();i++){
  804. resultList.get(i).setXnsslpm(i+1);
  805. }
  806. SortUtils.sort(resultList,"slssdl",SortUtils.ASC);
  807. for (int i=0;i<resultList.size();i++){
  808. resultList.get(i).setSlssdlpm(i+1);
  809. }
  810. SortUtils.sort(resultList,"slssl",SortUtils.ASC);
  811. for (int i=0;i<resultList.size();i++){
  812. resultList.get(i).setSlsslpm(i+1);
  813. }
  814. if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
  815. if (sort.equals("1")){
  816. SortUtils.sort(resultList,target,SortUtils.ASC);
  817. }else {
  818. SortUtils.sort(resultList,target,SortUtils.DESC);
  819. }
  820. }else {
  821. //SortUtils.sort(resultList,"fdl",SortUtils.DESC);
  822. SortUtils.sort(resultList,"ordernum",SortUtils.ASC);
  823. }
  824. return resultList;
  825. }
  826. /**
  827. * 场内对标
  828. * @param wpid
  829. * @param beginDate
  830. * @param endDate
  831. * @return
  832. */
  833. public List<WxsslVo> cndb(String wpid, String beginDate, String endDate,String target,String sort) {
  834. QueryWrapper<Equipmentdayinfo> qw = new QueryWrapper<>();
  835. List<WxsslVo> resultList = new ArrayList<>();
  836. qw.select("recorddate,sum(genecapacity) genecapacity,sum(therogenecapacity) therogenecapacity,sum(daynhwhssdl) daynhwhssdl,sum(daynhgzssdl) daynhgzssdl,sum(daynhxdssdl) daynhxdssdl,sum(daynhqfdl) daynhqfdl,sum(daynhcfdl) daynhcfdl");
  837. qw.ge("recorddate",DateUtils.parseDate(beginDate)).le("recorddate",DateUtils.parseDate(endDate));
  838. if (StringUtils.isNotEmpty(wpid)){
  839. qw.eq("windpowerstationid",wpid);
  840. }
  841. qw.groupBy("recorddate");
  842. List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList,TYPE_DATE);
  843. if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
  844. if (sort.equals("1")){
  845. SortUtils.sort(resultList,target,SortUtils.ASC);
  846. }else {
  847. SortUtils.sort(resultList,target,SortUtils.DESC);
  848. }
  849. }else {
  850. SortUtils.sort(resultList,"date",SortUtils.ASC);
  851. }
  852. return wxsslVoList;
  853. }
  854. /**
  855. * 场际对标
  856. * @param wpids
  857. * @param beginDate
  858. * @param endDate
  859. * @return
  860. */
  861. public List<WxsslVo> cjdb(String wpids, String beginDate, String endDate,String target,String sort) {
  862. List<WxsslVo> resultList = new ArrayList<>();
  863. QueryWrapper<Equipmentdayinfo> qw = new QueryWrapper<>();
  864. qw.select("windpowerstationid,sum(genecapacity) genecapacity,sum(therogenecapacity) therogenecapacity,sum(daynhwhssdl) daynhwhssdl,sum(daynhgzssdl) daynhgzssdl,sum(daynhxdssdl) daynhxdssdl,sum(daynhqfdl) daynhqfdl,sum(daynhcfdl) daynhcfdl");
  865. qw.ge("recorddate",DateUtils.parseDate(beginDate)).le("recorddate",DateUtils.parseDate(endDate));
  866. if (StringUtils.isNotEmpty(wpids)){
  867. List<String> wpList = Arrays.asList(wpids.split(","));
  868. qw.in("windpowerstationid",wpList);
  869. }
  870. qw.groupBy("windpowerstationid");
  871. List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList,TYPE_WIND);
  872. if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
  873. if (sort.equals("1")){
  874. SortUtils.sort(resultList,target,SortUtils.ASC);
  875. }else {
  876. SortUtils.sort(resultList,target,SortUtils.DESC);
  877. }
  878. }else {
  879. SortUtils.sort(resultList,"ordernum",SortUtils.ASC);
  880. }
  881. return wxsslVoList;
  882. }
  883. /**
  884. * 项目对标
  885. * @param wpids
  886. * @param projectids
  887. * @param beginDate
  888. * @param endDate
  889. * @return
  890. */
  891. public List<WxsslVo> xmdb(String wpids, String projectids, String beginDate, String endDate,String target,String sort) {
  892. List<WxsslVo> resultList = new ArrayList<>();
  893. QueryWrapper<Equipmentdayinfo> qw = new QueryWrapper<>();
  894. qw.select("projectid,sum(genecapacity) genecapacity,sum(therogenecapacity) therogenecapacity,sum(daynhwhssdl) daynhwhssdl,sum(daynhgzssdl) daynhgzssdl,sum(daynhxdssdl) daynhxdssdl,sum(daynhqfdl) daynhqfdl,sum(daynhcfdl) daynhcfdl");
  895. qw.ge("recorddate",DateUtils.parseDate(beginDate)).le("recorddate",DateUtils.parseDate(endDate));
  896. if (StringUtils.isNotEmpty(wpids)){
  897. List<String> wpList = Arrays.asList(wpids.split(","));
  898. qw.in("windpowerstationid",wpList);
  899. }
  900. if (StringUtils.isNotEmpty(projectids)){
  901. List<String> projectList = Arrays.asList(projectids.split(","));
  902. qw.in("projectid",projectList);
  903. }
  904. qw.groupBy("projectid");
  905. List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList,TYPE_PROJECT);
  906. if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
  907. if (sort.equals("1")){
  908. SortUtils.sort(resultList,target,SortUtils.ASC);
  909. }else {
  910. SortUtils.sort(resultList,target,SortUtils.DESC);
  911. }
  912. }else {
  913. SortUtils.sort(resultList,"fdl",SortUtils.ASC);
  914. }
  915. return wxsslVoList;
  916. }
  917. /**
  918. * 线路对标
  919. * @param wpids
  920. * @param projectids
  921. * @param lineids
  922. * @param beginDate
  923. * @param endDate
  924. * @return
  925. */
  926. public List<WxsslVo> xldb(String wpids, String projectids, String lineids, String beginDate, String endDate,String target,String sort) {
  927. List<WxsslVo> resultList = new ArrayList<>();
  928. QueryWrapper<Equipmentdayinfo> qw = new QueryWrapper<>();
  929. qw.select("lineid,sum(genecapacity) genecapacity,sum(therogenecapacity) therogenecapacity,sum(daynhwhssdl) daynhwhssdl,sum(daynhgzssdl) daynhgzssdl,sum(daynhxdssdl) daynhxdssdl,sum(daynhqfdl) daynhqfdl,sum(daynhcfdl) daynhcfdl");
  930. qw.ge("recorddate",DateUtils.parseDate(beginDate)).le("recorddate",DateUtils.parseDate(endDate));
  931. if (StringUtils.isNotEmpty(wpids)){
  932. List<String> wpList = Arrays.asList(wpids.split(","));
  933. qw.in("windpowerstationid",wpList);
  934. }
  935. if (StringUtils.isNotEmpty(projectids)){
  936. List<String> projectList = Arrays.asList(projectids.split(","));
  937. qw.in("projectid",projectList);
  938. }
  939. if (StringUtils.isNotEmpty(lineids)){
  940. List<String> lineList = Arrays.asList(lineids.split(","));
  941. qw.in("lineid",lineList);
  942. }
  943. qw.groupBy("lineid");
  944. List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList,TYPE_LINE);
  945. if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
  946. if (sort.equals("1")){
  947. SortUtils.sort(resultList,target,SortUtils.ASC);
  948. }else {
  949. SortUtils.sort(resultList,target,SortUtils.DESC);
  950. }
  951. }else {
  952. SortUtils.sort(resultList,"fdl",SortUtils.ASC);
  953. }
  954. return wxsslVoList;
  955. }
  956. /**
  957. * 根据查询条件和类型,查询处五项损失并封装到结果list
  958. * @param qw
  959. * @param resultList
  960. * @param type
  961. * @return
  962. */
  963. private List<WxsslVo> getWxsslSortVos(QueryWrapper<Equipmentdayinfo> qw, List<WxsslVo> resultList, String type) {
  964. Map<String,Double> station = windpowerstationService.list()
  965. .stream().collect(Collectors.toMap(Windpowerstation::getId,Windpowerstation::getOrdernum));
  966. List<Equipmentdayinfo> list = equipmentdayinfoService.list(qw);
  967. list.stream().forEach(i->{
  968. WxsslVo vo = new WxsslVo();
  969. vo.setOrdernum(station.get(i.getWindpowerstationid()));
  970. if (type.equals(TYPE_WIND)){
  971. vo.setId(i.getWindpowerstationid());
  972. vo.setName(CacheContext.wpmap.get(i.getWindpowerstationid().trim()).getName());
  973. }else if(type.equals(TYPE_PROJECT)){
  974. vo.setId(i.getProjectid());
  975. vo.setName(CacheContext.projects.stream().filter(p->p.getId().equals(i.getProjectid().trim())).findFirst().get().getName());
  976. }else if(type.equals(TYPE_LINE)){
  977. vo.setId(i.getLineid());
  978. vo.setName(CacheContext.lines.stream().filter(l->l.getId().equals(i.getLineid().trim())).findFirst().get().getName());
  979. }else if(type.equals(TYPE_WINDTURBINE)){
  980. vo.setId(i.getWindturbineid());
  981. vo.setName(CacheContext.wtls.stream().filter(w->w.getId().equals(i.getWindturbineid().trim())).findFirst().get().getName());
  982. }
  983. vo.setDate(i.getRecorddate());
  984. vo.setFdl(keepPrecision(i.getGenecapacity()/10000,2));
  985. vo.setLlfdl(keepPrecision(i.getTherogenecapacity()/10000,2));
  986. vo.setGzssdl(keepPrecision(i.getDaynhgzssdl()/10000,2));
  987. vo.setJxssdl(keepPrecision(i.getDaynhwhssdl()/10000,2));
  988. vo.setXdssdl(keepPrecision(i.getDaynhxdssdl()/10000,2));
  989. vo.setXnssdl(keepPrecision(i.getDaynhqfdl()/10000,2));
  990. vo.setSlssdl(keepPrecision(i.getDaynhcfdl()/10000,2));
  991. vo.setFnlyl(vo.getLlfdl()!=0?keepPrecision(vo.getFdl()/vo.getLlfdl()*100,2):0);
  992. vo.setGzssl(vo.getLlfdl()!=0?keepPrecision(vo.getGzssdl()/vo.getLlfdl()*100,2):0);
  993. vo.setJxssl(vo.getLlfdl()!=0?keepPrecision(vo.getJxssdl()/vo.getLlfdl()*100,2):0);
  994. vo.setQfl(vo.getLlfdl()!=0?keepPrecision(vo.getXdssdl()/vo.getLlfdl()*100,2):0);
  995. vo.setXnssl(vo.getLlfdl()!=0?keepPrecision(vo.getXnssdl()/vo.getLlfdl()*100,2):0);
  996. vo.setSlssl(vo.getLlfdl()!=0?keepPrecision(vo.getSlssdl()/vo.getLlfdl()*100,2):0);
  997. resultList.add(vo);
  998. });
  999. SortUtils.sort(resultList,"llfdl",SortUtils.DESC);
  1000. for (int i=0;i<resultList.size();i++){
  1001. resultList.get(i).setZhpm(i+1);
  1002. }
  1003. SortUtils.sort(resultList,"fdl",SortUtils.DESC);
  1004. for (int i=0;i<resultList.size();i++){
  1005. resultList.get(i).setFdlpm(i+1);
  1006. }
  1007. SortUtils.sort(resultList,"fnlyl",SortUtils.DESC);
  1008. for (int i=0;i<resultList.size();i++){
  1009. resultList.get(i).setFnlylpm(i+1);
  1010. }
  1011. SortUtils.sort(resultList,"gzssdl",SortUtils.ASC);
  1012. for (int i=0;i<resultList.size();i++){
  1013. resultList.get(i).setGzssdlpm(i+1);
  1014. }
  1015. SortUtils.sort(resultList,"gzssl",SortUtils.ASC);
  1016. for (int i=0;i<resultList.size();i++){
  1017. resultList.get(i).setGzsslpm(i+1);
  1018. }
  1019. SortUtils.sort(resultList,"jxssdl",SortUtils.ASC);
  1020. for (int i=0;i<resultList.size();i++){
  1021. resultList.get(i).setJxssdlpm(i+1);
  1022. }
  1023. SortUtils.sort(resultList,"jxssl",SortUtils.ASC);
  1024. for (int i=0;i<resultList.size();i++){
  1025. resultList.get(i).setJxsslpm(i+1);
  1026. }
  1027. SortUtils.sort(resultList,"xdssdl",SortUtils.ASC);
  1028. for (int i=0;i<resultList.size();i++){
  1029. resultList.get(i).setXdssdlpm(i+1);
  1030. }
  1031. SortUtils.sort(resultList,"qfl",SortUtils.ASC);
  1032. for (int i=0;i<resultList.size();i++){
  1033. resultList.get(i).setQflpm(i+1);
  1034. }
  1035. SortUtils.sort(resultList,"xnssdl",SortUtils.ASC);
  1036. for (int i=0;i<resultList.size();i++){
  1037. resultList.get(i).setXnssdlpm(i+1);
  1038. }
  1039. SortUtils.sort(resultList,"xnssl",SortUtils.ASC);
  1040. for (int i=0;i<resultList.size();i++){
  1041. resultList.get(i).setXnsslpm(i+1);
  1042. }
  1043. SortUtils.sort(resultList,"slssdl",SortUtils.ASC);
  1044. for (int i=0;i<resultList.size();i++){
  1045. resultList.get(i).setSlssdlpm(i+1);
  1046. }
  1047. SortUtils.sort(resultList,"slssl",SortUtils.ASC);
  1048. for (int i=0;i<resultList.size();i++){
  1049. resultList.get(i).setSlsslpm(i+1);
  1050. }
  1051. return resultList;
  1052. }
  1053. /**
  1054. * 值际操作指令list
  1055. * @param beginDate
  1056. * @param endDate
  1057. * @return
  1058. */
  1059. public List<Operation> findOperecords(String beginDate, String endDate) {
  1060. List<Operation> resultList = new ArrayList<>();
  1061. Date begin = DateUtils.parseDate(beginDate);
  1062. Date end = DateUtils.getEndOfDay(DateUtils.parseDate(endDate));
  1063. List<Operationrecord> opeList = operationrecordService.listByBeginAndEnd(begin, end);
  1064. QueryWrapper<Dutyschedule> wrapper = new QueryWrapper();
  1065. wrapper.select("max(id) id,name,max(begin) begin,max(end) end,max(createdate) createdate");
  1066. wrapper.le("createdate",end).ge("createdate",begin).groupBy("name");
  1067. List<Dutyschedule> dutyList= dutyscheduleService.list(wrapper);
  1068. for (Dutyschedule duty : dutyList) {
  1069. Operation ope = new Operation();
  1070. ope.setNameOfDuty(duty.getName());
  1071. List<Operationrecord> opeVos= opeList.stream().filter(v -> v.getDutyname().equals(duty.getName())).collect(Collectors.toList());
  1072. ope.setStartCount(opeVos.stream().filter(vo -> vo.getValue()==1.0).collect(Collectors.toList()).size());
  1073. ope.setStopCount(opeVos.stream().filter(vo -> vo.getValue()==2.0).collect(Collectors.toList()).size());
  1074. ope.setResetCount(opeVos.stream().filter(vo -> vo.getValue()==3.0).collect(Collectors.toList()).size());
  1075. ope.setMaintainCount(opeVos.stream().filter(vo -> vo.getValue()==4.0).collect(Collectors.toList()).size());
  1076. ope.setUnmaintainCount(opeVos.stream().filter(vo -> vo.getValue()==5.0).collect(Collectors.toList()).size());
  1077. ope.setGpmaintainCount(opeVos.stream().filter(vo -> vo.getValue()==6.0).collect(Collectors.toList()).size());
  1078. ope.setGpfaultCount(opeVos.stream().filter(vo -> vo.getValue()==7.0).collect(Collectors.toList()).size());
  1079. ope.setGponsiteinvolvementMaintainCount(opeVos.stream().filter(vo -> vo.getValue()==8.0).collect(Collectors.toList()).size());
  1080. ope.setGponsiteinvolvementFaultCount(opeVos.stream().filter(vo -> vo.getValue()==9.0).collect(Collectors.toList()).size());
  1081. ope.setGpoffsiteaffectedgridCount(opeVos.stream().filter(vo -> vo.getValue()==100).collect(Collectors.toList()).size());
  1082. ope.setGpweatherOutsideCount(opeVos.stream().filter(vo -> vo.getValue()==11.0).collect(Collectors.toList()).size());
  1083. ope.setUngpCount(opeVos.stream().filter(vo -> vo.getValue()==12.0).collect(Collectors.toList()).size());
  1084. resultList.add(ope);
  1085. }
  1086. return resultList;
  1087. }
  1088. /**
  1089. * 值际点击钻取
  1090. * @param beginDate
  1091. * @param endDate
  1092. * @param dutyname
  1093. * @param direct
  1094. * @return
  1095. */
  1096. public List<Operationrecord> drillOperecords(String beginDate, String endDate, String dutyname, String direct) {
  1097. Date begin = DateUtils.parseDate(beginDate);
  1098. Date end = DateUtils.getEndOfDay(DateUtils.parseDate(endDate));
  1099. List<Operationrecord> opeList = operationrecordService.listByBeginAndEnd(begin,end);
  1100. List<Operationrecord> resuList = opeList.stream().filter(ope -> ope.getDutyname().equals(dutyname) && ope.getValue() == Double.parseDouble(direct)).collect(Collectors.toList());
  1101. return resuList;
  1102. }
  1103. /**
  1104. * 值际五项损失
  1105. * @param beginDate
  1106. * @param endDate
  1107. * @return
  1108. */
  1109. public List<Benchmarkingbetween> findbenchlist(String beginDate, String endDate) {
  1110. Date begin = DateUtils.parseDate(beginDate);
  1111. Date end = DateUtils.parseDate(endDate);
  1112. List<Benchmarkingbetween> resuList = benchmarkingbetweenService.findByBeginAndEnd(begin,end);
  1113. return resuList;
  1114. }
  1115. /**
  1116. * 对标管理详情页面
  1117. * @param id
  1118. * @param beginDate
  1119. * @param endDate
  1120. * @return
  1121. */
  1122. public List<WxsslVo> details(String id, String beginDate, String endDate, String target,String sort) {
  1123. List<WxsslVo> resultList = new ArrayList<>();
  1124. QueryWrapper<Equipmentdayinfo> qw = new QueryWrapper<>();
  1125. qw.select("windturbineid,sum(genecapacity) genecapacity,sum(therogenecapacity) therogenecapacity,sum(daynhwhssdl) daynhwhssdl,sum(daynhgzssdl) daynhgzssdl,sum(daynhxdssdl) daynhxdssdl,sum(daynhqfdl) daynhqfdl,sum(daynhcfdl) daynhcfdl");
  1126. qw.ge("recorddate",DateUtils.parseDate(beginDate)).le("recorddate",DateUtils.parseDate(endDate));
  1127. if (id.endsWith("FDC")){
  1128. qw.eq("windpowerstationid",id);
  1129. }else if(id.endsWith("GC")){
  1130. qw.eq("projectid",id);
  1131. }else if(id.endsWith("XL")){
  1132. qw.eq("lineid",id);
  1133. }
  1134. qw.groupBy("windturbineid");
  1135. List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList,TYPE_WINDTURBINE);
  1136. if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
  1137. if (sort.equals("1")){
  1138. SortUtils.sort(resultList,target,SortUtils.ASC);
  1139. }else {
  1140. SortUtils.sort(resultList,target,SortUtils.DESC);
  1141. }
  1142. }else {
  1143. SortUtils.sort(resultList,"fdl",SortUtils.ASC);
  1144. }
  1145. return wxsslVoList;
  1146. }
  1147. /**
  1148. * 日单机横向对比列表
  1149. * @param wpid
  1150. * @param wtids
  1151. * @param date
  1152. * @return
  1153. */
  1154. public List<Object> daydjhxdbtop(String wpid, String wtids, String date) {
  1155. List<DjhxdbtopVo> resultList = new ArrayList<>();
  1156. QueryWrapper<Windturbineanalysisday> qw = new QueryWrapper<>();
  1157. Date recorddate = DateUtils.parseDate(date);
  1158. if (StringUtils.isNotEmpty(wpid) && StringUtils.isNotEmpty(wtids)){
  1159. String[] wtidArray = wtids.split(",");
  1160. List<String> wtidList = Arrays.asList(wtidArray);
  1161. qw.in("windturbineid",wtidList);
  1162. }else {
  1163. qw.eq("windturbineid","MG01_01");
  1164. }
  1165. qw.eq("recorddate",recorddate);
  1166. List<Windturbineanalysisday> windturbineanalysisdayList = windturbineanalysisdayService.list(qw);
  1167. windturbineanalysisdayList.stream().forEach(i->{
  1168. DjhxdbtopVo vo = new DjhxdbtopVo();
  1169. vo.setWtid(i.getWindturbineid());
  1170. vo.setFdl(i.getC1());
  1171. vo.setYfdl(i.getC4());
  1172. vo.setPjgl(i.getC7());
  1173. vo.setPjfs(i.getC10());
  1174. vo.setYxxs(i.getC13());
  1175. vo.setDjxs(i.getC16());
  1176. vo.setGzxs(i.getC19());
  1177. vo.setWhxs(i.getC22());
  1178. vo.setZdxs(i.getC25());
  1179. vo.setYxfs(i.getC28());
  1180. vo.setSsdl(i.getC31());
  1181. vo.setBjcs(i.getC34());
  1182. vo.setTjcs(i.getC37());
  1183. vo.setBbhcs(i.getC40());
  1184. vo.setSbklly(i.getC43());
  1185. vo.setPjwd(i.getC46());
  1186. vo.setPjsd(i.getC49());
  1187. vo.setPjyq(i.getC52());
  1188. vo.setNhyd(i.getC55());
  1189. vo.setSjbz(i.getC58());
  1190. resultList.add(vo);
  1191. });
  1192. List<Windturbinethewindinfo> fzyList = getFzy(wtids, date);
  1193. resultList.stream().forEach(i->{
  1194. String wtid = i.getWtid();
  1195. if (fzyList!=null && fzyList.size()>0){
  1196. Optional<Windturbinethewindinfo> first = fzyList.stream().filter(fzy -> fzy.getWindturbineid().equals(wtid)).findFirst();
  1197. Windturbinethewindinfo winfo = null;
  1198. if (first.isPresent()){
  1199. winfo = first.get();
  1200. }
  1201. List<FzyVo> vos = new ArrayList<>();
  1202. for (int j = 0; j < 16; j++) {
  1203. FzyVo vo = new FzyVo();
  1204. switch (j) {
  1205. case 0:
  1206. // vo.setName("N("+winfo.getN4()+"/"+winfo.getN()+")");
  1207. vo.setName("N");
  1208. vo.setValue(winfo.getN4());
  1209. break;
  1210. case 1:
  1211. // vo.setName("NNE("+winfo.getNne4()+"/"+winfo.getNne()+")");
  1212. vo.setName("NNE");
  1213. vo.setValue(winfo.getNne4());
  1214. break;
  1215. case 2:
  1216. // vo.setName("NE("+winfo.getNe4()+"/"+winfo.getNe()+")");
  1217. vo.setName("NE");
  1218. vo.setValue(winfo.getNe4());
  1219. break;
  1220. case 3:
  1221. // vo.setName("ENE("+winfo.getEne4()+"/"+winfo.getEne()+")");
  1222. vo.setName("ENE");
  1223. vo.setValue(winfo.getEne4());
  1224. break;
  1225. case 4:
  1226. // vo.setName("E("+winfo.getE4()+"/"+winfo.getE()+")");
  1227. vo.setName("E");
  1228. vo.setValue(winfo.getE4());
  1229. break;
  1230. case 5:
  1231. // vo.setName("ESE("+winfo.getEse()+"/"+winfo.getEse()+")");
  1232. vo.setName("ESE");
  1233. vo.setValue(winfo.getEse4());
  1234. break;
  1235. case 6:
  1236. // vo.setName("SE("+winfo.getSe4()+"/"+winfo.getSe()+")");
  1237. vo.setName("SE");
  1238. vo.setValue(winfo.getSe4());
  1239. break;
  1240. case 7:
  1241. // vo.setName("SSE("+winfo.getSse4()+"/"+winfo.getSse()+")");
  1242. vo.setName("SSE");
  1243. vo.setValue(winfo.getSse4());
  1244. break;
  1245. case 8:
  1246. // vo.setName("S("+winfo.getS4()+"/"+winfo.getS()+")");
  1247. vo.setName("S");
  1248. vo.setValue(winfo.getS4());
  1249. break;
  1250. case 9:
  1251. // vo.setName("SSW("+winfo.getSsw4()+"/"+winfo.getSsw()+")");
  1252. vo.setName("SSW");
  1253. vo.setValue(winfo.getSsw4());
  1254. break;
  1255. case 10:
  1256. // vo.setName("SW("+winfo.getSw4()+"/"+winfo.getSw()+")");
  1257. vo.setName("SW");
  1258. vo.setValue(winfo.getSw4());
  1259. break;
  1260. case 11:
  1261. // vo.setName("WSW("+winfo.getWsw4()+"/"+winfo.getWsw()+")");
  1262. vo.setName("WSW");
  1263. vo.setValue(winfo.getWsw4());
  1264. break;
  1265. case 12:
  1266. // vo.setName("W("+winfo.getW4()+"/"+winfo.getW()+")");
  1267. vo.setName("W");
  1268. vo.setValue(winfo.getW4());
  1269. break;
  1270. case 13:
  1271. // vo.setName("WNW("+winfo.getWnw4()+"/"+winfo.getWnw()+")");
  1272. vo.setName("WNW");
  1273. vo.setValue(winfo.getWnw4());
  1274. break;
  1275. case 14:
  1276. // vo.setName("NW("+winfo.getNw4()+"/"+winfo.getNw()+")");
  1277. vo.setName("NW");
  1278. vo.setValue(winfo.getNw4());
  1279. break;
  1280. case 15:
  1281. // vo.setName("NNW("+winfo.getNnw4()+"/"+winfo.getNnw()+")");
  1282. vo.setName("NNW");
  1283. vo.setValue(winfo.getNnw4());
  1284. break;
  1285. default:
  1286. break;
  1287. }
  1288. vos.add(vo);
  1289. }
  1290. i.setFzyList(vos);
  1291. i.setJfpl(winfo.getCb());
  1292. }
  1293. });
  1294. List<Object> list = convert(resultList);
  1295. return list;
  1296. }
  1297. /**
  1298. * 月单机横向对比列表
  1299. * @param wpid
  1300. * @param wtids
  1301. * @param date
  1302. * @return
  1303. */
  1304. public List<Object> monthdjhxdbtop(String wpid, String wtids, String date) {
  1305. List<DjhxdbtopVo> resultList = new ArrayList<>();
  1306. QueryWrapper<Windturbineanalysisday> qw = new QueryWrapper<>();
  1307. Date recorddate = DateUtils.parseDate(date);
  1308. if (StringUtils.isNotEmpty(wpid) && StringUtils.isNotEmpty(wtids)){
  1309. String[] wtidArray = wtids.split(",");
  1310. List<String> wtidList = Arrays.asList(wtidArray);
  1311. qw.in("windturbineid",wtidList);
  1312. }else {
  1313. qw.eq("windturbineid","MG01_01");
  1314. }
  1315. qw.eq("recorddate",recorddate);
  1316. List<Windturbineanalysisday> windturbineanalysisdayList = windturbineanalysisdayService.list(qw);
  1317. windturbineanalysisdayList.stream().forEach(i->{
  1318. DjhxdbtopVo vo = new DjhxdbtopVo();
  1319. vo.setWtid(i.getWindturbineid());
  1320. vo.setFdl(i.getC2());
  1321. vo.setYfdl(i.getC5());
  1322. vo.setPjgl(i.getC8());
  1323. vo.setPjfs(i.getC11());
  1324. vo.setYxxs(i.getC14());
  1325. vo.setDjxs(i.getC17());
  1326. vo.setGzxs(i.getC20());
  1327. vo.setWhxs(i.getC23());
  1328. vo.setZdxs(i.getC26());
  1329. vo.setYxfs(i.getC29());
  1330. vo.setSsdl(i.getC32());
  1331. vo.setBjcs(i.getC35());
  1332. vo.setTjcs(i.getC38());
  1333. vo.setBbhcs(i.getC41());
  1334. vo.setSbklly(i.getC44());
  1335. vo.setPjwd(i.getC47());
  1336. vo.setPjsd(i.getC50());
  1337. vo.setPjyq(i.getC53());
  1338. vo.setNhyd(i.getC56());
  1339. vo.setSjbz(i.getC59());
  1340. resultList.add(vo);
  1341. });
  1342. List<Windturbinethewindinfo> fzyList = getFzy(wtids, date);
  1343. resultList.stream().forEach(i->{
  1344. String wtid = i.getWtid();
  1345. Optional<Windturbinethewindinfo> first = fzyList.stream().filter(fzy -> fzy.getWindturbineid().equals(wtid)).findFirst();
  1346. Windturbinethewindinfo winfo = null;
  1347. if (first.isPresent()){
  1348. winfo = first.get();
  1349. }
  1350. List<FzyVo> vos = new ArrayList<>();
  1351. for (int j = 0; j < 16; j++) {
  1352. FzyVo vo = new FzyVo();
  1353. switch (j) {
  1354. case 0:
  1355. // vo.setName("N("+winfo.getN4()+"/"+winfo.getN()+")");
  1356. vo.setName("N");
  1357. vo.setValue(winfo.getN10());
  1358. break;
  1359. case 1:
  1360. // vo.setName("NNE("+winfo.getNne4()+"/"+winfo.getNne()+")");
  1361. vo.setName("NNE");
  1362. vo.setValue(winfo.getNne10());
  1363. break;
  1364. case 2:
  1365. // vo.setName("NE("+winfo.getNe4()+"/"+winfo.getNe()+")");
  1366. vo.setName("NE");
  1367. vo.setValue(winfo.getNe10());
  1368. break;
  1369. case 3:
  1370. // vo.setName("ENE("+winfo.getEne4()+"/"+winfo.getEne()+")");
  1371. vo.setName("ENE");
  1372. vo.setValue(winfo.getEne10());
  1373. break;
  1374. case 4:
  1375. // vo.setName("E("+winfo.getE4()+"/"+winfo.getE()+")");
  1376. vo.setName("E");
  1377. vo.setValue(winfo.getE10());
  1378. break;
  1379. case 5:
  1380. // vo.setName("ESE("+winfo.getEse()+"/"+winfo.getEse()+")");
  1381. vo.setName("ESE");
  1382. vo.setValue(winfo.getEse10());
  1383. break;
  1384. case 6:
  1385. // vo.setName("SE("+winfo.getSe4()+"/"+winfo.getSe()+")");
  1386. vo.setName("SE");
  1387. vo.setValue(winfo.getSe10());
  1388. break;
  1389. case 7:
  1390. // vo.setName("SSE("+winfo.getSse4()+"/"+winfo.getSse()+")");
  1391. vo.setName("SSE");
  1392. vo.setValue(winfo.getSse10());
  1393. break;
  1394. case 8:
  1395. // vo.setName("S("+winfo.getS4()+"/"+winfo.getS()+")");
  1396. vo.setName("S");
  1397. vo.setValue(winfo.getS10());
  1398. break;
  1399. case 9:
  1400. // vo.setName("SSW("+winfo.getSsw4()+"/"+winfo.getSsw()+")");
  1401. vo.setName("SSW");
  1402. vo.setValue(winfo.getSsw10());
  1403. break;
  1404. case 10:
  1405. // vo.setName("SW("+winfo.getSw4()+"/"+winfo.getSw()+")");
  1406. vo.setName("SW");
  1407. vo.setValue(winfo.getSw10());
  1408. break;
  1409. case 11:
  1410. // vo.setName("WSW("+winfo.getWsw4()+"/"+winfo.getWsw()+")");
  1411. vo.setName("WSW");
  1412. vo.setValue(winfo.getWsw10());
  1413. break;
  1414. case 12:
  1415. // vo.setName("W("+winfo.getW4()+"/"+winfo.getW()+")");
  1416. vo.setName("W");
  1417. vo.setValue(winfo.getW10());
  1418. break;
  1419. case 13:
  1420. // vo.setName("WNW("+winfo.getWnw4()+"/"+winfo.getWnw()+")");
  1421. vo.setName("WNW");
  1422. vo.setValue(winfo.getWnw10());
  1423. break;
  1424. case 14:
  1425. // vo.setName("NW("+winfo.getNw4()+"/"+winfo.getNw()+")");
  1426. vo.setName("NW");
  1427. vo.setValue(winfo.getNw10());
  1428. break;
  1429. case 15:
  1430. // vo.setName("NNW("+winfo.getNnw4()+"/"+winfo.getNnw()+")");
  1431. vo.setName("NNW");
  1432. vo.setValue(winfo.getNnw10());
  1433. break;
  1434. default:
  1435. break;
  1436. }
  1437. vos.add(vo);
  1438. }
  1439. i.setFzyList(vos);
  1440. i.setJfpl(winfo.getCb());
  1441. });
  1442. List<Object> list = convert(resultList);
  1443. return list;
  1444. }
  1445. /**
  1446. * 年单机横向对比列表
  1447. * @param wpid
  1448. * @param wtids
  1449. * @param date
  1450. * @return
  1451. */
  1452. public List<Object> yeardjhxdbtop(String wpid, String wtids, String date) {
  1453. List<DjhxdbtopVo> resultList = new ArrayList<>();
  1454. QueryWrapper<Windturbineanalysisday> qw = new QueryWrapper<>();
  1455. Date recorddate = DateUtils.parseDate(date);
  1456. if (StringUtils.isNotEmpty(wpid) && StringUtils.isNotEmpty(wtids)){
  1457. String[] wtidArray = wtids.split(",");
  1458. List<String> wtidList = Arrays.asList(wtidArray);
  1459. qw.in("windturbineid",wtidList);
  1460. }else {
  1461. qw.eq("windturbineid","MG01_01");
  1462. }
  1463. qw.eq("recorddate",recorddate);
  1464. List<Windturbineanalysisday> windturbineanalysisdayList = windturbineanalysisdayService.list(qw);
  1465. windturbineanalysisdayList.stream().forEach(i->{
  1466. DjhxdbtopVo vo = new DjhxdbtopVo();
  1467. vo.setWtid(i.getWindturbineid());
  1468. vo.setFdl(i.getC3());
  1469. vo.setYfdl(i.getC6());
  1470. vo.setPjgl(i.getC9());
  1471. vo.setPjfs(i.getC12());
  1472. vo.setYxxs(i.getC15());
  1473. vo.setDjxs(i.getC18());
  1474. vo.setGzxs(i.getC21());
  1475. vo.setWhxs(i.getC24());
  1476. vo.setZdxs(i.getC27());
  1477. vo.setYxfs(i.getC30());
  1478. vo.setSsdl(i.getC33());
  1479. vo.setBjcs(i.getC36());
  1480. vo.setTjcs(i.getC39());
  1481. vo.setBbhcs(i.getC42());
  1482. vo.setSbklly(i.getC45());
  1483. vo.setPjwd(i.getC48());
  1484. vo.setPjsd(i.getC51());
  1485. vo.setPjyq(i.getC54());
  1486. vo.setNhyd(i.getC57());
  1487. vo.setSjbz(i.getC60());
  1488. resultList.add(vo);
  1489. });
  1490. List<Windturbinethewindinfo> fzyList = getFzy(wtids, date);
  1491. resultList.stream().forEach(i->{
  1492. String wtid = i.getWtid();
  1493. Optional<Windturbinethewindinfo> first = fzyList.stream().filter(fzy -> fzy.getWindturbineid().equals(wtid)).findFirst();
  1494. Windturbinethewindinfo winfo = null;
  1495. if (first.isPresent()){
  1496. winfo = first.get();
  1497. }
  1498. List<FzyVo> vos = new ArrayList<>();
  1499. for (int j = 0; j < 16; j++) {
  1500. FzyVo vo = new FzyVo();
  1501. switch (j) {
  1502. case 0:
  1503. // vo.setName("N("+winfo.getN4()+"/"+winfo.getN()+")");
  1504. vo.setName("N");
  1505. vo.setValue(winfo.getN16());
  1506. break;
  1507. case 1:
  1508. // vo.setName("NNE("+winfo.getNne4()+"/"+winfo.getNne()+")");
  1509. vo.setName("NNE");
  1510. vo.setValue(winfo.getNne16());
  1511. break;
  1512. case 2:
  1513. // vo.setName("NE("+winfo.getNe4()+"/"+winfo.getNe()+")");
  1514. vo.setName("NE");
  1515. vo.setValue(winfo.getNe16());
  1516. break;
  1517. case 3:
  1518. // vo.setName("ENE("+winfo.getEne4()+"/"+winfo.getEne()+")");
  1519. vo.setName("ENE");
  1520. vo.setValue(winfo.getEne16());
  1521. break;
  1522. case 4:
  1523. // vo.setName("E("+winfo.getE4()+"/"+winfo.getE()+")");
  1524. vo.setName("E");
  1525. vo.setValue(winfo.getE16());
  1526. break;
  1527. case 5:
  1528. // vo.setName("ESE("+winfo.getEse()+"/"+winfo.getEse()+")");
  1529. vo.setName("ESE");
  1530. vo.setValue(winfo.getEse16());
  1531. break;
  1532. case 6:
  1533. // vo.setName("SE("+winfo.getSe4()+"/"+winfo.getSe()+")");
  1534. vo.setName("SE");
  1535. vo.setValue(winfo.getSe16());
  1536. break;
  1537. case 7:
  1538. // vo.setName("SSE("+winfo.getSse4()+"/"+winfo.getSse()+")");
  1539. vo.setName("SSE");
  1540. vo.setValue(winfo.getSse16());
  1541. break;
  1542. case 8:
  1543. // vo.setName("S("+winfo.getS4()+"/"+winfo.getS()+")");
  1544. vo.setName("S");
  1545. vo.setValue(winfo.getS16());
  1546. break;
  1547. case 9:
  1548. // vo.setName("SSW("+winfo.getSsw4()+"/"+winfo.getSsw()+")");
  1549. vo.setName("SSW");
  1550. vo.setValue(winfo.getSsw16());
  1551. break;
  1552. case 10:
  1553. // vo.setName("SW("+winfo.getSw4()+"/"+winfo.getSw()+")");
  1554. vo.setName("SW");
  1555. vo.setValue(winfo.getSw16());
  1556. break;
  1557. case 11:
  1558. // vo.setName("WSW("+winfo.getWsw4()+"/"+winfo.getWsw()+")");
  1559. vo.setName("WSW");
  1560. vo.setValue(winfo.getWsw16());
  1561. break;
  1562. case 12:
  1563. // vo.setName("W("+winfo.getW4()+"/"+winfo.getW()+")");
  1564. vo.setName("W");
  1565. vo.setValue(winfo.getW16());
  1566. break;
  1567. case 13:
  1568. // vo.setName("WNW("+winfo.getWnw4()+"/"+winfo.getWnw()+")");
  1569. vo.setName("WNW");
  1570. vo.setValue(winfo.getWnw16());
  1571. break;
  1572. case 14:
  1573. // vo.setName("NW("+winfo.getNw4()+"/"+winfo.getNw()+")");
  1574. vo.setName("NW");
  1575. vo.setValue(winfo.getNw16());
  1576. break;
  1577. case 15:
  1578. // vo.setName("NNW("+winfo.getNnw4()+"/"+winfo.getNnw()+")");
  1579. vo.setName("NNW");
  1580. vo.setValue(winfo.getNnw16());
  1581. break;
  1582. default:
  1583. break;
  1584. }
  1585. vos.add(vo);
  1586. }
  1587. i.setFzyList(vos);
  1588. i.setJfpl(winfo.getCb());
  1589. });
  1590. List<Object> list = convert(resultList);
  1591. return list;
  1592. }
  1593. /**
  1594. * 单机横向对比列表行转列
  1595. * @param resultList
  1596. * @return
  1597. */
  1598. private List<Object> convert(List<DjhxdbtopVo> resultList) {
  1599. List<Object> rList = new ArrayList<>();
  1600. List<String> wtids = resultList.stream().map(i -> i.getWtid()).collect(Collectors.toList());
  1601. DjhxdbInitVo fdj = new DjhxdbInitVo();
  1602. fdj.setName("风电机");
  1603. try {
  1604. LinkedHashMap addMap = new LinkedHashMap();
  1605. LinkedHashMap addValMap = new LinkedHashMap();
  1606. for (int j=0;j<wtids.size();j++){
  1607. addMap.put(String.valueOf(j+1), Class.forName("java.lang.String"));
  1608. addValMap.put(String.valueOf(j+1), wtids.get(j));
  1609. }
  1610. Object blo = new ClassUtil().dynamicClass(fdj, addMap, addValMap);
  1611. rList.add(blo);
  1612. System.out.println(JSON.toJSONString(blo));
  1613. } catch (Exception e) {
  1614. e.printStackTrace();
  1615. }
  1616. DjhxdbInitVo fdl = new DjhxdbInitVo();
  1617. fdl.setName("发电量");
  1618. try {
  1619. LinkedHashMap addMap = new LinkedHashMap();
  1620. LinkedHashMap addValMap = new LinkedHashMap();
  1621. for (int j=0;j<wtids.size();j++){
  1622. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1623. int finalJ = j;
  1624. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getFdl());
  1625. }
  1626. Object blo = new ClassUtil().dynamicClass(fdl, addMap, addValMap);
  1627. rList.add(blo);
  1628. System.out.println(JSON.toJSONString(blo));
  1629. } catch (Exception e) {
  1630. e.printStackTrace();
  1631. }
  1632. DjhxdbInitVo yfdl = new DjhxdbInitVo();
  1633. yfdl.setName("应发电量");
  1634. try {
  1635. LinkedHashMap addMap = new LinkedHashMap();
  1636. LinkedHashMap addValMap = new LinkedHashMap();
  1637. for (int j=0;j<wtids.size();j++){
  1638. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1639. int finalJ = j;
  1640. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getYfdl());
  1641. }
  1642. Object blo = new ClassUtil().dynamicClass(yfdl, addMap, addValMap);
  1643. rList.add(blo);
  1644. System.out.println(JSON.toJSONString(blo));
  1645. } catch (Exception e) {
  1646. e.printStackTrace();
  1647. }
  1648. DjhxdbInitVo pjgl = new DjhxdbInitVo();
  1649. pjgl.setName("平均功率");
  1650. try {
  1651. LinkedHashMap addMap = new LinkedHashMap();
  1652. LinkedHashMap addValMap = new LinkedHashMap();
  1653. for (int j=0;j<wtids.size();j++){
  1654. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1655. int finalJ = j;
  1656. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getPjgl());
  1657. }
  1658. Object blo = new ClassUtil().dynamicClass(pjgl, addMap, addValMap);
  1659. rList.add(blo);
  1660. System.out.println(JSON.toJSONString(blo));
  1661. } catch (Exception e) {
  1662. e.printStackTrace();
  1663. }
  1664. DjhxdbInitVo pjfs = new DjhxdbInitVo();
  1665. pjfs.setName("平均风速");
  1666. try {
  1667. LinkedHashMap addMap = new LinkedHashMap();
  1668. LinkedHashMap addValMap = new LinkedHashMap();
  1669. for (int j=0;j<wtids.size();j++){
  1670. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1671. int finalJ = j;
  1672. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getPjfs());
  1673. }
  1674. Object blo = new ClassUtil().dynamicClass(pjfs, addMap, addValMap);
  1675. rList.add(blo);
  1676. System.out.println(JSON.toJSONString(blo));
  1677. } catch (Exception e) {
  1678. e.printStackTrace();
  1679. }
  1680. DjhxdbInitVo yxxs = new DjhxdbInitVo();
  1681. yxxs.setName("运行小时");
  1682. try {
  1683. LinkedHashMap addMap = new LinkedHashMap();
  1684. LinkedHashMap addValMap = new LinkedHashMap();
  1685. for (int j=0;j<wtids.size();j++){
  1686. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1687. int finalJ = j;
  1688. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getYxxs());
  1689. }
  1690. Object blo = new ClassUtil().dynamicClass(yxxs, addMap, addValMap);
  1691. rList.add(blo);
  1692. System.out.println(JSON.toJSONString(blo));
  1693. } catch (Exception e) {
  1694. e.printStackTrace();
  1695. }
  1696. DjhxdbInitVo djxs = new DjhxdbInitVo();
  1697. djxs.setName("待机小时");
  1698. try {
  1699. LinkedHashMap addMap = new LinkedHashMap();
  1700. LinkedHashMap addValMap = new LinkedHashMap();
  1701. for (int j=0;j<wtids.size();j++){
  1702. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1703. int finalJ = j;
  1704. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getDjxs());
  1705. }
  1706. Object blo = new ClassUtil().dynamicClass(djxs, addMap, addValMap);
  1707. rList.add(blo);
  1708. System.out.println(JSON.toJSONString(blo));
  1709. } catch (Exception e) {
  1710. e.printStackTrace();
  1711. }
  1712. DjhxdbInitVo gzxs = new DjhxdbInitVo();
  1713. gzxs.setName("故障小时");
  1714. try {
  1715. LinkedHashMap addMap = new LinkedHashMap();
  1716. LinkedHashMap addValMap = new LinkedHashMap();
  1717. for (int j=0;j<wtids.size();j++){
  1718. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1719. int finalJ = j;
  1720. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getGzxs());
  1721. }
  1722. Object blo = new ClassUtil().dynamicClass(gzxs, addMap, addValMap);
  1723. rList.add(blo);
  1724. System.out.println(JSON.toJSONString(blo));
  1725. } catch (Exception e) {
  1726. e.printStackTrace();
  1727. }
  1728. DjhxdbInitVo whxs = new DjhxdbInitVo();
  1729. whxs.setName("维护小时");
  1730. try {
  1731. LinkedHashMap addMap = new LinkedHashMap();
  1732. LinkedHashMap addValMap = new LinkedHashMap();
  1733. for (int j=0;j<wtids.size();j++){
  1734. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1735. int finalJ = j;
  1736. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getWhxs());
  1737. }
  1738. Object blo = new ClassUtil().dynamicClass(whxs, addMap, addValMap);
  1739. rList.add(blo);
  1740. System.out.println(JSON.toJSONString(blo));
  1741. } catch (Exception e) {
  1742. e.printStackTrace();
  1743. }
  1744. DjhxdbInitVo zdxs = new DjhxdbInitVo();
  1745. zdxs.setName("中断小时");
  1746. try {
  1747. LinkedHashMap addMap = new LinkedHashMap();
  1748. LinkedHashMap addValMap = new LinkedHashMap();
  1749. for (int j=0;j<wtids.size();j++){
  1750. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1751. int finalJ = j;
  1752. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getZdxs());
  1753. }
  1754. Object blo = new ClassUtil().dynamicClass(zdxs, addMap, addValMap);
  1755. rList.add(blo);
  1756. System.out.println(JSON.toJSONString(blo));
  1757. } catch (Exception e) {
  1758. e.printStackTrace();
  1759. }
  1760. DjhxdbInitVo yxfs = new DjhxdbInitVo();
  1761. yxfs.setName("有效风时");
  1762. try {
  1763. LinkedHashMap addMap = new LinkedHashMap();
  1764. LinkedHashMap addValMap = new LinkedHashMap();
  1765. for (int j=0;j<wtids.size();j++){
  1766. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1767. int finalJ = j;
  1768. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getYxfs());
  1769. }
  1770. Object blo = new ClassUtil().dynamicClass(yxfs, addMap, addValMap);
  1771. rList.add(blo);
  1772. System.out.println(JSON.toJSONString(blo));
  1773. } catch (Exception e) {
  1774. e.printStackTrace();
  1775. }
  1776. DjhxdbInitVo ssdl = new DjhxdbInitVo();
  1777. ssdl.setName("损失电量");
  1778. try {
  1779. LinkedHashMap addMap = new LinkedHashMap();
  1780. LinkedHashMap addValMap = new LinkedHashMap();
  1781. for (int j=0;j<wtids.size();j++){
  1782. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1783. int finalJ = j;
  1784. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getSsdl());
  1785. }
  1786. Object blo = new ClassUtil().dynamicClass(ssdl, addMap, addValMap);
  1787. rList.add(blo);
  1788. System.out.println(JSON.toJSONString(blo));
  1789. } catch (Exception e) {
  1790. e.printStackTrace();
  1791. }
  1792. DjhxdbInitVo bjcs = new DjhxdbInitVo();
  1793. bjcs.setName("报警次数");
  1794. try {
  1795. LinkedHashMap addMap = new LinkedHashMap();
  1796. LinkedHashMap addValMap = new LinkedHashMap();
  1797. for (int j=0;j<wtids.size();j++){
  1798. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1799. int finalJ = j;
  1800. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getBjcs());
  1801. }
  1802. Object blo = new ClassUtil().dynamicClass(bjcs, addMap, addValMap);
  1803. rList.add(blo);
  1804. System.out.println(JSON.toJSONString(blo));
  1805. } catch (Exception e) {
  1806. e.printStackTrace();
  1807. }
  1808. DjhxdbInitVo tjcs = new DjhxdbInitVo();
  1809. tjcs.setName("停机次数");
  1810. try {
  1811. LinkedHashMap addMap = new LinkedHashMap();
  1812. LinkedHashMap addValMap = new LinkedHashMap();
  1813. for (int j=0;j<wtids.size();j++){
  1814. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1815. int finalJ = j;
  1816. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getTjcs());
  1817. }
  1818. Object blo = new ClassUtil().dynamicClass(tjcs, addMap, addValMap);
  1819. rList.add(blo);
  1820. System.out.println(JSON.toJSONString(blo));
  1821. } catch (Exception e) {
  1822. e.printStackTrace();
  1823. }
  1824. DjhxdbInitVo bbhcs = new DjhxdbInitVo();
  1825. bbhcs.setName("不饱和次数");
  1826. try {
  1827. LinkedHashMap addMap = new LinkedHashMap();
  1828. LinkedHashMap addValMap = new LinkedHashMap();
  1829. for (int j=0;j<wtids.size();j++){
  1830. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1831. int finalJ = j;
  1832. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getBbhcs());
  1833. }
  1834. Object blo = new ClassUtil().dynamicClass(bbhcs, addMap, addValMap);
  1835. rList.add(blo);
  1836. System.out.println(JSON.toJSONString(blo));
  1837. } catch (Exception e) {
  1838. e.printStackTrace();
  1839. }
  1840. DjhxdbInitVo sbklly = new DjhxdbInitVo();
  1841. sbklly.setName("设备可利用率");
  1842. try {
  1843. LinkedHashMap addMap = new LinkedHashMap();
  1844. LinkedHashMap addValMap = new LinkedHashMap();
  1845. for (int j=0;j<wtids.size();j++){
  1846. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1847. int finalJ = j;
  1848. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getSbklly());
  1849. }
  1850. Object blo = new ClassUtil().dynamicClass(sbklly, addMap, addValMap);
  1851. rList.add(blo);
  1852. System.out.println(JSON.toJSONString(blo));
  1853. } catch (Exception e) {
  1854. e.printStackTrace();
  1855. }
  1856. DjhxdbInitVo pjwd = new DjhxdbInitVo();
  1857. pjwd.setName("平均温度");
  1858. try {
  1859. LinkedHashMap addMap = new LinkedHashMap();
  1860. LinkedHashMap addValMap = new LinkedHashMap();
  1861. for (int j=0;j<wtids.size();j++){
  1862. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1863. int finalJ = j;
  1864. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getPjwd());
  1865. }
  1866. Object blo = new ClassUtil().dynamicClass(pjwd, addMap, addValMap);
  1867. rList.add(blo);
  1868. System.out.println(JSON.toJSONString(blo));
  1869. } catch (Exception e) {
  1870. e.printStackTrace();
  1871. }
  1872. DjhxdbInitVo pjsd = new DjhxdbInitVo();
  1873. pjsd.setName("平均湿度");
  1874. try {
  1875. LinkedHashMap addMap = new LinkedHashMap();
  1876. LinkedHashMap addValMap = new LinkedHashMap();
  1877. for (int j=0;j<wtids.size();j++){
  1878. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1879. int finalJ = j;
  1880. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getPjsd());
  1881. }
  1882. Object blo = new ClassUtil().dynamicClass(pjsd, addMap, addValMap);
  1883. rList.add(blo);
  1884. System.out.println(JSON.toJSONString(blo));
  1885. } catch (Exception e) {
  1886. e.printStackTrace();
  1887. }
  1888. DjhxdbInitVo pjyq = new DjhxdbInitVo();
  1889. pjyq.setName("平均压强");
  1890. try {
  1891. LinkedHashMap addMap = new LinkedHashMap();
  1892. LinkedHashMap addValMap = new LinkedHashMap();
  1893. for (int j=0;j<wtids.size();j++){
  1894. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1895. int finalJ = j;
  1896. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getPjyq());
  1897. }
  1898. Object blo = new ClassUtil().dynamicClass(pjyq, addMap, addValMap);
  1899. rList.add(blo);
  1900. System.out.println(JSON.toJSONString(blo));
  1901. } catch (Exception e) {
  1902. e.printStackTrace();
  1903. }
  1904. DjhxdbInitVo nhyd = new DjhxdbInitVo();
  1905. nhyd.setName("拟合优度");
  1906. try {
  1907. LinkedHashMap addMap = new LinkedHashMap();
  1908. LinkedHashMap addValMap = new LinkedHashMap();
  1909. for (int j=0;j<wtids.size();j++){
  1910. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1911. int finalJ = j;
  1912. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getNhyd());
  1913. }
  1914. Object blo = new ClassUtil().dynamicClass(nhyd, addMap, addValMap);
  1915. rList.add(blo);
  1916. System.out.println(JSON.toJSONString(blo));
  1917. } catch (Exception e) {
  1918. e.printStackTrace();
  1919. }
  1920. DjhxdbInitVo sjbz = new DjhxdbInitVo();
  1921. sjbz.setName("实际/保证");
  1922. try {
  1923. LinkedHashMap addMap = new LinkedHashMap();
  1924. LinkedHashMap addValMap = new LinkedHashMap();
  1925. for (int j=0;j<wtids.size();j++){
  1926. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1927. int finalJ = j;
  1928. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getSjbz());
  1929. }
  1930. Object blo = new ClassUtil().dynamicClass(sjbz, addMap, addValMap);
  1931. rList.add(blo);
  1932. System.out.println(JSON.toJSONString(blo));
  1933. } catch (Exception e) {
  1934. e.printStackTrace();
  1935. }
  1936. DjhxdbInitVo fzy = new DjhxdbInitVo();
  1937. fzy.setName("风资源");
  1938. try {
  1939. LinkedHashMap addMap = new LinkedHashMap();
  1940. LinkedHashMap addValMap = new LinkedHashMap();
  1941. for (int j=0;j<wtids.size();j++){
  1942. addMap.put(String.valueOf(j+1), Class.forName("java.util.List"));
  1943. int finalJ = j;
  1944. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getFzyList());
  1945. }
  1946. Object blo = new ClassUtil().dynamicClass(fzy, addMap, addValMap);
  1947. rList.add(blo);
  1948. System.out.println(JSON.toJSONString(blo));
  1949. } catch (Exception e) {
  1950. e.printStackTrace();
  1951. }
  1952. DjhxdbInitVo jfpl = new DjhxdbInitVo();
  1953. jfpl.setName("静风频率");
  1954. try {
  1955. LinkedHashMap addMap = new LinkedHashMap();
  1956. LinkedHashMap addValMap = new LinkedHashMap();
  1957. for (int j=0;j<wtids.size();j++){
  1958. addMap.put(String.valueOf(j+1), Class.forName("java.lang.Double"));
  1959. int finalJ = j;
  1960. addValMap.put(String.valueOf(j+1), resultList.stream().filter(i->i.getWtid().equals(wtids.get(finalJ))).findFirst().get().getJfpl());
  1961. }
  1962. Object blo = new ClassUtil().dynamicClass(jfpl, addMap, addValMap);
  1963. rList.add(blo);
  1964. System.out.println(JSON.toJSONString(blo));
  1965. } catch (Exception e) {
  1966. e.printStackTrace();
  1967. }
  1968. return rList;
  1969. }
  1970. /**
  1971. * 获取风资源和静风频率
  1972. * @param wtids
  1973. * @param date
  1974. */
  1975. private List<Windturbinethewindinfo> getFzy(String wtids, String date) {
  1976. QueryWrapper<Windturbinethewindinfo> qw = new QueryWrapper<>();
  1977. Date recorddate = DateUtils.parseDate(date);
  1978. if (StringUtils.isNotEmpty(wtids)){
  1979. String[] wtidArray = wtids.split(",");
  1980. List<String> wtidList = Arrays.asList(wtidArray);
  1981. qw.in("windturbineid",wtidList);
  1982. }else {
  1983. qw.eq("windturbineid","MG01_01");
  1984. }
  1985. qw.eq("recorddate",recorddate);
  1986. List<Windturbinethewindinfo> fzyList = windturbinethewindinfoService.list(qw);
  1987. return fzyList;
  1988. }
  1989. /**
  1990. * 日单机横向对比图
  1991. * @param wpid
  1992. * @param wtids
  1993. * @param date
  1994. * @return
  1995. */
  1996. public List<Object> djhxdbbottom(String wpid, String wtids, String date) {
  1997. List<DjhxdbtopVo> resultList = new ArrayList<>();
  1998. QueryWrapper<Windturbinecurvefitting> qw = new QueryWrapper<>();
  1999. Date recorddate = DateUtils.parseDate(date);
  2000. if (StringUtils.isNotEmpty(wpid) && StringUtils.isNotEmpty(wtids)){
  2001. String[] wtidArray = wtids.split(",");
  2002. List<String> wtidList = Arrays.asList(wtidArray);
  2003. qw.in("windturbineid",wtidList);
  2004. }else {
  2005. qw.eq("windturbineid","MG01_01");
  2006. }
  2007. qw.eq("recorddate",recorddate);
  2008. List<Windturbinecurvefitting> windturbinecurvefittingList = windturbinecurvefittingService.list(qw);
  2009. List<String> wtidList = windturbinecurvefittingList.stream().map(i -> i.getWindturbineid()).distinct().collect(Collectors.toList());
  2010. List<Object> rList = new ArrayList<>();
  2011. for (String wtid : wtidList) {
  2012. List<Windturbinecurvefitting> windturbinecurvefittings = windturbinecurvefittingList.stream().filter(i -> i.getWindturbineid().equals(wtid)).collect(Collectors.toList());
  2013. DjhxdbInitVo vo = new DjhxdbInitVo();
  2014. vo.setName(wtid);
  2015. try {
  2016. LinkedHashMap addMap = new LinkedHashMap();
  2017. LinkedHashMap addValMap = new LinkedHashMap();
  2018. for (Windturbinecurvefitting curve : windturbinecurvefittings) {
  2019. addMap.put(String.valueOf(curve.getSpeed()), Class.forName("java.lang.Double"));
  2020. addValMap.put(String.valueOf(curve.getSpeed()), curve.getActualpower());
  2021. }
  2022. Object blo = new ClassUtil().dynamicClass(vo, addMap, addValMap);
  2023. rList.add(blo);
  2024. System.out.println(JSON.toJSONString(blo));
  2025. } catch (Exception e) {
  2026. e.printStackTrace();
  2027. }
  2028. }
  2029. return rList;
  2030. }
  2031. /**
  2032. * 保存对标管理首页大表
  2033. * @param beginDate
  2034. * @param endDate
  2035. */
  2036. public void saveBenchmark(String beginDate,String endDate){
  2037. List<Windpowerstation> wplist = CacheContext.wplist;
  2038. List<String> days = getDays(beginDate, endDate);
  2039. for (String day : days) {
  2040. Date date = DateUtils.parseDate(day);
  2041. Map<String,Object> selMap = new HashMap<>();
  2042. selMap.put("recorddate",date);
  2043. benchmarkService.removeByMap(selMap);
  2044. //获取数据
  2045. List<Windpowerinfoday> windpowerinfodays = windpowerinfodayService.listByMap(selMap);
  2046. List<Windpowerinfoday3> windpowerinfoday3s = windpowerinfoday3Service.listByMap(selMap);
  2047. List<Wpmttrandmtbfday> wpmttrandmtbfdays = wpmttrandmtbfdayService.listByMap(selMap);
  2048. List<Windpowerspecificinfoday> windpowerspecificinfodays = windpowerspecificinfodayService.listByMap(selMap);
  2049. List<Windpowerstationthewindinfo> windpowerstationthewindinfos = windpowerstationthewindinfoService.listByMap(selMap);
  2050. //封装结果list一起存储
  2051. List<Benchmark> resultList = new ArrayList<>();
  2052. //赋值
  2053. wplist.stream().forEach(wp -> {
  2054. Benchmark benchmark = new Benchmark();
  2055. benchmark.setId(StringUtils.getUUID());
  2056. benchmark.setForeignkeyid(wp.getId()); //场站
  2057. benchmark.setRecorddate(date);
  2058. benchmark.setMark(RandomUtil.getRandomForDoubleBounded(80.0,95.0));
  2059. benchmark.setCapacity(wp.getCapacity());
  2060. benchmark.setUnits(wp.getQuantity());
  2061. double fdl = 0.0;
  2062. double swdl = 0.0;
  2063. double gwdl = 0.0;
  2064. double gzdl = 0.0;
  2065. double whdl = 0.0;
  2066. double xddl = 0.0;
  2067. double xndl = 0.0;
  2068. double sldl = 0.0;
  2069. double zhcydl = 0.0;
  2070. double gzcs = 0.0;
  2071. double gzsj = 0.0;
  2072. double rlsj = 0.0;
  2073. double sbklyl = 0.0;
  2074. double dxkyxs = 0.0;
  2075. double yfwcs = 0.0;
  2076. double sjfwcs = 0.0;
  2077. double yzhcs = 0.0;
  2078. double sjzhcs = 0.0;
  2079. double yxqcs = 0.0;
  2080. double sjxqcs = 0.0;
  2081. double speed = 0.0;
  2082. double jfpl = 0.0;
  2083. double jfcs = 0.0;
  2084. List<Windpowerinfoday> infodayList = windpowerinfodays.stream().filter(i -> i.getForeignkeyid().equals(wp.getId())).collect(Collectors.toList());
  2085. if (StringUtils.isNotNull(infodayList) && StringUtils.isNotEmpty(infodayList)){
  2086. Windpowerinfoday windpowerinfoday = infodayList.get(0);
  2087. fdl = windpowerinfoday.getGeneratingcapacity();
  2088. swdl = windpowerinfoday.getGridelectricity();
  2089. gwdl = windpowerinfoday.getBuyelectricity();
  2090. zhcydl = fdl + gwdl - swdl;
  2091. sbklyl = windpowerinfoday.getDaysbklyl();
  2092. dxkyxs = windpowerinfoday.getDaydxkyxs();
  2093. speed = windpowerinfoday.getSpeed();
  2094. }
  2095. List<Windpowerinfoday3> infoday3List = windpowerinfoday3s.stream().filter(i -> i.getForeignkeyid().equals(wp.getId())).collect(Collectors.toList());
  2096. if (StringUtils.isNotNull(infoday3List) && StringUtils.isNotEmpty(infoday3List)){
  2097. Windpowerinfoday3 windpowerinfoday3 = infoday3List.get(0);
  2098. gzdl = windpowerinfoday3.getDaynhgzssdl()/10000;
  2099. whdl = windpowerinfoday3.getDaynhwhssdl()/10000;
  2100. xddl = windpowerinfoday3.getDaynhxdssdl()/10000;
  2101. xndl = windpowerinfoday3.getDaynhqfdl()/10000;
  2102. //sldl = windpowerinfoday3.getDaynhcfdl()/10000;
  2103. }
  2104. List<Wpmttrandmtbfday> wpmttrandmtbfdayList = wpmttrandmtbfdays.stream().filter(i -> i.getWpid().equals(wp.getId())).collect(Collectors.toList());
  2105. if (StringUtils.isNotNull(wpmttrandmtbfdayList) && StringUtils.isNotEmpty(wpmttrandmtbfdayList)){
  2106. Wpmttrandmtbfday wpmttrandmtbfday = wpmttrandmtbfdayList.get(0);
  2107. gzcs = wpmttrandmtbfday.getStoprtimes();
  2108. gzsj = wpmttrandmtbfday.getStophours();
  2109. rlsj = wpmttrandmtbfday.getWthours();
  2110. }
  2111. List<Windpowerspecificinfoday> windpowerspecificinfodayList = windpowerspecificinfodays.stream().filter(i -> i.getWindpowerstationid().equals(wp.getId())).collect(Collectors.toList());
  2112. if (StringUtils.isNotNull(windpowerspecificinfodayList) && StringUtils.isNotEmpty(windpowerspecificinfodayList)){
  2113. Windpowerspecificinfoday windpowerspecificinfoday = windpowerspecificinfodayList.get(0);
  2114. yfwcs = windpowerspecificinfoday.getTheoresettimes();
  2115. sjfwcs = windpowerspecificinfoday.getResettimes();
  2116. yzhcs = windpowerspecificinfoday.getTheoconversiontimes();
  2117. sjzhcs = windpowerspecificinfoday.getConversiontimes();
  2118. yxqcs = windpowerspecificinfoday.getTheofaultcount();
  2119. sjxqcs = windpowerspecificinfoday.getRightcount();
  2120. }
  2121. List<Windpowerstationthewindinfo> windpowerstationthewindinfoList = windpowerstationthewindinfos.stream().filter(i -> i.getWindpowerstationid().equals(wp.getId())).collect(Collectors.toList());
  2122. if (StringUtils.isNotNull(windpowerstationthewindinfoList) && StringUtils.isNotEmpty(windpowerstationthewindinfoList)){
  2123. Windpowerstationthewindinfo windpowerstationthewindinfo = windpowerstationthewindinfoList.get(0);
  2124. jfcs = windpowerstationthewindinfo.getCa();
  2125. jfpl = windpowerstationthewindinfo.getCb();
  2126. }
  2127. benchmark.setActualpower(fdl);
  2128. benchmark.setDaynhgzssdl(gzdl);
  2129. benchmark.setDaynhwhssdl(whdl);
  2130. benchmark.setDaynhxdssdl(xddl);
  2131. benchmark.setDaynhqfdl(xndl);
  2132. benchmark.setDaynhcfdl(sldl);
  2133. benchmark.setTheoreticalpower(benchmark.getActualpower()+benchmark.getDaynhgzssdl()+benchmark.getDaynhwhssdl()+benchmark.getDaynhxdssdl()+benchmark.getDaynhqfdl()+benchmark.getDaynhcfdl());
  2134. benchmark.setWindenergy(benchmark.getTheoreticalpower()!=0?benchmark.getActualpower()/benchmark.getTheoreticalpower()*100:0.0);
  2135. benchmark.setPowerlossrate(benchmark.getTheoreticalpower()!=0?benchmark.getDaynhxdssdl()/benchmark.getTheoreticalpower()*100:0.0);
  2136. benchmark.setPerformancelossrate(benchmark.getTheoreticalpower()!=0?benchmark.getDaynhqfdl()/benchmark.getTheoreticalpower()*100:0.0);
  2137. benchmark.setComprehensiverate(benchmark.getActualpower()!=0?zhcydl/benchmark.getActualpower()*100:0.0);
  2138. benchmark.setUtilizationhours(benchmark.getActualpower()/benchmark.getCapacity()*10);
  2139. benchmark.setWindpoweraccuracy(RandomUtil.getRandomForDoubleBounded(91.0,99.0));
  2140. benchmark.setAgccurvefollowing(RandomUtil.getRandomForDoubleBounded(91.0,99.0));
  2141. benchmark.setMttr(gzcs!=0?gzsj/gzcs:0.0);
  2142. benchmark.setMtbf(gzcs!=0?rlsj/gzcs:0.0);
  2143. benchmark.setMttf(benchmark.getMtbf()-benchmark.getMttr());
  2144. benchmark.setAvailability(sbklyl);
  2145. benchmark.setAvailabilityfactor(dxkyxs);
  2146. benchmark.setFailurelossrate(benchmark.getTheoreticalpower()!=0?benchmark.getDaynhgzssdl()/benchmark.getTheoreticalpower()*100:0.0);
  2147. benchmark.setMainlossrate(benchmark.getTheoreticalpower()!=0?benchmark.getDaynhwhssdl()/benchmark.getTheoreticalpower()*100:0.0);
  2148. benchmark.setHiddentimely(RandomUtil.getRandomForDoubleBounded(70.0,99.0));
  2149. benchmark.setResettimelyrate(yfwcs!=0?sjfwcs/yfwcs*100:0.0);
  2150. benchmark.setStatetransitionrate(yzhcs!=0?sjzhcs/yzhcs*100:0.0);
  2151. benchmark.setEliminationrate(yxqcs!=0?sjxqcs/yxqcs*100:0.0);
  2152. benchmark.setSpeed(speed);
  2153. benchmark.setStaticwindfrequency(jfpl);
  2154. benchmark.setEffectivewindhourrate(0.0);
  2155. resultList.add(benchmark);
  2156. });
  2157. benchmarkService.saveBatch(resultList);
  2158. }
  2159. }
  2160. /**
  2161. * 对标首页下面部分
  2162. * @param timetype
  2163. * @param foreigntype
  2164. * @return
  2165. */
  2166. public List<Benchmark> dbmainbottom(String timetype, String foreigntype) throws Exception {
  2167. if (StringUtils.isEmpty(timetype)){
  2168. timetype = "日";
  2169. }
  2170. if (StringUtils.isEmpty(foreigntype)){
  2171. foreigntype = "风电";
  2172. }
  2173. QueryWrapper<Benchmark> qw = new QueryWrapper<>();
  2174. qw.select("foreignkeyid,avg(mark) mark," +
  2175. "avg(capacity) capacity," +
  2176. "avg(units) units," +
  2177. "sum(theoreticalpower) theoreticalpower," +
  2178. "sum(actualpower) actualpower," +
  2179. "sum(daynhgzssdl) daynhgzssdl, " +
  2180. "sum(daynhwhssdl) daynhwhssdl," +
  2181. "sum(daynhxdssdl) daynhxdssdl," +
  2182. "sum(daynhqfdl) daynhqfdl," +
  2183. "sum(daynhcfdl) daynhcfdl, " +
  2184. "nvl(sum(actualpower),0)/nvl(sum(theoreticalpower),1)*100 windenergy, " +
  2185. "nvl(sum(daynhxdssdl),0)/nvl(sum(theoreticalpower),1)*100 powerlossrate, " +
  2186. "nvl(sum(daynhqfdl),0)/nvl(sum(theoreticalpower),1)*100 performancelossrate, " +
  2187. "nvl(sum(daynhgzssdl),0)/nvl(sum(theoreticalpower),1)*100 failurelossrate, " +
  2188. "nvl(sum(daynhwhssdl),0)/nvl(sum(theoreticalpower),1)*100 mainlossrate," +
  2189. "avg(comprehensiverate) comprehensiverate,sum(actualpower)/avg(capacity) utilizationhours," +
  2190. "avg(windpoweraccuracy) windpoweraccuracy," +
  2191. "avg(agccurvefollowing) agccurvefollowing," +
  2192. "avg(mtbf) mtbf,avg(mttr) mttr,avg(mttf) mttf," +
  2193. "avg(availability) availability,avg(availabilityfactor) availabilityfactor," +
  2194. "avg(hiddentimely) hiddentimely," +
  2195. "avg(resettimelyrate) resettimelyrate," +
  2196. "avg(statetransitionrate) statetransitionrate," +
  2197. "avg(eliminationrate) eliminationrate," +
  2198. "avg(speed) speed," +
  2199. "avg(staticwindfrequency) staticwindfrequency," +
  2200. "avg(effectivewindhourrate) effectivewindhourrate");
  2201. if (foreigntype.equals("风电")){
  2202. qw.like("foreignkeyid","_FDC");
  2203. }else {
  2204. qw.like("foreignkeyid","_GDC");
  2205. }
  2206. Date end = DateUtils.getYesterdayStart();
  2207. Date begin = end;
  2208. if (timetype.equals("日")){
  2209. begin = end;
  2210. }else if(timetype.equals("周")){
  2211. begin = DateUtils.getThisWeekMonday(end);
  2212. }else if(timetype.equals("月")){
  2213. begin = DateUtils.getFirstAndLastDayOfMonth(end);
  2214. }else if(timetype.equals("季")){
  2215. begin = DateUtils.getSeasonStartDate(end);
  2216. }else if(timetype.equals("年")){
  2217. begin = DateUtils.getYearBegin(end);
  2218. }
  2219. qw.ge("recorddate",begin).le("recorddate",end);
  2220. qw.groupBy("foreignkeyid");
  2221. List<Benchmark> benchmarkList = benchmarkService.list(qw);
  2222. return benchmarkList;
  2223. }
  2224. public void getSj(String timetype, String foreigntype,List<Benchmark> resultList) throws Exception {
  2225. QueryWrapper<Benchmark> qw = new QueryWrapper<>();
  2226. qw.select("max(foreignkeyid) foreignkeyid," +
  2227. "sum(theoreticalpower) theoreticalpower," +
  2228. "sum(actualpower) actualpower," +
  2229. "sum(daynhgzssdl) daynhgzssdl," +
  2230. "sum(daynhwhssdl) daynhwhssdl," +
  2231. "sum(daynhxdssdl) daynhxdssdl," +
  2232. "sum(daynhqfdl) daynhqfdl," +
  2233. "sum(daynhcfdl) daynhcfdl," +
  2234. "CASE WHEN SUM ( theoreticalpower ) = 0 THEN 0 ELSE SUM ( actualpower ) / SUM ( theoreticalpower ) * 100 END AS windenergy," +
  2235. "CASE WHEN SUM ( theoreticalpower ) = 0 THEN 0 ELSE SUM ( daynhxdssdl ) / SUM ( theoreticalpower ) * 100 END AS powerlossrate," +
  2236. "CASE WHEN SUM ( theoreticalpower ) = 0 THEN 0 ELSE SUM ( daynhqfdl ) / SUM ( theoreticalpower ) * 100 END AS performancelossrate," +
  2237. "CASE WHEN SUM ( theoreticalpower ) = 0 THEN 0 ELSE SUM ( daynhgzssdl ) / SUM ( theoreticalpower ) * 100 END AS failurelossrate," +
  2238. "CASE WHEN SUM ( theoreticalpower ) = 0 THEN 0 ELSE SUM ( daynhwhssdl ) / SUM ( theoreticalpower ) * 100 END AS mainlossrate," +
  2239. "avg(resettimelyrate) resettimelyrate," +
  2240. "avg(statetransitionrate) statetransitionrate," +
  2241. "avg(eliminationrate) eliminationrate," +
  2242. "avg(comprehensiverate) comprehensiverate," +
  2243. "avg(windpoweraccuracy) windpoweraccuracy," +
  2244. "avg(agccurvefollowing) agccurvefollowing");
  2245. if (foreigntype.equals("风电")){
  2246. qw.like("foreignkeyid","_FDC");
  2247. }else {
  2248. qw.like("foreignkeyid","_GDC");
  2249. }
  2250. Date end = DateUtils.getYesterdayStart();
  2251. Date begin = end;
  2252. if (timetype.equals("日")){
  2253. begin = end;
  2254. }else if(timetype.equals("周")){
  2255. begin = DateUtils.getThisWeekMonday(end);
  2256. }else if(timetype.equals("月")){
  2257. begin = DateUtils.getFirstAndLastDayOfMonth(end);
  2258. }else if(timetype.equals("季")){
  2259. begin = DateUtils.getSeasonStartDate(end);
  2260. }else if(timetype.equals("年")){
  2261. begin = DateUtils.getYearBegin(end);
  2262. }
  2263. qw.ge("recorddate",begin).le("recorddate",end);
  2264. List<Benchmark> sjList = benchmarkService.list(qw);
  2265. if (StringUtils.isNotNull(sjList)){
  2266. sjList.get(0).setForeignkeyid("实际");
  2267. resultList.add(sjList.get(0));
  2268. }
  2269. }
  2270. public void getHb(String timetype, String foreigntype,List<Benchmark> resultList) throws Exception {
  2271. QueryWrapper<Benchmark> qw = new QueryWrapper<>();
  2272. qw.select("max(foreignkeyid) foreignkeyid," +
  2273. "sum(theoreticalpower) theoreticalpower," +
  2274. "sum(actualpower) actualpower," +
  2275. "sum(daynhgzssdl) daynhgzssdl," +
  2276. "sum(daynhwhssdl) daynhwhssdl," +
  2277. "sum(daynhxdssdl) daynhxdssdl," +
  2278. "sum(daynhqfdl) daynhqfdl," +
  2279. "sum(daynhcfdl) daynhcfdl," +
  2280. "isnull(sum(actualpower)/nullif(sum(theoreticalpower),0),0)*100 windenergy," +
  2281. "isnull(sum(daynhxdssdl)/nullif(sum(theoreticalpower),0),0)*100 powerlossrate," +
  2282. "isnull(sum(daynhqfdl)/nullif(sum(theoreticalpower),0),0)*100 performancelossrate," +
  2283. "isnull(sum(daynhgzssdl)/nullif(sum(theoreticalpower),0),0)*100 failurelossrate," +
  2284. "isnull(sum(daynhwhssdl)/nullif(sum(theoreticalpower),0),0)*100 mainlossrate," +
  2285. "avg(resettimelyrate) resettimelyrate,avg(statetransitionrate) statetransitionrate," +
  2286. "avg(eliminationrate) eliminationrate,avg(comprehensiverate) comprehensiverate," +
  2287. "avg(windpoweraccuracy) windpoweraccuracy,avg(agccurvefollowing) agccurvefollowing");
  2288. if (foreigntype.equals("风电")){
  2289. qw.like("foreignkeyid","_FDC");
  2290. }else {
  2291. qw.like("foreignkeyid","_GDC");
  2292. }
  2293. Date end = DateUtils.getYesterdayStart();
  2294. Date begin = end;
  2295. if (timetype.equals("日")){
  2296. begin = end;
  2297. }else if(timetype.equals("周")){
  2298. begin = DateUtils.getThisWeekMonday(end);
  2299. }else if(timetype.equals("月")){
  2300. begin = DateUtils.getFirstAndLastDayOfMonth(end);
  2301. }else if(timetype.equals("季")){
  2302. begin = DateUtils.getSeasonStartDate(end);
  2303. }else if(timetype.equals("年")){
  2304. begin = DateUtils.getYearBegin(end);
  2305. }
  2306. begin = DateUtils.addMonths(begin,-1);
  2307. end = DateUtils.addMonths(end,-1);
  2308. qw.ge("recorddate",begin).le("recorddate",end);
  2309. List<Benchmark> hbList = benchmarkService.list(qw);
  2310. if (StringUtils.isNotNull(hbList) && StringUtils.isNotEmpty(hbList)){
  2311. hbList.get(0).setForeignkeyid("环比");
  2312. resultList.add(hbList.get(0));
  2313. }
  2314. }
  2315. public void getTb(String timetype, String foreigntype,List<Benchmark> resultList) throws Exception {
  2316. QueryWrapper<Benchmark> qw = new QueryWrapper<>();
  2317. qw.select("max(foreignkeyid) foreignkeyid," +
  2318. "sum(theoreticalpower) theoreticalpower," +
  2319. "sum(actualpower) actualpower," +
  2320. "sum(daynhgzssdl) daynhgzssdl," +
  2321. "sum(daynhwhssdl) daynhwhssdl," +
  2322. "sum(daynhxdssdl) daynhxdssdl," +
  2323. "sum(daynhqfdl) daynhqfdl," +
  2324. "sum(daynhcfdl) daynhcfdl," +
  2325. "CASE WHEN sum(theoreticalpower) = 0 THEN 0 ELSE sum(actualpower)/sum(theoreticalpower)*100 END AS windenergy," +
  2326. "CASE WHEN sum(theoreticalpower) = 0 THEN 0 ELSE sum(daynhxdssdl)/sum(theoreticalpower)*100 END AS powerlossrate," +
  2327. "CASE WHEN sum(theoreticalpower) = 0 THEN 0 ELSE sum(daynhqfdl)/sum(theoreticalpower)*100 END AS performancelossrate," +
  2328. "CASE WHEN SUM ( theoreticalpower ) = 0 THEN 0 ELSE SUM ( daynhgzssdl ) / SUM ( theoreticalpower ) * 100 END AS failurelossrate,"+
  2329. "CASE WHEN SUM ( theoreticalpower ) = 0 THEN 0 ELSE SUM ( daynhwhssdl ) / SUM ( theoreticalpower ) * 100 END AS mainlossrate," +
  2330. "avg(resettimelyrate) resettimelyrate," +
  2331. "avg(statetransitionrate) statetransitionrate," +
  2332. "avg(eliminationrate) eliminationrate," +
  2333. "avg(comprehensiverate) comprehensiverate," +
  2334. "avg(windpoweraccuracy) windpoweraccuracy," +
  2335. "avg(agccurvefollowing) agccurvefollowing");
  2336. if (foreigntype.equals("风电")){
  2337. qw.like("foreignkeyid","_FDC");
  2338. }else {
  2339. qw.like("foreignkeyid","_GDC");
  2340. }
  2341. Date end = DateUtils.getYesterdayStart();
  2342. Date begin = end;
  2343. if (timetype.equals("日")){
  2344. begin = end;
  2345. }else if(timetype.equals("周")){
  2346. begin = DateUtils.getThisWeekMonday(end);
  2347. }else if(timetype.equals("月")){
  2348. begin = DateUtils.getFirstAndLastDayOfMonth(end);
  2349. }else if(timetype.equals("季")){
  2350. begin = DateUtils.getSeasonStartDate(end);
  2351. }else if(timetype.equals("年")){
  2352. begin = DateUtils.getYearBegin(end);
  2353. }
  2354. begin = DateUtils.addYears(DateUtils.addMonths(begin,1),-1);
  2355. end = DateUtils.addYears(DateUtils.addMonths(end,1),-1);
  2356. qw.ge("recorddate",begin).le("recorddate",end);
  2357. List<Benchmark> tbList = benchmarkService.list(qw);
  2358. if (StringUtils.isNotNull(tbList) && StringUtils.isNotEmpty(tbList)){
  2359. Benchmark benchmark = tbList.get(0);
  2360. if(benchmark!=null){
  2361. benchmark.setForeignkeyid("同比");
  2362. resultList.add(benchmark);
  2363. }
  2364. }
  2365. }
  2366. public void getJz(String timetype, String foreigntype,List<Benchmark> resultList) throws Exception {
  2367. QueryWrapper<Benchmark> qw = new QueryWrapper<>();
  2368. qw.select("max(foreignkeyid) foreignkeyid," +
  2369. "sum(theoreticalpower) theoreticalpower," +
  2370. "sum(actualpower) actualpower," +
  2371. "sum(daynhgzssdl) daynhgzssdl," +
  2372. "sum(daynhwhssdl) daynhwhssdl," +
  2373. "sum(daynhxdssdl) daynhxdssdl," +
  2374. "sum(daynhqfdl) daynhqfdl," +
  2375. "sum(daynhcfdl) daynhcfdl," +
  2376. "CASE WHEN SUM ( theoreticalpower ) = 0 THEN 0 ELSE SUM ( actualpower ) / SUM ( theoreticalpower ) * 100 END AS windenergy," +
  2377. "CASE WHEN SUM ( theoreticalpower ) = 0 THEN 0 ELSE SUM ( daynhxdssdl ) / SUM ( theoreticalpower ) * 100 END AS powerlossrate," +
  2378. "CASE WHEN SUM ( theoreticalpower ) = 0 THEN 0 ELSE SUM ( daynhqfdl ) / SUM ( theoreticalpower ) * 100 END AS performancelossrate," +
  2379. "CASE WHEN SUM ( theoreticalpower ) = 0 THEN 0 ELSE SUM ( daynhgzssdl ) / SUM ( theoreticalpower ) * 100 END AS failurelossrate," +
  2380. "CASE WHEN SUM ( theoreticalpower ) = 0 THEN 0 ELSE SUM ( daynhwhssdl ) / SUM ( theoreticalpower ) * 100 END AS mainlossrate," +
  2381. "avg(resettimelyrate) resettimelyrate," +
  2382. "avg(statetransitionrate) statetransitionrate," +
  2383. "avg(eliminationrate) eliminationrate," +
  2384. "avg(comprehensiverate) comprehensiverate," +
  2385. "avg(windpoweraccuracy) windpoweraccuracy," +
  2386. "avg(agccurvefollowing) agccurvefollowing");
  2387. if (foreigntype.equals("风电")){
  2388. qw.like("foreignkeyid","_FDC");
  2389. }else {
  2390. qw.like("foreignkeyid","_GDC");
  2391. }
  2392. Date end = DateUtils.getYesterdayStart();
  2393. Date begin = end;
  2394. if (timetype.equals("日")){
  2395. begin = end;
  2396. }else if(timetype.equals("周")){
  2397. begin = DateUtils.getThisWeekMonday(end);
  2398. }else if(timetype.equals("月")){
  2399. begin = DateUtils.getFirstAndLastDayOfMonth(end);
  2400. }else if(timetype.equals("季")){
  2401. begin = DateUtils.getSeasonStartDate(end);
  2402. }else if(timetype.equals("年")){
  2403. begin = DateUtils.getYearBegin(end);
  2404. }
  2405. begin = DateUtils.addYears(begin,-5);
  2406. end = DateUtils.addYears(end,-5);
  2407. qw.ge("recorddate",begin).le("recorddate",end);
  2408. List<Benchmark> jzList = benchmarkService.list(qw);
  2409. if (StringUtils.isNotNull(jzList) && StringUtils.isNotEmpty(jzList)){
  2410. jzList.get(0).setForeignkeyid("基准");
  2411. resultList.add(jzList.get(0));
  2412. }
  2413. }
  2414. /**
  2415. * 对标首页上面部分
  2416. * @param timetype
  2417. * @param foreigntype
  2418. * @return
  2419. */
  2420. public List<Benchmark> dbmaintop(String timetype, String foreigntype) throws Exception {
  2421. List<Benchmark> resultList = new ArrayList<>();
  2422. getSj(timetype,foreigntype,resultList);
  2423. getHb(timetype,foreigntype,resultList);
  2424. getTb(timetype,foreigntype,resultList);
  2425. getJz(timetype,foreigntype,resultList);
  2426. return resultList;
  2427. }
  2428. }