Przeglądaj źródła

单机性能分析中的风机日详细情况优化

wangb 2 dni temu
rodzic
commit
fe25201e76

+ 45 - 3
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/goodness/WindturbineGoodnessDetailController.java

@@ -1,5 +1,6 @@
 package com.gyee.runeconomy.controller.goodness;
 
+import cn.hutool.core.util.NumberUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.util.DateUtils;
 import com.gyee.common.vo.benchmark.ValueVo;
@@ -22,6 +23,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 
 /**
@@ -67,6 +71,11 @@ public class WindturbineGoodnessDetailController {
         if (StringUtils.notEmp(wtId) && StringUtils.notEmp(recorddate)) {
 
             Date date = DateUtils.parseDate(recorddate);
+            LocalDate localDate = LocalDate.parse(recorddate, DateTimeFormatter.ISO_LOCAL_DATE);
+            LocalDate firstOfMonth = localDate.withDayOfMonth(1);
+            Date firstDayOfMonth = Date.from(firstOfMonth.atStartOfDay(ZoneId.systemDefault()).toInstant());
+            LocalDate localdate2 = localDate.withDayOfYear(1);
+            Date firstDayOfYear = Date.from(localdate2.atStartOfDay(ZoneId.systemDefault()).toInstant());
             QueryWrapper<ProEconWtAlysisDay> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("record_date", date).eq("windturbine_id", wtId);
             List<ProEconWtAlysisDay> wtadls = proEconWtAlysisDayService.list(queryWrapper);
@@ -79,11 +88,44 @@ public class WindturbineGoodnessDetailController {
                 QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
                 qw.lambda().eq(TurbineInfoDay::getRecordDate, date).eq(TurbineInfoDay::getTurbineId, wtId);
                 List<TurbineInfoDay> turbineInfoDays = turbineInfoDayService.list(qw);
+
+                TurbineInfoDay ytb = turbineInfoDayService.getTurbineSingle(wtId, firstDayOfMonth, date);
+                TurbineInfoDay ntb = turbineInfoDayService.getTurbineSingle(wtId, firstDayOfYear, date);
+
                 TurbineInfoDay tb = turbineInfoDays.get(0);
-                wtday.setRfdl(Math.round((tb.getRfdl() / 1000) * 100.0) / 100.0);
-                wtday.setRyfdl(Math.round((tb.getLlfdl() / 1000) * 100.0) / 100.0);
-                wtday.setNpjfs(tb.getPjfs());
+                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.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());
+                wtday.setRzdxs(NumberUtil.round(tb.getLxMin() / 60, 2).doubleValue());
+                wtday.setRyxfs(NumberUtil.round(tb.getYxfss(), 2).doubleValue());
+                wtday.setRssdl(NumberUtil.round((tb.getGzss() + tb.getSlss() + tb.getXdss() + tb.getJhjxss() + tb.getFjhjxss() + tb.getXnss()) / 1000, 2).doubleValue());
+                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.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.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.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.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.setNyxfs(NumberUtil.round(ntb.getYxfss(), 2).doubleValue());
             }
+
         }
         if (null != wtday) {
             return R.data(ResultMsg.ok(wtday));

+ 3 - 2
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/TurbineInfoDayServiceImpl.java

@@ -37,8 +37,9 @@ public class TurbineInfoDayServiceImpl extends ServiceImpl<TurbineInfoDayMapper,
         QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
         qw.eq("turbine_id", turbineId)
                 .between("record_date", startDate, endDate)
-                .groupBy("turbine_id",
-                        "to_char(record_date, 'yyyy-MM')" )
+                .groupBy("turbine_id"
+//                        ,"to_char(record_date, 'yyyy-MM')"
+                )
                 .orderByAsc("turbine_id")
                 .select(
                         "turbine_id",

+ 11 - 9
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/homepage/EconomyPointHomePageService.java

@@ -1707,27 +1707,29 @@ public class EconomyPointHomePageService {
         Map<String, Object> allmap = new HashMap<>();
         PlanDataVo pd = new PlanDataVo();
         Double week = weekFdlCal();
-        pd.setZfdlsj(week);
+        pd.setZfdlsj(NumberUtil.round(week,2).doubleValue());
         String s = year + "-" + month;
         BigDecimal monCache = yfdlCal.get(s);
-        pd.setYfdlsj(monCache.add(new BigDecimal(rfdl)).doubleValue());
+//        pd.setYfdlsj(monCache.add(new BigDecimal(rfdl)).doubleValue());
+        pd.setYfdlsj(NumberUtil.round(monCache.add(new BigDecimal(rfdl)).doubleValue(),2).doubleValue());
         BigDecimal yearCache = nfdlCal.get(year);
-        pd.setNfdlsj(yearCache.add(new BigDecimal(rfdl)).doubleValue());
+//        pd.setNfdlsj(yearCache.add(new BigDecimal(rfdl)).doubleValue());
+        pd.setNfdlsj(NumberUtil.round(yearCache.add(new BigDecimal(rfdl)).doubleValue(),2).doubleValue());
 
         //计划发电量
         pd.setZfdljh(NumberUtil.round(yjh / 4, 0).doubleValue());
         pd.setYfdljh(NumberUtil.round(yjh, 0).doubleValue());
         Double zjd = calDivide(pd.getZfdlsj(), pd.getZfdljh());
-        pd.setZjd(zjd * 100);
-        pd.setZwcl(zjd);
+        pd.setZjd(NumberUtil.round(zjd * 100,2).doubleValue());
+        pd.setZwcl(NumberUtil.round(zjd,2).doubleValue());
         Double yjd = calDivide(pd.getYfdlsj(), pd.getYfdljh());
-        pd.setYjd(yjd * 100);
-        pd.setYwcl(yjd);
+        pd.setYjd(NumberUtil.round(yjd * 100,2).doubleValue());
+        pd.setYwcl(NumberUtil.round(yjd,2).doubleValue());
 
         pd.setNfdljh(NumberUtil.round(njh, 0).doubleValue());
         Double njd = calDivide(pd.getNfdlsj(), pd.getNfdljh());
-        pd.setNjd(njd * 100);
-        pd.setNwcl(njd);
+        pd.setNjd(NumberUtil.round(njd * 100,2).doubleValue());
+        pd.setNwcl(NumberUtil.round(njd,2).doubleValue());
         allmap.put("planData", pd);
 
         QueryWrapper<TurbineInfoDay> qw2 = new QueryWrapper<>();