From 8315e45f60c80d6ca07ee0a8834ba47c595d0346 Mon Sep 17 00:00:00 2001
From: whyclxw <810412026@qq.com>
Date: 星期四, 05 六月 2025 09:39:14 +0800
Subject: [PATCH] 蓄电池组对比分析界面统计15,16,17

---
 src/main/java/com/whyc/service/BatttestdataInfService.java |  104 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 63 insertions(+), 41 deletions(-)

diff --git a/src/main/java/com/whyc/service/BatttestdataInfService.java b/src/main/java/com/whyc/service/BatttestdataInfService.java
index 10b27d3..f38297c 100644
--- a/src/main/java/com/whyc/service/BatttestdataInfService.java
+++ b/src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -264,6 +264,7 @@
             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.setMonvolstd(binf.getMonvolstd());
@@ -308,7 +309,7 @@
                 }
             }
             res.setMonNums(monNums);
-            if(stic.getPerformance()==0){
+            if(stic.getPerformance()==null){
                 reslist.add(res);
             }else{
                 if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){
@@ -351,6 +352,7 @@
             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.setMonvolstd(binf.getMonvolstd());
@@ -420,66 +422,86 @@
         }
         List<SticCompare17Res> reslist=new ArrayList<>();
         for (BattInf binf:binfList) {
-            SticCompare17Res res=new SticCompare17Res();
-            res.setProvice(binf.getProvice());
-            res.setCity(binf.getCity());
-            res.setCountry(binf.getCountry());
-            res.setStationName(binf.getStationName());
-            res.setBattgroupName(binf.getBattgroupName());
-            res.setProduct(binf.getProduct());
-            res.setInuseTime(binf.getInuseTime());
-            res.setMonvolstd(binf.getMonvolstd());
+
             //2.鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數)
             BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime());
-            /*if(tinf==null){
-                res.setMonrealCap(0f);
-                res.setMonprecentCap("0");
-                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
+            if(tinf==null){
+                //涓嶅瓨鍦ㄦ斁鐢佃褰曞垯榛樿涓哄疄闄呴浼板閲忓叏涓�0
+                setSticCompare17Res(binf,reslist,stic.getPerformance());
                 continue;
             }
             //鎵捐繖娆℃斁鐢电殑鏈�鍚庝竴绗旀暟鎹�
             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_3.getStateId()));
+                //涓嶅瓨鍦ㄦ斁鐢佃褰曞垯榛樿涓哄疄闄呴浼板閲忓叏涓�0
+                setSticCompare17Res(binf,reslist,stic.getPerformance());
                 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()));
-            }
-            if(grouprealCap<=moncapStd*damageValue){
-                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
-            }
-            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) {//姹傚崟浣撶殑 瀹為檯瀹归噺锛屾渶灏忓�煎氨鏄崟浣撶殑鍗曚綋鐢靛帇
+                SticCompare17Res res=new SticCompare17Res();
+                res.setProvice(binf.getProvice());
+                res.setCity(binf.getCity());
+                res.setCountry(binf.getCountry());
+                res.setStationName(binf.getStationName());
+                res.setDevName(binf.getDevName());
+                res.setBattgroupName(binf.getBattgroupName());
+                res.setProduct(binf.getProduct());
+                res.setInuseTime(binf.getInuseTime());
+                res.setMonvolstd(binf.getMonvolstd());
+                res.setMonNum(data.getMonNum());
                 Float monrealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), data.getMonVol(), tinf.getGroupVol(), BattCapFactory.CapType_Real);
+                res.setMonrealCap(monrealCap);
+                //淇濈暀5浣嶅皬鏁�
+                String monprecentCap = String.format("%.5f",(monrealCap/binf.getMoncapstd()*100));
+                res.setMonprecentCap(monprecentCap);
+                if(monrealCap>=moncapStd*badValue){
+                    res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()));
+                }
                 if (monrealCap <= moncapStd * damageValue) {//鎹熷潖鐨�
-                    monNums.add(data.getMonNum());
+                    res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                 }
-            }
-            res.setMonNums(monNums);
-            if(stic.getPerformance()==0){
-                reslist.add(res);
-            }else{
-                if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){
+                if((monrealCap>moncapStd*damageValue)&&(monrealCap<moncapStd*badValue)){
+                    res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
+                }
+                if(stic.getPerformance()==null){
                     reslist.add(res);
+                }else{
+                    if(res.getMoncapperformance().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,"钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰锛堝悓涓�鍝佺墝鍚屼竴鏃堕棿锛�");
     }
+    //涓嶅瓨鍦ㄦ斁鐢佃褰曞垯榛樿涓哄疄闄呴浼板閲忓叏涓�0
+    private void setSticCompare17Res( BattInf binf, List<SticCompare17Res> reslist,Integer performance) {
+        for (int i=0;i<binf.getMoncount();i++){
+            SticCompare17Res res=new SticCompare17Res();
+            res.setProvice(binf.getProvice());
+            res.setCity(binf.getCity());
+            res.setCountry(binf.getCountry());
+            res.setStationName(binf.getStationName());
+            res.setDevName(binf.getDevName());
+            res.setBattgroupName(binf.getBattgroupName());
+            res.setProduct(binf.getProduct());
+            res.setInuseTime(binf.getInuseTime());
+            res.setMonvolstd(binf.getMonvolstd());
+            res.setMonNum(i+1);
+            res.setMonrealCap(0f);
+            res.setMonprecentCap("0");
+            res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
+            if(performance==null){
+                reslist.add(res);
+            }else{
+                if(res.getMoncapperformance().equals(Capperformance.getValue(performance))){
+                    reslist.add(res);
+                }
+            }
+            reslist.add(res);
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.1