Quellcode durchsuchen

单机性能分析bug修复

wangb vor 2 Wochen
Ursprung
Commit
636b74757b

+ 50 - 8
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/SingleAnalysisController.java

@@ -1,6 +1,7 @@
 package com.gyee.runeconomy.controller;
 
 
+import cn.hutool.core.util.NumberUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -80,7 +81,49 @@ public class SingleAnalysisController {
         IPage<TurbineInfoDay> page = new Page<>(pageNum, pageSize);
         IPage<TurbineInfoDay> page1 = turbineInfoDayService.page(page, qw);
         Map<String, TurbineInfoDay> dayMap = page1.getRecords().stream().collect(Collectors.toMap(TurbineInfoDay::getTurbineId, Function.identity()));
-        subList.forEach(sav->{
+        List<SingleAnalysisVo> subList2 = subList.stream().filter(s -> null != s.getWindturbineid()).collect(Collectors.toList());
+        List<SingleAnalysisVo> subList3 = subList.stream().filter(s -> null == s.getWindturbineid()).collect(Collectors.toList());
+        if (subList3.size() == 1) {
+            List<TurbineInfoDay> list = turbineInfoDayService.list(qw);
+            SingleAnalysisVo sav = subList3.get(0);
+            double fdl = list.stream().mapToDouble(TurbineInfoDay::getRfdl).sum();
+            sav.setFdl(fdl);
+            double fs = list.stream().mapToDouble(TurbineInfoDay::getPjfs).average().orElse(0.0);
+            sav.setFs(NumberUtil.round(fs,2).doubleValue());
+            double gzss = list.stream().mapToDouble(TurbineInfoDay::getGzss).sum();
+            sav.setGzss(gzss);
+            double jxss = list.stream().mapToDouble(TurbineInfoDay::getJhjxss).sum();
+            sav.setJxss(jxss);
+            double xdss = list.stream().mapToDouble(TurbineInfoDay::getXdss).sum();
+            sav.setXdss(xdss);
+            double xnss = list.stream().mapToDouble(TurbineInfoDay::getXnss).sum();
+            sav.setXnss(xnss);
+            double slss = list.stream().mapToDouble(TurbineInfoDay::getSlss).sum();
+            sav.setSlss(slss);
+            double llfdl = list.stream().mapToDouble(TurbineInfoDay::getLlfdl).sum();
+            sav.setLlfdl(llfdl);
+            double gzmin = list.stream().mapToDouble(TurbineInfoDay::getGzMin).sum();
+            sav.setGzxs(NumberUtil.round(gzmin / 60, 2).doubleValue());
+            double jxmin = list.stream().mapToDouble(TurbineInfoDay::getJxMin).sum();
+            sav.setJxxs(NumberUtil.round(jxmin / 60, 2).doubleValue());
+            double tjmin = list.stream().mapToDouble(TurbineInfoDay::getTjMin).sum();
+            sav.setTjxs(NumberUtil.round(tjmin / 60, 2).doubleValue());
+            double yxmin = list.stream().mapToDouble(TurbineInfoDay::getYxMin).sum();
+            sav.setYxxs(NumberUtil.round(yxmin / 60, 2).doubleValue());
+            double djmin = list.stream().mapToDouble(TurbineInfoDay::getDjMin).sum();
+            sav.setDjxs(NumberUtil.round(djmin / 60, 2).doubleValue());
+            double lyxs = list.stream().mapToDouble(TurbineInfoDay::getLyxs).sum();
+            sav.setLyxs(lyxs);
+            double sbklyl = list.stream().mapToDouble(TurbineInfoDay::getKlyl).average().orElse(0.0);
+            sav.setSbklyl(NumberUtil.round(sbklyl,2).doubleValue());
+            double xfqrfs = list.stream().mapToDouble(TurbineInfoDay::getXfqrfs).average().orElse(0.0);
+            sav.setXfqr(NumberUtil.round(xfqrfs,2).doubleValue());
+            double yxfss = list.stream().mapToDouble(TurbineInfoDay::getYxfss).sum();
+            sav.setYxfss(yxfss);
+            double jfpl = list.stream().mapToDouble(TurbineInfoDay::getJfpl).sum();
+            sav.setJfpl(jfpl);
+        }
+        subList2.forEach(sav -> {
             TurbineInfoDay day = dayMap.get(sav.getWindturbineid());
             sav.setFdl(day.getRfdl());
             sav.setFs(day.getPjfs());
@@ -90,22 +133,21 @@ public class SingleAnalysisController {
             sav.setXnss(day.getXnss());
             sav.setSlss(day.getSlss());
             sav.setLlfdl(day.getLlfdl());
-            sav.setGzxs(day.getGzMin()/60);
-            sav.setJxxs(day.getJxMin()/60);
-            sav.setTjxs(day.getTjMin()/60);
-            sav.setYxxs(day.getYxMin()/60);
-            sav.setDjxs(day.getDjMin()/60);
+            sav.setGzxs(NumberUtil.round(day.getGzMin() / 60, 2).doubleValue());
+            sav.setJxxs(NumberUtil.round(day.getJxMin() / 60, 2).doubleValue());
+            sav.setTjxs(NumberUtil.round(day.getTjMin() / 60, 2).doubleValue());
+            sav.setYxxs(NumberUtil.round(day.getYxMin() / 60, 2).doubleValue());
+            sav.setDjxs(NumberUtil.round(day.getDjMin() / 60, 2).doubleValue());
             sav.setLyxs(day.getLyxs());
             sav.setSbklyl(day.getKlyl());
             //                    "dxklyxs": 26.0,
             //                    "rlxs": 384.0,
             sav.setXfqr(day.getXfqrfs());
-            sav.setGlyzxxs(day.getGlyzxxs());
+//            sav.setGlyzxxs(day.getGlyzxxs());
             sav.setYxfss(day.getYxfss());
             //                    "xfqrhgl": 24.14,
             //                    "fjrl": 2000.0,
             sav.setJfpl(day.getJfpl());
-            sav.setJfpl(day.getJfpl());
         });
 
         return R.data(ResultMsg.ok(map));