//精简方法(java8, lambda) List<Integer> categoryTypeList = productInfoList.stream() .map(e -> e.getCategoryType()) .collect(Collectors.toList());
//2. 计算订单总价 orderAmount = productInfo.getProductPrice() .multiply(new BigDecimal(orderDetail.getProductQuantity())) .add(orderAmount);
//判断list是否为空 if (CollectionUtils.isEmpty(orderDetailList)) { throw new SellException(ResultEnum.ORDERDETAIL_NOT_EXIST); }
BeanUtils.copyProperties(productInfo, orderDetail);
List<OrderDetail> orderDetailList = new ArrayList<>(); try { orderDetailList = gson.fromJson(orderForm.getItems(), new TypeToken<List<OrderDetail>>() { }.getType()); } catch (Exception e) { log.error("【对象转换】错误, string={}", orderForm.getItems()); throw new SellException(ResultEnum.PARAM_ERROR); }