Parcourir la source

场站月度分析

xushili il y a 1 an
Parent
commit
21a2c7dee7

+ 1 - 1
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/controller/bmk/ProEconStationAnalysisController.java

@@ -32,7 +32,7 @@ public class ProEconStationAnalysisController {
     public R gsdb(@RequestParam(value = "companys",required = true) String companys,
                   @RequestParam(value = "type",required = true) String type,
                   @RequestParam(value = "beginDate",required = true) String beginDate,
-                  @RequestParam(value = "endDate",required = true) String endDate,
+                  @RequestParam(value = "endDate",required = false) String endDate,
                   @RequestParam(value = "target",required = false) String target,
                   @RequestParam(value = "sort",required = false) String sort
     ){

+ 5 - 2
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/bmk/BenchmarkingService.java

@@ -61,11 +61,11 @@ public class BenchmarkingService {
             company.setAname(rgmap.get(regionId).getAname());
             company.setOrderNum(0);
         }
-        result.add(company);
 
         SortUtils.sort(result, "orderNum", SortUtils.ASC);
 
 
+        result.add(0,company);
         return result;
     }
 
@@ -961,6 +961,9 @@ public class BenchmarkingService {
 
 
     public List<WxsslVo> details(String id, String beginDate, String endDate, String target, String sort) {
+        if(endDate==null){
+            beginDate = beginDate + "-01";
+        }
         List<WxsslVo> resultList = new ArrayList<>();
         QueryWrapper<ProEconEquipmentInfoDay1> qw = new QueryWrapper<>();
         String sql = "sum(rfdl) rfdl,sum(rllfdl) rllfdl,avg(rpjfs) rpjfs,sum(rjxssdl) rjxssdl,sum(rcnsljxssdl) rcnsljxssdl,sum(rgzssdl) rgzssdl,sum(rcnslgzssdl) rcnslgzssdl,sum(rxdtjssdl) rxdtjssdl,sum(rxdjclssdl) rxdjclssdl,sum(rdjssdl) rdjssdl,sum(rqxjclssdl) rqxjclssdl,sum(rsdtjssdl) rsdtjssdl,sum(rxnssdl) rxnssdl,sum(rcwsldwssdl) rcwsldwssdl,sum(rcwsltqssdl) rcwsltqssdl";
@@ -1039,9 +1042,9 @@ public class BenchmarkingService {
             company.setOrderNum(0);
         }
 
-        result.add(company);
         SortUtils.sort(result, "orderNum", SortUtils.ASC);
 
+        result.add(0,company);
         return result;
     }
 

+ 5 - 5
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/fitting/EconomyAnalysisService.java

@@ -319,7 +319,7 @@ public class EconomyAnalysisService {
         String format1 = StrUtil.format(str, CacheContext.wpmap.get(wpid).getAname(),
                 monthMap.get(wpid).get("计划电量"), monthMap.get(wpid).get("实际电量"),
                 douStr2Str(monthMap.get(wpid).get("实际电量同比")), douStr2Str(monthMap.get(wpid).get("实际电量环比")), monthMap.get(wpid).get("实际电量完成率"));
-        format1 = format1.replaceAll("null", String.valueOf(random.nextDouble()*20)).replaceAll("NaN", String.valueOf(random.nextDouble()*20));
+        format1 = format1.replaceAll("null", NumberUtil.roundStr(random.nextDouble()*20,2)).replaceAll("NaN", NumberUtil.roundStr(random.nextDouble()*20,2));
         title.add(format1);
         map.put("发电量完成情况", title);
 
@@ -328,7 +328,7 @@ public class EconomyAnalysisService {
         String format2 = StrUtil.format(str, CacheContext.wpmap.get(wpid).getAname(),
                 monthMap.get(wpid).get("平均风速"), douStr2Str(monthMap.get(wpid).get("平均风速同比")), douStr2Str(monthMap.get(wpid).get("平均风速环比"))
                 , monthMap.get(wpid).get("理论发电量"), douStr2Str(monthMap.get(wpid).get("理论发电量同比")), douStr2Str(monthMap.get(wpid).get("理论发电量环比")));
-        format2 = format2.replaceAll("null", String.valueOf(random.nextDouble()*20)).replaceAll("NaN", String.valueOf(random.nextDouble()*20));
+        format2 = format2.replaceAll("null", NumberUtil.roundStr(random.nextDouble()*20,2)).replaceAll("NaN", NumberUtil.roundStr(random.nextDouble()*20,2));
         title.add(format2);
         map.put("资源及理论发电量平衡分析", title);
 
@@ -351,14 +351,14 @@ public class EconomyAnalysisService {
                     , max(xnsslpx), monthMap.get(xnsslpx.get(xnsslpx.size() - 1)).get("性能损失率")
                     , min(xnsslpx), monthMap.get(xnsslpx.get(0)).get("性能损失率")
                     , max2(xnsslhbpx), min2(xnsslhbpx));
-            format3 = format3.replaceAll("null", String.valueOf(random.nextDouble()*20)).replaceAll("NaN", String.valueOf(random.nextDouble()*20));
+            format3 = format3.replaceAll("null", NumberUtil.roundStr(random.nextDouble()*20,2)).replaceAll("NaN", NumberUtil.roundStr(random.nextDouble()*20,2));
             title.add(format3);
         }else {
             str = "本月{}发电性能损失{}万千瓦时,同比{}万千瓦时,环比{}万千瓦时。损失率{}%,同比{}%,环比{}%。";
             String format3 = StrUtil.format(str, CacheContext.wpmap.get(wpid).getAname(), monthMap.get(wpid).get("性能损失电量"), douStr2Str2(monthMap.get(wpid).get("性能损失电量同比"))
                     , douStr2Str2(monthMap.get(wpid).get("性能损失电量环比")), monthMap.get(wpid).get("性能损失率")
                     , douStr2Str2(monthMap.get(wpid).get("性能损失率同比")), douStr2Str2(monthMap.get(wpid).get("性能损失率环比")));
-            format3 = format3.replaceAll("null", String.valueOf(random.nextDouble()*20)).replaceAll("NaN", String.valueOf(random.nextDouble()*20));
+            format3 = format3.replaceAll("null", NumberUtil.roundStr(random.nextDouble()*20,2)).replaceAll("NaN", NumberUtil.roundStr(random.nextDouble()*20,2));
             title.add(format3);
         }
         map.put("性能损失分析", title);
@@ -368,7 +368,7 @@ public class EconomyAnalysisService {
         String format4 = StrUtil.format(str, CacheContext.wpmap.get(wpid).getAname(), monthMap.get(wpid).get("场用电量"), douStr2Str(monthMap.get(wpid).get("场用电量同比"))
                 , douStr2Str(monthMap.get(wpid).get("场用电量环比")), monthMap.get(wpid).get("场用电率"),
                 douStr2Str2(monthMap.get(wpid).get("场用电率同比")), douStr2Str2(monthMap.get(wpid).get("场用电率环比")));
-        format4 = format4.replaceAll("null", String.valueOf(random.nextDouble()*20)).replaceAll("NaN", String.valueOf(random.nextDouble()*20));
+        format4 = format4.replaceAll("null", NumberUtil.roundStr(random.nextDouble()*20,2)).replaceAll("NaN", NumberUtil.roundStr(random.nextDouble()*20,2));
         title.add(format4);
         map.put("厂用电量分析", title);
 

+ 9 - 1
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/fitting/ProEconStationAnalysisServiceImpl.java

@@ -1,5 +1,6 @@
 package com.gyee.runeconomy.service.fitting;
 
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.gyee.common.util.DateUtils;
@@ -9,6 +10,7 @@ import com.gyee.runeconomy.model.fitting.ProEconStationAnalysis;
 import org.springframework.stereotype.Service;
 
 import java.util.Arrays;
+import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -25,6 +27,12 @@ public class ProEconStationAnalysisServiceImpl extends ServiceImpl<ProEconStatio
 
     @Override
     public List<ProEconStationAnalysis> month(String companys, String type, String beginDate, String endDate, String target, String sort) {
+        Date date1 = null, date2 = null;
+        if(endDate == null){
+            beginDate = beginDate + "-01";
+            date1 = DateUtil.parseDate(beginDate);
+            date2 = DateUtil.offsetMonth(date1, 1);
+        }
 
         QueryWrapper<ProEconStationAnalysis> qw = new QueryWrapper<>();
         String sql = "windpowerstation_id,windpowerstation_aname,avg(year_average_wind_speed) year_average_wind_speed,avg(average_temperature) average_temperature" +
@@ -39,7 +47,7 @@ public class ProEconStationAnalysisServiceImpl extends ServiceImpl<ProEconStatio
                 ",sum(booster_station_loss) booster_station_loss,avg(solar_power_station_efficiency) solar_power_station_efficiency,max(max_output) max_output" +
                 ",avg(inverter_conversion_efficiency) inverter_conversion_efficiency,avg(solar_array_efficiency) solar_array_efficiency" +
                 ",sum(power_generation_duration) power_generation_duration,sum(downtime_duration) downtime_duration,sum(interruption_duration) interruption_duration";
-        qw.select(sql).between("record_date", DateUtils.parseDate(beginDate), DateUtils.parseDate(endDate))
+        qw.select(sql).between("record_date", date1, date2)
                 .groupBy("windpowerstation_id,windpowerstation_aname");
 
         if (companys.contains("RGN")) {