From 35764901d6a63ee5427ab2f07b76ca3827be3f43 Mon Sep 17 00:00:00 2001
From: whyclxw <810412026@qq.com>
Date: 星期二, 10 六月 2025 18:21:04 +0800
Subject: [PATCH] 电池组电池性能统计(未放电,优秀,劣化,损坏)统计(1.2.8/9/10)

---
 src/main/java/com/whyc/service/BatttestdataInfService.java |   50 ++++++++++++++++----------------------------------
 1 files changed, 16 insertions(+), 34 deletions(-)

diff --git a/src/main/java/com/whyc/service/BatttestdataInfService.java b/src/main/java/com/whyc/service/BatttestdataInfService.java
index 9f9835b..c1cea22 100644
--- a/src/main/java/com/whyc/service/BatttestdataInfService.java
+++ b/src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -18,6 +18,7 @@
 import com.whyc.pojo.db_ram_db.BattRtstate;
 import com.whyc.pojo.db_station.BattInf;
 import com.whyc.pojo.db_user.Baojigroup;
+import com.whyc.util.ActionUtil;
 import com.whyc.util.PageInfoUtils;
 import com.whyc.util.ThreadLocalUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -793,7 +794,7 @@
     }
     //鐢垫睜缁勭數姹犳�ц兘缁熻锛堟湭鏀剧數锛屼紭绉�锛屽姡鍖栵紝鎹熷潖锛夌粺璁�(1.2.8/9/10)
     public Response getPerformanceStatistic(PerformanceStic stic) {
-        /*//鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁�
+        //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁�
         List<AppParam> paramList=appParamService.getHrParam();
         Float badValue=0f;
         Float damageValue=0f;
@@ -809,31 +810,34 @@
             }
         }
         //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍
-        List<BattInf> binfList=battInfService.getBattCompare15Statistic(stic);
+        List<BattInf> binfList=battInfService.getPerformanceStatistic(stic);
         if(binfList==null||binfList.size()==0){
             return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�");
         }
-        List<SticCompare15Res> reslist=new ArrayList<>();
+        List<PerformanceRes> reslist=new ArrayList<>();
         for (BattInf binf:binfList) {
-            SticCompare15Res res=new SticCompare15Res();
+            PerformanceRes res=new PerformanceRes();
             res.setProvice(binf.getProvice());
             res.setCity(binf.getCity());
             res.setCountry(binf.getCountry());
             res.setStationName(binf.getStationName());
             res.setBattgroupName(binf.getBattgroupName());
-            res.setDevName(binf.getDevName());
             res.setProduct(binf.getProduct());
-            res.setInuseTime(binf.getInuseTime());
+            res.setInuseYear(ActionUtil.getDateYear(new Date())-ActionUtil.getDateYear(binf.getInuseTime()));
             res.setMonvolstd(binf.getMonvolstd());
-            res.setStationId(binf.getStationId());
-            res.setPowerId(binf.getPowerId());
-            res.setDevId(binf.getDevId());
-            res.setBattgroupId(binf.getBattgroupId());
+            res.setMoncapstd(binf.getMoncapstd());
+            res.setMoncount(binf.getMoncount());
             //2.鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數)
             BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime());
+            if(stic.getPerformance()==null){
+                reslist.add(res);
+            }else{
+                if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){
+                    reslist.add(res);
+                }
+            }
             if(tinf==null){
                 res.setRealCap(0f);
-                res.setPrecentCap("0");
                 res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId()));
                 continue;
             }
@@ -841,14 +845,12 @@
             List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum());
             if(idDataList==null||idDataList.size()==0){
                 res.setRealCap(0f);
-                res.setPrecentCap("0");
                 res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId()));
                 continue;
             }
             Float moncapStd=binf.getMoncapstd();
             int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr());
             Float grouprealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real);
-            //Float restCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest);
             res.setRealCap(grouprealCap);
             if(grouprealCap>=moncapStd*badValue){
                 res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()));
@@ -859,28 +861,8 @@
             if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){
                 res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
             }
-            //淇濈暀5浣嶅皬鏁�
-            String precentCap = String.format("%.5f",(grouprealCap/binf.getMoncapstd()*100));
-            res.setPrecentCap(precentCap);
-            List<Integer> monNums=new ArrayList<>();
-            for (BatttestdataId data:idDataList) {//姹傚崟浣撶殑 瀹為檯瀹归噺锛屾渶灏忓�煎氨鏄崟浣撶殑鍗曚綋鐢靛帇
-                Float monrealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), data.getMonVol(), tinf.getGroupVol(), BattCapFactory.CapType_Real);
-                if (monrealCap <= moncapStd * damageValue) {//鎹熷潖鐨�
-                    monNums.add(data.getMonNum());
-                }
-            }
-            res.setMonNums(monNums);
-            if(stic.getPerformance()==null){
-                reslist.add(res);
-            }else{
-                if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){
-                    reslist.add(res);
-                }
-            }
-
         }
         PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
-        return new Response().setII(1,reslist.size()>0,pageInfo,"钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰锛堝悓涓�鍝佺墝鍚屼竴鏃堕棿锛�");*/
-        return null;
+        return new Response().setII(1,reslist.size()>0,pageInfo,"鐢垫睜缁勭數姹犳�ц兘缁熻锛堟湭鏀剧數锛屼紭绉�锛屽姡鍖栵紝鎹熷潖锛夌粺璁�(1.2.8/9/10)");
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1