Commit 2c1fe837 by ping.wu

处理集合中返回null对象报错

parent eb8d4744
...@@ -372,34 +372,36 @@ public class PointsMallOrderServiceImpl implements PointsMallOrderService { ...@@ -372,34 +372,36 @@ public class PointsMallOrderServiceImpl implements PointsMallOrderService {
List<ScoreRecordVo> result = new ArrayList<>(); List<ScoreRecordVo> result = new ArrayList<>();
List<OrderInfoReqs> list = userorderResponse.getResult().getItemList(); List<OrderInfoReqs> list = userorderResponse.getResult().getItemList();
list.forEach(order -> { list.forEach(order -> {
ScoreRecordVo responseVo = new ScoreRecordVo(); if (order != null){
responseVo.setOrderCode(order.getOrderCode()); ScoreRecordVo responseVo = new ScoreRecordVo();
responseVo.setOrderStatus(order.getOrderState()); responseVo.setOrderCode(order.getOrderCode());
responseVo.setOrderStatus(order.getOrderState());
// responseVo.setExpressChannelName(order.getExpressChannelName()); // responseVo.setExpressChannelName(order.getExpressChannelName());
// responseVo.setExpressChannelCode(order.getExpressChannelCode()); // responseVo.setExpressChannelCode(order.getExpressChannelCode());
if (order.getCreateTime() != null) { if (order.getCreateTime() != null) {
responseVo.setCreateTime(Long.parseLong(order.getCreateTime())); responseVo.setCreateTime(Long.parseLong(order.getCreateTime()));
}
boolean entityProduct = false;
if (CollectionUtils.isNotEmpty(order.getOrderItemList())) {
OrderItemResp orderItemResp = order.getOrderItemList().get(0);
responseVo.setProductName(orderItemResp.getProductName());
responseVo.setProductQuantity(orderItemResp.getProductQuantity());
responseVo.setProductType(orderItemResp.getProductType());
responseVo.setIntegralPrice(orderItemResp.getProductPrice().intValue());
responseVo.setCashPrice(orderItemResp.getSalePrice().intValue());
responseVo.setProductPicUrl(orderItemResp.getProductPicUrl());
if (orderItemResp.getProductType() == 2) {
entityProduct = true;
} }
boolean entityProduct = false;
if (CollectionUtils.isNotEmpty(order.getOrderItemList())) {
OrderItemResp orderItemResp = order.getOrderItemList().get(0);
responseVo.setProductName(orderItemResp.getProductName());
responseVo.setProductQuantity(orderItemResp.getProductQuantity());
responseVo.setProductType(orderItemResp.getProductType());
responseVo.setIntegralPrice(orderItemResp.getProductPrice().intValue());
responseVo.setCashPrice(orderItemResp.getSalePrice().intValue());
responseVo.setProductPicUrl(orderItemResp.getProductPicUrl());
if (orderItemResp.getProductType() == 2) {
entityProduct = true;
}
}
if (entityProduct && CollectionUtils.isNotEmpty(order.getDeliveryContactInfoList())) {
DeliveryContactInfoResp deliveryContactInfoResp = order.getDeliveryContactInfoList().get(0);
responseVo.setUserName(deliveryContactInfoResp.getContactsName());
responseVo.setMobile(deliveryContactInfoResp.getMobile());
responseVo.setAddressDetail(deliveryContactInfoResp.getAddressDetail());
}
result.add(responseVo);
} }
if (entityProduct && CollectionUtils.isNotEmpty(order.getDeliveryContactInfoList())) {
DeliveryContactInfoResp deliveryContactInfoResp = order.getDeliveryContactInfoList().get(0);
responseVo.setUserName(deliveryContactInfoResp.getContactsName());
responseVo.setMobile(deliveryContactInfoResp.getMobile());
responseVo.setAddressDetail(deliveryContactInfoResp.getAddressDetail());
}
result.add(responseVo);
}); });
PageInfo<ScoreRecordVo> pageInfo = new PageInfo<>(); PageInfo<ScoreRecordVo> pageInfo = new PageInfo<>();
pageInfo.setList(result); pageInfo.setList(result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment