| | |
| | | //片区 |
| | | if (ywxtAdDetail == null) { |
| | | sgStatisProVOS = sgProjectInfoMapper.getsgStatisticsZero(code); |
| | | getDeviceTypes(sgStatisProVOS); |
| | | setDeviceTypes(sgStatisProVOS); |
| | | // String getname = sgProjectInfoMapper.getname(code); |
| | | String getname = code; |
| | | updateProjectProgress(sgStatisProVOS, code, getname, "2"); |
| | | } else if (ywxtAdDetail.getAdGrad().equals("1")) {//默认 |
| | | sgStatisProVOS = sgProjectInfoMapper.getsgStatisticsOne(code); |
| | | sgStatisProVOS = getSgStatisProVOS(sgStatisProVOS); |
| | | getDeviceTypes(sgStatisProVOS); |
| | | setDeviceTypes(sgStatisProVOS); |
| | | updateProjectProgress(sgStatisProVOS, ywxtAdDetail.getPAdCode(), ywxtAdDetail.getPAdName(), "0"); |
| | | } else {//区县 |
| | | sgStatisProVOS = sgProjectInfoMapper.getsgStatisticsList(code); |
| | | getDeviceTypes(sgStatisProVOS); |
| | | setDeviceTypes(sgStatisProVOS); |
| | | updateProjectProgress(sgStatisProVOS, ywxtAdDetail.getAdCode(), ywxtAdDetail.getAdName(), "3"); |
| | | } |
| | | return sgStatisProVOS; |
| | | } |
| | | |
| | | /** |
| | | * 统计施工进度 |
| | | * @param sgStatisProVOS |
| | | */ |
| | | private void setDeviceTypes(List<SgStatisProVO> sgStatisProVOS) { |
| | | if (CollectionUtils.isNotEmpty(sgStatisProVOS)){ |
| | | Map<String, SgOperatingRateVO> deviceTypes = getDeviceTypes(sgStatisProVOS.stream().map(SgStatisProVO::getProIds).collect(Collectors.toList())); |
| | | for (SgStatisProVO vo : sgStatisProVOS) { |
| | | SgOperatingRateVO sVo = deviceTypes.get(vo.getProIds()); |
| | | if (Objects.nonNull(sVo)){ |
| | | vo.setSurfaceNum(sVo.getSurfaceNum()); |
| | | vo.setSurfaceProgress(sVo.getSurfaceProgress()+"%"); |
| | | vo.setVideoNum(sVo.getVideoNum()); |
| | | vo.setVideoProgress(sVo.getVideoProgress()+"%"); |
| | | vo.setTransNum(sVo.getTransNum()); |
| | | vo.setTransProgress(sVo.getTransProgress()+"%"); |
| | | vo.setSeepageNum(sVo.getSeepageNum()); |
| | | vo.setSeepageProgress(sVo.getSeepageProgress()+"%"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * 统计设备类型开工率 |
| | | * @param sgStatisProVOS |
| | | */ |
| | | private void getDeviceTypes(List<SgStatisProVO> sgStatisProVOS) { |
| | | if (CollectionUtils.isNotEmpty(sgStatisProVOS)){ |
| | | for (SgStatisProVO vo : sgStatisProVOS) { |
| | | String proIds = vo.getProIds(); |
| | | private Map<String,SgOperatingRateVO> getDeviceTypes(List<String> projectIds) { |
| | | Map<String,SgOperatingRateVO> result = new HashMap<>(); |
| | | if (CollectionUtils.isNotEmpty(projectIds)){ |
| | | for (String proIds : projectIds) { |
| | | SgOperatingRateVO sgOperatingRateVO = new SgOperatingRateVO(); |
| | | if (StringUtils.isNotBlank(proIds)){ |
| | | List<SgStatisDeviceVO> deviceVOS = sgProjectInfoMapper.getDeviceTypes("("+proIds+")"); |
| | | if(CollectionUtils.isNotEmpty(deviceVOS)){ |
| | |
| | | if (Objects.nonNull(sg108)){ |
| | | Integer deviceCount = sg108.getDeviceCount(); |
| | | Integer deviceStart = sg108.getDeviceStart(); |
| | | vo.setSurfaceNum(deviceCount); |
| | | sgOperatingRateVO.setSurfaceNum(deviceCount); |
| | | if (deviceCount != 0){ |
| | | BigDecimal divide = BigDecimal.valueOf(deviceStart).divide(BigDecimal.valueOf(deviceCount), 2, BigDecimal.ROUND_UP); |
| | | vo.setSeepageProgress(getBigDecimalPercent(divide)); |
| | | sgOperatingRateVO.setSeepageProgress(getBigDecimalPercent(divide)); |
| | | }else { |
| | | vo.setSeepageProgress("0%"); |
| | | sgOperatingRateVO.setSeepageProgress("0"); |
| | | } |
| | | } |
| | | //视频 |
| | |
| | | if (Objects.nonNull(sg104)){ |
| | | Integer deviceCount = sg104.getDeviceCount(); |
| | | Integer deviceStart = sg104.getDeviceStart(); |
| | | vo.setVideoNum(deviceCount); |
| | | sgOperatingRateVO.setVideoNum(deviceCount); |
| | | if (deviceCount != 0){ |
| | | BigDecimal divide = BigDecimal.valueOf(deviceStart).divide(BigDecimal.valueOf(deviceCount), 2, BigDecimal.ROUND_UP); |
| | | vo.setVideoProgress(getBigDecimalPercent(divide)); |
| | | sgOperatingRateVO.setVideoProgress(getBigDecimalPercent(divide)); |
| | | }else { |
| | | vo.setVideoProgress("0%"); |
| | | sgOperatingRateVO.setVideoProgress("0"); |
| | | } |
| | | } |
| | | //渗压 |
| | |
| | | if (Objects.nonNull(sg101)){ |
| | | Integer deviceCount = sg101.getDeviceCount(); |
| | | Integer deviceStart = sg101.getDeviceStart(); |
| | | vo.setTransNum(deviceCount); |
| | | sgOperatingRateVO.setTransNum(deviceCount); |
| | | if (deviceCount != 0){ |
| | | BigDecimal divide = BigDecimal.valueOf(deviceStart).divide(BigDecimal.valueOf(deviceCount), 2, BigDecimal.ROUND_UP); |
| | | vo.setTransProgress(getBigDecimalPercent(divide)); |
| | | sgOperatingRateVO.setTransProgress(getBigDecimalPercent(divide)); |
| | | }else { |
| | | vo.setTransProgress("0%"); |
| | | sgOperatingRateVO.setTransProgress("0"); |
| | | } |
| | | } |
| | | //渗流 |
| | |
| | | if (Objects.nonNull(sg102)){ |
| | | Integer deviceCount = sg102.getDeviceCount(); |
| | | Integer deviceStart = sg102.getDeviceStart(); |
| | | vo.setSeepageNum(deviceCount); |
| | | sgOperatingRateVO.setSeepageNum(deviceCount); |
| | | if (deviceCount != 0){ |
| | | BigDecimal divide = BigDecimal.valueOf(deviceStart).divide(BigDecimal.valueOf(deviceCount), 2, BigDecimal.ROUND_UP); |
| | | vo.setSeepageProgress(getBigDecimalPercent(divide)); |
| | | sgOperatingRateVO.setSeepageProgress(getBigDecimalPercent(divide)); |
| | | }else { |
| | | vo.setSeepageProgress("0%"); |
| | | sgOperatingRateVO.setSeepageProgress("0"); |
| | | } |
| | | } |
| | | } |
| | | result.put(proIds,sgOperatingRateVO); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private void updateProjectProgress(List<SgStatisProVO> sgStatisProVOS, String pcode, String pname, String adGrad) { |
| | |
| | | BigDecimal percentage = bigDecimal.multiply(new BigDecimal("100")); |
| | | // 如果不需要保留小数位,可以设置一个scale为0 |
| | | BigDecimal percentageRounded = percentage.setScale(0, RoundingMode.HALF_UP); |
| | | return percentageRounded+"%"; |
| | | return percentageRounded.toString(); |
| | | } |
| | | |
| | | @Override |