From a84916eb504db4bb18b9280cc8ab1c059824fb1e Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期一, 09 六月 2025 19:00:09 +0800 Subject: [PATCH] 统计1.2.5 --- src/main/java/com/whyc/service/BatttestdataInfService.java | 196 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 195 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/whyc/service/BatttestdataInfService.java b/src/main/java/com/whyc/service/BatttestdataInfService.java index bffa249..0f96191 100644 --- a/src/main/java/com/whyc/service/BatttestdataInfService.java +++ b/src/main/java/com/whyc/service/BatttestdataInfService.java @@ -16,7 +16,9 @@ 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_user.Baojigroup; import com.whyc.util.PageInfoUtils; +import com.whyc.util.ThreadLocalUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -41,6 +43,9 @@ @Autowired(required = false) private AppParamService appParamService; + + @Autowired(required = false) + private BaojigroupService bjService; @@ -437,7 +442,7 @@ } } //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 - List<BattInf> binfList=battInfService.getBattCompare15Statistic(stic); + List<BattInf> binfList=battInfService.getBattCompare17Statistic(stic); if(binfList==null||binfList.size()==0){ return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�"); } @@ -604,4 +609,193 @@ } return new Response().setII(1,true,map,"鍘嗗彶娴嬭瘯璁板綍"); } + //鏈勾搴﹀凡鏀剧數鏁伴噺缁熻(1.2.5) + public Response getDischr5Statistic(DisChargeStic stic) { + Map<String, Object> map=new HashMap<>(); + //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪�� + setBanZuDefault(map); + //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁� + 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.getDischr5Statistic(stic); + if(binfList==null||binfList.size()==0){ + return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�"); + } + List<SticDischarge5Res> reslist=new ArrayList<>(); + for (BattInf binf:binfList) { + //鏌ヨ鐢垫睜缁勬墍鍦ㄧ殑鐝粍 + String groupName=bjService.getGroupName(binf.getPowerId()); + SticDischarge5Res res=new SticDischarge5Res(); + res.setProvice(binf.getProvice()); + res.setCity(binf.getCity()); + res.setCountry(binf.getCountry()); + res.setStationName(binf.getStationName()); + res.setBattgroupName(binf.getBattgroupName()); + //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); + int dischargeNum=bz.getDischargeNum(); + bz.setDischargeNum(dischargeNum+1); + map.put(groupName,bz); + } + res.setTestStartTime(tinf.getTestStarttime()); + res.setTestTimelong(tinf.getTestTimelong()); + res.setTestCap(tinf.getTestCap()); + res.setStopReason(StopReasonEnum.getValue(tinf.getTestStoptype())); + 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); + 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())); + } + if(stic.getDisChargeType()==null){ + reslist.add(res); + }else{ + if(res.getDisChargeType()==stic.getDisChargeType()){ + reslist.add(res); + } + } + } + PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); + return new Response().setIII(1,reslist.size()>0,pageInfo,map,"鏈勾搴﹀凡鏀剧數鏁伴噺缁熻"); + } + //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪�� + private void setBanZuDefault(Map<String, Object> map) { + List<Baojigroup> banZuList=bjService.getGroupList(); + for (Baojigroup bj:banZuList) { + BanZu bz=new BanZu(); + bz.setBaojiGroupId(bj.getBaojiGroupId()); + bz.setBaojiGroupName(bj.getBaojiGroupName()); + bz.setDischargeNum(0); + bz.setNochargeNum(0); + map.put(bj.getBaojiGroupName(),bz); + } + } + + //鏈勾搴︽湭鏀剧數鏁伴噺缁熻(1.2.6) + public Response getDischr6Statistic(DisChargeStic stic) { + Map<String, Object> map=new HashMap<>(); + //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪�� + setBanZuDefault(map); + //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁� + 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.getDischr5Statistic(stic); + if(binfList==null||binfList.size()==0){ + return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�"); + } + List<SticDischarge5Res> reslist=new ArrayList<>(); + for (BattInf binf:binfList) { + //鏌ヨ鐢垫睜缁勬墍鍦ㄧ殑鐝粍 + String groupName=bjService.getGroupName(binf.getPowerId()); + SticDischarge5Res res=new SticDischarge5Res(); + res.setProvice(binf.getProvice()); + res.setCity(binf.getCity()); + res.setCountry(binf.getCountry()); + res.setStationName(binf.getStationName()); + res.setBattgroupName(binf.getBattgroupName()); + //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); + int dischargeNum=bz.getDischargeNum(); + bz.setDischargeNum(dischargeNum+1); + map.put(groupName,bz); + } + res.setTestStartTime(tinf.getTestStarttime()); + res.setTestTimelong(tinf.getTestTimelong()); + res.setTestCap(tinf.getTestCap()); + res.setStopReason(StopReasonEnum.getValue(tinf.getTestStoptype())); + 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); + 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())); + } + if(stic.getDisChargeType()==null){ + reslist.add(res); + }else{ + if(res.getDisChargeType()==stic.getDisChargeType()){ + reslist.add(res); + } + } + } + PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); + return new Response().setII(1,reslist.size()>0,pageInfo,"鏈勾搴︽湭鏀剧數鏁伴噺缁熻"); + } } \ No newline at end of file -- Gitblit v1.9.1