|
@@ -3,10 +3,7 @@ package com.yohoufo.order.service.impl; |
|
@@ -3,10 +3,7 @@ package com.yohoufo.order.service.impl; |
3
|
import com.google.common.collect.Maps;
|
3
|
import com.google.common.collect.Maps;
|
4
|
import com.yoho.error.ServiceError;
|
4
|
import com.yoho.error.ServiceError;
|
5
|
import com.yoho.error.exception.ServiceException;
|
5
|
import com.yoho.error.exception.ServiceException;
|
6
|
-import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
|
|
|
7
|
-import com.yohobuy.ufo.model.order.bo.GoodsInfo;
|
|
|
8
|
-import com.yohobuy.ufo.model.order.bo.OrderInfo;
|
|
|
9
|
-import com.yohobuy.ufo.model.order.bo.TimeoutBo;
|
6
|
+import com.yohobuy.ufo.model.order.bo.*;
|
10
|
import com.yohobuy.ufo.model.order.common.*;
|
7
|
import com.yohobuy.ufo.model.order.common.*;
|
11
|
import com.yohobuy.ufo.model.order.constants.SkupType;
|
8
|
import com.yohobuy.ufo.model.order.constants.SkupType;
|
12
|
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
|
9
|
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
|
|
@@ -105,15 +102,21 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
|
@@ -105,15 +102,21 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
105
|
|
102
|
|
106
|
|
103
|
|
107
|
public List<OrderListInfo> buildOrderList(List<SellerOrderGoods> sogList, SellerType sellerType){
|
104
|
public List<OrderListInfo> buildOrderList(List<SellerOrderGoods> sogList, SellerType sellerType){
|
108
|
- Map<String, String> overPriceTipsMap = buildOverPriceTipsMap(sogList);
|
105
|
+ Set<Integer> storageIds = sogList.parallelStream().map(SellerOrderGoods::getStorageId)
|
|
|
106
|
+ .collect(Collectors.toSet());
|
|
|
107
|
+ Map<Integer, StorageInfoResp> getStorageDataMap = productProxyService.getStorageDataMap(storageIds);
|
|
|
108
|
+ Map<String, String> overPriceTipsMap = skupListService.buildOverPriceTipsMap(storageIds, sogList, getStorageDataMap);
|
109
|
Map<Integer, SellerOrderGoods> skupSellerOrderGoodsMap = sogList.parallelStream()
|
109
|
Map<Integer, SellerOrderGoods> skupSellerOrderGoodsMap = sogList.parallelStream()
|
110
|
.collect(Collectors.toMap(SellerOrderGoods::getId, Function.identity()));
|
110
|
.collect(Collectors.toMap(SellerOrderGoods::getId, Function.identity()));
|
111
|
List<Integer> skupList = sogList.parallelStream().map(SellerOrderGoods::getId).collect(Collectors.toList());
|
111
|
List<Integer> skupList = sogList.parallelStream().map(SellerOrderGoods::getId).collect(Collectors.toList());
|
112
|
List<SellerOrder> sellerOrders = sellerOrderMapper.selectBySkups(skupList);
|
112
|
List<SellerOrder> sellerOrders = sellerOrderMapper.selectBySkups(skupList);
|
113
|
List<OrderListInfo> data ;
|
113
|
List<OrderListInfo> data ;
|
114
|
data = sellerOrders.parallelStream()
|
114
|
data = sellerOrders.parallelStream()
|
115
|
- .map(sellerOrder -> buildOrderListInfo(skupSellerOrderGoodsMap.get(sellerOrder.getSkup()),
|
|
|
116
|
- sellerOrder, sellerType, overPriceTipsMap))
|
115
|
+ .map(sellerOrder -> {
|
|
|
116
|
+ SellerOrderGoods psog = skupSellerOrderGoodsMap.get(sellerOrder.getSkup());
|
|
|
117
|
+ StorageInfoResp storageInfoResp = getStorageDataMap.get(psog.getStorageId());
|
|
|
118
|
+ return buildOrderListInfo(psog, storageInfoResp, sellerOrder, sellerType, overPriceTipsMap);
|
|
|
119
|
+ })
|
117
|
.filter(oli -> Objects.nonNull(oli))
|
120
|
.filter(oli -> Objects.nonNull(oli))
|
118
|
.collect(Collectors.toList());
|
121
|
.collect(Collectors.toList());
|
119
|
return data;
|
122
|
return data;
|
|
@@ -219,6 +222,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
|
@@ -219,6 +222,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
219
|
oli.setLeftTime(timeoutBo.getLeftTime());
|
222
|
oli.setLeftTime(timeoutBo.getLeftTime());
|
220
|
oli.setTimeLimit(timeoutBo.getTimelimit());
|
223
|
oli.setTimeLimit(timeoutBo.getTimelimit());
|
221
|
}
|
224
|
}
|
|
|
225
|
+
|
222
|
}
|
226
|
}
|
223
|
}
|
227
|
}
|
224
|
});
|
228
|
});
|
|
@@ -227,22 +231,13 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
|
@@ -227,22 +231,13 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
227
|
|
231
|
|
228
|
|
232
|
|
229
|
|
233
|
|
230
|
- /**
|
|
|
231
|
- * 需要商品提供批量接口,减少db net IO, 目前的工期太短,后期再优化
|
|
|
232
|
- * @param sogList
|
|
|
233
|
- * @return
|
|
|
234
|
- */
|
|
|
235
|
- public Map<String,String> buildOverPriceTipsMap(List<SellerOrderGoods> sogList){
|
|
|
236
|
- Set<Integer> storageIds = sogList.parallelStream().map(SellerOrderGoods::getStorageId)
|
|
|
237
|
- .collect(Collectors.toSet());
|
|
|
238
|
- Map<Integer, StorageInfoResp> getStorageDataMap = productProxyService.getStorageDataMap(storageIds);
|
|
|
239
|
- Map<String,String> map = skupListService.buildOverPriceTipsMap(storageIds, sogList, getStorageDataMap);
|
|
|
240
|
- return map;
|
|
|
241
|
- }
|
|
|
242
|
|
234
|
|
243
|
|
235
|
|
244
|
- OrderListInfo buildOrderListInfo(SellerOrderGoods sellerOrderGoods,
|
|
|
245
|
- SellerOrder sellerOrder, SellerType st,
|
236
|
+
|
|
|
237
|
+ private OrderListInfo buildOrderListInfo(SellerOrderGoods sellerOrderGoods,
|
|
|
238
|
+ StorageInfoResp storageInfoResp,
|
|
|
239
|
+ SellerOrder sellerOrder,
|
|
|
240
|
+ SellerType st,
|
246
|
Map<String,String> overPriceTipsMap) {
|
241
|
Map<String,String> overPriceTipsMap) {
|
247
|
OrderListInfo orderListInfo = new OrderListInfo();
|
242
|
OrderListInfo orderListInfo = new OrderListInfo();
|
248
|
Long orderCode;
|
243
|
Long orderCode;
|
|
@@ -282,6 +277,16 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
|
@@ -282,6 +277,16 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
282
|
orderListInfo.setEarnestMoney(sellerOrder.getEarnestMoney());
|
277
|
orderListInfo.setEarnestMoney(sellerOrder.getEarnestMoney());
|
283
|
|
278
|
|
284
|
//
|
279
|
//
|
|
|
280
|
+ String leastPriceOfSkuTips = null;
|
|
|
281
|
+ if (skupType == SkupType.ADVANCE || skupType == SkupType.IN_STOCK){
|
|
|
282
|
+ if (storageInfoResp != null) {
|
|
|
283
|
+ PrdPrice prdPrice = PrdPrice.builder()
|
|
|
284
|
+ .leastPrice(storageInfoResp.getLeastPrice())
|
|
|
285
|
+ .preSaleLeastPrice(storageInfoResp.getPreSaleLeastPrice())
|
|
|
286
|
+ .build();
|
|
|
287
|
+ leastPriceOfSkuTips = sellerOrderViewService.buildLeastPriceTips(prdPrice, skupType);
|
|
|
288
|
+ }
|
|
|
289
|
+ }
|
285
|
|
290
|
|
286
|
GoodsInfo goodsInfo = new GoodsInfo();
|
291
|
GoodsInfo goodsInfo = new GoodsInfo();
|
287
|
goodsInfo.setColorName(sellerOrderGoods.getColorName());
|
292
|
goodsInfo.setColorName(sellerOrderGoods.getColorName());
|
|
@@ -294,7 +299,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
|
@@ -294,7 +299,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
294
|
goodsInfo.setBatchNo(sellerOrderGoods.getBatchNo());
|
299
|
goodsInfo.setBatchNo(sellerOrderGoods.getBatchNo());
|
295
|
goodsInfo.setStorageNum(storageNum);
|
300
|
goodsInfo.setStorageNum(storageNum);
|
296
|
goodsInfo.setSkupList(sellerOrderGoods.getSkupList());
|
301
|
goodsInfo.setSkupList(sellerOrderGoods.getSkupList());
|
297
|
-
|
302
|
+ goodsInfo.setLeastPriceOfSkuTips(leastPriceOfSkuTips);
|
298
|
|
303
|
|
299
|
orderListInfo.setGoodsInfo(goodsInfo);
|
304
|
orderListInfo.setGoodsInfo(goodsInfo);
|
300
|
orderListInfo.setSecendLevelCreateTime(sellerOrder.getCreateTime());
|
305
|
orderListInfo.setSecendLevelCreateTime(sellerOrder.getCreateTime());
|