From a0a525d59f1cb3167a54af9309c8dab162e89005 Mon Sep 17 00:00:00 2001
From: whycxzp <glperry@163.com>
Date: 星期四, 12 六月 2025 19:23:32 +0800
Subject: [PATCH] 优化巡检和维修器件的图片路径

---
 src/main/java/com/whyc/service/BatttestdataInfService.java |  154 +++++++++++++++++++++++++++++++++------------------
 1 files changed, 100 insertions(+), 54 deletions(-)

diff --git a/src/main/java/com/whyc/service/BatttestdataInfService.java b/src/main/java/com/whyc/service/BatttestdataInfService.java
index c1cea22..19b4222 100644
--- a/src/main/java/com/whyc/service/BatttestdataInfService.java
+++ b/src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -17,6 +17,7 @@
 import com.whyc.pojo.db_ram_db.BattRtdata;
 import com.whyc.pojo.db_ram_db.BattRtstate;
 import com.whyc.pojo.db_station.BattInf;
+import com.whyc.pojo.db_station.PowerInf;
 import com.whyc.pojo.db_user.Baojigroup;
 import com.whyc.util.ActionUtil;
 import com.whyc.util.PageInfoUtils;
@@ -49,8 +50,11 @@
     @Autowired(required = false)
     private BaojigroupService bjService;
 
+    @Autowired(required = false)
+    private PowerInfService powerInfService;
 
-
+    @Autowired(required = false)
+    private PwrdevHistorydataIdService pwrHisdataIdService;
 
 
     //鑾峰彇鏈�鍚庝竴娆℃祴璇曟暟鎹苟璁$畻鍓╀綑瀹归噺
@@ -547,11 +551,11 @@
         List<TestDataDto> List3=new ArrayList<>();
         List<TestDataDto> List4=new ArrayList<>();
         List<TestDataDto> List5=new ArrayList<>();
-        map.put("1",List1);   //鏍稿鏀剧數
-        map.put("2",List2);   //鏍稿鍏呯數
-        map.put("3",List3);   //鐩戞祴鏀剧數
-        map.put("4",List4);   //鐩戞祴鍏呯數
-        map.put("5",List5);   //鍋滅數鏀剧數
+        map.put("鏍稿鏀剧數",List1);   //鏍稿鏀剧數
+        map.put("鏍稿鍏呯數",List2);   //鏍稿鍏呯數
+        map.put("鐩戞祴鏀剧數",List3);   //鐩戞祴鏀剧數
+        map.put("鐩戞祴鍏呯數",List4);   //鐩戞祴鍏呯數
+        map.put("鍋滅數鏀剧數",List5);   //鍋滅數鏀剧數
         QueryWrapper wrapper=new QueryWrapper();
         wrapper.eq("battgroup_id",battgroupId);
         wrapper.orderByDesc("test_starttime");
@@ -612,11 +616,18 @@
         }
         return new Response().setII(1,true,map,"鍘嗗彶娴嬭瘯璁板綍");
     }
-    //鏈勾搴﹀凡鏀剧數鏁伴噺缁熻(1.2.5)
+    //鏈勾搴﹀凡鏀剧數鏁伴噺缁熻(1.2.5)<鍙煡鐪嬪凡鏀剧數鏁版嵁>
     public Response getDischr5Statistic(DisChargeStic stic) {
-        Map<String,  Object> map=new HashMap<>();
+        //鐝粍
+        Map<String,  Object> bzmap=new HashMap<>();
+        //鎬ц兘
+        Map<String,  Integer> xnmap=new HashMap<>();
+        xnmap.put("浼樼",0);
+        xnmap.put("鍔e寲",0);
+        xnmap.put("鎹熷潖",0);
+        xnmap.put("鏈斁鐢�",0);
         //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪��
-        setBanZuDefault(map);
+        setBanZuDefault(bzmap);
         //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁�
         List<AppParam> paramList=appParamService.getHrParam();
         Float badValue=0f;
@@ -650,56 +661,55 @@
             //2.鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數)
             BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime());
             if(tinf==null){
-                res.setRealCap(0f);
-                res.setTestStartTime(ThreadLocalUtil.parse("1972-01-01 00:00:00",1));
-                res.setTestTimelong(0);
-                res.setTestCap(0f);
-                res.setStopReason("");
-                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId()));
-                res.setDisChargeType(2);
-                if(!groupName.equals("none")){
-                    BanZu bz= (BanZu) map.get(groupName);
-                    int nochargeNum=bz.getNochargeNum();
-                    bz.setNochargeNum(nochargeNum+1);
-                    map.put(groupName,bz);
-                }
                 continue;
             }
             if(!groupName.equals("none")){
-                BanZu bz= (BanZu) map.get(groupName);
+                BanZu bz= (BanZu) bzmap.get(groupName);
                 int dischargeNum=bz.getDischargeNum();
                 bz.setDischargeNum(dischargeNum+1);
-                map.put(groupName,bz);
+                bzmap.put(groupName,bz);
             }
             res.setTestStartTime(tinf.getTestStarttime());
             res.setTestTimelong(tinf.getTestTimelong());
             res.setTestCap(tinf.getTestCap());
             res.setStopReason(StopReasonEnum.getValue(tinf.getTestStoptype()));
+            if (tinf.getTestType() == 3) {
+                // 娴嬭瘯绫诲瀷涓烘斁鐢�
+                if (tinf.getTestStarttype() == 3) {
+                    res.setDischargeName("鏍稿鏀剧數");
+                } else if(tinf.getTestStarttype() == 4){
+                    res.setDischargeName("鍋滅數鏀剧數");
+                }else {
+                    res.setDischargeName("鐩戞祴鏀剧數");
+                }
+            }
+            res.setTestRecordCount(tinf.getTestRecordCount());
             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);
-            res.setDisChargeType(1);
+            //res.setDisChargeType(1);
             if(grouprealCap>=moncapStd*badValue){
                 res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()));
+                int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()));
+                xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()),value+1);
             }
             if(grouprealCap<=moncapStd*damageValue){
                 res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
+                int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
+                xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()),value+1);
             }
             if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){
                 res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
+                int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
+                xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()),value+1);
             }
-            if(stic.getDisChargeType()==null){
-                reslist.add(res);
-            }else{
-                if(res.getDisChargeType()==stic.getDisChargeType()){
-                    reslist.add(res);
-                }
-            }
+            reslist.add(res);
         }
         PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
-        return new Response().setIII(1,reslist.size()>0,pageInfo,map,"鏈勾搴﹀凡鏀剧數鏁伴噺缁熻");
+        return new Response().setIIII(1,reslist.size()>0,pageInfo,bzmap,xnmap,"鏈勾搴﹀凡鏀剧數鏁伴噺缁熻");
     }
+
     //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪��
     private void setBanZuDefault(Map<String, Object> map) {
         List<Baojigroup> banZuList=bjService.getGroupList();
@@ -715,10 +725,10 @@
 
     //鏈勾搴︽湭鏀剧數鏁伴噺缁熻(1.2.6)
     public Response getDischr6Statistic(DisChargeStic stic) {
-        Map<String,  Object> map=new HashMap<>();
+        //鐝粍
+        Map<String,  Object> bzmap=new HashMap<>();
         //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪��
-        setBanZuDefault(map);
-
+        setBanZuDefault(bzmap);
         //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍
         List<BattInf> binfList=battInfService.getDischr6Statistic(stic);
         if(binfList==null||binfList.size()==0){
@@ -740,9 +750,6 @@
             res.setProduct(binf.getProduct());
             //鑾峰彇鐢垫睜缁勬湭鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數)
             getNoDischargeData(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime(),stic.getTypeList(),res);
-            //2.鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數)
-            BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime());
-            res.setTinf(tinf);
             if(stic.getStopReasonType()==0){
                 reslist.add(res);
             }else {
@@ -750,24 +757,15 @@
                     reslist.add(res);
                 }
             }
-            if(tinf==null){
-                if(!groupName.equals("none")){
-                    BanZu bz= (BanZu) map.get(groupName);
-                    int nochargeNum=bz.getNochargeNum();
-                    bz.setNochargeNum(nochargeNum+1);
-                    map.put(groupName,bz);
-                }
-                continue;
-            }
             if(!groupName.equals("none")){
-                BanZu bz= (BanZu) map.get(groupName);
-                int dischargeNum=bz.getDischargeNum();
-                bz.setDischargeNum(dischargeNum+1);
-                map.put(groupName,bz);
+                BanZu bz= (BanZu) bzmap.get(groupName);
+                int nochargeNum=bz.getNochargeNum();
+                bz.setNochargeNum(nochargeNum+1);
+                bzmap.put(groupName,bz);
             }
         }
         PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
-        return new Response().setIII(1,reslist.size()>0,pageInfo,map,"鏈勾搴︽湭鏀剧數鏁伴噺缁熻");
+        return new Response().setIII(1,reslist.size()>0,pageInfo,bzmap,"鏈勾搴︽湭鏀剧數鏁伴噺缁熻");
     }
     //2.鑾峰彇鐢垫睜缁勬湭鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數)
     private void getNoDischargeData(Integer battgroupId, Date testStartTime, Date testEndTime, List<Integer> typeList, SticDischarge6Res res) {
@@ -776,7 +774,21 @@
         if(tinfList!=null&&tinfList.size()>0){
             res.setErrorNum(tinfList.size());
             res.setStopReasonType(1);
-            for (BatttestdataInf tinf:tinfList) {
+            for (int i=0;i<tinfList.size();i++) {
+                BatttestdataInf tinf=tinfList.get(i);
+                if(i==0){
+                   res.setTestRecordCount(tinf.getTestRecordCount());
+                   if (tinf.getTestType() == 3) {
+                        // 娴嬭瘯绫诲瀷涓烘斁鐢�
+                        if (tinf.getTestStarttype() == 3) {
+                            res.setDischargeName("鏍稿鏀剧數");
+                        } else if(tinf.getTestStarttype() == 4){
+                            res.setDischargeName("鍋滅數鏀剧數");
+                        }else {
+                            res.setDischargeName("鐩戞祴鏀剧數");
+                        }
+                   }
+                }
                 String stopReason=StopReasonEnum.getValue(tinf.getTestStoptype());
                 stopList.add(stopReason);
             }
@@ -865,4 +877,38 @@
         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.7)
+    public Response getPwr7Statistic(Pwr7Stic stic) {
+        //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍
+        List<PowerInf> pinfList=powerInfService.getPwr7Statistic(stic);
+        if(pinfList==null||pinfList.size()==0){
+            return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�");
+        }
+        List<SticPwr7Res> reslist=new ArrayList<>();
+        for (PowerInf pinf:pinfList) {
+            SticPwr7Res res=new SticPwr7Res();
+            //鏌ヨ鐢垫睜缁勬墍鍦ㄧ殑鐝粍
+            String groupName = bjService.getGroupName(pinf.getPowerId());
+            if(groupName.equals("none")){
+                continue;
+            }else{
+                if(stic.getGroupName()==null||res.getGroupName()==stic.getGroupName()){
+                    res.setProvice(pinf.getProvice());
+                    res.setCity(pinf.getCity());
+                    res.setCountry(pinf.getCountry());
+                    res.setStationName(pinf.getStationName());
+                    res.setPowerName(pinf.getPowerName());
+                    res.setCompany(pinf.getCompany());
+                    res.setStationType(pinf.getStationType());
+                    res.setGroupName(groupName);
+                    res.setInuseTime(pinf.getPowerInuseTime());
+                    Map<String,Integer> map=pwrHisdataIdService.getPwrQuarter7(pinf.getPowerId(),null);
+                    reslist.add(res);
+                }
+            }
+        }
+
+        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