| | |
| | | |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/visual/wrapper/VisualCountPulseWrapper.class */ |
| | | public class VisualCountPulseWrapper { |
| | | static final /* synthetic */ boolean $assertionsDisabled; |
| | | |
| | | static { |
| | | $assertionsDisabled = !VisualCountPulseWrapper.class.desiredAssertionStatus(); |
| | | } |
| | | |
| | | |
| | | public static ChartSeriesDataVO<Long> visualCountDataByHour(DynamicCountDateAggregateDTO countAggregateDataDTO) { |
| | | return visualCountDataByCondition(countAggregateDataDTO, ChronoUnit.HOURS, date -> { |
| | |
| | | } |
| | | |
| | | public static ChartSeriesDataVO<Long> visualCountDataByShift(DynamicCountDateAggregateDTO countAggregateDataDTO) { |
| | | Map<Long, Long> aggregateData = (Map) countAggregateDataDTO.getList().stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<Long, Long> aggregateData = countAggregateDataDTO.getList().stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | }, Collectors.summingLong((v0) -> { |
| | | return v0.getOutput(); |
| | | }))); |
| | | WorkstationChartSeriesDataVO<Long> chartSeriesDataVO = new WorkstationChartSeriesDataVO<>(); |
| | | List<Long> data = (List) countAggregateDataDTO.getWorkstationList().stream().map(workstation -> { |
| | | List<Long> data = countAggregateDataDTO.getWorkstationList().stream().map(workstation -> { |
| | | return (Long) aggregateData.getOrDefault(workstation.getId(), 0L); |
| | | }).collect(Collectors.toList()); |
| | | SeriesItem<Long> item = new SeriesItem<>(VisualConstant.SHIFT_OUTPUT, data); |
| | |
| | | } |
| | | |
| | | private static ChartSeriesDataVO<Long> visualCountDataByCondition(DynamicCountDateAggregateDTO countAggregateDataDTO, ChronoUnit chronoUnit, Function<LocalDateTime, String> categoriesFormat) { |
| | | UnaryOperator<LocalDateTime> unaryOperator; |
| | | if ($assertionsDisabled || countAggregateDataDTO.getStartTime() != null) { |
| | | if ($assertionsDisabled || countAggregateDataDTO.getEndTime() != null) { |
| | | List<Workstation> workstationList = countAggregateDataDTO.getWorkstationList(); |
| | | Map<Long, String> categoriesSuffix = (Map) workstationList.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getId(); |
| | | }, (v0) -> { |
| | | return v0.getName(); |
| | | })); |
| | | List<SuperAggregateOutput> list = countAggregateDataDTO.getList(); |
| | | LocalDateTime startTime = countAggregateDataDTO.getStartTime(); |
| | | LocalDateTime endTime = countAggregateDataDTO.getEndTime(); |
| | | long between = chronoUnit.between(startTime, endTime); |
| | | if (chronoUnit.equals(ChronoUnit.HOURS)) { |
| | | unaryOperator = date -> { |
| | | return date.plusHours(1L); |
| | | }; |
| | | } else { |
| | | unaryOperator = chronoUnit.equals(ChronoUnit.DAYS) ? date2 -> { |
| | | return date2.plusDays(1L); |
| | | } : null; |
| | | } |
| | | UnaryOperator<LocalDateTime> operator = unaryOperator; |
| | | if ($assertionsDisabled || operator != null) { |
| | | List<String> categories = (List) Stream.iterate(startTime, operator).limit(between + 1).map(categoriesFormat).collect(Collectors.toList()); |
| | | ChartSeriesDataVO<Long> chartSeriesDataVO = new ChartSeriesDataVO<>(); |
| | | Map<Long, SeriesItem<Long>> seriesMap = new HashMap<>(); |
| | | ((Map) list.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | }))).forEach(id, aggregateOutputs -> { |
| | | Map<String, Long> collectMap = (Map) aggregateOutputs.stream().collect(Collectors.groupingBy(aggregate -> { |
| | | return (String) categoriesFormat.apply(aggregate.getTs().toLocalDateTime()); |
| | | }, Collectors.summingLong((v0) -> { |
| | | return v0.getOutput(); |
| | | }))); |
| | | seriesMap.put(id, new SeriesItem((String) categoriesSuffix.get(id), (List) categories.stream().map(it -> { |
| | | return (Long) collectMap.getOrDefault(it, 0L); |
| | | }).collect(Collectors.toList()))); |
| | | }); |
| | | chartSeriesDataVO.setCategories(categories); |
| | | chartSeriesDataVO.setSeries((List) countAggregateDataDTO.getWorkstationList().stream().map(item -> { |
| | | return (SeriesItem) seriesMap.get(item.getId()); |
| | | }).filter((v0) -> { |
| | | return Objects.nonNull(v0); |
| | | }).collect(Collectors.toList())); |
| | | return chartSeriesDataVO; |
| | | } |
| | | throw new AssertionError(); |
| | | } |
| | | throw new AssertionError(); |
| | | assert countAggregateDataDTO.getStartTime() != null; |
| | | assert countAggregateDataDTO.getEndTime() != null; |
| | | //UnaryOperator<LocalDateTime> unaryOperator; |
| | | |
| | | List<Workstation> workstationList = countAggregateDataDTO.getWorkstationList(); |
| | | Map<Long, String> categoriesSuffix = workstationList.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getId(); |
| | | }, (v0) -> { |
| | | return v0.getName(); |
| | | })); |
| | | List<SuperAggregateOutput> list = countAggregateDataDTO.getList(); |
| | | LocalDateTime startTime = countAggregateDataDTO.getStartTime(); |
| | | LocalDateTime endTime = countAggregateDataDTO.getEndTime(); |
| | | long between = chronoUnit.between(startTime, endTime); |
| | | |
| | | UnaryOperator<LocalDateTime> operator = chronoUnit.equals(ChronoUnit.HOURS) ? (date -> date.plusHours(1L)) : (chronoUnit.equals(ChronoUnit.DAYS) ? (date -> date.plusDays(1L)) : null); |
| | | /* |
| | | if (chronoUnit.equals(ChronoUnit.HOURS)) { |
| | | unaryOperator = date -> { |
| | | return date.plusHours(1L); |
| | | }; |
| | | } else { |
| | | unaryOperator = chronoUnit.equals(ChronoUnit.DAYS) ? date2 -> { |
| | | return date2.plusDays(1L); |
| | | } : null; |
| | | } |
| | | throw new AssertionError(); |
| | | UnaryOperator<LocalDateTime> operator = unaryOperator; |
| | | */ |
| | | assert operator != null; |
| | | |
| | | List<String> categories = Stream.iterate(startTime, operator).limit(between + 1).map(categoriesFormat).collect(Collectors.toList()); |
| | | ChartSeriesDataVO<Long> chartSeriesDataVO = new ChartSeriesDataVO<>(); |
| | | Map<Long, SeriesItem<Long>> seriesMap = new HashMap<>(); |
| | | list.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | })).forEach((id, aggregateOutputs) -> { |
| | | Map<String, Long> collectMap = aggregateOutputs.stream().collect(Collectors.groupingBy(aggregate -> { |
| | | return (String) categoriesFormat.apply(aggregate.getTs().toLocalDateTime()); |
| | | }, Collectors.summingLong((v0) -> { |
| | | return v0.getOutput(); |
| | | }))); |
| | | seriesMap.put(id, new SeriesItem((String) categoriesSuffix.get(id), categories.stream().map(it -> { |
| | | return (Long) collectMap.getOrDefault(it, 0L); |
| | | }).collect(Collectors.toList()))); |
| | | }); |
| | | chartSeriesDataVO.setCategories(categories); |
| | | chartSeriesDataVO.setSeries(countAggregateDataDTO.getWorkstationList().stream().map(item -> { |
| | | return (SeriesItem) seriesMap.get(item.getId()); |
| | | }).filter((v0) -> { |
| | | return Objects.nonNull(v0); |
| | | }).collect(Collectors.toList())); |
| | | return chartSeriesDataVO; |
| | | } |
| | | } |