From 1231655a352410f9086895efaff185fb6f94c647 Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期四, 12 六月 2025 09:58:50 +0800 Subject: [PATCH] 蓄电池组1.2.5,1.2.6 --- src/main/java/com/whyc/service/BattInfService.java | 4 + src/main/java/com/whyc/service/BatttestdataInfService.java | 118 ++++++++++++++++++++++++++++++++------- src/main/java/com/whyc/controller/StatisticController.java | 12 ++++ src/main/java/com/whyc/mapper/BattInfMapper.java | 2 src/main/resources/mapper/BattInfMapper.xml | 16 +++++ 5 files changed, 130 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/whyc/controller/StatisticController.java b/src/main/java/com/whyc/controller/StatisticController.java index a071479..718d865 100644 --- a/src/main/java/com/whyc/controller/StatisticController.java +++ b/src/main/java/com/whyc/controller/StatisticController.java @@ -74,6 +74,18 @@ stic.setUid(uinf.getId()); return battTinfService.getDischr5Statistic(stic); } + @ApiOperation(value = "鏈勾搴﹀凡鏀剧數鏁伴噺缁熻鍙充晶鍥捐〃(1.2.5)") + @PostMapping("getDischr5Chart") + public Response getDischr5Chart(){ + User uinf= ActionUtil.getUser(); + return battTinfService.getDischr5Chart(uinf.getId()); + } + @ApiOperation(value = "鏈勾搴︽湭鏀剧數鏁伴噺缁熻鍙充晶鍥捐〃(1.2.6)") + @PostMapping("getDischr6Chart") + public Response getDischr6Chart(){ + User uinf= ActionUtil.getUser(); + return battTinfService.getDischr6Chart(uinf.getId()); + } @ApiOperation(value = "鏈勾搴︽湭鏀剧數鏁伴噺缁熻(1.2.6)") @PostMapping("getDischr6Statistic") diff --git a/src/main/java/com/whyc/mapper/BattInfMapper.java b/src/main/java/com/whyc/mapper/BattInfMapper.java index b214255..a291b1c 100644 --- a/src/main/java/com/whyc/mapper/BattInfMapper.java +++ b/src/main/java/com/whyc/mapper/BattInfMapper.java @@ -51,4 +51,6 @@ List<BattInf> getDischr6Statistic(@Param("stic") DisChargeStic stic); //鐢垫睜缁勭數姹犳�ц兘缁熻锛堟湭鏀剧數锛屼紭绉�锛屽姡鍖栵紝鎹熷潖锛夌粺璁�(1.2.8/9/10) List<BattInf> getPerformanceStatistic(@Param("stic") PerformanceStic stic); + //鏈勾搴﹀凡/鏈斁鐢垫暟閲忕粺璁″彸渚у浘琛�(1.2.5) + List<BattInf> getDischrChart(@Param("uid") Integer uid); } \ No newline at end of file diff --git a/src/main/java/com/whyc/service/BattInfService.java b/src/main/java/com/whyc/service/BattInfService.java index c027615..534ae58 100644 --- a/src/main/java/com/whyc/service/BattInfService.java +++ b/src/main/java/com/whyc/service/BattInfService.java @@ -469,4 +469,8 @@ public List<BattInf> getPerformanceStatistic(PerformanceStic stic) { return mapper.getPerformanceStatistic(stic); } + //鏈勾搴﹀凡/鏈斁鐢垫暟閲忕粺璁″彸渚у浘琛�(1.2.5) + public List<BattInf> getDischrChart(Integer uid) { + return mapper.getDischrChart(uid); + } } \ No newline at end of file diff --git a/src/main/java/com/whyc/service/BatttestdataInfService.java b/src/main/java/com/whyc/service/BatttestdataInfService.java index c1cea22..2c1f2f6 100644 --- a/src/main/java/com/whyc/service/BatttestdataInfService.java +++ b/src/main/java/com/whyc/service/BatttestdataInfService.java @@ -614,9 +614,6 @@ } //鏈勾搴﹀凡鏀剧數鏁伴噺缁熻(1.2.5) public Response getDischr5Statistic(DisChargeStic stic) { - Map<String, Object> map=new HashMap<>(); - //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪�� - setBanZuDefault(map); //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁� List<AppParam> paramList=appParamService.getHrParam(); Float badValue=0f; @@ -657,20 +654,9 @@ 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); - int dischargeNum=bz.getDischargeNum(); - bz.setDischargeNum(dischargeNum+1); - map.put(groupName,bz); - } + res.setTestStartTime(tinf.getTestStarttime()); res.setTestTimelong(tinf.getTestTimelong()); res.setTestCap(tinf.getTestCap()); @@ -698,8 +684,81 @@ } } PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); - return new Response().setIII(1,reslist.size()>0,pageInfo,map,"鏈勾搴﹀凡鏀剧數鏁伴噺缁熻"); + return new Response().setII(1,reslist.size()>0,pageInfo,"鏈勾搴﹀凡鏀剧數鏁伴噺缁熻"); + }//鏈勾搴﹀凡鏀剧數鏁伴噺缁熻鍙充晶鍥捐〃(1.2.5) + public Response getDischr5Chart(Integer uid) { + //鐝粍 + Map<String, Object> bzmap=new HashMap<>(); + //鎬ц兘 + Map<Integer, Integer> xnmap=new HashMap<>(); + xnmap.put(1,0); + xnmap.put(2,0); + xnmap.put(3,0); + xnmap.put(4,0); + //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪�� + setBanZuDefault(bzmap); + //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁� + List<AppParam> paramList=appParamService.getHrParam(); + Float badValue=0f; + Float damageValue=0f; + if(paramList!=null){ + for (AppParam param:paramList) { + if(param.getParamNamePsx().equals("batt_mon_deteriorate_val")){ + badValue=param.getParamValue(); + } + if(param.getParamNamePsx().equals("batt_mon_damage_val")){ + damageValue=param.getParamValue(); + } + + } + } + //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 + List<BattInf> binfList=battInfService.getDischrChart(uid); + if(binfList==null||binfList.size()==0){ + return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�"); + } + for (BattInf binf:binfList) { + //鏌ヨ鐢垫睜缁勬墍鍦ㄧ殑鐝粍 + String groupName=bjService.getGroupName(binf.getPowerId()); + //2.鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) + BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),null,null); + if(tinf==null){ + int value=xnmap.get(Capperformance.BATTSTATE_4.getStateId()); + xnmap.put(Capperformance.BATTSTATE_4.getStateId(),value+1); + if(!groupName.equals("none")){ + BanZu bz= (BanZu) bzmap.get(groupName); + int nochargeNum=bz.getNochargeNum(); + bz.setNochargeNum(nochargeNum+1); + bzmap.put(groupName,bz); + } + continue; + } + if(!groupName.equals("none")){ + BanZu bz= (BanZu) bzmap.get(groupName); + int dischargeNum=bz.getDischargeNum(); + bz.setDischargeNum(dischargeNum+1); + bzmap.put(groupName,bz); + } + 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); + if(grouprealCap>=moncapStd*badValue){ + int value=xnmap.get(Capperformance.BATTSTATE_1.getStateId()); + xnmap.put(Capperformance.BATTSTATE_1.getStateId(),value+1); + } + if(grouprealCap<=moncapStd*damageValue){ + int value=xnmap.get(Capperformance.BATTSTATE_3.getStateId()); + xnmap.put(Capperformance.BATTSTATE_3.getStateId(),value+1); + } + if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){ + int value=xnmap.get(Capperformance.BATTSTATE_2.getStateId()); + xnmap.put(Capperformance.BATTSTATE_2.getStateId(),value+1); + } + + } + return new Response().setIII(1,true,bzmap,xnmap,"鏈勾搴﹀凡鏀剧數鏁伴噺缁熻"); } + //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪�� private void setBanZuDefault(Map<String, Object> map) { List<Baojigroup> banZuList=bjService.getGroupList(); @@ -715,10 +774,6 @@ //鏈勾搴︽湭鏀剧數鏁伴噺缁熻(1.2.6) public Response getDischr6Statistic(DisChargeStic stic) { - Map<String, Object> map=new HashMap<>(); - //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪�� - setBanZuDefault(map); - //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 List<BattInf> binfList=battInfService.getDischr6Statistic(stic); if(binfList==null||binfList.size()==0){ @@ -750,6 +805,25 @@ reslist.add(res); } } + } + PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); + return new Response().setII(1,reslist.size()>0,pageInfo,"鏈勾搴︽湭鏀剧數鏁伴噺缁熻"); + } + //鏈勾搴︽湭鏀剧數鏁伴噺缁熻鍙充晶鍥捐〃(1.2.6) + public Response getDischr6Chart(Integer uid) { + Map<String, Object> map=new HashMap<>(); + //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪�� + setBanZuDefault(map); + //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 + List<BattInf> binfList=battInfService.getDischrChart(uid); + if(binfList==null||binfList.size()==0){ + return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�"); + } + for (BattInf binf:binfList) { + //鏌ヨ鐢垫睜缁勬墍鍦ㄧ殑鐝粍 + String groupName=bjService.getGroupName(binf.getPowerId()); + //2.鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) + BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),null,null); if(tinf==null){ if(!groupName.equals("none")){ BanZu bz= (BanZu) map.get(groupName); @@ -766,8 +840,7 @@ map.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().setII(1,true,map,"鏈勾搴﹀凡鏀剧數鏁伴噺缁熻鍙充晶鍥捐〃(1.2.5)"); } //2.鑾峰彇鐢垫睜缁勬湭鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) private void getNoDischargeData(Integer battgroupId, Date testStartTime, Date testEndTime, List<Integer> typeList, SticDischarge6Res res) { @@ -865,4 +938,5 @@ PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); return new Response().setII(1,reslist.size()>0,pageInfo,"鐢垫睜缁勭數姹犳�ц兘缁熻锛堟湭鏀剧數锛屼紭绉�锛屽姡鍖栵紝鎹熷潖锛夌粺璁�(1.2.8/9/10)"); } + } \ No newline at end of file diff --git a/src/main/resources/mapper/BattInfMapper.xml b/src/main/resources/mapper/BattInfMapper.xml index 1abbd67..6d8f68f 100644 --- a/src/main/resources/mapper/BattInfMapper.xml +++ b/src/main/resources/mapper/BattInfMapper.xml @@ -402,4 +402,20 @@ order by tb_batt_inf.dev_id asc,battgroup_id asc </where> </select> + <select id="getDischrChart" resultType="com.whyc.pojo.db_station.BattInf"> + select distinct tb_batt_inf.* + ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_station.tb_batt_inf,db_station.tb_station_inf + <where> + tb_batt_inf.station_id=tb_station_inf.station_id + <if test="uid>100"> + and tb_batt_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{uid} + ) + </if> + order by tb_batt_inf.dev_id asc,battgroup_id asc + </where> + </select> </mapper> \ No newline at end of file -- Gitblit v1.9.1