| | |
| | | |
| | | public ChartNameValueDataVO entityToEfficiencyAverageVo(List<SuperAggregateState> superAggregateStates, ProductivityTypeEnum productivityTypeEnum) { |
| | | ChartNameValueDataVO vo = new ChartNameValueDataVO(); |
| | | Map<Long, List<SuperAggregateState>> collect = (Map) superAggregateStates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<Long, List<SuperAggregateState>> collect = superAggregateStates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | })); |
| | | AtomicReference<Double> allValue = new AtomicReference<>(Double.valueOf(0.0d)); |
| | | collect.forEach(workstationId, superAggregateStateList -> { |
| | | collect.forEach((workstationId, superAggregateStateList) -> { |
| | | Double value = EifficiencyUtils.calculationResults(superAggregateStateList, productivityTypeEnum); |
| | | allValue.updateAndGet(v -> { |
| | | return Double.valueOf(v.doubleValue() + value.doubleValue()); |
| | |
| | | public ChartGanttStatusDataVO entityVO(List<Workstation> workstations, List<SuperAggregateState> superAggregateStateList) { |
| | | Map<Long, List<SuperAggregateState>> map = new HashMap<>(32); |
| | | if (Func.isNotEmpty(superAggregateStateList)) { |
| | | map = (Map) superAggregateStateList.stream().collect(Collectors.groupingBy((v0) -> { |
| | | map = superAggregateStateList.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | })); |
| | | } |
| | | ChartGanttStatusDataVO chartGanttStatusDataVO = new ChartGanttStatusDataVO(); |
| | | List<SeriesItem<GanttStatusVO>> series = new ArrayList<>(); |
| | | List<ChartGanttStatusDataVO.ColorStatus> colorStatusList = (List) WorkstationCache.getDefaultWcs().stream().map(globalWcs -> { |
| | | List<ChartGanttStatusDataVO.ColorStatus> colorStatusList = WorkstationCache.getDefaultWcs().stream().map(globalWcs -> { |
| | | return new ChartGanttStatusDataVO.ColorStatus(globalWcs.getColor(), Integer.valueOf(globalWcs.getCode()), globalWcs.getName()); |
| | | }).collect(Collectors.toList()); |
| | | for (Workstation workstation : workstations) { |
| | | List<SuperAggregateState> superAggregateStates = map.getOrDefault(workstation.getId(), new ArrayList<>()); |
| | | List<GanttStatusVO> list = (List) superAggregateStates.stream().map(superAggregateState -> { |
| | | List<GanttStatusVO> list = superAggregateStates.stream().map(superAggregateState -> { |
| | | return GanttStatusVO.builder().startTime(superAggregateState.getStartTime()).endTime(superAggregateState.getEndTime()).status(superAggregateState.getWcs()).build(); |
| | | }).collect(Collectors.toList()); |
| | | SeriesItem seriesItem = new SeriesItem(workstation.getName(), list); |
| | |
| | | public ChartNameValueDataVO entityToChartName(List<SuperAggregateState> data) { |
| | | ChartNameValueDataVO vo = new ChartNameValueDataVO(); |
| | | List<GlobalWcs> defaultWcs = WorkstationCache.getDefaultWcs(); |
| | | Map<Integer, GlobalWcs> wcsMap = (Map) defaultWcs.stream().collect(Collectors.toMap(k -> { |
| | | Map<Integer, GlobalWcs> wcsMap = defaultWcs.stream().collect(Collectors.toMap(k -> { |
| | | return Integer.valueOf(Integer.parseInt(k.getCode())); |
| | | }, v -> { |
| | | return v; |
| | | })); |
| | | Map<Integer, Long> durationMap = (Map) data.stream().filter(c -> { |
| | | Map<Integer, Long> durationMap = data.stream().filter(c -> { |
| | | return wcsMap.containsKey(c.getValueCollect()); |
| | | }).collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWcs(); |
| | |
| | | } |
| | | |
| | | public ChartSeriesDataVO entityToEfficiencyTopVo(List<SuperAggregateState> statusByCondition, ProductivityTypeEnum productivityTypeEnum, Integer top, List<Workstation> workstations, String name) { |
| | | Map<Long, Workstation> workstationMap = (Map) workstations.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<Long, Workstation> workstationMap = workstations.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getId(); |
| | | }, Function.identity())); |
| | | Map<Long, List<SuperAggregateState>> collect = (Map) statusByCondition.stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<Long, List<SuperAggregateState>> collect = statusByCondition.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | })); |
| | | Map<Long, Double> idToValue = new HashMap<>(); |
| | | collect.forEach(workstationId, statusByConditionList -> { |
| | | collect.forEach((workstationId, statusByConditionList) -> { |
| | | Double value = EifficiencyUtils.calculationResults(statusByConditionList, productivityTypeEnum); |
| | | double v = BigDecimal.valueOf(value.doubleValue()).multiply(BigDecimal.valueOf(100L)).doubleValue(); |
| | | idToValue.put(workstationId, Double.valueOf(v)); |
| | | }); |
| | | LinkedHashMap<Long, Double> collectSorted = (LinkedHashMap) idToValue.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).limit(top.intValue()).collect(Collectors.toMap((v0) -> { |
| | | LinkedHashMap<Long, Double> collectSorted = idToValue.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).limit(top.intValue()).collect(Collectors.toMap((v0) -> { |
| | | return v0.getKey(); |
| | | }, (v0) -> { |
| | | return v0.getValue(); |
| | | }, oldValue, newValue -> { |
| | | }, (oldValue, newValue) -> { |
| | | return oldValue; |
| | | }, LinkedHashMap::new)); |
| | | WorkstationChartSeriesDataVO chartSeriesDataVO = new WorkstationChartSeriesDataVO(); |
| | |
| | | SeriesItem seriesItem = new SeriesItem(); |
| | | seriesItem.setName(name); |
| | | List<Workstation> categories = new ArrayList<>(); |
| | | collectSorted.forEach(workstationId2, value -> { |
| | | collectSorted.forEach((workstationId2, value) -> { |
| | | data.add(value); |
| | | categories.add(workstationMap.get(workstationId2)); |
| | | }); |
| | |
| | | |
| | | public ChartNameValueDataVO entityToEfficiencyTodayVo(List<SuperAggregateState> superAggregateStates, List<Workstation> workstations, ProductivityTypeEnum productivityTypeEnum) { |
| | | ChartNameValueDataVO vo = new ChartNameValueDataVO(); |
| | | Map<Long, String> workstationIdToName = (Map) workstations.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<Long, String> workstationIdToName = workstations.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getId(); |
| | | }, (v0) -> { |
| | | return v0.getName(); |
| | | })); |
| | | Map<Long, List<SuperAggregateState>> collect = (Map) superAggregateStates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<Long, List<SuperAggregateState>> collect = superAggregateStates.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | })); |
| | | collect.forEach(workstationId, superAggregateStateList -> { |
| | | collect.forEach((workstationId, superAggregateStateList) -> { |
| | | Double value = EifficiencyUtils.calculationResults(superAggregateStateList, productivityTypeEnum); |
| | | vo.addValue((String) workstationIdToName.get(workstationId), value); |
| | | }); |