Browse Source

经济运行报告bug修复

王波 1 month ago
parent
commit
03a06d9a12

+ 32 - 20
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/EarlyWarning/ReportService.java

@@ -76,7 +76,7 @@ public class ReportService {
                 .sum(); // 去年同期理论发电量
 
 
-        double currentWindSpeed =  new BigDecimal(
+        double currentWindSpeed = new BigDecimal(
                 turbineList.stream()
                         .mapToDouble(t -> t.getPjfs() == null ? 0 : t.getPjfs().doubleValue())
                         .average()
@@ -84,7 +84,7 @@ public class ReportService {
         ).setScale(2, RoundingMode.HALF_UP)
                 .doubleValue();// 本月平均风速
 
-        double lastYearWindSpeed =  new BigDecimal(
+        double lastYearWindSpeed = new BigDecimal(
                 tqturbineList.stream()
                         .mapToDouble(t -> t.getPjfs() == null ? 0 : t.getPjfs().doubleValue())
                         .average()
@@ -93,8 +93,9 @@ public class ReportService {
                 .doubleValue(); // 去年同期平均风速
 
 
-        double currentUtilization = DoubleUtils.getRoundingNum(currentPower / sbrl,0); // 本月利用小时
-        double lastYearUtilization = DoubleUtils.getRoundingNum(lastYearPower / sbrl,0);; // 去年同期利用小时
+        double currentUtilization = DoubleUtils.getRoundingNum(currentPower / sbrl, 0); // 本月利用小时
+        double lastYearUtilization = DoubleUtils.getRoundingNum(lastYearPower / sbrl, 0);
+        ; // 去年同期利用小时
 
         //计划运行时间
         int jhyxsj = daysInMonth * 24;
@@ -108,8 +109,15 @@ public class ReportService {
                 .mapToDouble(t -> t.getYxMin() == null ? 0 : Math.round(t.getYxMin().doubleValue() * 100.0) / 100.0)
                 .sum();
 
-        double currentEquipmentUtilization = yxsj / jhyxsj * 100; // 本月设备可利用率
-        double lastYearEquipmentUtilization = tqyxsj / tqjhyxsj * 100; // 去年同期设备可利用率
+        // 计算本月设备可利用率
+        double currentEquipmentUtilization = yxsj / jhyxsj * 100;
+        // 格式化保留两位小数
+        currentEquipmentUtilization = Double.parseDouble(String.format("%.2f", currentEquipmentUtilization));
+
+        // 计算去年同期设备可利用率
+        double lastYearEquipmentUtilization = tqyxsj / tqjhyxsj * 100;
+        // 格式化保留两位小数
+        lastYearEquipmentUtilization = Double.parseDouble(String.format("%.2f", lastYearEquipmentUtilization));
 
         //检修时间
         double jxsj = turbineList.stream()
@@ -119,8 +127,11 @@ public class ReportService {
                 .mapToDouble(t -> t.getYxMin() == null ? 0 : Math.round(t.getYxMin().doubleValue() * 100.0) / 100.0)
                 .sum();
 
-        double currentEfficiencyCoefficient = (yxsj + jxsj) / jhyxsj * 100;; // 本月等效可用系数
+        double currentEfficiencyCoefficient = (yxsj + jxsj) / jhyxsj * 100;
+        currentEfficiencyCoefficient = Double.parseDouble(String.format("%.2f", currentEfficiencyCoefficient));
+        // 本月等效可用系数
         double lastYearEfficiencyCoefficient = (tqyxsj + tqjxsj) / tqjhyxsj * 100; // 去年同期等效可用系数
+        lastYearEfficiencyCoefficient = Double.parseDouble(String.format("%.2f", lastYearEfficiencyCoefficient));
 
 
         double currentSmallWindSpeed = new BigDecimal(
@@ -261,24 +272,24 @@ public class ReportService {
         result.add(createIndicatorData("待机时间", currentStandbyTime, lastYearStandbyTime));
         result.add(createIndicatorData("通讯中断时间", currentCommFailureTime, lastYearCommFailureTime));
         result.add(createIndicatorData("静风频率", currentCalmWindFrequency, lastYearCalmWindFrequency));
-        map.put("lb",result);
+        map.put("lb", result);
 
         double fdlzzl = calculateGrowthRate(currentPower, lastYearPower);//发电量增长率
         double ssdllj = currentFaultLossPower + currentDispatchLossPower + currentPlannedMaintenanceLossPower + currentPerformanceLossPower; //损失电量合计
         double tqssdllj = lastYearFaultLossPower + lastYearDispatchLossPower + lastYearPlannedMaintenanceLossPower + lastYearPerformanceLossPower;//同期损失电量合计
-        double ssdlzzl = calculateGrowthRate(ssdllj,tqssdllj);
-        double dlxc =DoubleUtils.getRoundingNum( currentPower - currentTheoryPower,2);
-        String wz1 = "本月"+ collect.get(0).getNemCode() +"风机设备利用小时数"+ currentUtilization +"小时、同比"+ lastYearUtilization +"小时," +
-                "设备可利用率"+ currentEquipmentUtilization +"%、同比"+ lastYearEquipmentUtilization +"%,等效可用系数"+ currentEfficiencyCoefficient +"%、同比"+ lastYearEfficiencyCoefficient +"%," +
-                "静风频率达到"+ currentCalmWindFrequency +"%、同比"+ lastYearCalmWindFrequency +"%。";
-        String wz2 = collect.get(0).getNemCode() +"风机"+ time +"月平均风速"+ currentWindSpeed +"m/s、同比"+ lastYearWindSpeed +"m/s,小风平均切入风速"+ currentSmallWindSpeed +"m/s、同比"+ lastYearSmallWindSpeed +"m/," +
-                "有效风时数"+ currentRunningWindHours +"小时、同比"+ lastYearRunningWindHours +"小时,实际发电电量"+ currentPower +"万kmh、同比"+ lastYearPower +"万kwh,同比增长率"+ fdlzzl +"%," +
-                "各项损失电量累计"+ ssdllj +"万kmh、同比"+ tqssdllj +"万kmh,同比增长率"+ ssdlzzl +"%," +
-                "理论发电量"+ currentTheoryPower +"万kwh,实际发电量与理论发电量相差"+ dlxc +"万kwh。";
-        map.put("wz1",wz1);
-        map.put("wz2",wz2);
+        double ssdlzzl = calculateGrowthRate(ssdllj, tqssdllj);
+        double dlxc = DoubleUtils.getRoundingNum(currentPower - currentTheoryPower, 2);
+        String wz1 = "本月" + collect.get(0).getNemCode() + "风机设备利用小时数" + currentUtilization + "小时、同比" + lastYearUtilization + "小时," +
+                "设备可利用率" + currentEquipmentUtilization + "%、同比" + lastYearEquipmentUtilization + "%,等效可用系数" + currentEfficiencyCoefficient + "%、同比" + lastYearEfficiencyCoefficient + "%," +
+                "静风频率达到" + currentCalmWindFrequency + "%、同比" + lastYearCalmWindFrequency + "%。";
+        String wz2 = collect.get(0).getNemCode() + "风机" + time + "月平均风速" + currentWindSpeed + "m/s、同比" + lastYearWindSpeed + "m/s,小风平均切入风速" + currentSmallWindSpeed + "m/s、同比" + lastYearSmallWindSpeed + "m/," +
+                "有效风时数" + currentRunningWindHours + "小时、同比" + lastYearRunningWindHours + "小时,实际发电电量" + currentPower + "万kmh、同比" + lastYearPower + "万kwh,同比增长率" + fdlzzl + "%," +
+                "各项损失电量累计" + ssdllj + "万kmh、同比" + tqssdllj + "万kmh,同比增长率" + ssdlzzl + "%," +
+                "理论发电量" + currentTheoryPower + "万kwh,实际发电量与理论发电量相差" + dlxc + "万kwh。";
+        map.put("wz1", wz1);
+        map.put("wz2", wz2);
         turbineList.sort(Comparator.comparing(TurbineInfoDay::getRecordDate));
-        map.put("tb",turbineList);
+        map.put("tb", turbineList);
 
         return map;
     }
@@ -290,6 +301,7 @@ public class ReportService {
         }
         return (current - lastYear) / lastYear;
     }
+
     // 定义一个方法来创建 IndicatorData
     private IndicatorData createIndicatorData(String name, double currentValue, double lastYearValue) {
         DecimalFormat df = new DecimalFormat("0.00%");