| | |
| | | //转换成字符串用于excel导出 |
| | | public static CheckIndexCarVO getExcelVo(@NonNull CheckIndexCar checkIndexCar) { |
| | | CheckIndexCarVO checkIndexCarVo = new CheckIndexCarVO(); |
| | | checkIndexCarVo.setNum(checkIndexCar.getNum()); |
| | | checkIndexCarVo.setScore(checkIndexCar.getScore().setScale(2,RoundingMode.HALF_UP)); |
| | | checkIndexCarVo.setDeptName(checkIndexCar.getDeptName()); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | |
| | | }else { |
| | | checkIndexCarVo.setCreateTimeStr(checkIndexCar.getCreateTimeStr()); |
| | | } |
| | | checkIndexCarVo.setExamineTagStr(CheckConstants.Examine_Tag_Province.equals(checkIndexCar.getExamineTag()) ? "省厅考核" : "区县考核"); |
| | | checkIndexCarVo.setExamineTagStr(CheckConstants.Examine_Tag_Province.equals(checkIndexCar.getExamineTag()) ? "省厅考核" : CheckConstants.Examine_Tag_County.equals(checkIndexCar.getExamineTag()) ? "区县考核" : "公安部考核"); |
| | | checkIndexCarVo.setSiteOnlineText(checkIndexCar.getSiteOnline().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%"); |
| | | checkIndexCarVo.setVehicleCaptureAccuracyText(checkIndexCar.getVehicleCaptureAccuracy().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%"); |
| | | checkIndexCarVo.setDeviceDirectoryConsistentText(checkIndexCar.getDeviceDirectoryConsistent().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%"); |
| | |
| | | * 导出时用于计算平均值 |
| | | */ |
| | | public static CheckIndexCar calculateAverage(List<CheckIndexCar> checkIndexCars) { |
| | | Integer numSum = 0; |
| | | BigDecimal scoreSum = BigDecimal.ZERO; |
| | | BigDecimal viewConnectStabilitySum = BigDecimal.ZERO; |
| | | BigDecimal siteOnlineSum = BigDecimal.ZERO; |
| | |
| | | BigDecimal vehicleUrlAvailabilitySum = BigDecimal.ZERO; |
| | | BigDecimal vehiclePictureAvailabilitySum = BigDecimal.ZERO; |
| | | for (CheckIndexCar car : checkIndexCars) { |
| | | numSum = numSum + (car.getNum() == null? 0:car.getNum()); |
| | | scoreSum = scoreSum.add(car.getScore() == null ? BigDecimal.ZERO : car.getScore()); |
| | | viewConnectStabilitySum = viewConnectStabilitySum.add(car.getViewConnectStability()); |
| | | siteOnlineSum = siteOnlineSum.add(car.getSiteOnline()); |
| | |
| | | checkIndexCar.setDeptName(checkIndexCars.get(0).getDeptName()); |
| | | checkIndexCar.setExamineTag(checkIndexCars.get(0).getExamineTag()); |
| | | checkIndexCar.setScore(scoreSum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); |
| | | checkIndexCar.setNum(numSum/checkIndexCars.size()); |
| | | checkIndexCar.setViewConnectStability(viewConnectStabilitySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); |
| | | checkIndexCar.setSiteOnline(siteOnlineSum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); |
| | | checkIndexCar.setDeviceDirectoryConsistent(deviceDirectoryConsistentSum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); |