| | |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | BeanUtils.copyProperties(orderMeal, orderMealVO); |
| | | List<TOrderMealGoods> list = orderMealGoodsService.list(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .eq(TOrderMealGoods::getOrderId, orderMeal.getId())); |
| | | if(!CollectionUtils.isEmpty(list)){ |
| | | Map<String, List<TOrderMealGoods>> map = list.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(","))); |
| | | }); |
| | | orderMealVO.setGoodsList(goodsList); |
| | | } |
| | | orderMealVO.setOrderMealGoods(list); |
| | | return AjaxResult.success(orderMealVO); |
| | | } |