| | |
| | | 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.ActionUtil; |
| | | import com.whyc.util.PageInfoUtils; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | 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("劣化",0); |
| | | xnmap.put("损坏",0); |
| | | xnmap.put("未放电",0); |
| | | //查询出所有的班组并赋予初始值 |
| | | setBanZuDefault(map); |
| | | setBanZuDefault(bzmap); |
| | | //获取核容优劣,损坏参数 |
| | | List<AppParam> paramList=appParamService.getHrParam(); |
| | | Float badValue=0f; |
| | |
| | | //2.获取电池组在给定时间段的放电记录(指定时间段的标准核容放电) |
| | | BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime()); |
| | | if(tinf==null){ |
| | | res.setRealCap(0f); |
| | | /* 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); |
| | | } |
| | | res.setDisChargeType(2);*/ |
| | | 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()); |
| | |
| | | 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,"本年度已放电数量统计"); |
| | | }//本年度已放电数量统计右侧图表(1.2.5/6) |
| | | 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")){ |
| | | 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.getValue(Capperformance.BATTSTATE_1.getStateId())); |
| | | xnmap.put(Capperformance.getValue(Capperformance.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); |
| | | } |
| | | 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); |
| | | } |
| | | |
| | | } |
| | | return new Response().setIII(1,true,bzmap,xnmap,"本年度已放电数量统计"); |
| | | } |
| | | |
| | | //查询出所有的班组并赋予初始值 |
| | | private void setBanZuDefault(Map<String, Object> map) { |
| | | List<Baojigroup> banZuList=bjService.getGroupList(); |
| | |
| | | |
| | | //本年度未放电数量统计(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){ |
| | |
| | | } |
| | | if(tinf==null){ |
| | | if(!groupName.equals("none")){ |
| | | BanZu bz= (BanZu) map.get(groupName); |
| | | BanZu bz= (BanZu) bzmap.get(groupName); |
| | | int nochargeNum=bz.getNochargeNum(); |
| | | bz.setNochargeNum(nochargeNum+1); |
| | | map.put(groupName,bz); |
| | | bzmap.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); |
| | | } |
| | | |
| | | } |
| | | 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) { |
| | |
| | | } |
| | | //电池组电池性能统计(未放电,优秀,劣化,损坏)统计(1.2.8/9/10) |
| | | public Response getPerformanceStatistic(PerformanceStic stic) { |
| | | /*//获取核容优劣,损坏参数 |
| | | //获取核容优劣,损坏参数 |
| | | List<AppParam> paramList=appParamService.getHrParam(); |
| | | Float badValue=0f; |
| | | Float damageValue=0f; |
| | |
| | | } |
| | | } |
| | | //1查询符合条件的电池组 |
| | | List<BattInf> binfList=battInfService.getBattCompare15Statistic(stic); |
| | | List<BattInf> binfList=battInfService.getPerformanceStatistic(stic); |
| | | if(binfList==null||binfList.size()==0){ |
| | | return new Response().set(1,false,"当前用户未管理满足条件的电池组"); |
| | | } |
| | | List<SticCompare15Res> reslist=new ArrayList<>(); |
| | | List<PerformanceRes> reslist=new ArrayList<>(); |
| | | for (BattInf binf:binfList) { |
| | | SticCompare15Res res=new SticCompare15Res(); |
| | | 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.setDevName(binf.getDevName()); |
| | | res.setProduct(binf.getProduct()); |
| | | res.setInuseTime(binf.getInuseTime()); |
| | | res.setInuseYear(ActionUtil.getDateYear(new Date())-ActionUtil.getDateYear(binf.getInuseTime())); |
| | | res.setMonvolstd(binf.getMonvolstd()); |
| | | res.setStationId(binf.getStationId()); |
| | | res.setPowerId(binf.getPowerId()); |
| | | res.setDevId(binf.getDevId()); |
| | | res.setBattgroupId(binf.getBattgroupId()); |
| | | res.setMoncapstd(binf.getMoncapstd()); |
| | | 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.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)&&(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); |
| | | }else{ |
| | | 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,"蓄电池组对比分析界面(同一品牌同一时间)");*/ |
| | | return null; |
| | | return new Response().setII(1,reslist.size()>0,pageInfo,"电池组电池性能统计(未放电,优秀,劣化,损坏)统计(1.2.8/9/10)"); |
| | | } |
| | | //优良电源数量统计(1.2.7) |
| | | public Response getPwr7Statistic(Pwr7Stic stic) { |
| | | //获取核容优劣,损坏参数 |
| | | 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.getPwr7Statistic(stic); |
| | | List<PerformanceRes> reslist=new ArrayList<>(); |
| | | PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); |
| | | return new Response().setII(1,reslist.size()>0,pageInfo,"优良电源数量统计(1.2.7)"); |
| | | } |
| | | } |