From fbd26bdd7e89693f86b71969a885779a9ab065a3 Mon Sep 17 00:00:00 2001
From: whyclxw <810412026@qq.com>
Date: 星期五, 13 六月 2025 14:27:48 +0800
Subject: [PATCH] 1.2.8/9/10电池组优秀劣化损坏统计修改

---
 src/main/java/com/whyc/service/BatttestdataInfService.java |   93 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 69 insertions(+), 24 deletions(-)

diff --git a/src/main/java/com/whyc/service/BatttestdataInfService.java b/src/main/java/com/whyc/service/BatttestdataInfService.java
index 378a4c7..c3320f3 100644
--- a/src/main/java/com/whyc/service/BatttestdataInfService.java
+++ b/src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -11,6 +11,7 @@
 import com.whyc.dto.Statistic.*;
 import com.whyc.factory.BattCapFactory;
 import com.whyc.mapper.BatttestdataInfMapper;
+import com.whyc.pojo.db_alarm.BattalarmData;
 import com.whyc.pojo.db_batt_testdata.BatttestdataId;
 import com.whyc.pojo.db_batt_testdata.BatttestdataInf;
 import com.whyc.pojo.db_param.AppParam;
@@ -55,6 +56,8 @@
 
     @Autowired(required = false)
     private PwrdevHistorydataIdService pwrHisdataIdService;
+
+
 
 
     //鑾峰彇鏈�鍚庝竴娆℃祴璇曟暟鎹苟璁$畻鍓╀綑瀹归噺
@@ -849,37 +852,78 @@
             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.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId()));
-                continue;
+            }else{
+                //鎵捐繖娆℃斁鐢电殑鏈�鍚庝竴绗旀暟鎹�
+                List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum());
+                if(idDataList==null||idDataList.size()==0){
+                    res.setRealCap(0f);
+                    res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId()));
+                }else{
+                    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);
+                    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()));
+                    }
+                }
             }
-            //鎵捐繖娆℃斁鐢电殑鏈�鍚庝竴绗旀暟鎹�
-            List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum());
-            if(idDataList==null||idDataList.size()==0){
+            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,"鐢垫睜缁勭數姹犳�ц兘缁熻锛堟湭鏀剧數锛屼紭绉�锛屽姡鍖栵紝鎹熷潖锛夌粺璁�(1.2.8/9/10)");
+    }
+    //鐢垫睜缁勭數姹犳�ц兘缁熻锛堝姡鍖�<鎸夌収鍗曚綋鐢靛帇+鍐呴樆缁熻>锛夌粺璁�(1.2.9)
+    public Response getPerVolAndRes9Statistic(PerformanceStic stic) {
+        //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍
+        List<BattInf> binfList=battInfService.getPerformanceStatistic(stic);
+        if(binfList==null||binfList.size()==0){
+            return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�");
+        }
+        List<PerformanceRes> reslist=new ArrayList<>();
+        for (BattInf binf:binfList) {
+            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.setProduct(binf.getProduct());
+            res.setInuseYear(ActionUtil.getDateYear(new Date())-ActionUtil.getDateYear(binf.getInuseTime()));
+            res.setMonvolstd(binf.getMonvolstd());
+            res.setMoncapstd(binf.getMoncapstd());
+            res.setMoncount(binf.getMoncount());
+            //2.鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數)
+            BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime());
+            if(tinf==null){
                 res.setRealCap(0f);
-                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId()));
-                continue;
+            }else{
+                //鎵捐繖娆℃斁鐢电殑鏈�鍚庝竴绗旀暟鎹�
+                List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum());
+                if(idDataList==null||idDataList.size()==0){
+                    res.setRealCap(0f);
+                }else{
+                    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);
+                    res.setRealCap(grouprealCap);
+                }
             }
-            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);
-            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)){
+            //鏌ヨ褰撳墠鐢垫睜缁勫綋鍓嶅崟浣撶數鍘嬫垨鑰呭崟浣撳唴闃讳綆浜庡叾鍗曚綋鐢靛帇鐨勪笅涓嬮檺鎴栭珮浜庝笂涓婇檺鍒ゅ畾褰撳墠鐢垫睜缁勫姡鍖�
+            int flag = rtdataService.getVolAndRes(binf.getBattgroupId());
+            if(flag==1){
                 res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
+                reslist.add(res);
             }
         }
         PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
@@ -919,4 +963,5 @@
         PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
         return new Response().setII(1,reslist.size()>0,pageInfo,"浼樿壇鐢垫簮鏁伴噺缁熻(1.2.7)");
     }
+
 }
\ No newline at end of file

--
Gitblit v1.9.1