| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.constant.Capperformance; |
| | | import com.whyc.constant.PowerAlarmEnum; |
| | | import com.whyc.constant.BattCapperformanceEnum; |
| | | import com.whyc.constant.PwrCapperformanceEnum; |
| | | import com.whyc.constant.StopReasonEnum; |
| | | import com.whyc.dto.Real.TestDataDto; |
| | | import com.whyc.dto.Response; |
| | |
| | | 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.DateUtil; |
| | | import com.whyc.util.PageInfoUtils; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | |
| | | @Autowired(required = false) |
| | | private BaojigroupService bjService; |
| | | |
| | | @Autowired(required = false) |
| | | private PowerInfService powerInfService; |
| | | |
| | | @Autowired(required = false) |
| | | private PwrdevHistorydataIdService pwrHisdataIdService; |
| | | |
| | | @Autowired(required = false) |
| | | private BattresdataInfService battResdataInfService; |
| | | |
| | | |
| | | |
| | | |
| | | //获取最后一次测试数据并计算剩余容量 |
| | | public Float getLastTestDataRestCap(Integer battgroupId) { |
| | | public Float getLastTestDataRestCap(Float moncapstd,Integer battgroupId) { |
| | | //获取放电记录 |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("battgroup_id",battgroupId); |
| | |
| | | BatttestdataInf tinf=mapper.selectOne(wrapper); |
| | | if(tinf!=null){ |
| | | int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); |
| | | Float restcap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); |
| | | Float restcap = (float) BattCapFactory.GetMonomerCap(moncapstd, hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); |
| | | return restcap; |
| | | }else{ |
| | | return 0f; |
| | |
| | | List<BatttestdataInf> list=mapper.getBattTinfStatistic(stic); |
| | | if(list!=null&&list.size()>0){ |
| | | for (BatttestdataInf tinf:list) { |
| | | //获取电池组信息 |
| | | BattInf binf=battInfService.getBinfByBattgroupId(tinf.getBattgroupId()); |
| | | //剩余容量和剩余时间计算 |
| | | int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); |
| | | Float restCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); |
| | | Float realCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | Float restCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); |
| | | Float realCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | tinf.setRestCap(restCap); |
| | | tinf.setRealCap(realCap); |
| | | tinf.setRestTime(0f); |
| | | //获取电池组实时数据 |
| | | BattRtstate battRtstate=rtstateService.getBattRealInfo(tinf.getBattgroupId()); |
| | | //获取电池组信息 |
| | | BattInf binf=battInfService.getBinfByBattgroupId(tinf.getBattgroupId()); |
| | | |
| | | //实时组端电流,剩余容量,标称容量 |
| | | if(battRtstate!=null){ |
| | | Float restTime= BattCapFactory.getTheoryTime(battRtstate.getLoadCurr(), restCap, binf.getMoncapstd()); |
| | |
| | | wrapper.eq("battgroup_id", battgroupId); |
| | | wrapper.eq("test_type", 3); |
| | | wrapper.eq("test_starttype", 3); |
| | | wrapper.last(" and test_timelong >= 7200 ORDER BY test_starttime DESC "); |
| | | wrapper.eq("data_available", 1);//一次有效的记录 |
| | | wrapper.last(" ORDER BY test_starttime DESC "); |
| | | wrapper.last("limit 1"); |
| | | BatttestdataInf tinf = mapper.selectOne(wrapper); |
| | | tinf.setTestStoptypeReason(StopReasonEnum.getValue(tinf.getTestStoptype())); |
| | |
| | | } |
| | | |
| | | //获取电池组在给定时间段的放电记录(指定时间段的标准核容放电) |
| | | private BatttestdataInf getLastStandardTestDataByTime(Integer battgroupId, Date testStartTime, Date testEndTime) { |
| | | protected BatttestdataInf getLastStandardTestDataByTime(Integer battgroupId, Date testStartTime, Date testEndTime) { |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | wrapper.eq("battgroup_id", battgroupId); |
| | | wrapper.eq("test_type", 3); |
| | |
| | | if(testEndTime!=null){ |
| | | wrapper.lt("test_starttime",testEndTime); |
| | | } |
| | | wrapper.last(" and test_timelong >= 7200 ORDER BY test_starttime DESC "); |
| | | wrapper.last("limit 1"); |
| | | wrapper.eq("data_available", 1);//一次有效的记录 |
| | | wrapper.last(" ORDER BY test_starttime DESC "); |
| | | wrapper.last(" limit 1 "); |
| | | BatttestdataInf tinf = mapper.selectOne(wrapper); |
| | | return tinf; |
| | | } |
| | |
| | | int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); |
| | | Float moncapStd=binf.getMoncapstd(); |
| | | for (BatttestdataId data:idDataList) {//求单体的 实际容量,最小值就是单体的单体电压 |
| | | realCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(),data.getMonVol() , tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | realCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(),data.getMonVol() , tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | SticMonRes res=new SticMonRes(); |
| | | res.setBattgroupId(binf.getBattgroupId()); |
| | | res.setBattgroupName(binf.getBattgroupName()); |
| | |
| | | } |
| | | } |
| | | /*蓄电池组对比分析界面(同一品牌同一时间) |
| | | *1.查询出符合条件的电池组信息 |
| | | * 2.计算电池组的预估剩余容量 |
| | | *1.查询出符合条件的电池组信息(同一品牌同一投运时间) |
| | | * 2.计算电池组的最近一次标准核容放电的预估容量 |
| | | *3.判断性能和百分比 |
| | | * 4.分页 |
| | | */ |
| | |
| | | if(param.getParamNamePsx().equals("batt_mon_damage_val")){ |
| | | damageValue=param.getParamValue(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | Map<String,Object> map=new HashMap<>();//右侧图表 |
| | | map.put("avgCap",0f); |
| | | map.put("standCapDiff",0f); |
| | | Float sumCap=0f; |
| | | Float maxCap=0f; |
| | | Float minCap=0f; |
| | | Float standCapDiff=0f; |
| | | List<ComPareChart> capList=new ArrayList<>(); |
| | | List<ComPareChart> resList=new ArrayList<>(); |
| | | List<ComPareChart> flotVolList=new ArrayList<>(); |
| | | map.put("capList",capList); |
| | | map.put("resList",resList); |
| | | map.put("flotVolList",flotVolList); |
| | | //1查询符合条件的电池组 |
| | | List<BattInf> binfList=battInfService.getBattCompare15Statistic(stic); |
| | | if(binfList==null||binfList.size()==0){ |
| | | return new Response().set(1,false,"当前用户未管理满足条件的电池组"); |
| | | } |
| | | List<SticCompare15Res> reslist=new ArrayList<>(); |
| | | List<SticCompare15Res> comparelist=new ArrayList<>(); |
| | | for (BattInf binf:binfList) { |
| | | SticCompare15Res res=new SticCompare15Res(); |
| | | res.setProvice(binf.getProvice()); |
| | |
| | | BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime()); |
| | | if(tinf==null){ |
| | | res.setRealCap(0f); |
| | | res.setPrecentCap("0"); |
| | | res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId())); |
| | | 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_4.getStateId())); |
| | | 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) {//求单体的 实际容量,最小值就是单体的单体电压 |
| | | Float monrealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), data.getMonVol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | if (monrealCap <= moncapStd * damageValue) {//损坏的 |
| | | monNums.add(data.getMonNum()); |
| | | } |
| | | } |
| | | res.setMonNums(monNums); |
| | | if(stic.getPerformance()==null){ |
| | | reslist.add(res); |
| | | res.setPrecentCap("0.00000"); |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_4.getStateId())); |
| | | res.setStopReason("--"); |
| | | res.setFloatGroupVol(0f); |
| | | }else{ |
| | | if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){ |
| | | reslist.add(res); |
| | | res.setStopReason(StopReasonEnum.getValue(tinf.getTestStoptype())); |
| | | res.setFloatGroupVol(tinf.getFloatGroupVol()); |
| | | //找这次放电的最后一笔数据 |
| | | List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum()); |
| | | if(idDataList==null||idDataList.size()==0){ |
| | | res.setRealCap(0f); |
| | | res.setPrecentCap("0.00000"); |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_4.getStateId())); |
| | | res.setFloatGroupVol(0f); |
| | | }else{ |
| | | Float moncapStd=binf.getMoncapstd(); |
| | | int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); |
| | | Float grouprealCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | //Float restCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); |
| | | res.setRealCap(grouprealCap); |
| | | if(grouprealCap>=moncapStd*badValue){ |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId())); |
| | | } |
| | | if(grouprealCap<=moncapStd*damageValue){ |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId())); |
| | | } |
| | | if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){ |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId())); |
| | | } |
| | | //保留5位小数 |
| | | String precentCap = String.format("%.5f",(grouprealCap/binf.getMoncapstd()*100)); |
| | | res.setPrecentCap(precentCap); |
| | | sumCap+=grouprealCap; |
| | | if(grouprealCap>=maxCap){ |
| | | maxCap=grouprealCap; |
| | | } |
| | | if(grouprealCap<=minCap){ |
| | | minCap=grouprealCap; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(stic.getPerformance()==null){ |
| | | comparelist.add(res); |
| | | }else{ |
| | | if(res.getCapperformance().equals(BattCapperformanceEnum.getValue(stic.getPerformance()))){ |
| | | comparelist.add(res); |
| | | } |
| | | } |
| | | ComPareChart capChart=new ComPareChart(); |
| | | capChart.setBattgroupId(binf.getBattgroupId()); |
| | | capChart.setBattgroupName(binf.getBattgroupName()); |
| | | capChart.setValue(res.getRealCap()); |
| | | capList.add(capChart); |
| | | ComPareChart floatVolChart=new ComPareChart(); |
| | | floatVolChart.setBattgroupId(binf.getBattgroupId()); |
| | | floatVolChart.setBattgroupName(binf.getBattgroupName()); |
| | | floatVolChart.setValue(res.getFloatGroupVol()); |
| | | flotVolList.add(floatVolChart); |
| | | //统计内阻测试 |
| | | ComPareChart resChart=battResdataInfService.getMaxResData(binf); |
| | | resList.add(resChart); |
| | | } |
| | | PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); |
| | | return new Response().setII(1,reslist.size()>0,pageInfo,"蓄电池组对比分析界面(同一品牌同一时间)"); |
| | | map.put("avgCap",sumCap/binfList.size()); |
| | | map.put("standCapDiff",maxCap-minCap); |
| | | |
| | | PageInfo pageInfo=PageInfoUtils.list2PageInfo(comparelist, stic.getPageNum(), stic.getPageSize()); |
| | | return new Response().setIII(1,comparelist.size()>0,pageInfo,map,"蓄电池组对比分析界面(同一品牌同一时间)"); |
| | | } |
| | | |
| | | //蓄电池组对比分析界面(不同品牌同一时间)(1.2.16) |
| | |
| | | if(tinf==null){ |
| | | res.setRealCap(0f); |
| | | res.setPrecentCap("0"); |
| | | res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId())); |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId())); |
| | | res.setStopReason("--"); |
| | | continue; |
| | | } |
| | | 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); |
| | | //Float restCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); |
| | | Float grouprealCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | //Float restCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), 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())); |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId())); |
| | | } |
| | | if(grouprealCap<=moncapStd*damageValue){ |
| | | res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId())); |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId())); |
| | | } |
| | | if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){ |
| | | res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId())); |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId())); |
| | | } |
| | | //保留5位小数 |
| | | String precentCap = String.format("%.5f",(grouprealCap/binf.getMoncapstd()*100)); |
| | |
| | | if(stic.getPerformance()==null){ |
| | | reslist.add(res); |
| | | }else{ |
| | | if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){ |
| | | if(res.getCapperformance().equals(BattCapperformanceEnum.getValue(stic.getPerformance()))){ |
| | | reslist.add(res); |
| | | } |
| | | } |
| | |
| | | res.setPowerId(binf.getPowerId()); |
| | | res.setDevId(binf.getDevId()); |
| | | res.setBattgroupId(binf.getBattgroupId()); |
| | | Float monrealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), data.getMonVol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | Float monrealCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), 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())); |
| | | res.setMoncapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId())); |
| | | } |
| | | if (monrealCap <= moncapStd * damageValue) {//损坏的 |
| | | res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId())); |
| | | res.setMoncapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId())); |
| | | } |
| | | if((monrealCap>moncapStd*damageValue)&&(monrealCap<moncapStd*badValue)){ |
| | | res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId())); |
| | | res.setMoncapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId())); |
| | | } |
| | | if(stic.getPerformance()==null){ |
| | | reslist.add(res); |
| | | }else{ |
| | | if(res.getMoncapperformance().equals(Capperformance.getValue(stic.getPerformance()))){ |
| | | if(res.getMoncapperformance().equals(BattCapperformanceEnum.getValue(stic.getPerformance()))){ |
| | | reslist.add(res); |
| | | } |
| | | } |
| | |
| | | res.setMonNum(i+1); |
| | | res.setMonrealCap(0f); |
| | | res.setMonprecentCap("0"); |
| | | res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId())); |
| | | res.setMoncapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_4.getStateId())); |
| | | if(performance==null){ |
| | | reslist.add(res); |
| | | }else{ |
| | | if(res.getMoncapperformance().equals(Capperformance.getValue(performance))){ |
| | | if(res.getMoncapperformance().equals(BattCapperformanceEnum.getValue(performance))){ |
| | | reslist.add(res); |
| | | } |
| | | } |
| | |
| | | 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"); |
| | |
| | | dto.setRecordNum(tinf.getRecordNum()); |
| | | dto.setTestCap(tinf.getTestCap()); |
| | | dto.setTestTimeLong(tinf.getTestTimelong()); |
| | | int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); |
| | | Float realCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | dto.setRealCap(realCap); |
| | | //实时获取电池组信息 |
| | | BattRtstate battRtstate = rtstateService.getBattRealInfo(tinf.getBattgroupId()); |
| | | //获取电池组信息 |
| | | BattInf binf = battInfService.getBinfByBattgroupId(tinf.getBattgroupId()); |
| | | dto.setMoncapstd(binf.getMoncapstd()); |
| | | dto.setMonCount(binf.getMoncount()); |
| | | dto.setMonvolstd(binf.getMonvolstd()); |
| | | int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); |
| | | Float realCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | dto.setRealCap(realCap); |
| | | //实时获取电池组信息 |
| | | BattRtstate battRtstate = rtstateService.getBattRealInfo(tinf.getBattgroupId()); |
| | | dto.setFloatchartVol(tinf.getFloatGroupVol()); |
| | | if(battRtstate!=null){ |
| | | Float restTime= BattCapFactory.getTheoryTime(battRtstate.getLoadCurr(), realCap, binf.getMoncapstd()); |
| | | dto.setRestTime(restTime); |
| | | dto.setFloatchartVol(battRtstate.getGroupVol()); |
| | | }else{ |
| | | dto.setRestTime(0f); |
| | | dto.setFloatchartVol(0f); |
| | | } |
| | | //找这次放电的指定一笔数据 |
| | | List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),1); |
| | | if(idDataList!=null&&idDataList.size()>=0){ |
| | | if(idDataList!=null&&idDataList.size()>0){ |
| | | BatttestdataId idData=idDataList.get(0); |
| | | dto.setOnlineVol(idData.getOnlineVol()); |
| | | dto.setGroupCurr(idData.getTestCurr()); |
| | |
| | | } |
| | | return new Response().setII(1,true,map,"历史测试记录"); |
| | | } |
| | | //本年度已放电数量统计(1.2.5) |
| | | //本年度已放电数量统计(1.2.5)<只查看已放电数据> |
| | | public Response getDischr5Statistic(DisChargeStic stic) { |
| | | //班组 |
| | | Map<String, Object> bzmap=new HashMap<>(); |
| | | //性能 |
| | | Map<String, Integer> xnmap=new HashMap<>(); |
| | | xnmap.put("优秀",0); |
| | | xnmap.put("劣化",0); |
| | | xnmap.put("损坏",0); |
| | | xnmap.put("未放电",0); |
| | | //查询出所有的班组并赋予初始值 |
| | | setBanZuDefault(bzmap); |
| | | //获取核容优劣,损坏参数 |
| | | List<AppParam> paramList=appParamService.getHrParam(); |
| | | Float badValue=0f; |
| | |
| | | res.setCountry(binf.getCountry()); |
| | | res.setStationName(binf.getStationName()); |
| | | res.setBattgroupName(binf.getBattgroupName()); |
| | | res.setStationId(binf.getStationId()); |
| | | res.setPowerId(binf.getPowerId()); |
| | | res.setBattgroupId(binf.getBattgroupId()); |
| | | res.setDevId(binf.getDevId()); |
| | | //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); |
| | | continue; |
| | | } |
| | | |
| | | 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,"本年度已放电数量统计"); |
| | | }//本年度已放电数量统计右侧图表(1.2.5) |
| | | public Response getDischr5Chart(Integer uid) { |
| | | //班组 |
| | | Map<String, Object> bzmap=new HashMap<>(); |
| | | //性能 |
| | | Map<String, Integer> xnmap=new HashMap<>(); |
| | | xnmap.put("优秀",0); |
| | | xnmap.put("劣化",0); |
| | | xnmap.put("损坏",0); |
| | | xnmap.put("未放电",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.getValue(Capperformance.BATTSTATE_4.getStateId())); |
| | | xnmap.put(Capperformance.getValue(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")){ |
| | |
| | | bz.setDischargeNum(dischargeNum+1); |
| | | 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); |
| | | Float grouprealCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | res.setRealCap(grouprealCap); |
| | | //res.setDisChargeType(1); |
| | | if(grouprealCap>=moncapStd*badValue){ |
| | | int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId())); |
| | | xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()),value+1); |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId())); |
| | | int value=xnmap.get(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId())); |
| | | xnmap.put(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId()),value+1); |
| | | } |
| | | if(grouprealCap<=moncapStd*damageValue){ |
| | | int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId())); |
| | | xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()),value+1); |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId())); |
| | | int value=xnmap.get(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId())); |
| | | xnmap.put(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId()),value+1); |
| | | } |
| | | if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){ |
| | | int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId())); |
| | | xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()),value+1); |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId())); |
| | | int value=xnmap.get(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId())); |
| | | xnmap.put(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId()),value+1); |
| | | } |
| | | |
| | | reslist.add(res); |
| | | } |
| | | return new Response().setIII(1,true,bzmap,xnmap,"本年度已放电数量统计"); |
| | | PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); |
| | | return new Response().setIIII(1,reslist.size()>0,pageInfo,bzmap,xnmap,"本年度已放电数量统计"); |
| | | } |
| | | |
| | | //查询出所有的班组并赋予初始值 |
| | |
| | | |
| | | //本年度未放电数量统计(1.2.6) |
| | | public Response getDischr6Statistic(DisChargeStic stic) { |
| | | //班组 |
| | | Map<String, Object> bzmap=new HashMap<>(); |
| | | //查询出所有的班组并赋予初始值 |
| | | setBanZuDefault(bzmap); |
| | | //1查询符合条件的电池组 |
| | | List<BattInf> binfList=battInfService.getDischr6Statistic(stic); |
| | | if(binfList==null||binfList.size()==0){ |
| | |
| | | res.setMonvolstd(binf.getMonvolstd()); |
| | | res.setMoncount(binf.getMoncount()); |
| | | res.setProduct(binf.getProduct()); |
| | | res.setStationId(binf.getStationId()); |
| | | res.setPowerId(binf.getPowerId()); |
| | | res.setBattgroupId(binf.getBattgroupId()); |
| | | res.setDevId(binf.getDevId()); |
| | | //获取电池组未放电记录(指定时间段的标准核容放电) |
| | | 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){ |
| | | getNoDischargeData(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime(),null,res); |
| | | /*if(stic.getStopReasonType()==0){ |
| | | reslist.add(res); |
| | | }else { |
| | | if(res.getStopReasonType()==stic.getStopReasonType()){ |
| | | reslist.add(res); |
| | | } |
| | | }*/ |
| | | reslist.add(res); |
| | | if(!groupName.equals("none")){ |
| | | 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().setII(1,reslist.size()>0,pageInfo,"本年度未放电数量统计"); |
| | | 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) { |
| | | List<BatttestdataInf> tinfList=mapper.getNoDischargeData(battgroupId,testStartTime,testEndTime,typeList); |
| | | List<BatttestdataInf> tinfList=mapper.getNoDischargeData(battgroupId,testStartTime,testEndTime,null); |
| | | List<String> stopList=new ArrayList<>(); |
| | | if(tinfList!=null&&tinfList.size()>0){ |
| | | res.setErrorNum(tinfList.size()); |
| | | res.setStopReasonType(1); |
| | | for (BatttestdataInf tinf:tinfList) { |
| | | //res.setStopReasonType(1); |
| | | 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); |
| | | } |
| | |
| | | }else { |
| | | res.setErrorNum(0); |
| | | res.setStopList(new ArrayList<>()); |
| | | res.setStopReasonType(0); |
| | | //res.setStopReasonType(0); |
| | | } |
| | | } |
| | | //获取核容停止原因类型(下拉) |
| | |
| | | res.setStationName(binf.getStationName()); |
| | | res.setBattgroupName(binf.getBattgroupName()); |
| | | res.setProduct(binf.getProduct()); |
| | | res.setInuseYear(ActionUtil.getDateYear(new Date())-ActionUtil.getDateYear(binf.getInuseTime())); |
| | | res.setInuseYear(ActionUtil.getDateYear(new Date())-ActionUtil.getDateYear(binf.getInuseTime())+1); |
| | | res.setMonvolstd(binf.getMonvolstd()); |
| | | res.setMoncapstd(binf.getMoncapstd()); |
| | | res.setMoncount(binf.getMoncount()); |
| | | res.setStationId(binf.getStationId()); |
| | | res.setPowerId(binf.getPowerId()); |
| | | res.setBattgroupId(binf.getBattgroupId()); |
| | | res.setDevId(binf.getDevId()); |
| | | //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; |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_4.getStateId())); |
| | | }else{ |
| | | //找这次放电的最后一笔数据 |
| | | List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum()); |
| | | if(idDataList==null||idDataList.size()==0){ |
| | | res.setRealCap(0f); |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_4.getStateId())); |
| | | }else{ |
| | | Float moncapStd=binf.getMoncapstd(); |
| | | int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); |
| | | Float grouprealCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | res.setRealCap(grouprealCap); |
| | | if(grouprealCap>=moncapStd*badValue){ |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId())); |
| | | } |
| | | if(grouprealCap<=moncapStd*damageValue){ |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId())); |
| | | } |
| | | if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){ |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId())); |
| | | } |
| | | } |
| | | } |
| | | //找这次放电的最后一笔数据 |
| | | 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())); |
| | | 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); |
| | | 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())); |
| | | if(res.getCapperformance().equals(BattCapperformanceEnum.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())+1); |
| | | res.setMonvolstd(binf.getMonvolstd()); |
| | | res.setMoncapstd(binf.getMoncapstd()); |
| | | res.setMoncount(binf.getMoncount()); |
| | | res.setStationId(binf.getStationId()); |
| | | res.setPowerId(binf.getPowerId()); |
| | | res.setBattgroupId(binf.getBattgroupId()); |
| | | res.setDevId(binf.getDevId()); |
| | | //2.获取电池组在给定时间段的放电记录(指定时间段的标准核容放电) |
| | | BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime()); |
| | | if(tinf==null){ |
| | | res.setRealCap(0f); |
| | | }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); |
| | | } |
| | | } |
| | | //查询当前电池组当前单体电压或者单体内阻低于其单体电压的下下限或高于上上限判定当前电池组劣化 |
| | | int flag = rtdataService.getVolAndRes(binf.getBattgroupId()); |
| | | if(flag==1){ |
| | | res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId())); |
| | | 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.7) |
| | | public Response getPwr7Statistic(Pwr7Stic stic) throws NoSuchFieldException, IllegalAccessException { |
| | | Date inuseTimeStart =new Date(); |
| | | if(stic.getInuseYear()!=null){ |
| | | if(stic.getInuseYear()==1){ |
| | | //投入使用时间条件筛选 |
| | | LocalDateTime startTime = LocalDateTime.now().minusYears(5); |
| | | inuseTimeStart = DateUtil.convertToDate(startTime); |
| | | }else{ |
| | | //投入使用时间条件筛选 |
| | | LocalDateTime startTime = LocalDateTime.now().minusYears(stic.getInuseYear()); |
| | | inuseTimeStart = DateUtil.convertToDate(startTime); |
| | | } |
| | | stic.setPwrInUseTime(inuseTimeStart); |
| | | } |
| | | //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 (stic.getGroupName() == null || groupName == 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()); |
| | | Integer performance= pwrHisdataIdService.getPwrQuarter7(pinf.getPowerId(),pinf.getPowerType()); |
| | | res.setPerformanceName(PwrCapperformanceEnum.getValue(performance)); |
| | | if(stic.getPerformance()==null){ |
| | | reslist.add(res); |
| | | }else{ |
| | | if(performance==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.7)"); |
| | | } |
| | | |
| | | |
| | | public List<BatttestdataInf> getListByUserId(Integer userId) { |
| | | return mapper.getListByUserId(userId); |
| | | } |
| | | |
| | | public int getHrDisCount(Integer userId, Date startTime, Date endTime) { |
| | | return mapper.getHrDisCount(userId, startTime, endTime); |
| | | } |
| | | //获取这一次的放电信息 |
| | | public BatttestdataInf getTinfByTestRecordCount(Integer battgroupId, Integer testRecordCount) { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("battgroup_id",battgroupId); |
| | | wrapper.eq("test_record_count",testRecordCount); |
| | | wrapper.last(" limit 1"); |
| | | return mapper.selectOne(wrapper); |
| | | } |
| | | //历史测试数据导出 |
| | | public BatttestdataInf exportTinfDataByTestRecordCount(Integer battgroupId, Integer testRecordCount) { |
| | | QueryWrapper wrapper =new QueryWrapper(); |
| | | wrapper.eq("battgroup_id",battgroupId); |
| | | wrapper.eq("test_record_count",testRecordCount); |
| | | wrapper.last(" limit 1"); |
| | | return mapper.selectOne(wrapper); |
| | | } |
| | | //点击右侧折线图画出电池组所有完整周期的实际容量变化图(1.2.15/16/17) |
| | | public Response getRealCapChangeByBattgroupId(Integer battgroupId) { |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | wrapper.eq("battgroup_id", battgroupId); |
| | | wrapper.eq("test_type", 3); |
| | | wrapper.eq("test_starttype", 3); |
| | | wrapper.eq("data_available", 1);//一次有效的记录 |
| | | wrapper.last(" ORDER BY test_starttime DESC "); |
| | | List<BatttestdataInf> list = mapper.selectList(wrapper); |
| | | //获取电池组的标称容量 |
| | | BattInf binf=battInfService.getBattgroupIdInf(battgroupId); |
| | | List<ComPareChangeCurve> curvelist=new ArrayList<>(); |
| | | for (BatttestdataInf tinf:list) { |
| | | int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); |
| | | Float realCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | ComPareChangeCurve curve=new ComPareChangeCurve(); |
| | | curve.setBattgroupId(battgroupId); |
| | | curve.setStartTime(tinf.getTestStarttime()); |
| | | curve.setCurveValue(realCap); |
| | | curvelist.add(curve); |
| | | } |
| | | return new Response().setII(1,list.size()>0,curvelist,"点击右侧折线图画出电池组所有完整周期的实际容量变化图(1.2.15/16/17)"); |
| | | } |
| | | //点击右侧折线图画出电池组所有完整周期的浮充电压变化图(1.2.15/16/17) |
| | | public Response getFloatGroupVolChangeByBattgroupId(Integer battgroupId) { |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | wrapper.eq("battgroup_id", battgroupId); |
| | | wrapper.eq("test_type", 3); |
| | | wrapper.eq("test_starttype", 3); |
| | | wrapper.eq("data_available", 1);//一次有效的记录 |
| | | wrapper.last(" ORDER BY test_starttime asc "); |
| | | List<BatttestdataInf> list = mapper.selectList(wrapper); |
| | | List<ComPareChangeCurve> curvelist=new ArrayList<>(); |
| | | for (BatttestdataInf tinf:list) { |
| | | ComPareChangeCurve curve=new ComPareChangeCurve(); |
| | | curve.setBattgroupId(battgroupId); |
| | | curve.setStartTime(tinf.getTestStarttime()); |
| | | curve.setCurveValue(tinf.getFloatGroupVol()); |
| | | curvelist.add(curve); |
| | | } |
| | | return new Response().setII(1,list.size()>0,curvelist,"点击右侧折线图画出电池组所有完整周期的浮充电压变化图(1.2.15/16/17)"); |
| | | } |
| | | } |