Authored by chenchao

fix some bug

@@ -14,6 +14,7 @@ import com.yohoufo.dal.order.model.BuyerOrderGoods; @@ -14,6 +14,7 @@ import com.yohoufo.dal.order.model.BuyerOrderGoods;
14 import com.yohoufo.dal.order.model.SellerOrderGoods; 14 import com.yohoufo.dal.order.model.SellerOrderGoods;
15 import com.yohoufo.order.model.request.OrderListRequest; 15 import com.yohoufo.order.model.request.OrderListRequest;
16 import com.yohoufo.order.service.IOrderListService; 16 import com.yohoufo.order.service.IOrderListService;
  17 +import org.apache.commons.collections.CollectionUtils;
17 import org.slf4j.Logger; 18 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory; 19 import org.slf4j.LoggerFactory;
19 import org.springframework.beans.factory.annotation.Autowired; 20 import org.springframework.beans.factory.annotation.Autowired;
@@ -68,7 +69,10 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements @@ -68,7 +69,10 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements
68 List<BuyerOrder> buyerOrderList = getOrderList(request.getUid(), statusQuery, offset, limit); 69 List<BuyerOrder> buyerOrderList = getOrderList(request.getUid(), statusQuery, offset, limit);
69 70
70 List<Long> orderCodeList = buyerOrderList.stream().map(BuyerOrder::getOrderCode).collect(Collectors.toList()); 71 List<Long> orderCodeList = buyerOrderList.stream().map(BuyerOrder::getOrderCode).collect(Collectors.toList());
71 - 72 + //TODO 可以提前计算 total offset limit三者之间的关系,减少一次网络I
  73 + if (CollectionUtils.isEmpty(orderCodeList)){
  74 + return respBuilder.build();
  75 + }
72 // buyer_order_goods ===> skup+商品成交价 1:1 76 // buyer_order_goods ===> skup+商品成交价 1:1
73 List<BuyerOrderGoods> buyerOrderGoodsList = getOrderGoodsList(request.getUid(), orderCodeList); 77 List<BuyerOrderGoods> buyerOrderGoodsList = getOrderGoodsList(request.getUid(), orderCodeList);
74 Map<Long, BuyerOrderGoods> buyerOrderGoodsMap = buyerOrderGoodsList.stream() 78 Map<Long, BuyerOrderGoods> buyerOrderGoodsMap = buyerOrderGoodsList.stream()
@@ -100,7 +100,11 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde @@ -100,7 +100,11 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
100 int offset = (request.getPage() - 1) * limit; 100 int offset = (request.getPage() - 1) * limit;
101 List<SellerOrderGoods> sogList = sellerOrderGoodsMapper.selectByUidStatusGBBNList(request.getUid(), 101 List<SellerOrderGoods> sogList = sellerOrderGoodsMapper.selectByUidStatusGBBNList(request.getUid(),
102 statusList, offset, limit); 102 statusList, offset, limit);
103 - 103 + //TODO 可以提前计算 total offset limit三者之间的关系,减少一次网络I
  104 + if (CollectionUtils.isEmpty(sogList)){
  105 + log.warn("seller get order list SellerOrderGoods is empty,req {}", request);
  106 + return respBuilder.build();
  107 + }
104 sogList.stream().forEach(item -> { 108 sogList.stream().forEach(item -> {
105 item.setImageUrl(ImageUrlAssist.getAllProductPicUrl(item.getImageUrl(), "goodsimg", "center", "d2hpdGU=")); 109 item.setImageUrl(ImageUrlAssist.getAllProductPicUrl(item.getImageUrl(), "goodsimg", "center", "d2hpdGU="));
106 }); 110 });