| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @Service |
| | |
| | | }); |
| | | result.put("day", dayDTOList); |
| | | |
| | | Map<String, CokingOverviewEntity> ratioMonth = new HashMap<>(); |
| | | if (processType.equals(ProcessTypeEnum.BM.getCode())) { |
| | | ratioMonth = dayList.stream().collect(Collectors.toMap(CokingOverviewEntity::getSubProcessType, Function.identity(), (e1, e2) -> e1)); |
| | | } |
| | | |
| | | // 月数据 |
| | | QueryWrapper<CokingOverviewEntity> queryWrapperMonth = new QueryWrapper<>(); |
| | | queryWrapperMonth.eq("process_type", processType); |
| | |
| | | List<CokingOverviewEntity> monthList = cokingOverviewDao.selectList(queryWrapperMonth); |
| | | monthList.forEach(e -> e.setClock("前30日累计")); |
| | | List<CokingOverviewDTO> monthDTOList = ConvertUtils.sourceToTarget(monthList, CokingOverviewDTO.class); |
| | | monthDTOList.forEach(e -> { |
| | | for (CokingOverviewDTO e : monthDTOList) { |
| | | e.setProcessTypeName(processName); |
| | | e.setSubProcessTypeName(SubProcessTypeEnum.getEumByCode(e.getSubProcessType()).getProcess()); |
| | | }); |
| | | if (processType.equals(ProcessTypeEnum.BM.getCode())) { |
| | | // 月占比 |
| | | if (ratioMonth.containsKey(e.getSubProcessType())) { |
| | | e.setFsRatio(ratioMonth.get(e.getSubProcessType()).getFsRatioMonth()); |
| | | e.setGsRatio(ratioMonth.get(e.getSubProcessType()).getGsRatioMonth()); |
| | | e.setPsRatio(ratioMonth.get(e.getSubProcessType()).getPsRatioMonth()); |
| | | }else { |
| | | e.setFsRatio(BigDecimal.ZERO); |
| | | e.setGsRatio(BigDecimal.ZERO); |
| | | e.setPsRatio(BigDecimal.ZERO); |
| | | } |
| | | |
| | | } |
| | | } |
| | | result.put("month", monthDTOList); |
| | | |
| | | return result; |