yangys
2024-03-29 e7aaa62a5c499747275a78ed6157024f15b9ab1e
smart-man-boot/src/main/java/com/qianwen/smartman/modules/report/service/impl/OutputStatisticsReportServiceImpl.java
@@ -73,24 +73,27 @@
        if (CollectionUtil.isEmpty(workstationData)) {
            return new JSONObject();
        }
        List<Long> ids = (List) workstationData.parallelStream().map((v0) -> {
        List<Long> ids =  workstationData.parallelStream().map((v0) -> {
            return v0.getWorkstationId();
        }).collect(Collectors.toList());
        List<ShiftInfoDTO> shiftInfoDtoList = this.calendarMapper.listShiftInfo(ids, LocalDate.parse(queryVO.getBeginTime()), LocalDate.parse(queryVO.getEndTime()));
        List<WorkstationShiftDTO> workstationShifts = CommonUtil.dataMerge(workstationData, shiftInfoDtoList);
        List<WorkstationShiftDTO> filter = (List) workstationShifts.parallelStream().filter(CommonUtil.conditionFilter(queryVO.getShiftName(), queryVO.getShiftIndex())).collect(Collectors.toList());
        List<WorkstationShiftDTO> filter =workstationShifts.parallelStream().filter(CommonUtil.conditionFilter(queryVO.getShiftName(), queryVO.getShiftIndex())).collect(Collectors.toList());
        List<OutputShiftResultVO> result = settingResult(fillDateCol, filter);
        String beginTime = DateCycleUtil.getDateByDateCycle(queryVO.getBeginTime(), anEnum, Boolean.TRUE);
        String endTime = DateCycleUtil.getDateByDateCycle(queryVO.getEndTime(), anEnum, Boolean.FALSE);
        List<SuperAggregateOutput> outputs = multithreadingTask(beginTime, endTime, ids, queryVO.getStatisticsType());
        Map<String, List<SuperAggregateOutput>> workstationOutMap = (Map) outputs.parallelStream().collect(Collectors.groupingBy(s -> {
        Map<String, List<SuperAggregateOutput>> workstationOutMap = outputs.parallelStream().collect(Collectors.groupingBy(s -> {
            return s.getWorkstationId() + "-" + s.getShiftIndex();
        }));
        Map<String, OutputShiftResultVO> voMap = (Map) result.parallelStream().collect(LinkedHashMap::new, map, c -> {
        //Map<String, OutputShiftResultVO> voMap2 = (Map<String, OutputShiftResultVO>)result.parallelStream().collect(LinkedHashMap::new, (map, c) -> {map.put(c.getWorkstationId() + "-" + c.getShiftIndex() + "-" + c.getDateCycle(), c)}, Map::putAll);
        Map<String, OutputShiftResultVO> voMap =  result.parallelStream().collect(LinkedHashMap::new, (map, c) -> {
            OutputShiftResultVO outputShiftResultVO = (OutputShiftResultVO) map.put(c.getWorkstationId() + "-" + c.getShiftIndex() + "-" + c.getDateCycle(), c);
        }, (v0, v1) -> {
            v0.putAll(v1);
        });
        }); /**/
        resultCount(workstationOutMap, anEnum, voMap);
        return ResultUtil.dataToJsonObject(voMap.values(), Long.valueOf(iPage.getTotal()), queryVO.getPageSize());
    }
@@ -116,13 +119,13 @@
    }
    private <T, R extends OutputResultVO> void resultCount(Map<T, List<SuperAggregateOutput>> workstationOutMap, StatisticalMethodEnum anEnum, Map<String, R> voMap) {
        workstationOutMap.forEach(outputKey, outputList -> {
            Map<String, Long> output = (Map) outputList.parallelStream().collect(Collectors.groupingBy(groupKey(anEnum), Collectors.mapping((v0) -> {
        workstationOutMap.forEach((outputKey, outputList) -> {
            Map<String, Long> output = outputList.parallelStream().collect(Collectors.groupingBy(groupKey(anEnum), Collectors.mapping((v0) -> {
                return v0.getOutput();
            }, Collectors.reducing(0L, (v0, v1) -> {
                return Long.sum(v0, v1);
            }))));
            output.forEach(k, v -> {
            output.forEach((k, v) -> {
                OutputResultVO vo = (OutputResultVO) voMap.get(outputKey + "-" + k);
                if (!Objects.isNull(vo)) {
                    vo.setOutputCount(v);
@@ -157,16 +160,16 @@
            return new JSONObject();
        }
        List<OutputResultVO> result = Convert.toList(OutputResultVO.class, settingResult(fillDateCol, workstationData));
        Map<String, OutputResultVO> voMap = (Map) result.parallelStream().collect(Collectors.toMap(c -> {
        Map<String, OutputResultVO> voMap = result.parallelStream().collect(Collectors.toMap(c -> {
            return c.getWorkstationId() + "-" + c.getDateCycle();
        }, o -> {
            return o;
        }));
        List<Long> ids = (List) workstationData.parallelStream().map((v0) -> {
        List<Long> ids = workstationData.parallelStream().map((v0) -> {
            return v0.getWorkstationId();
        }).collect(Collectors.toList());
        List<SuperAggregateOutput> outputs = multithreadingTask(beginTime, endTime, ids, queryVO.getStatisticsType());
        Map<Long, List<SuperAggregateOutput>> workstationOutMap = (Map) outputs.parallelStream().collect(Collectors.groupingBy((v0) -> {
        Map<Long, List<SuperAggregateOutput>> workstationOutMap = outputs.parallelStream().collect(Collectors.groupingBy((v0) -> {
            return v0.getWorkstationId();
        }));
        resultCount(workstationOutMap, anEnum, voMap);