| | |
| | | List<PersonnelStatisticsVO> personnelStatisticsVOS = orderMealService.personnelStatistics(query); |
| | | personnelStatisticsAndSumVO.setPersonnelStatisticsVOS(personnelStatisticsVOS); |
| | | if(!CollectionUtils.isEmpty(personnelStatisticsVOS)){ |
| | | personnelStatisticsAndSumVO.setPersonCountSum(personnelStatisticsVOS.stream().mapToInt(PersonnelStatisticsVO::getPersonCount).sum()); |
| | | personnelStatisticsAndSumVO.setPersonCountSum(personnelStatisticsVOS.stream().filter(e->e.getPersonCount() != null).mapToInt(PersonnelStatisticsVO::getPersonCount).sum()); |
| | | // 计算列表中平均金额乘以人数的总和 |
| | | personnelStatisticsAndSumVO.setTotalMoney(personnelStatisticsVOS.stream().mapToDouble(personnelStatisticsVO -> personnelStatisticsVO.getAvgAmount().doubleValue() * personnelStatisticsVO.getPersonCount()).sum()); |
| | | personnelStatisticsAndSumVO.setTotalMoney(personnelStatisticsVOS.stream().filter(e->e.getPersonCount() != null).mapToDouble(personnelStatisticsVO -> personnelStatisticsVO.getAvgAmount().doubleValue() * personnelStatisticsVO.getPersonCount()).sum()); |
| | | } |
| | | return AjaxResult.success(personnelStatisticsAndSumVO); |
| | | } |