From 1157cd6b7100bf001cdeac654eb4b9f7708cbf39 Mon Sep 17 00:00:00 2001
From: whyclxw <810412026@qq.com>
Date: 星期四, 19 六月 2025 16:12:34 +0800
Subject: [PATCH] 1.2.7优良电源统计

---
 src/main/java/com/whyc/service/BatttestdataInfService.java     |    8 +++++++-
 src/main/java/com/whyc/pojo/db_param/PowerPropertyParam.java   |    2 +-
 src/main/java/com/whyc/dto/Statistic/SticPwr7Res.java          |    2 +-
 src/main/java/com/whyc/service/PwrdevHistorydataIdService.java |   35 +++++++++++++++++++++++++++++++----
 4 files changed, 40 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/whyc/dto/Statistic/SticPwr7Res.java b/src/main/java/com/whyc/dto/Statistic/SticPwr7Res.java
index d844030..1f5d3b3 100644
--- a/src/main/java/com/whyc/dto/Statistic/SticPwr7Res.java
+++ b/src/main/java/com/whyc/dto/Statistic/SticPwr7Res.java
@@ -17,5 +17,5 @@
     private Date inuseTime;
     private String stationType;
     private String groupName;
-    private String performanceName;//鐢垫睜鎬ц兘锛�1浼樼锛�2鍔e寲锛�3鎹熷潖 4鏈斁鐢� 涓嶄紶鍏ㄩ儴
+    private String performanceName;//鐢垫睜鎬ц兘锛�1浼樼锛�2涓�鑸紝3棰勮 4涓ラ噸涓嶄紶鍏ㄩ儴
 }
\ No newline at end of file
diff --git a/src/main/java/com/whyc/pojo/db_param/PowerPropertyParam.java b/src/main/java/com/whyc/pojo/db_param/PowerPropertyParam.java
index 640e6c1..08c68d1 100644
--- a/src/main/java/com/whyc/pojo/db_param/PowerPropertyParam.java
+++ b/src/main/java/com/whyc/pojo/db_param/PowerPropertyParam.java
@@ -52,5 +52,5 @@
     private Float alarmLimithUpper;
 
     @TableField(exist = false)
-    private Float alarmLimithLowper;
+    private Float alarmLimitlLower;
 }
diff --git a/src/main/java/com/whyc/service/BatttestdataInfService.java b/src/main/java/com/whyc/service/BatttestdataInfService.java
index 219895b..89f956e 100644
--- a/src/main/java/com/whyc/service/BatttestdataInfService.java
+++ b/src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -973,7 +973,13 @@
                 res.setInuseTime(pinf.getPowerInuseTime());
                 Integer performance= pwrHisdataIdService.getPwrQuarter7(pinf.getPowerId(),pinf.getPowerType());
                 res.setPerformanceName(PwrCapperformanceEnum.getValue(performance));
-                reslist.add(res);
+                if(stic.getPerformance()==null){
+                    reslist.add(res);
+                }else{
+                    if(performance==stic.getPerformance()){
+                        reslist.add(res);
+                    }
+                }
             }
         }
         PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
diff --git a/src/main/java/com/whyc/service/PwrdevHistorydataIdService.java b/src/main/java/com/whyc/service/PwrdevHistorydataIdService.java
index c7a72a1..2c3e675 100644
--- a/src/main/java/com/whyc/service/PwrdevHistorydataIdService.java
+++ b/src/main/java/com/whyc/service/PwrdevHistorydataIdService.java
@@ -1,6 +1,7 @@
 package com.whyc.service;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.whyc.constant.PwrCapperformanceEnum;
 import com.whyc.dto.Real.CompareDto;
 import com.whyc.dto.Real.PwrHisRealAcInDto;
 import com.whyc.dto.Real.PwrHisRealDcoutInDto;
@@ -100,7 +101,7 @@
         Map<String,Float> paramValues=new HashMap<>();
         for (PowerPropertyParam param : paramList) {
             paramValues.put(param.getPropertyName()+"_upper", param.getBasisVal()*param.getAlarmLimithUpper());
-            paramValues.put(param.getPropertyName()+"_lower", param.getBasisVal()*param.getAlarmLimithLowper());
+            paramValues.put(param.getPropertyName()+"_lower", param.getBasisVal()*param.getAlarmLimitlLower());
             map.put(param.getPropertyName(), 0);
         }
         for (int i=0;i<datelist.size();i++) {
@@ -136,8 +137,9 @@
                 }
             }
         }
-
-        return 1;
+        //鍒ゆ柇浼樿壇鐢垫簮鎬ц兘
+        int pwrPerformence=judgePwrPerformence(map);
+        return pwrPerformence;
     }
     //鍒ゆ柇浼樿壇鐢垫簮鎬ц兘
     private Integer judgePwrPerformence(Map<String,Integer> map){
@@ -157,6 +159,31 @@
                 warningVal=appParam.getParamValue();
             }
         }
-        return 1;
+        Integer performance = PwrCapperformanceEnum.PWRSTATE_1.getStateId(); // 鍒濆鍖栦负鏈�浼樼瓑绾�
+        for (Map.Entry<String, Integer> entry : map.entrySet()) {
+            Integer level = evaluateValue(entry.getValue(), excellentVal, commonlyVal, warningVal);
+            // 鏍规嵁绛夌骇鎺掑簭纭畾褰撳墠鏄惁鏄渶宸瓑绾�
+            if (PwrCapperformanceEnum.PWRSTATE_4.getStateId()==level) {
+                performance = PwrCapperformanceEnum.PWRSTATE_4.getStateId();
+                return performance; // 涓�鏃﹀嚭鐜板樊锛岀洿鎺ヨ繑鍥�
+            } else if (PwrCapperformanceEnum.PWRSTATE_3.getStateId()==level && PwrCapperformanceEnum.PWRSTATE_4.getStateId()!=performance) {
+                performance = PwrCapperformanceEnum.PWRSTATE_3.getStateId();
+            } else if (PwrCapperformanceEnum.PWRSTATE_2.getStateId()==level &&(PwrCapperformanceEnum.PWRSTATE_3.getStateId()!=performance||PwrCapperformanceEnum.PWRSTATE_4.getStateId()!=performance)) {
+                performance = PwrCapperformanceEnum.PWRSTATE_2.getStateId();
+            }
+        }
+        return performance;
+    }
+    // 鍒ゆ柇鍗曚釜鍊肩殑绛夌骇
+    public  Integer evaluateValue(Integer value, Float excellentVal, Float commonlyVal, Float warningVal) {
+        if (value <= excellentVal) {
+            return PwrCapperformanceEnum.PWRSTATE_1.getStateId();
+        } else if (value <= commonlyVal&&value > excellentVal) {
+            return PwrCapperformanceEnum.PWRSTATE_2.getStateId();
+        } else if (value <= warningVal&&value > commonlyVal) {
+            return PwrCapperformanceEnum.PWRSTATE_3.getStateId();
+        } else {
+            return PwrCapperformanceEnum.PWRSTATE_4.getStateId();
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1