|
@@ -30,6 +30,7 @@ import com.yohoufo.order.common.ClientType; |
|
@@ -30,6 +30,7 @@ import com.yohoufo.order.common.ClientType; |
30
|
import com.yohoufo.order.constants.MetaKey;
|
30
|
import com.yohoufo.order.constants.MetaKey;
|
31
|
import com.yohoufo.order.convert.SellerOrderConvertor;
|
31
|
import com.yohoufo.order.convert.SellerOrderConvertor;
|
32
|
import com.yohoufo.order.model.dto.SellerDepositOrderContext;
|
32
|
import com.yohoufo.order.model.dto.SellerDepositOrderContext;
|
|
|
33
|
+import com.yohoufo.order.model.dto.SellerDepositSubOrderContext;
|
33
|
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
|
34
|
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
|
34
|
import com.yohoufo.order.model.response.AppraiseAddressResp;
|
35
|
import com.yohoufo.order.model.response.AppraiseAddressResp;
|
35
|
import com.yohoufo.order.service.impl.AbsOrderViewService;
|
36
|
import com.yohoufo.order.service.impl.AbsOrderViewService;
|
|
@@ -37,6 +38,7 @@ import com.yohoufo.order.service.impl.AppraiseAddressService; |
|
@@ -37,6 +38,7 @@ import com.yohoufo.order.service.impl.AppraiseAddressService; |
37
|
import com.yohoufo.order.service.impl.AppraiseOrderCreateService;
|
38
|
import com.yohoufo.order.service.impl.AppraiseOrderCreateService;
|
38
|
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
|
39
|
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
|
39
|
import com.yohoufo.order.utils.LoggerUtils;
|
40
|
import com.yohoufo.order.utils.LoggerUtils;
|
|
|
41
|
+import lombok.Builder;
|
40
|
import org.slf4j.Logger;
|
42
|
import org.slf4j.Logger;
|
41
|
import org.springframework.beans.factory.annotation.Autowired;
|
43
|
import org.springframework.beans.factory.annotation.Autowired;
|
42
|
import org.springframework.stereotype.Service;
|
44
|
import org.springframework.stereotype.Service;
|
|
@@ -331,19 +333,16 @@ public class SellerDepositOrderService extends AbsOrderViewService { |
|
@@ -331,19 +333,16 @@ public class SellerDepositOrderService extends AbsOrderViewService { |
331
|
return paogs.parallelStream().map(paog-> convertProductVo(paog, null))
|
333
|
return paogs.parallelStream().map(paog-> convertProductVo(paog, null))
|
332
|
.collect(Collectors.toCollection(()->new ArrayList<>(paogs.size())));
|
334
|
.collect(Collectors.toCollection(()->new ArrayList<>(paogs.size())));
|
333
|
}
|
335
|
}
|
|
|
336
|
+ @Builder
|
|
|
337
|
+ private class OrderDataNode{
|
|
|
338
|
+ int sknNum;
|
|
|
339
|
+ List<AppraiseOrderGoods> paogs;
|
|
|
340
|
+ Map<Integer,List<AppraiseOrderStorage>> prdIdAOSListMap;
|
|
|
341
|
+ Map<Integer,SellerOrderComputeResult> storageIdSOCRMap;
|
|
|
342
|
+ Map<Integer, AppraiseOrderMeta> storageIdFeeMetaMap;
|
|
|
343
|
+ }
|
334
|
|
344
|
|
335
|
-
|
|
|
336
|
- public PageResp<ProductVo> getSkuList(SellerDepositOrderPrdListReq req){
|
|
|
337
|
- final Long orderCode = req.getOrderCode();
|
|
|
338
|
- int total = appraiseOrderGoodsMapper.selectCntByOrderCode(orderCode);
|
|
|
339
|
- int limit = req.getLimit();
|
|
|
340
|
- PageResp.PageRespBuilder<ProductVo> respBuilder = PageResp.builder();
|
|
|
341
|
- respBuilder.page(req.getPage()).pageSize(limit).total(total);
|
|
|
342
|
- if (total == 0){
|
|
|
343
|
- return respBuilder.build();
|
|
|
344
|
- }
|
|
|
345
|
- int offset = (req.getPage() - 1) * limit;
|
|
|
346
|
- List<AppraiseOrderGoods> paogs = appraiseOrderGoodsMapper.selectAllByOrderCode(orderCode, offset, limit);
|
345
|
+ OrderDataNode buildDataSourceOfParentOrder(long orderCode, List<AppraiseOrderGoods> paogs){
|
347
|
Map<Integer,List<AppraiseOrderStorage>> prdIdAOSListMap = new HashMap<>(paogs.size());
|
346
|
Map<Integer,List<AppraiseOrderStorage>> prdIdAOSListMap = new HashMap<>(paogs.size());
|
348
|
Map<Integer,SellerOrderComputeResult> storageIdSOCRMap = new HashMap<>(128);
|
347
|
Map<Integer,SellerOrderComputeResult> storageIdSOCRMap = new HashMap<>(128);
|
349
|
|
348
|
|
|
@@ -358,7 +357,7 @@ public class SellerDepositOrderService extends AbsOrderViewService { |
|
@@ -358,7 +357,7 @@ public class SellerDepositOrderService extends AbsOrderViewService { |
358
|
return socr;
|
357
|
return socr;
|
359
|
}
|
358
|
}
|
360
|
};
|
359
|
};
|
361
|
-
|
360
|
+ Map<Integer, AppraiseOrderMeta> storageIdFeeMetaMap = new HashMap<>(128);
|
362
|
for(AppraiseOrderGoods paog : paogs){
|
361
|
for(AppraiseOrderGoods paog : paogs){
|
363
|
Integer prdId;
|
362
|
Integer prdId;
|
364
|
List<AppraiseOrderStorage> paosList = appraiseOrderStorageMapper.selectAllByOrderCodePrdId(orderCode, prdId=paog.getProductId());
|
363
|
List<AppraiseOrderStorage> paosList = appraiseOrderStorageMapper.selectAllByOrderCodePrdId(orderCode, prdId=paog.getProductId());
|
|
@@ -370,8 +369,31 @@ public class SellerDepositOrderService extends AbsOrderViewService { |
|
@@ -370,8 +369,31 @@ public class SellerDepositOrderService extends AbsOrderViewService { |
370
|
aomc.setMetaKey(MetaKey.SELLER_FEE);
|
369
|
aomc.setMetaKey(MetaKey.SELLER_FEE);
|
371
|
List<AppraiseOrderMeta> paomList = appraiseOrderMetaMapper.selectByOrderCodeStorageIds(aomc, storageIds);
|
370
|
List<AppraiseOrderMeta> paomList = appraiseOrderMetaMapper.selectByOrderCodeStorageIds(aomc, storageIds);
|
372
|
//
|
371
|
//
|
|
|
372
|
+ storageIdFeeMetaMap.putAll(paomList.parallelStream().collect(Collectors.toMap(AppraiseOrderMeta::getStorageId, Function.identity())));
|
373
|
storageIdSOCRMap.putAll(paomList.parallelStream().collect(Collectors.toMap(AppraiseOrderMeta::getStorageId, socrFunction::apply)));
|
373
|
storageIdSOCRMap.putAll(paomList.parallelStream().collect(Collectors.toMap(AppraiseOrderMeta::getStorageId, socrFunction::apply)));
|
374
|
}
|
374
|
}
|
|
|
375
|
+ return OrderDataNode.builder().paogs(paogs)
|
|
|
376
|
+ .prdIdAOSListMap(prdIdAOSListMap)
|
|
|
377
|
+ .storageIdFeeMetaMap(storageIdFeeMetaMap)
|
|
|
378
|
+ .storageIdSOCRMap(storageIdSOCRMap)
|
|
|
379
|
+ .build();
|
|
|
380
|
+ }
|
|
|
381
|
+
|
|
|
382
|
+
|
|
|
383
|
+ public PageResp<ProductVo> getSkuList(SellerDepositOrderPrdListReq req){
|
|
|
384
|
+ final Long orderCode = req.getOrderCode();
|
|
|
385
|
+ int total = appraiseOrderGoodsMapper.selectCntByOrderCode(orderCode);
|
|
|
386
|
+ int limit = req.getLimit();
|
|
|
387
|
+ PageResp.PageRespBuilder<ProductVo> respBuilder = PageResp.builder();
|
|
|
388
|
+ respBuilder.page(req.getPage()).pageSize(limit).total(total);
|
|
|
389
|
+ if (total == 0){
|
|
|
390
|
+ return respBuilder.build();
|
|
|
391
|
+ }
|
|
|
392
|
+ int offset = (req.getPage() - 1) * limit;
|
|
|
393
|
+ List<AppraiseOrderGoods> paogs = appraiseOrderGoodsMapper.selectAllByOrderCode(orderCode, offset, limit);
|
|
|
394
|
+ OrderDataNode node = buildDataSourceOfParentOrder(orderCode, paogs);
|
|
|
395
|
+ Map<Integer,List<AppraiseOrderStorage>> prdIdAOSListMap = node.prdIdAOSListMap;
|
|
|
396
|
+ Map<Integer,SellerOrderComputeResult> storageIdSOCRMap = node.storageIdSOCRMap;
|
375
|
|
397
|
|
376
|
List<ProductVo> productVoList = buildProductVoListWithSkuDetail(paogs, prdIdAOSListMap, storageIdSOCRMap);
|
398
|
List<ProductVo> productVoList = buildProductVoListWithSkuDetail(paogs, prdIdAOSListMap, storageIdSOCRMap);
|
377
|
|
399
|
|
|
@@ -443,7 +465,20 @@ public class SellerDepositOrderService extends AbsOrderViewService { |
|
@@ -443,7 +465,20 @@ public class SellerDepositOrderService extends AbsOrderViewService { |
443
|
return;
|
465
|
return;
|
444
|
}
|
466
|
}
|
445
|
//split sku 2 order
|
467
|
//split sku 2 order
|
446
|
-
|
468
|
+ List<AppraiseOrderGoods> paogList = appraiseOrderGoodsMapper.selectByOrderCode(orderCode);
|
|
|
469
|
+ OrderDataNode node = buildDataSourceOfParentOrder(orderCode, paogList);
|
|
|
470
|
+ Map<Integer,List<AppraiseOrderStorage>> prdIdAOSListMap = node.prdIdAOSListMap;
|
|
|
471
|
+ Map<Integer,SellerOrderComputeResult> storageIdSOCRMap = node.storageIdSOCRMap;
|
|
|
472
|
+
|
|
|
473
|
+ AppraiseOrder sellerDepositOrder = appraiseOrderMapper.selectByOrderCode(orderCode);
|
|
|
474
|
+ SellerDepositSubOrderContext context = SellerDepositSubOrderContext.builder()
|
|
|
475
|
+ .appraiseOrderGoodsList(paogList)
|
|
|
476
|
+ .sellerDepositOrder(sellerDepositOrder)
|
|
|
477
|
+ .storageIdFeeMetaMap(node.storageIdFeeMetaMap)
|
|
|
478
|
+ .storageIdSOCRMap(storageIdSOCRMap)
|
|
|
479
|
+ .prdIdAOSListMap(prdIdAOSListMap)
|
|
|
480
|
+ .build();
|
|
|
481
|
+ appraiseOrderCreateService.createSellerDepoistOrderOfSku(context);
|
447
|
|
482
|
|
448
|
|
483
|
|
449
|
//todo add express info
|
484
|
//todo add express info
|