精简笔记

//精简方法(java8, lambda)
List 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 orderDetailList = new ArrayList<>();
try {
orderDetailList = gson.fromJson(orderForm.getItems(),
new TypeToken<List>() {
}.getType());
} catch (Exception e) {
log.error("【对象转换】错误, string={}", orderForm.getItems());
throw new SellException(ResultEnum.PARAM_ERROR);
}

作者:weixin_38639243
来源:CSDN
原文:https://blog.csdn.net/weixin_38639243/article/details/85260486
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自blog.csdn.net/qq_38950013/article/details/85265476
今日推荐