...
|
...
|
@@ -3,10 +3,7 @@ package com.yohoufo.order.service.impl; |
|
|
import com.google.common.collect.Maps;
|
|
|
import com.yoho.error.ServiceError;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
|
|
|
import com.yohobuy.ufo.model.order.bo.GoodsInfo;
|
|
|
import com.yohobuy.ufo.model.order.bo.OrderInfo;
|
|
|
import com.yohobuy.ufo.model.order.bo.TimeoutBo;
|
|
|
import com.yohobuy.ufo.model.order.bo.*;
|
|
|
import com.yohobuy.ufo.model.order.common.*;
|
|
|
import com.yohobuy.ufo.model.order.constants.SkupType;
|
|
|
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
|
...
|
...
|
@@ -105,15 +102,21 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
|
|
|
|
|
|
|
|
public List<OrderListInfo> buildOrderList(List<SellerOrderGoods> sogList, SellerType sellerType){
|
|
|
Map<String, String> overPriceTipsMap = buildOverPriceTipsMap(sogList);
|
|
|
Set<Integer> storageIds = sogList.parallelStream().map(SellerOrderGoods::getStorageId)
|
|
|
.collect(Collectors.toSet());
|
|
|
Map<Integer, StorageInfoResp> getStorageDataMap = productProxyService.getStorageDataMap(storageIds);
|
|
|
Map<String, String> overPriceTipsMap = skupListService.buildOverPriceTipsMap(storageIds, sogList, getStorageDataMap);
|
|
|
Map<Integer, SellerOrderGoods> skupSellerOrderGoodsMap = sogList.parallelStream()
|
|
|
.collect(Collectors.toMap(SellerOrderGoods::getId, Function.identity()));
|
|
|
List<Integer> skupList = sogList.parallelStream().map(SellerOrderGoods::getId).collect(Collectors.toList());
|
|
|
List<SellerOrder> sellerOrders = sellerOrderMapper.selectBySkups(skupList);
|
|
|
List<OrderListInfo> data ;
|
|
|
data = sellerOrders.parallelStream()
|
|
|
.map(sellerOrder -> buildOrderListInfo(skupSellerOrderGoodsMap.get(sellerOrder.getSkup()),
|
|
|
sellerOrder, sellerType, overPriceTipsMap))
|
|
|
.map(sellerOrder -> {
|
|
|
SellerOrderGoods psog = skupSellerOrderGoodsMap.get(sellerOrder.getSkup());
|
|
|
StorageInfoResp storageInfoResp = getStorageDataMap.get(psog.getStorageId());
|
|
|
return buildOrderListInfo(psog, storageInfoResp, sellerOrder, sellerType, overPriceTipsMap);
|
|
|
})
|
|
|
.filter(oli -> Objects.nonNull(oli))
|
|
|
.collect(Collectors.toList());
|
|
|
return data;
|
...
|
...
|
@@ -219,6 +222,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
|
|
oli.setLeftTime(timeoutBo.getLeftTime());
|
|
|
oli.setTimeLimit(timeoutBo.getTimelimit());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -227,22 +231,13 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 需要商品提供批量接口,减少db net IO, 目前的工期太短,后期再优化
|
|
|
* @param sogList
|
|
|
* @return
|
|
|
*/
|
|
|
public Map<String,String> buildOverPriceTipsMap(List<SellerOrderGoods> sogList){
|
|
|
Set<Integer> storageIds = sogList.parallelStream().map(SellerOrderGoods::getStorageId)
|
|
|
.collect(Collectors.toSet());
|
|
|
Map<Integer, StorageInfoResp> getStorageDataMap = productProxyService.getStorageDataMap(storageIds);
|
|
|
Map<String,String> map = skupListService.buildOverPriceTipsMap(storageIds, sogList, getStorageDataMap);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
|
|
|
OrderListInfo buildOrderListInfo(SellerOrderGoods sellerOrderGoods,
|
|
|
SellerOrder sellerOrder, SellerType st,
|
|
|
|
|
|
private OrderListInfo buildOrderListInfo(SellerOrderGoods sellerOrderGoods,
|
|
|
StorageInfoResp storageInfoResp,
|
|
|
SellerOrder sellerOrder,
|
|
|
SellerType st,
|
|
|
Map<String,String> overPriceTipsMap) {
|
|
|
OrderListInfo orderListInfo = new OrderListInfo();
|
|
|
Long orderCode;
|
...
|
...
|
@@ -282,6 +277,16 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
|
|
orderListInfo.setEarnestMoney(sellerOrder.getEarnestMoney());
|
|
|
|
|
|
//
|
|
|
String leastPriceOfSkuTips = null;
|
|
|
if (skupType == SkupType.ADVANCE || skupType == SkupType.IN_STOCK){
|
|
|
if (storageInfoResp != null) {
|
|
|
PrdPrice prdPrice = PrdPrice.builder()
|
|
|
.leastPrice(storageInfoResp.getLeastPrice())
|
|
|
.preSaleLeastPrice(storageInfoResp.getPreSaleLeastPrice())
|
|
|
.build();
|
|
|
leastPriceOfSkuTips = sellerOrderViewService.buildLeastPriceTips(prdPrice, skupType);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
GoodsInfo goodsInfo = new GoodsInfo();
|
|
|
goodsInfo.setColorName(sellerOrderGoods.getColorName());
|
...
|
...
|
@@ -294,7 +299,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
|
|
goodsInfo.setBatchNo(sellerOrderGoods.getBatchNo());
|
|
|
goodsInfo.setStorageNum(storageNum);
|
|
|
goodsInfo.setSkupList(sellerOrderGoods.getSkupList());
|
|
|
|
|
|
goodsInfo.setLeastPriceOfSkuTips(leastPriceOfSkuTips);
|
|
|
|
|
|
orderListInfo.setGoodsInfo(goodsInfo);
|
|
|
orderListInfo.setSecendLevelCreateTime(sellerOrder.getCreateTime());
|
...
|
...
|
|