| | |
| | | //转换成字符串用于excel导出 |
| | | public static CheckIndexVideoVO getExcelVo(@NonNull CheckIndexVideo checkIndexVideo) { |
| | | CheckIndexVideoVO checkIndexVideoVO = new CheckIndexVideoVO(); |
| | | checkIndexVideoVO.setScore(checkIndexVideo.getScore().setScale(2,RoundingMode.HALF_UP)); |
| | | checkIndexVideoVO.setNum(checkIndexVideo.getNum()); |
| | | checkIndexVideoVO.setScore(checkIndexVideo.getScore().setScale(2, RoundingMode.HALF_UP)); |
| | | checkIndexVideoVO.setDeptName(checkIndexVideo.getDeptName()); |
| | | //避免合计行报错(合计数据 缺少createTimeStr字段 直接将createTimeStr设置为"合计") |
| | | if (StringUtils.isEmpty(checkIndexVideo.getCreateTimeStr())) { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | checkIndexVideoVO.setCreateTimeStr(format.format(checkIndexVideo.getCreateTime())); |
| | | }else { |
| | | } else { |
| | | checkIndexVideoVO.setCreateTimeStr(checkIndexVideo.getCreateTimeStr()); |
| | | } |
| | | checkIndexVideoVO.setExamineTagStr(CheckConstants.Examine_Tag_Province.equals(checkIndexVideo.getExamineTag()) ? "省厅考核" : "区县考核"); |
| | | checkIndexVideoVO.setExamineTagStr(CheckConstants.Examine_Tag_Province.equals(checkIndexVideo.getExamineTag()) ? "省厅考核" : CheckConstants.Examine_Tag_County.equals(checkIndexVideo.getExamineTag()) ? "区县考核" : "公安部考核"); |
| | | checkIndexVideoVO.setSiteOnlineText(checkIndexVideo.getSiteOnline().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%"); |
| | | checkIndexVideoVO.setImageResourceSecurityText(checkIndexVideo.getImageResourceSecurity().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%"); |
| | | checkIndexVideoVO.setArchivesRateText(checkIndexVideo.getArchivesRate().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%"); |
| | |
| | | * 用于导出计算平均值 |
| | | */ |
| | | public static CheckIndexVideo calculateAverage(List<CheckIndexVideo> videos) { |
| | | Integer numSum = 0; |
| | | BigDecimal scoreSum = BigDecimal.ZERO; |
| | | BigDecimal totalPlatformOnline = BigDecimal.ZERO; |
| | | BigDecimal totalMonitorQualification = BigDecimal.ZERO; |
| | |
| | | |
| | | int count = videos.size(); |
| | | for (CheckIndexVideo video : videos) { |
| | | numSum = numSum + (video.getNum() == null ? 0 : video.getNum()); |
| | | scoreSum = scoreSum.add(video.getScore() == null ? BigDecimal.ZERO : video.getScore()); |
| | | totalPlatformOnline = totalPlatformOnline.add(video.getPlatformOnline()); |
| | | totalMonitorQualification = totalMonitorQualification.add(video.getMonitorQualification()); |
| | |
| | | averageVideo.setCreateTimeStr("合计"); |
| | | averageVideo.setDeptName(videos.get(0).getDeptName()); |
| | | averageVideo.setExamineTag(videos.get(0).getExamineTag()); |
| | | averageVideo.setNum(numSum / count); |
| | | averageVideo.setScore(scoreSum.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); |
| | | averageVideo.setPlatformOnline(totalPlatformOnline.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); |
| | | averageVideo.setMonitorQualification(totalMonitorQualification.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); |