| | |
| | | } |
| | | PageInfo<TOrderMealVO> pageInfo = new PageInfo<>(query.getPageNum(),query.getPageSize()); |
| | | List<TOrderMealVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | return new PageInfo<>(); |
| | | } |
| | | List<Long> ids = list.stream().map(TOrderMealVO::getId).collect(Collectors.toList()); |
| | | List<TOrderMealGoods> list1 = orderMealGoodsService.list(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .in(TOrderMealGoods::getOrderId, ids)); |
| | | // 查询商品信息 |
| | | for (TOrderMealVO tOrderMealVO : list) { |
| | | List<TOrderMealGoods> list1 = orderMealGoodsService.list(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .eq(TOrderMealGoods::getOrderId, tOrderMealVO.getId())); |
| | | tOrderMealVO.setOrderMealGoods(list1); |
| | | if(!CollectionUtils.isEmpty(list1)){ |
| | | Map<String, List<TOrderMealGoods>> map = list1.stream().collect(Collectors.groupingBy(TOrderMealGoods::getTypeName)); |
| | | List<TOrderMealGoods> collect = list1.stream().filter(e -> e.getOrderId().equals(tOrderMealVO.getId())).collect(Collectors.toList()); |
| | | tOrderMealVO.setOrderMealGoods(collect); |
| | | if(!CollectionUtils.isEmpty(collect)){ |
| | | Map<String, List<TOrderMealGoods>> map = collect.stream().collect(Collectors.groupingBy(TOrderMealGoods::getTypeName)); |
| | | List<String> goodsList = new ArrayList<>(); |
| | | map.forEach((k,v)->{ |
| | | goodsList.add(k+":"+v.stream().map(item->item.getGoodsName()+" "+(item.getGoodsSalePrice().multiply(new BigDecimal(item.getGoodsCount())))).collect(Collectors.joining(","))); |