| | |
| | | package org.jeecg.modules.mdc.subcontrol.service.impl; |
| | | |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.jeecg.modules.mdc.entity.EquipmentLog; |
| | | import org.jeecg.modules.mdc.service.*; |
| | | import org.jeecg.modules.mdc.subcontrol.service.MdcBigScreenService; |
| | |
| | | private IEquipmentStatisticalInfoService equipmentStatisticalInfoService; |
| | | @Autowired |
| | | private IMdcEquipmentStatisticalShiftInfoService mdcEquipmentStatisticalShiftInfoService; |
| | | @Autowired |
| | | private IMdcEquipmentStatisticalInfoService mdcEquipmentStatisticalInfoService; |
| | | |
| | | |
| | | @Resource |
| | |
| | | List<LastWeekDataVo> lastWeekDataVos = equipmentStatisticalInfoService.findDataRankingForBigScreen(equipmentIdList, monday, saturday); |
| | | if (!lastWeekDataVos.isEmpty()) { |
| | | for (LastWeekDataVo lastWeekDataVo : lastWeekDataVos) { |
| | | Long size = equipmentStatisticalInfoService.selectSize(lastWeekDataVo.getEquipment(), monday, saturday); |
| | | lastWeekDataVo.setUtilization(new BigDecimal(String.format("%.2f", (Float.parseFloat(lastWeekDataVo.getProcessingLong()) / (86400 * size) * 100)))); |
| | | Long size = mdcEquipmentStatisticalInfoService.selectSize(lastWeekDataVo.getEquipment(), monday, saturday); |
| | | if (StringUtils.isNotEmpty(lastWeekDataVo.getProcessingLong()) && Float.parseFloat(lastWeekDataVo.getProcessingLong()) >0) { |
| | | lastWeekDataVo.setUtilization(new BigDecimal(String.format("%.2f", |
| | | (Float.parseFloat(lastWeekDataVo.getProcessingLong()) / (86400 * size) * 100)))); |
| | | } else { |
| | | lastWeekDataVo.setUtilization(new BigDecimal(0)); |
| | | } |
| | | |
| | | } |
| | | List<LastWeekDataVo> collect = lastWeekDataVos.stream().sorted(Comparator.comparing(LastWeekDataVo::getUtilization).reversed()).collect(Collectors.toList()); |
| | | if (collect.size() > 3) { |
| | | if (collect.size() > 6) { |
| | | List<LastWeekDataVo> topList = collect.subList(0, 6); |
| | | for (LastWeekDataVo vo : topList) { |
| | | LastWeekDataRankingVo rankingVo = new LastWeekDataRankingVo(); |
| | |
| | | rankingVo.setTopRate(vo.getUtilization().toString()); |
| | | voList.add(rankingVo); |
| | | } |
| | | } else { |
| | | for (LastWeekDataVo vo : collect) { |
| | | LastWeekDataRankingVo rankingVo = new LastWeekDataRankingVo(); |
| | | rankingVo.setTopName(vo.getEquipment()); |
| | | rankingVo.setTopRate(vo.getUtilization().toString()); |
| | | voList.add(rankingVo); |
| | | } |
| | | } |
| | | |
| | | } |