| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/mdc/wrapper/StatisticsWrapper.class */ |
| | | public class StatisticsWrapper { |
| | | private static final Logger log = LoggerFactory.getLogger(StatisticsWrapper.class); |
| | | private final ITimeUsedAnalysisService timeUsedAnalysisService; |
| | |
| | | Boolean isOutput = statisticsWrapperDto.getIsOutput(); |
| | | Integer queryType = statisticsAnalysisQueryVO.getQueryType(); |
| | | List<Integer> shiftIndexList = statisticsAnalysisQueryVO.getShiftIndexList(); |
| | | new StatisticsVO(); |
| | | |
| | | ProductivityTypeEnum productivityType = statisticsAnalysisQueryVO.getProductivityType(); |
| | | switch (statisticsAnalysisQueryVO.getStatisticalMethod()) { |
| | | case DAY: |
| | |
| | | break; |
| | | } |
| | | default: |
| | | List<Long> workstationIds = (List) workstationPage.getRecords().stream().map((v0) -> { |
| | | List<Long> workstationIds = workstationPage.getRecords().stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toList()); |
| | | Map<Long, List<ShiftIndexNameDTO>> idToValue = this.timeUsedAnalysisService.queryWorkStationShiftIndex(workstationIds, statisticsAnalysisQueryVO.getStartDate()); |
| | |
| | | |
| | | public StatisticsVO buildDateDataSheet(List<IntervalDateDto> intervalDates, List<SuperAggregate> superAggregates, IPage<Workstation> workstationIPage, Boolean isOutput, ProductivityTypeEnum productivityType) { |
| | | StatisticsVO statisticsVO = new StatisticsVO(); |
| | | Map<Long, Map<Integer, List<SuperAggregate>>> collectGroupByDate = (Map) superAggregates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<Long, Map<Integer, List<SuperAggregate>>> collectGroupByDate = superAggregates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | }, Collectors.groupingBy((v0) -> { |
| | | return v0.getFactoryDate(); |
| | |
| | | statisticsDataVO.setId(workstation.getId().toString()); |
| | | statisticsDataVO.setWorkstationCode(workstation.getCode()); |
| | | statisticsDataVO.setWorkstationName(workstation.getName()); |
| | | Map<Integer, List<SuperAggregate>> map = (Map) collectGroupByDate.get(workstation.getId()); |
| | | Map<Integer, List<SuperAggregate>> map = collectGroupByDate.get(workstation.getId()); |
| | | LinkedHashMap<String, String> data = new LinkedHashMap<>(); |
| | | if (Func.isEmpty(map)) { |
| | | dayList.forEach(day -> { |
| | |
| | | }); |
| | | } else { |
| | | dayList.forEach(day2 -> { |
| | | List<SuperAggregate> superAggregateList = (List) map.get(Integer.valueOf(day2.replaceAll("-", ""))); |
| | | List<SuperAggregate> superAggregateList = map.get(Integer.valueOf(day2.replaceAll("-", ""))); |
| | | String value = getValue(superAggregateList, isOutput, productivityType); |
| | | data.put(day2, value); |
| | | }); |
| | |
| | | } |
| | | |
| | | public StatisticsVO buildDateData(List<IntervalDateDto> intervalDates, List<SuperAggregate> superAggregates, List<Workstation> workstationList, Boolean isOutput, ProductivityTypeEnum productivityType) { |
| | | Map<Long, Workstation> workstationIdToValue = (Map) workstationList.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<Long, Workstation> workstationIdToValue = workstationList.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getId(); |
| | | }, v -> { |
| | | return v; |
| | | })); |
| | | List<Long> workstationIdList = (List) workstationList.stream().map((v0) -> { |
| | | List<Long> workstationIdList = workstationList.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toList()); |
| | | StatisticsVO statisticsVO = new StatisticsVO(); |
| | |
| | | |
| | | public StatisticsVO buildMonthOrWeekDataSheet(List<IntervalDateDto> intervalDates, List<SuperAggregate> superAggregates, IPage<Workstation> workstationIPage, Boolean isMonth, Boolean isOutput, ProductivityTypeEnum productivityType) { |
| | | StatisticsVO statisticsVO = new StatisticsVO(); |
| | | Map<Long, Map<Integer, Map<Integer, List<SuperAggregate>>>> collectGroupByMonth = (Map) superAggregates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<Long, Map<Integer, Map<Integer, List<SuperAggregate>>>> collectGroupByMonth = superAggregates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | }, Collectors.groupingBy((v0) -> { |
| | | return v0.getFactoryYear(); |
| | | }, Collectors.groupingBy((v0) -> { |
| | | return v0.getFactoryMonth(); |
| | | })))); |
| | | Map<Long, Map<Integer, Map<Integer, List<SuperAggregate>>>> collectGroupByWeek = (Map) superAggregates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<Long, Map<Integer, Map<Integer, List<SuperAggregate>>>> collectGroupByWeek = superAggregates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | }, Collectors.groupingBy((v0) -> { |
| | | return v0.getFactoryYear(); |
| | |
| | | statisticsDataVO.setWorkstationName(workstation.getName()); |
| | | LinkedHashMap<String, String> data = new LinkedHashMap<>(); |
| | | if (isMonth.booleanValue()) { |
| | | yearMap = (Map) collectGroupByMonth.get(workstation.getId()); |
| | | yearMap = collectGroupByMonth.get(workstation.getId()); |
| | | } else { |
| | | yearMap = (Map) collectGroupByWeek.get(workstation.getId()); |
| | | yearMap = collectGroupByWeek.get(workstation.getId()); |
| | | } |
| | | if (Func.isEmpty(yearMap)) { |
| | | intervalDates.forEach(intervalDateDto -> { |
| | |
| | | |
| | | public StatisticsVO buildMonthOrWeekData(List<IntervalDateDto> intervalDates, List<SuperAggregate> superAggregates, List<Workstation> workstationList, Boolean isMonth, Boolean isOutput, ProductivityTypeEnum productivityType) { |
| | | Map<Integer, Map<Integer, Map<Long, List<SuperAggregate>>>> collectGroupByMonthOrWeek; |
| | | Map<Long, Workstation> workstationIdToValue = (Map) workstationList.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<Long, Workstation> workstationIdToValue = workstationList.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getId(); |
| | | }, v -> { |
| | | return v; |
| | | })); |
| | | List<Long> workstationIdList = (List) workstationList.stream().map((v0) -> { |
| | | List<Long> workstationIdList = workstationList.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toList()); |
| | | StatisticsVO statisticsVO = new StatisticsVO(); |
| | | if (isMonth.booleanValue()) { |
| | | collectGroupByMonthOrWeek = (Map) superAggregates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | collectGroupByMonthOrWeek = superAggregates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getFactoryYear(); |
| | | }, Collectors.groupingBy((v0) -> { |
| | | return v0.getFactoryMonth(); |
| | |
| | | return v0.getWorkstationId(); |
| | | })))); |
| | | } else { |
| | | collectGroupByMonthOrWeek = (Map) superAggregates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | collectGroupByMonthOrWeek = superAggregates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getFactoryYear(); |
| | | }, Collectors.groupingBy((v0) -> { |
| | | return v0.getFactoryWeek(); |
| | |
| | | intervalDates.forEach(intervalDateDto -> { |
| | | List<Integer> monthOrWeekList; |
| | | Integer year = intervalDateDto.getYear(); |
| | | Map<Integer, Map<Long, List<SuperAggregate>>> monthOrWeekToValue = (Map) finalCollectGroupByMonthOrWeek.get(year); |
| | | Map<Integer, Map<Long, List<SuperAggregate>>> monthOrWeekToValue = finalCollectGroupByMonthOrWeek.get(year); |
| | | if (isMonth.booleanValue()) { |
| | | monthOrWeekList = intervalDateDto.getMonthList(); |
| | | } else { |
| | |
| | | return statisticsVO; |
| | | } |
| | | |
| | | /** |
| | | * 构建效率分析的统计数据 |
| | | * @param superAggregates |
| | | * @param workstationIPage |
| | | * @param shiftIndexList |
| | | * @param idToValue |
| | | * @param isOutput |
| | | * @param productivityType |
| | | * @return |
| | | */ |
| | | public StatisticsVO buildShiftData(List<SuperAggregate> superAggregates, IPage<Workstation> workstationIPage, List<Integer> shiftIndexList, Map<Long, List<ShiftIndexNameDTO>> idToValue, Boolean isOutput, ProductivityTypeEnum productivityType) { |
| | | Map<Long, Map<Integer, List<SuperAggregate>>> collectGroupByShift = (Map) superAggregates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<Long, Map<Integer, List<SuperAggregate>>> collectGroupByShift = superAggregates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | }, Collectors.groupingBy((v0) -> { |
| | | return v0.getShiftIndex(); |
| | |
| | | statisticsDataVO.setId(String.valueOf(workstation.getId())); |
| | | statisticsDataVO.setWorkstationCode(workstation.getCode()); |
| | | statisticsDataVO.setWorkstationName(workstation.getName()); |
| | | Map<Integer, List<SuperAggregate>> map = (Map) collectGroupByShift.get(workstation.getId()); |
| | | Map<Integer, List<SuperAggregate>> map = collectGroupByShift.get(workstation.getId()); |
| | | LinkedHashMap<String, String> data = new LinkedHashMap<>(); |
| | | LinkedHashMap<String, String> shiftData = new LinkedHashMap<>(); |
| | | List<ShiftIndexNameDTO> shiftDetails = (List) idToValue.get(workstation.getId()); |
| | | List<ShiftIndexNameDTO> shiftDetails = idToValue.get(workstation.getId()); |
| | | List<Integer> trueShiftIndexList = new ArrayList<>(); |
| | | Map<Integer, String> shiftIndexToName = new HashMap<>(); |
| | | if (Func.isNotEmpty(shiftDetails)) { |
| | | trueShiftIndexList = (List) shiftDetails.stream().map((v0) -> { |
| | | trueShiftIndexList = shiftDetails.stream().map((v0) -> { |
| | | return v0.getShiftIndex(); |
| | | }).collect(Collectors.toList()); |
| | | shiftIndexToName = (Map) shiftDetails.stream().collect(Collectors.toMap((v0) -> { |
| | | shiftIndexToName = shiftDetails.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getShiftIndex(); |
| | | }, (v0) -> { |
| | | return v0.getIndexName(); |
| | |
| | | shiftIndexList.forEach(shiftIndex -> { |
| | | if (finalTrueShiftIndexList.contains(shiftIndex)) { |
| | | data.put(shiftIndex.toString(), "0"); |
| | | //data.put(shiftIndex.toString(), "0.88"); |
| | | shiftData.put(shiftIndex.toString(), finalShiftIndexToName.get(shiftIndex)); |
| | | return; |
| | | } |
| | | data.put(shiftIndex.toString(), "-"); |
| | | shiftData.put(shiftIndex.toString(), MessageUtils.message("mdc.not.schedule", new Object[0])); |
| | | }); |
| | | } else { |
| | | } else {//有数据的情况下 |
| | | Map<Integer, String> finalShiftIndexToName1 = shiftIndexToName; |
| | | List<Integer> finalTrueShiftIndexList1 = trueShiftIndexList; |
| | | shiftIndexList.forEach(shiftIndex2 -> { |
| | | if (finalTrueShiftIndexList1.contains(shiftIndex2)) { |
| | | List<SuperAggregate> superAggregateList = (List) map.get(shiftIndex2); |
| | | List<SuperAggregate> superAggregateList = map.get(shiftIndex2); |
| | | String value = getValue(superAggregateList, isOutput, productivityType); |
| | | data.put(shiftIndex2.toString(), value); |
| | | shiftData.put(shiftIndex2.toString(), finalShiftIndexToName1.get(shiftIndex2)); |