From 5aac1d3b69111db2536280d0603d7c850d961551 Mon Sep 17 00:00:00 2001 From: whycxzp <glperry@163.com> Date: 星期一, 16 六月 2025 16:39:31 +0800 Subject: [PATCH] 领导层首页-电池时间品牌统计 --- src/main/java/com/whyc/service/LeaderHomeService.java | 393 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 371 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/whyc/service/LeaderHomeService.java b/src/main/java/com/whyc/service/LeaderHomeService.java index a941000..55ad958 100644 --- a/src/main/java/com/whyc/service/LeaderHomeService.java +++ b/src/main/java/com/whyc/service/LeaderHomeService.java @@ -1,9 +1,13 @@ package com.whyc.service; -import com.whyc.dto.NameValueDto; -import com.whyc.dto.Response; +import com.sun.org.glassfish.gmbal.NameValue; +import com.whyc.constant.Capperformance; +import com.whyc.dto.*; +import com.whyc.factory.BattCapFactory; import com.whyc.factory.ThreadPoolExecutorFactory; +import com.whyc.pojo.db_batt_testdata.BatttestdataId; import com.whyc.pojo.db_batt_testdata.BatttestdataInf; +import com.whyc.pojo.db_param.AppParam; import com.whyc.pojo.db_station.BattInf; import com.whyc.pojo.db_station.PowerInf; import com.whyc.pojo.db_station.StationInf; @@ -17,11 +21,7 @@ import java.util.stream.Collectors; import java.time.LocalDateTime; -import java.time.LocalDate; -import java.time.ZoneId; -import java.time.temporal.TemporalAdjusters; import java.util.List; -import java.util.stream.Collectors; import static com.whyc.util.DateUtil.convertToLocalDateTime; @@ -41,11 +41,28 @@ @Autowired private BatttestdataInfService battTestDataInfService; + @Autowired + private PwrdevAlarmService powerAlarmService; + + @Autowired + private DevalarmDataService devAlarmService; + + @Autowired + private BattalarmDataService battAlarmService; + + @Autowired + private AppParamService appParamService; + + @Autowired + private BatttestdataIdService battTestDataIdService; + + + public Response getAll(Integer userId) { Response response = new Response(); Map<String,Object> map = new HashMap<>(); - CountDownLatch latch = new CountDownLatch(9); + CountDownLatch latch = new CountDownLatch(6); ThreadPoolExecutor poolExecutor = ThreadPoolExecutorFactory.getPoolExecutor(); //绔欑偣淇℃伅缁熻, @@ -75,28 +92,17 @@ latch.countDown(); }); //TODO 瀹炴椂鍛婅淇℃伅缁熻 + /** + * 閫昏緫鏇存柊: + */ poolExecutor.execute(() -> { //alarmRealtimeStatistics(userId, map); - latch.countDown(); - }); - //TODO 涓嶅悓鏃堕棿鍚屼竴鍝佺墝钃勭數姹犳�ц兘缁熻 - poolExecutor.execute(() -> { - //performanceInfoStatistics(userId, map); - latch.countDown(); - }); - //TODO 鍚屼竴鏃堕棿涓嶅悓鍝佺墝钃勭數姹犳�ц兘缁熻 - poolExecutor.execute(() -> { - //performanceInfoStatistics2(userId, map); - latch.countDown(); - }); - //TODO 鍚屼竴鏃堕棿鍚屼竴鍝佺墝钃勭數姹犳�ц兘缁熻 - poolExecutor.execute(() -> { - //performanceInfoStatistics3(userId, map); latch.countDown(); }); return response; } + private void testDataInfoStatistics(Integer userId, Map<String, Object> map) { List<BatttestdataInf> testInfList = battTestDataInfService.getListByUserId(userId); @@ -253,4 +259,347 @@ map.put("stationInfo_stationVol",stationVolList); } + //鍚屼竴鏃堕棿鍚屼竴鍝佺墝鐢垫睜鎬ц兘缁熻 + public Response getBattPerformanceOfSameTimeSameBrand(Integer userId, NameValueIntDto nameValueDto) { + String brand = nameValueDto.getName(); + Integer year = nameValueDto.getValue(); + //鎶曞叆浣跨敤鏃堕棿鏉′欢绛涢�� + LocalDateTime startTime = LocalDateTime.now().minusYears(year); + Date inuseTimeStart = DateUtil.convertToDate(startTime); + BattInf battInf = new BattInf(); + battInf.setInuseTime(inuseTimeStart); + battInf.setProduct(brand); + //鏌ヨ婊¤冻鏉′欢鐨勮搫鐢垫睜鍒楄〃 + List<BattInf> battInfList = battInfService.getListByCondition(userId,battInf); + List<BattCapInfoDto> battCapInfoList = getBattCapInfo(battInfList); + //data,鍜宒ata2鍒嗗埆杩斿洖 缁熻鏁伴噺鍜� 绔欑偣浼樿壇,鍔e寲,鎹熷潖 鍓嶄簩鐨勪俊鎭� + List<NameValueIntDto> data = new ArrayList<>(); + List<NameValueListDto> data2 = new ArrayList<>(); + //绛涢�夊嚭 绔欑偣浼樿壇,鍔e寲,鎹熷潖 鐨勭數姹犵粍,骞舵寜鐓ц繖涓瓧娈靛垎缁� + List<BattCapInfoDto> goodList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_1.getStateName())) + .sorted(Comparator.comparing(BattCapInfoDto::getRealCap).reversed()).collect(Collectors.toList()); + if(goodList.size()==0){ + data.add(new NameValueIntDto("浼樿壇",0)); + data2.add(new NameValueListDto("浼樿壇",goodList)); + }else{ + data.add(new NameValueIntDto("浼樿壇",goodList.size())); + data2.add(new NameValueListDto("浼樿壇",goodList.subList(0, Math.min(goodList.size(), 2)))); + } + List<BattCapInfoDto> badList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_2.getStateName())) + .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList()); + if(badList.size()==0){ + data.add(new NameValueIntDto("鍔e寲",0)); + data2.add(new NameValueListDto("鍔e寲",badList)); + }else{ + data.add(new NameValueIntDto("鍔e寲",badList.size())); + data2.add(new NameValueListDto("鍔e寲",badList.subList(0, Math.min(badList.size(), 2)))); + } + List<BattCapInfoDto> damageList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_3.getStateName())) + .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList()); + if(damageList.size()==0){ + data.add(new NameValueIntDto("鎹熷潖",0)); + data2.add(new NameValueListDto("鎹熷潖",damageList)); + }else{ + data.add(new NameValueIntDto("鎹熷潖",damageList.size())); + data2.add(new NameValueListDto("鎹熷潖",damageList.subList(0, Math.min(damageList.size(), 2)))); + } + return new Response().setII(1,data,data2,""); + + } + + public Response getBattPerformanceOfSameTimeDiffBrand(Integer userId, int year) { + //鎶曞叆浣跨敤鏃堕棿鏉′欢绛涢�� + LocalDateTime startTime = LocalDateTime.now().minusYears(year); + Date inuseTimeStart = DateUtil.convertToDate(startTime); + BattInf battInf = new BattInf(); + battInf.setInuseTime(inuseTimeStart); + //鏌ヨ婊¤冻鏉′欢鐨勮搫鐢垫睜鍒楄〃 + List<BattInf> battInfList = battInfService.getListByCondition(userId,battInf); + List<BattCapInfoDto> battCapInfoList = getBattCapInfo(battInfList); + + //data,鏍规嵁鍝佺墝鍒嗙粍缁熻鐧惧垎姣� + Map<String, List<BattCapInfoDto>> brandMap = battCapInfoList.stream().collect(Collectors.groupingBy(BattCapInfoDto::getProduct)); + List<NameValueListDto<NameValueDto>> data = new ArrayList<>(); + brandMap.forEach((brand,battCapInfoListTemp)->{ + //k -鍝佺墝 + long goodCount = battCapInfoListTemp.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_1.getStateName())).count(); + long badCount = battCapInfoListTemp.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_2.getStateName())).count(); + long damageCount = battCapInfoListTemp.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_3.getStateName())).count(); + long total = goodCount + badCount + damageCount; + //鑹ソ,鍔e寲,鎹熷潖鐨勭櫨鍒嗘瘮.锛堜繚鐣�0浣嶅皬鏁帮級 + int goodPercent = Math.round((float) goodCount / total * 100); + int badPercent = Math.round((float) badCount / total * 100); + int damagePercent = Math.round((float) damageCount / total * 100); + + List<NameValueDto> performanceList = new ArrayList<>(); + performanceList.add(new NameValueDto("浼樿壇",String.format("%d%%",goodPercent))); + performanceList.add(new NameValueDto("鍔e寲",String.format("%d%%",badPercent))); + performanceList.add(new NameValueDto("鎹熷潖",String.format("%d%%",damagePercent))); + + NameValueListDto brandPerformance = new NameValueListDto(brand,performanceList); + data.add(brandPerformance); + }); + //data2,浼樿壇閲岄潰鏈�澶х殑鍜屾渶灏忕殑鍝佺墝 + List<NameValueListDto<NameValueDto>> data2 = new ArrayList<>(); + List<BattCapInfoDto> goodList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_1.getStateName())) + .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList()); + NameValueListDto<NameValueDto> goodListDto = new NameValueListDto<>(); + List<NameValueDto> goodListValue = new ArrayList<>(); + NameValueDto goodMaxDto = new NameValueDto(); + NameValueDto goodMinDto = new NameValueDto(); + goodMaxDto.setName("max"); + goodMinDto.setName("min"); + if (goodList.size()==0){ + goodMaxDto.setValue("-"); + goodMinDto.setValue("-"); + }else{ + goodMinDto.setValue(goodList.get(0).getProduct()); + goodMaxDto.setValue(goodList.get(goodList.size()-1).getProduct()); + } + goodListValue.add(goodMaxDto); + goodListValue.add(goodMinDto); + + goodListDto.setName("浼樿壇"); + goodListDto.setValue(goodListValue); + data2.add(goodListDto); + //鍔e寲閲岄潰鏈�澶х殑鍜屾渶灏忕殑鍝佺墝 + List<BattCapInfoDto> badList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_2.getStateName())) + .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList()); + NameValueListDto<NameValueDto> badListDto = new NameValueListDto<>(); + List<NameValueDto> badListValue = new ArrayList<>(); + NameValueDto badMaxDto = new NameValueDto(); + NameValueDto badMinDto = new NameValueDto(); + badMaxDto.setName("max"); + badMinDto.setName("min"); + if (badList.size()==0){ + badMaxDto.setValue("-"); + badMinDto.setValue("-"); + }else{ + badMinDto.setValue(badList.get(0).getProduct()); + badMaxDto.setValue(badList.get(badList.size()-1).getProduct()); + } + badListValue.add(badMaxDto); + badListValue.add(badMinDto); + + badListDto.setName("鍔e寲"); + badListDto.setValue(badListValue); + data2.add(badListDto); + + //鎹熷潖閲岄潰鏈�澶х殑鍜屾渶灏忕殑鍝佺墝 + List<BattCapInfoDto> damageList = battCapInfoList.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_3.getStateName())) + .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList()); + + NameValueListDto<NameValueDto> damageListDto = new NameValueListDto<>(); + List<NameValueDto> damageListValue = new ArrayList<>(); + NameValueDto damageMaxDto = new NameValueDto(); + NameValueDto damageMinDto = new NameValueDto(); + damageMaxDto.setName("max"); + damageMinDto.setName("min"); + if (damageList.size()==0){ + damageMaxDto.setValue("-"); + damageMinDto.setValue("-"); + }else if (damageList.size()==1){ + damageMaxDto.setValue(damageList.get(0).getProduct()); + damageMinDto.setValue(damageList.get(0).getProduct()); + }else{ + damageMinDto.setValue(damageList.get(0).getProduct()); + damageMaxDto.setValue(damageList.get(damageList.size()-1).getProduct()); + } + damageListValue.add(damageMaxDto); + damageListValue.add(damageMinDto); + + damageListDto.setName("鎹熷潖"); + damageListDto.setValue(damageListValue); + data2.add(damageListDto); + + //data3. 鎬ц兘鏈�浣冲搧鐗� TODO 濞佸皵閫婄疆淇″尯闂存硶浠ュ強璐濆彾鏂钩鍧囨硶锛岄�氳繃璁剧疆鐨勬潈閲嶏紝璁$畻鍚勪釜鍝佺墝鍦ㄦ寚瀹氭姇杩愭椂闂村唴鐨勫緱鍒� + return new Response().setIII(1,data,data2,"鎬ц兘鏈�浣冲搧鐗�:TODO 濞佸皵閫婄疆淇″尯闂存硶浠ュ強璐濆彾鏂钩鍧囨硶锛岄�氳繃璁剧疆鐨勬潈閲嶏紝璁$畻鍚勪釜鍝佺墝鍦ㄦ寚瀹氭姇杩愭椂闂村唴鐨勫緱鍒�",null); + + } + + public Response getBattPerformanceOfDiffTimeSameBrand(Integer userId, String brand) { + BattInf battInf = new BattInf(); + battInf.setProduct(brand); + //鏌ヨ婊¤冻鏉′欢鐨勮搫鐢垫睜鍒楄〃 + List<BattInf> battInfList = battInfService.getListByCondition(userId,battInf); + List<BattCapInfoDto> battCapInfoList = getBattCapInfo(battInfList); + + //data,TODO 鎶曡繍鏃堕棿鐨勭淮搴﹀弬鏁�,鍏堝浐瀹氬彉閲�,鍚庣画浠庢暟鎹簱鑾峰彇 + //time1鍜宼ime2鐨勫崟浣嶄负骞� + int time1 = 3; + int time2 = 5; + + //绛涢�塨attCapInfoList涓璞$殑inuseTime灞炴�� 璺熷綋鍓嶆椂闂村姣�,骞翠唤宸湪time1涔嬪唴,time1-time2涔嬮棿,time2涔嬪悗鐨勬暟鎹� + // --------------time2Limit------time1Limit-------now + LocalDateTime time1DateLimit = LocalDateTime.now().minusYears(time1); + Date time1Limit = DateUtil.convertToDate(time1DateLimit); + LocalDateTime time2DateLimit = LocalDateTime.now().minusYears(time2); + Date time2Limit = DateUtil.convertToDate(time2DateLimit); + + //澶т簬time1鐨勬暟鎹� + List<BattCapInfoDto> time1List = battCapInfoList.stream(). + filter(battCapInfo -> battCapInfo.getInuseTime().compareTo(time1Limit)>=0).collect(Collectors.toList()); + //鍦╰ime1鍜宼ime2涔嬮棿鐨勬暟鎹� + List<BattCapInfoDto> time12List = battCapInfoList.stream(). + filter(battCapInfo -> battCapInfo.getInuseTime().compareTo(time2Limit)>0 && battCapInfo.getInuseTime().compareTo(time1Limit)<=0).collect(Collectors.toList()); + //灏忎簬time2鐨勬暟鎹� + List<BattCapInfoDto> time2List = battCapInfoList.stream(). + filter(battCapInfo -> battCapInfo.getInuseTime().compareTo(time2Limit)<0).collect(Collectors.toList()); + + //data + List<NameValueListDto<NameValueIntDto>> data = new ArrayList<>(); + NameValueListDto<NameValueIntDto> time1Dto = new NameValueListDto<>(); + time1Dto.setName(time1+"骞村唴"); + List<BattCapInfoDto> badListOfTime1 = time1List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_2.getStateName())) + .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList()); + List<BattCapInfoDto> damageListOfTime1 = time1List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_3.getStateName())) + .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList()); + NameValueIntDto time1BadDto = new NameValueIntDto(); + time1BadDto.setName("鍔e寲"); + time1BadDto.setValue(badListOfTime1.size()); + NameValueIntDto time1DamageDto = new NameValueIntDto(); + time1DamageDto.setName("鎹熷潖"); + time1DamageDto.setValue(damageListOfTime1.size()); + time1Dto.setValue(Arrays.asList(time1BadDto,time1DamageDto)); + + NameValueListDto<NameValueIntDto> time12Dto = new NameValueListDto<>(); + time12Dto.setName(time1+"-"+time2+"骞�"); + List<BattCapInfoDto> badListOfTime12 = time12List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_2.getStateName())) + .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList()); + List<BattCapInfoDto> damageListOfTime12 = time12List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_3.getStateName())) + .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList()); + NameValueIntDto time12BadDto = new NameValueIntDto(); + time12BadDto.setName("鍔e寲"); + time12BadDto.setValue(badListOfTime12.size()); + NameValueIntDto time12DamageDto = new NameValueIntDto(); + time12DamageDto.setName("鎹熷潖"); + time12DamageDto.setValue(damageListOfTime12.size()); + time12Dto.setValue(Arrays.asList(time12BadDto,time12DamageDto)); + + NameValueListDto<NameValueIntDto> time2Dto = new NameValueListDto<>(); + time2Dto.setName(time2+"骞翠互涓�"); + List<BattCapInfoDto> badListOfTime2 = time2List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_2.getStateName())) + .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList()); + List<BattCapInfoDto> damageListOfTime2 = time2List.stream().filter(battCapInfo -> battCapInfo.getPerformance().equals(Capperformance.BATTSTATE_3.getStateName())) + .sorted(Comparator.comparing(BattCapInfoDto::getRealCap)).collect(Collectors.toList()); + NameValueIntDto time2BadDto = new NameValueIntDto(); + time2BadDto.setName("鍔e寲"); + time2BadDto.setValue(badListOfTime2.size()); + NameValueIntDto time2DamageDto = new NameValueIntDto(); + time2DamageDto.setName("鎹熷潖"); + time2DamageDto.setValue(damageListOfTime2.size()); + time2Dto.setValue(Arrays.asList(time2BadDto,time2DamageDto)); + + data.add(time1Dto); + data.add(time12Dto); + data.add(time2Dto); + + //data2 + List<NameValueListDto<NameValueObjectDto<BattCapInfoDto>>> data2 = new ArrayList<>(); + NameValueListDto<NameValueObjectDto<BattCapInfoDto>> time1ObjectDto = new NameValueListDto<>(); + time1ObjectDto.setName(time1+"骞村唴"); + NameValueObjectDto<BattCapInfoDto> time1BadObjectDto = new NameValueObjectDto(); + time1BadObjectDto.setName("鍔e寲"); + time1BadObjectDto.setValue(badListOfTime1.size()==0?new BattCapInfoDto():badListOfTime1.get(0)); + + NameValueObjectDto<BattCapInfoDto> time1DamageObjectDto = new NameValueObjectDto(); + time1DamageObjectDto.setName("鎹熷潖"); + time1DamageObjectDto.setValue(damageListOfTime1.size()==0?new BattCapInfoDto():damageListOfTime1.get(0)); + time1ObjectDto.setValue(Arrays.asList(time1BadObjectDto,time1DamageObjectDto)); + data2.add(time1ObjectDto); + + NameValueListDto<NameValueObjectDto<BattCapInfoDto>> time12ObjectDto = new NameValueListDto<>(); + time12ObjectDto.setName(time1+"-"+time2+"骞�"); + NameValueObjectDto<BattCapInfoDto> time12BadObjectDto = new NameValueObjectDto(); + time12BadObjectDto.setName("鍔e寲"); + time12BadObjectDto.setValue(badListOfTime12.size()==0?new BattCapInfoDto():badListOfTime12.get(0)); + NameValueObjectDto<BattCapInfoDto> time12DamageObjectDto = new NameValueObjectDto(); + time12DamageObjectDto.setName("鎹熷潖"); + time12DamageObjectDto.setValue(damageListOfTime12.size()==0?new BattCapInfoDto():damageListOfTime12.get(0)); + time12ObjectDto.setValue(Arrays.asList(time12BadObjectDto,time12DamageObjectDto)); + data2.add(time12ObjectDto); + + NameValueListDto<NameValueObjectDto<BattCapInfoDto>> time2ObjectDto = new NameValueListDto<>(); + time2ObjectDto.setName(time2+"骞翠互涓�"); + NameValueObjectDto<BattCapInfoDto> time2BadObjectDto = new NameValueObjectDto(); + time2BadObjectDto.setName("鍔e寲"); + time2BadObjectDto.setValue(badListOfTime2.size()==0?new BattCapInfoDto():badListOfTime2.get(0)); + NameValueObjectDto<BattCapInfoDto> time2DamageObjectDto = new NameValueObjectDto(); + time2DamageObjectDto.setName("鎹熷潖"); + time2DamageObjectDto.setValue(damageListOfTime2.size()==0?new BattCapInfoDto():damageListOfTime2.get(0)); + time2ObjectDto.setValue(Arrays.asList(time2BadObjectDto,time2DamageObjectDto)); + data2.add(time2ObjectDto); + + return new Response().setII(1,data,data2,""); + + } + + public List<BattCapInfoDto> getBattCapInfo(List<BattInf> battInfList) { + //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁� + 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鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 + if(battInfList==null||battInfList.size()==0){ + //return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�"); + } + List<BattCapInfoDto> capInfoList = new ArrayList<>(); + + for (BattInf battInf:battInfList) { + BattCapInfoDto capInfo = new BattCapInfoDto(); + capInfo.setStationName(battInf.getStationName()); + capInfo.setBattGroupName(battInf.getBattgroupName()); + capInfo.setDeviceName(battInf.getDevName()); + capInfo.setProduct(battInf.getProduct()); + capInfo.setInuseTime(battInf.getInuseTime()); + + //2.鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) + BatttestdataInf testInf = battTestDataInfService.getLastStandardTestDataByTime(battInf.getBattgroupId(), battInf.getInuseTime(),null); + if (testInf == null) { + capInfo.setRealCap(0f); + capInfo.setCapPercentage("0"); + capInfo.setPerformance(Capperformance.BATTSTATE_4.getStateName()); + continue; + } + //鎵捐繖娆℃斁鐢电殑鏈�鍚庝竴绗旀暟鎹� + List<BatttestdataId> idDataList = battTestDataIdService.getLastDataByBattgroupId(testInf.getBattgroupId(), testInf.getTestRecordCount(), testInf.getRecordNum()); + if (idDataList == null || idDataList.size() == 0) { + capInfo.setRealCap(0f); + capInfo.setCapPercentage("0"); + capInfo.setPerformance(Capperformance.BATTSTATE_4.getStateName()); + continue; + } + Float moncapStd = battInf.getMoncapstd(); + int hourRate = BattCapFactory.GetHourRate(testInf.getTestCap(), testInf.getTestCurr()); + Float groupRealCap = (float) BattCapFactory.GetMonomerCap(testInf.getTestCap(), hourRate, testInf.getTestCap(), testInf.getMaxMonvol(), testInf.getMinMonvol(), testInf.getGroupVol(), BattCapFactory.CapType_Real); + capInfo.setRealCap(groupRealCap); + if (groupRealCap >= moncapStd * badValue) { + capInfo.setPerformance(Capperformance.BATTSTATE_1.getStateName()); + } + if (groupRealCap <= moncapStd * damageValue) { + capInfo.setPerformance(Capperformance.BATTSTATE_3.getStateName()); + } + if ((groupRealCap > moncapStd * damageValue) && (groupRealCap < moncapStd * badValue)) { + capInfo.setPerformance(Capperformance.BATTSTATE_2.getStateName()); + } + //淇濈暀5浣嶅皬鏁� + String capPercentage = String.format("%.5f", (groupRealCap / battInf.getMoncapstd() * 100)); + capInfo.setCapPercentage(capPercentage); + + capInfoList.add(capInfo); + } + return capInfoList; + } + } -- Gitblit v1.9.1