wangb hai 2 meses
pai
achega
c32f40b3e6

+ 13 - 12
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/SingleAnalysisController.java

@@ -65,12 +65,12 @@ public class SingleAnalysisController {
         int newyear = cal.get(Calendar.YEAR);
         int newmonth = cal.get(Calendar.MONTH) + 1;
         Date recordDate = null;
-        if (Integer.valueOf(year) == newyear && Integer.valueOf(month) == newmonth) {
+        if (Integer.parseInt(year) == newyear && Integer.parseInt(month) == newmonth) {
             cal.add(Calendar.DAY_OF_MONTH, -1);
             recordDate = DateUtils.truncate(cal.getTime());
         } else {
-            cal.set(Calendar.YEAR, Integer.valueOf(year));
-            cal.set(Calendar.MONTH, Integer.valueOf(month) - 1);
+            cal.set(Calendar.YEAR, Integer.parseInt(year));
+            cal.set(Calendar.MONTH, Integer.parseInt(month) - 1);
             cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
             recordDate = DateUtils.truncate(cal.getTime());
         }
@@ -142,11 +142,11 @@ public class SingleAnalysisController {
                 sum.setXnss(sum.getXnss() + day.getXnss());
                 sum.setSlss(sum.getSlss() + day.getSlss());
                 sum.setLlfdl(sum.getLlfdl() + day.getLlfdl());
-                sum.setGzMin(sum.getGzMin() + day.getGzMin() / 60);
-                sum.setJxMin(sum.getJxMin() + day.getJxMin() / 60);
-                sum.setXdss(sum.getTjMin() + day.getTjMin() / 60);
-                sum.setYxMin(sum.getYxMin() + day.getYxMin() / 60);
-                sum.setDjMin(sum.getDjMin() + day.getDjMin() / 60);
+                sum.setGzMin(sum.getGzMin() + day.getGzMin());
+                sum.setJxMin(sum.getJxMin() + day.getJxMin());
+                sum.setXdMin(sum.getTjMin() + day.getTjMin());
+                sum.setYxMin(sum.getYxMin() + day.getYxMin());
+                sum.setDjMin(sum.getDjMin() + day.getDjMin());
                 sum.setLyxs(sum.getLyxs() + day.getLyxs());
                 sum.setKlyl(sum.getKlyl() + day.getKlyl());
                 sum.setXfqrfs(sum.getXfqrfs() + day.getXfqrfs());
@@ -240,12 +240,12 @@ public class SingleAnalysisController {
             int newyear = cal.get(Calendar.YEAR);
             int newmonth = cal.get(Calendar.MONTH) + 1;
             Date recordDate = null;
-            if (Integer.valueOf(year) == newyear && Integer.valueOf(month) == newmonth) {
+            if (Integer.parseInt(year) == newyear && Integer.parseInt(month) == newmonth) {
                 cal.add(Calendar.DAY_OF_MONTH, -1);
                 recordDate = DateUtils.truncate(cal.getTime());
             } else {
-                cal.set(Calendar.YEAR, Integer.valueOf(year));
-                cal.set(Calendar.MONTH, Integer.valueOf(month) - 1);
+                cal.set(Calendar.YEAR, Integer.parseInt(year));
+                cal.set(Calendar.MONTH, Integer.parseInt(month) - 1);
                 cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
                 recordDate = DateUtils.truncate(cal.getTime());
             }
@@ -264,9 +264,10 @@ public class SingleAnalysisController {
 
             cal.add(Calendar.YEAR, -1);
             Date lastYear = DateUtils.truncate(cal.getTime());
+            LocalDate localDate = lastYear.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
 
             SingleAnalysisVo tqzb = singleAnalysisService.SingleAnalysisListByWtId(wtId, lastYear);
-            SingleAnalysisVo tqzbNew = singleAnalysisService.SingleAnalysisTurbineinfoday(wtId, lastYear.toString(), month, tqzb);
+            SingleAnalysisVo tqzbNew = singleAnalysisService.SingleAnalysisTurbineinfoday(wtId, String.valueOf(localDate.getYear()), month, tqzb);
 
             SingleAnalysisVo tbzb = singleAnalysisService.SingleAnalysisListByWtId(byzb, tqzb);
 

+ 13 - 6
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/goodness/WindturbineGoodnessDetailController.java

@@ -96,7 +96,7 @@ public class WindturbineGoodnessDetailController {
                 wtday.setRfdl(NumberUtil.round(tb.getRfdl() / 1000, 2).doubleValue());
                 wtday.setRyfdl(NumberUtil.round(tb.getLlfdl() / 1000, 2).doubleValue());
                 wtday.setRpjfs(NumberUtil.round(tb.getPjfs(), 2).doubleValue());
-                wtday.setRyxxs(NumberUtil.round(tb.getYxMin() / 60, 2).doubleValue());
+                wtday.setRyxxs(NumberUtil.round((tb.getYxMin() + tb.getXdMin()) / 60, 2).doubleValue());
                 wtday.setRjxxs(NumberUtil.round(tb.getTjMin() / 60, 2).doubleValue());
                 wtday.setRgzxs(NumberUtil.round(tb.getGzMin() / 60, 2).doubleValue());
                 wtday.setRdjxs(NumberUtil.round(tb.getDjMin() / 60, 2).doubleValue());
@@ -106,25 +106,29 @@ public class WindturbineGoodnessDetailController {
                 wtday.setRtjcs(NumberUtil.round(tb.getTjcs(), 2).doubleValue());
                 wtday.setRsbklyl(NumberUtil.round(tb.getKlyl(), 2).doubleValue());
                 wtday.setRpjwd(NumberUtil.round(tb.getHjwd(), 2).doubleValue());
+                wtday.setRbbhcs(NumberUtil.round(tb.getTjMin() / 60, 2).doubleValue());
                 wtday.setYfdl(NumberUtil.round(ytb.getRfdl() / 1000, 2).doubleValue());
                 wtday.setYyfdl(NumberUtil.round(ytb.getLlfdl() / 1000, 2).doubleValue());
                 wtday.setYpjfs(NumberUtil.round(ytb.getPjfs(), 2).doubleValue());
-                wtday.setYyxxs(NumberUtil.round(ytb.getYxMin() / 60, 2).doubleValue());
-                wtday.setYdjxs(NumberUtil.round(ytb.getTjMin() / 60, 2).doubleValue());
+                wtday.setYyxxs(NumberUtil.round((ytb.getYxMin() + ytb.getXdMin()) / 60, 2).doubleValue());
+                wtday.setYdjxs(NumberUtil.round(ytb.getDjMin() / 60, 2).doubleValue());
                 wtday.setYgzxs(NumberUtil.round(ytb.getGzMin() / 60, 2).doubleValue());
                 wtday.setYjxxs(NumberUtil.round(ytb.getJxMin() / 60, 2).doubleValue());
                 wtday.setYzdxs(NumberUtil.round(ytb.getLxMin() / 60, 2).doubleValue());
                 wtday.setYyxfs(NumberUtil.round(ytb.getYxfss(), 2).doubleValue());
                 wtday.setYtjcs(NumberUtil.round(ytb.getTjcs(), 2).doubleValue());
                 wtday.setYsbklyl(NumberUtil.round(ytb.getKlyl(), 2).doubleValue());
+                wtday.setYbbhcs(NumberUtil.round(ytb.getTjMin() / 60, 2).doubleValue());
                 wtday.setNfdl(NumberUtil.round(ntb.getRfdl() / 1000, 2).doubleValue());
                 wtday.setNyfdl(NumberUtil.round(ntb.getLlfdl() / 1000, 2).doubleValue());
                 wtday.setNpjfs(NumberUtil.round(ntb.getPjfs(), 2).doubleValue());
-                wtday.setNyxxs(NumberUtil.round(ntb.getYxMin() / 60, 2).doubleValue());
+                wtday.setNyxxs(NumberUtil.round((ntb.getYxMin() + ntb.getXdMin()) / 60, 2).doubleValue());
                 wtday.setNgzxs(NumberUtil.round(ntb.getGzMin() / 60, 2).doubleValue());
                 wtday.setNjxxs(NumberUtil.round(ntb.getJxMin() / 60, 2).doubleValue());
                 wtday.setNzdxs(NumberUtil.round(ntb.getTjMin() / 60, 2).doubleValue());
+                wtday.setNdjxs(NumberUtil.round(ntb.getDjMin() / 60, 2).doubleValue());
                 wtday.setNyxfs(NumberUtil.round(ntb.getYxfss(), 2).doubleValue());
+                wtday.setNbbhcs(NumberUtil.round(ntb.getTjMin() / 60, 2).doubleValue());
             }
 
         }
@@ -162,7 +166,7 @@ public class WindturbineGoodnessDetailController {
             Date beginDate = cal.getTime();
             cal.add(Calendar.DAY_OF_MONTH, 1);
             Date endDate = cal.getTime();
-            //            resultList = alarmsnapService.getWarningRecordsTop(tablepar, wtId, beginDate, endDate);
+//                        resultList = alarmsnapService.getWarningRecordsTop(tablepar, wtId, beginDate, endDate);
 
         }
         if (null != resultList) {
@@ -198,7 +202,10 @@ public class WindturbineGoodnessDetailController {
             int month = cal.get(Calendar.MONTH) + 1;
 
             QueryWrapper<ProEconWtCurveFittingMonth> queryWrapper = new QueryWrapper<>();
-            queryWrapper.eq("windturbine_id", wtId).eq("year", String.valueOf(year)).eq("month", String.valueOf(month));
+            queryWrapper.lambda().eq(ProEconWtCurveFittingMonth::getWindturbineId, wtId)
+                    .eq(ProEconWtCurveFittingMonth::getYear, String.valueOf(year))
+                    .eq(ProEconWtCurveFittingMonth::getMonth, String.valueOf(month))
+                    .orderByAsc(ProEconWtCurveFittingMonth::getSpeed);
 
             List<ProEconWtCurveFittingMonth> wcls = proEconWtCurveFittingMonthService.list(queryWrapper);
             //                    .stream().filter(i->

+ 6 - 4
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/goodness/WindturbinegoodnessService.java

@@ -123,9 +123,9 @@ public class WindturbinegoodnessService {
 
 
         // WindTurbineTestingPointAi2 fs = map.get(ContantXk.TPOINT_WT_PJFS);
-
+        List<PointData> sjglls = null;
         if (null != sjgl) {
-            List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 3600L);
+            sjglls = edosUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 3600L);
             if (!sjglls.isEmpty()) {
                 int count = 0;
                 double temp = 0;
@@ -164,6 +164,9 @@ public class WindturbinegoodnessService {
                         if (vos.get(i).getTime() <= DateUtils.now().getTime()) {
                             temp = bzglls.get(i).getPointValueInDouble();
                             if (Math.abs(temp) < 10000) {
+                                if (sjglls != null && sjglls.get(i).getPointValueInDouble() > temp) {
+                                    temp = sjglls.get(i).getPointValueInDouble();
+                                }
                                 vos.get(i).setValue2(StringUtils.round(temp, 2));// 保证功率
                             }
 
@@ -203,7 +206,6 @@ public class WindturbinegoodnessService {
 
         }
 
-
         return vos;
     }
 
@@ -810,7 +812,7 @@ public class WindturbinegoodnessService {
                             }
 
                         } else {
-                             vos.get(i-1).setTime(qfssls.get(i).getPointTime()*1000);
+                            vos.get(i - 1).setTime(qfssls.get(i).getPointTime() * 1000);
                             vos.get(i).setValue5(0d);// 欠发损失电量
                         }
 

+ 29 - 13
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/singleanalysis/SingleAnalysisService.java

@@ -1,5 +1,6 @@
 package com.gyee.runeconomy.service.singleanalysis;
 
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.NumberUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.model.StringUtils;
@@ -12,6 +13,8 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.time.ZoneId;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -1110,20 +1113,24 @@ public class SingleAnalysisService {
 
 
     public Map<String, List<SingleAnalysisVo>> SingleAnalysisListByWtIdDetiml(String wtId, Date beginDate, Date endDate) {
-
         Map<String, List<SingleAnalysisVo>> map = new HashMap<>();
         List<SingleAnalysisVo> fdlfsls = new ArrayList<>();
         List<SingleAnalysisVo> wsls = new ArrayList<>();
         List<SingleAnalysisVo> jfpldjsjls = new ArrayList<>();
         if (StringUtils.notEmp(wtId) && StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate)) {
-
+            LocalDate now = LocalDate.now();
+            int year = DateUtil.year(beginDate);
+            int month = DateUtil.month(beginDate);
+            if (year == now.getYear() && month + 1 == now.getMonthValue()) {
+                endDate = DateUtil.beginOfDay(Date.from(now.atStartOfDay(ZoneId.systemDefault()).toInstant()));
+            }
 
             Map<String, Map<Long, ProEconEquipmentInfoDay1>> day1map = new HashMap<>();
             Map<String, Map<Long, ProEconEquipmentInfoDay2>> day2map = new HashMap<>();
 
             QueryWrapper<ProEconEquipmentInfoDay1> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("windturbine_id", wtId).ge("record_date", beginDate)
-                    .le("record_date", endDate)
+                    .lt("record_date", endDate)
                     .orderByAsc("record_date");
             List<ProEconEquipmentInfoDay1> wtday1ls = proEconEquipmentInfoDay1Service.list(queryWrapper);
             if (!wtday1ls.isEmpty()) {
@@ -1141,8 +1148,9 @@ public class SingleAnalysisService {
             }
             QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper2 = new QueryWrapper<>();
             queryWrapper2.eq("windturbine_id", wtId).ge("record_date", beginDate)
-                    .le("record_date", endDate)
-                    .orderByAsc("record_date");;
+                    .lt("record_date", endDate)
+                    .orderByAsc("record_date");
+            ;
             List<ProEconEquipmentInfoDay2> wtday2ls = proEconEquipmentInfoDay2Service.list(queryWrapper2);
             if (!wtday2ls.isEmpty()) {
                 for (ProEconEquipmentInfoDay2 wtday2 : wtday2ls) {
@@ -1159,7 +1167,7 @@ public class SingleAnalysisService {
             }
             QueryWrapper<ProEconEquipmentInfoDay4> queryWrapper4 = new QueryWrapper<>();
             queryWrapper4.eq("windturbine_id", wtId).ge("record_date", beginDate)
-                    .le("record_date", endDate)
+                    .lt("record_date", endDate)
                     .orderByAsc("record_date");
             List<ProEconEquipmentInfoDay4> wtday4ls = proEconEquipmentInfoDay4Service.list(queryWrapper4);
             ProBasicEquipment wt = CacheContext.wtmap.get(wtId);
@@ -1285,22 +1293,22 @@ public class SingleAnalysisService {
         }
 
         List<TurbineInfoDay> turbineSingle = turbineInfoDayService.getTurbineSingleList(wtId, beginDate, endDate);
-        Map<Date, TurbineInfoDay> col= turbineSingle.stream().collect(Collectors.toMap(TurbineInfoDay::getRecordDate, Function.identity()));
+        Map<Date, TurbineInfoDay> col = turbineSingle.stream().collect(Collectors.toMap(TurbineInfoDay::getRecordDate, Function.identity()));
         List<SingleAnalysisVo> ff = map.get("ff").stream().collect(Collectors.toList());
         List<SingleAnalysisVo> ws = map.get("ws").stream().collect(Collectors.toList());
         List<SingleAnalysisVo> jd = map.get("jd").stream().collect(Collectors.toList());
         ff.forEach(f -> {
             TurbineInfoDay tb = col.get(f.getRecorddate());
-            f.setFdl(NumberUtil.round(tb.getRfdl() /1000 , 2).doubleValue());
+            f.setFdl(NumberUtil.round(tb.getRfdl() / 1000, 2).doubleValue());
             f.setFs(NumberUtil.round(tb.getPjfs(), 2).doubleValue());
         });
         ws.forEach(w -> {
             TurbineInfoDay tb = col.get(w.getRecorddate());
-            w.setSlss(NumberUtil.round(tb.getSlss() /1000, 2).doubleValue());
-            w.setXnss(NumberUtil.round(tb.getXnss() /1000, 2).doubleValue());
-            w.setXdss(NumberUtil.round(tb.getXdss() /1000, 2).doubleValue());
-            w.setJxss(NumberUtil.round(tb.getJhjxss() /1000, 2).doubleValue());
-            w.setGzss(NumberUtil.round(tb.getGzss() /1000, 2).doubleValue());
+            w.setSlss(NumberUtil.round(tb.getSlss() / 1000, 2).doubleValue());
+            w.setXnss(NumberUtil.round(tb.getXnss() / 1000, 2).doubleValue());
+            w.setXdss(NumberUtil.round(tb.getXdss() / 1000, 2).doubleValue());
+            w.setJxss(NumberUtil.round(tb.getJhjxss() / 1000, 2).doubleValue());
+            w.setGzss(NumberUtil.round(tb.getGzss() / 1000, 2).doubleValue());
         });
         jd.forEach(j -> {
             TurbineInfoDay tb = col.get(j.getRecorddate());
@@ -1574,10 +1582,16 @@ public class SingleAnalysisService {
 
 
     public SingleAnalysisVo SingleAnalysisTurbineinfoday(String wtId, String year, String month, SingleAnalysisVo byzb) {
+        LocalDate now=LocalDate.now();
+        int yearCurrent = now.getYear();
+        int monthCurrent = now.getMonthValue();
         String date = year + "-" + month;
         QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
         qw.lambda().eq(TurbineInfoDay::getTurbineId, wtId)
                 .apply("to_char(record_date,'YYYY-MM')='" + date + "'");
+        if (Integer.parseInt(year) == yearCurrent && Integer.parseInt(month) == monthCurrent) {
+            qw.lambda().lt(TurbineInfoDay::getRecordDate,now);
+        }
         List<TurbineInfoDay> list = turbineInfoDayService.list(qw);
         double rfdl = list.stream().mapToDouble(TurbineInfoDay::getRfdl).sum();
         byzb.setFdl(NumberUtil.round(rfdl / 1000, 2).doubleValue());
@@ -1609,6 +1623,8 @@ public class SingleAnalysisService {
         byzb.setLyxs(NumberUtil.round(sblyxs, 2).doubleValue());
         double sbklyl = list.stream().mapToDouble(TurbineInfoDay::getKlyl).average().orElse(0.0);
         byzb.setSbklyl(NumberUtil.round(sbklyl, 2).doubleValue());
+        double yxfss = list.stream().mapToDouble(TurbineInfoDay::getYxfss).sum();
+        byzb.setYxfss(NumberUtil.round(yxfss, 2).doubleValue());
         return byzb;
     }
 }