GenerationService.java 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. //package com.gyee.generation.service;
  2. //
  3. //import com.gyee.common.model.PointData;
  4. //import com.gyee.common.util.DateUtils;
  5. //import com.gyee.generation.init.CacheContext;
  6. //import com.gyee.generation.model.auto.*;
  7. //import com.gyee.generation.util.realtimesource.EdosUtil;
  8. //import com.gyee.generation.util.realtimesource.IEdosUtil;
  9. //import org.springframework.stereotype.Service;
  10. //
  11. //import java.util.*;
  12. //import java.util.concurrent.atomic.AtomicReference;
  13. //
  14. ///**
  15. // * @ClassName : GenerationService
  16. // * @Author : xieshengjie
  17. // * @Date: 2022/2/28 15:23
  18. // * @Description :
  19. // */
  20. //@Service
  21. //public class GenerationService {
  22. //
  23. // private IEdosUtil edosUtil = new EdosUtil();
  24. //
  25. // public void saveGenerationDatas(){
  26. // List<Windpowerstation> wpls = CacheContext.wpls;
  27. // Map<String, List<Project>> wppromap = CacheContext.wppromap;
  28. // Map<String, List<Line>> prolinemap = CacheContext.prolinemap;
  29. // List<Meterpoint> meterpoints = CacheContext.meterpoints;
  30. // Map<String, Map<String, Windpowerstationpointnew>> wppointmap = CacheContext.wppointmap;
  31. // Date samedayZero = DateUtils.getSamedayZero();
  32. // Date monthFirstZero = DateUtils.getMonthFirstZero();
  33. // Date yearFirstZero = DateUtils.getYearFirstZero();
  34. // Date currentDate = DateUtils.getCurrentDate();
  35. // wpls.stream().forEach(wp->{
  36. // AtomicReference<Double> fcrfdl = new AtomicReference<>((double) 0);
  37. // AtomicReference<Double> fcyfdl = new AtomicReference<>((double) 0);
  38. // AtomicReference<Double> fcnfdl = new AtomicReference<>((double) 0);
  39. // wppromap.get(wp.getId()).stream().forEach(project -> {
  40. // AtomicReference<Double> qcrfdl = new AtomicReference<>(0.0);
  41. // AtomicReference<Double> qcyfdl = new AtomicReference<>(0.0);
  42. // AtomicReference<Double> qcnfdl = new AtomicReference<>(0.0);
  43. // prolinemap.get(project.getId()).stream().forEach(line -> {
  44. // Optional<Meterpoint> optionalMeterpoint = meterpoints.stream().filter(me -> me.getUniformcode().equals("ZXYG") && me.getMetertype().equals("进线") && me.getMetersort().equals("主")).findFirst();
  45. // if (optionalMeterpoint.isPresent()){
  46. // String pointid = optionalMeterpoint.get().getId();
  47. // Double real = 0.0;
  48. // Double sameday = 0.0;
  49. // Double month = 0.0;
  50. // Double year = 0.0;
  51. // try {
  52. // real = edosUtil.getRealData(pointid).getPointValueInDouble();
  53. // Optional<PointData> dayFirst = edosUtil.getHistoryDatasSnap(pointid, samedayZero.getTime() / 1000, samedayZero.getTime() / 1000, 1l, null).stream().findFirst();
  54. // if (dayFirst.isPresent()){
  55. // sameday = dayFirst.get().getPointValueInDouble();
  56. // }
  57. // Optional<PointData> monthFirst = edosUtil.getHistoryDatasSnap(pointid, monthFirstZero.getTime() / 1000, monthFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
  58. // if (monthFirst.isPresent()){
  59. // month = monthFirst.get().getPointValueInDouble();
  60. // }
  61. // Optional<PointData> yearFirst = edosUtil.getHistoryDatasSnap(pointid, yearFirstZero.getTime() / 1000, yearFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
  62. // if (yearFirst.isPresent()){
  63. // year = yearFirst.get().getPointValueInDouble();
  64. // }
  65. // Double magnification = optionalMeterpoint.get().getMagnification();
  66. // double xlrfdl = (real - sameday) * magnification;
  67. // qcrfdl.updateAndGet(v -> new Double((double) (v + xlrfdl)));
  68. // PointData r = new PointData();
  69. // r.setPointTime(currentDate.getTime());
  70. // r.setPointValue(String.valueOf(xlrfdl));
  71. // r.setPointValueInDouble(xlrfdl);
  72. // r.setEdnaId();
  73. // r.setPointName();
  74. //
  75. // double xlyfdl = (real - month) * magnification;
  76. // qcyfdl.updateAndGet(v -> new Double((double) (v + xlyfdl)));
  77. // PointData y = new PointData();
  78. // y.setPointTime(currentDate.getTime());
  79. // y.setPointValue(String.valueOf(xlyfdl));
  80. // y.setPointValueInDouble(xlyfdl);
  81. // y.setEdnaId();
  82. // y.setPointName();
  83. //
  84. // double xlnfdl = (real - year) * magnification;
  85. // qcnfdl.updateAndGet(v -> new Double((double) (v + xlnfdl)));
  86. // PointData n = new PointData();
  87. // n.setPointTime(currentDate.getTime());
  88. // n.setPointValue(String.valueOf(xlnfdl));
  89. // n.setPointValueInDouble(xlnfdl);
  90. // n.setEdnaId();
  91. // n.setPointName();
  92. // } catch (Exception e) {
  93. // e.printStackTrace();
  94. // }
  95. // }
  96. // });
  97. // fcrfdl.updateAndGet(v -> new Double((double) (v + qcrfdl.get())));
  98. // PointData r = new PointData();
  99. // r.setPointTime(currentDate.getTime());
  100. // r.setPointValue(String.valueOf(qcrfdl.get()));
  101. // r.setPointValueInDouble(qcrfdl.get());
  102. // r.setEdnaId();
  103. // r.setPointName();
  104. //
  105. // fcyfdl.updateAndGet(v -> new Double((double) (v + qcyfdl.get())));
  106. // PointData y = new PointData();
  107. // y.setPointTime(currentDate.getTime());
  108. // y.setPointValue(String.valueOf(qcyfdl.get()));
  109. // y.setPointValueInDouble(qcyfdl.get());
  110. // y.setEdnaId();
  111. // y.setPointName();
  112. //
  113. // fcnfdl.updateAndGet(v -> new Double((double) (v + qcnfdl.get())));
  114. // PointData n = new PointData();
  115. // n.setPointTime(currentDate.getTime());
  116. // n.setPointValue(String.valueOf(qcnfdl.get()));
  117. // n.setPointValueInDouble(qcnfdl.get());
  118. // n.setEdnaId();
  119. // n.setPointName();
  120. // });
  121. // PointData r = new PointData();
  122. // r.setPointTime(currentDate.getTime());
  123. // r.setPointValue(String.valueOf(fcrfdl.get()));
  124. // r.setPointValueInDouble(fcrfdl.get());
  125. // r.setEdnaId();
  126. // r.setPointName();
  127. //
  128. // PointData y = new PointData();
  129. // y.setPointTime(currentDate.getTime());
  130. // y.setPointValue(String.valueOf(fcyfdl.get()));
  131. // y.setPointValueInDouble(fcyfdl.get());
  132. // y.setEdnaId();
  133. // y.setPointName();
  134. //
  135. // PointData n = new PointData();
  136. // n.setPointTime(currentDate.getTime());
  137. // n.setPointValue(String.valueOf(fcnfdl.get()));
  138. // n.setPointValueInDouble(fcnfdl.get());
  139. // n.setEdnaId();
  140. // n.setPointName();
  141. // });
  142. // }
  143. //}