实际开发中java使用stream()流的操作
List<SalesSettlementReportVo> salesList = baseMapper.selectSalesInfoByDate(monthDate);
//计算该月全渠道净销售额总值
BigDecimal sumNetSales =salesList.stream().map(SalesSettlementReportVo::getNetSales).reduce(BigDecimal.ZERO, BigDecimal::add);
//根据销售渠道id(channelId)属性,对净销售额(netSales)属性进行分组求和
Map<Long, BigDecimal> sumNetSalesMap = salesList.stream().collect(
Collectors.groupingBy(SalesSettlementReportVo::getChannelId,
Collectors.reducing(BigDecimal.ZERO, SalesSettlementReportVo::getNetSales, BigDecimal::add)));