...
|
...
|
@@ -30,6 +30,7 @@ import com.yohoufo.order.common.ClientType; |
|
|
import com.yohoufo.order.constants.MetaKey;
|
|
|
import com.yohoufo.order.convert.SellerOrderConvertor;
|
|
|
import com.yohoufo.order.model.dto.SellerDepositOrderContext;
|
|
|
import com.yohoufo.order.model.dto.SellerDepositSubOrderContext;
|
|
|
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
|
|
|
import com.yohoufo.order.model.response.AppraiseAddressResp;
|
|
|
import com.yohoufo.order.service.impl.AbsOrderViewService;
|
...
|
...
|
@@ -37,6 +38,7 @@ import com.yohoufo.order.service.impl.AppraiseAddressService; |
|
|
import com.yohoufo.order.service.impl.AppraiseOrderCreateService;
|
|
|
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
|
|
|
import com.yohoufo.order.utils.LoggerUtils;
|
|
|
import lombok.Builder;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
...
|
...
|
@@ -331,19 +333,16 @@ public class SellerDepositOrderService extends AbsOrderViewService { |
|
|
return paogs.parallelStream().map(paog-> convertProductVo(paog, null))
|
|
|
.collect(Collectors.toCollection(()->new ArrayList<>(paogs.size())));
|
|
|
}
|
|
|
@Builder
|
|
|
private class OrderDataNode{
|
|
|
int sknNum;
|
|
|
List<AppraiseOrderGoods> paogs;
|
|
|
Map<Integer,List<AppraiseOrderStorage>> prdIdAOSListMap;
|
|
|
Map<Integer,SellerOrderComputeResult> storageIdSOCRMap;
|
|
|
Map<Integer, AppraiseOrderMeta> storageIdFeeMetaMap;
|
|
|
}
|
|
|
|
|
|
|
|
|
public PageResp<ProductVo> getSkuList(SellerDepositOrderPrdListReq req){
|
|
|
final Long orderCode = req.getOrderCode();
|
|
|
int total = appraiseOrderGoodsMapper.selectCntByOrderCode(orderCode);
|
|
|
int limit = req.getLimit();
|
|
|
PageResp.PageRespBuilder<ProductVo> respBuilder = PageResp.builder();
|
|
|
respBuilder.page(req.getPage()).pageSize(limit).total(total);
|
|
|
if (total == 0){
|
|
|
return respBuilder.build();
|
|
|
}
|
|
|
int offset = (req.getPage() - 1) * limit;
|
|
|
List<AppraiseOrderGoods> paogs = appraiseOrderGoodsMapper.selectAllByOrderCode(orderCode, offset, limit);
|
|
|
OrderDataNode buildDataSourceOfParentOrder(long orderCode, List<AppraiseOrderGoods> paogs){
|
|
|
Map<Integer,List<AppraiseOrderStorage>> prdIdAOSListMap = new HashMap<>(paogs.size());
|
|
|
Map<Integer,SellerOrderComputeResult> storageIdSOCRMap = new HashMap<>(128);
|
|
|
|
...
|
...
|
@@ -358,7 +357,7 @@ public class SellerDepositOrderService extends AbsOrderViewService { |
|
|
return socr;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
Map<Integer, AppraiseOrderMeta> storageIdFeeMetaMap = new HashMap<>(128);
|
|
|
for(AppraiseOrderGoods paog : paogs){
|
|
|
Integer prdId;
|
|
|
List<AppraiseOrderStorage> paosList = appraiseOrderStorageMapper.selectAllByOrderCodePrdId(orderCode, prdId=paog.getProductId());
|
...
|
...
|
@@ -370,8 +369,31 @@ public class SellerDepositOrderService extends AbsOrderViewService { |
|
|
aomc.setMetaKey(MetaKey.SELLER_FEE);
|
|
|
List<AppraiseOrderMeta> paomList = appraiseOrderMetaMapper.selectByOrderCodeStorageIds(aomc, storageIds);
|
|
|
//
|
|
|
storageIdFeeMetaMap.putAll(paomList.parallelStream().collect(Collectors.toMap(AppraiseOrderMeta::getStorageId, Function.identity())));
|
|
|
storageIdSOCRMap.putAll(paomList.parallelStream().collect(Collectors.toMap(AppraiseOrderMeta::getStorageId, socrFunction::apply)));
|
|
|
}
|
|
|
return OrderDataNode.builder().paogs(paogs)
|
|
|
.prdIdAOSListMap(prdIdAOSListMap)
|
|
|
.storageIdFeeMetaMap(storageIdFeeMetaMap)
|
|
|
.storageIdSOCRMap(storageIdSOCRMap)
|
|
|
.build();
|
|
|
}
|
|
|
|
|
|
|
|
|
public PageResp<ProductVo> getSkuList(SellerDepositOrderPrdListReq req){
|
|
|
final Long orderCode = req.getOrderCode();
|
|
|
int total = appraiseOrderGoodsMapper.selectCntByOrderCode(orderCode);
|
|
|
int limit = req.getLimit();
|
|
|
PageResp.PageRespBuilder<ProductVo> respBuilder = PageResp.builder();
|
|
|
respBuilder.page(req.getPage()).pageSize(limit).total(total);
|
|
|
if (total == 0){
|
|
|
return respBuilder.build();
|
|
|
}
|
|
|
int offset = (req.getPage() - 1) * limit;
|
|
|
List<AppraiseOrderGoods> paogs = appraiseOrderGoodsMapper.selectAllByOrderCode(orderCode, offset, limit);
|
|
|
OrderDataNode node = buildDataSourceOfParentOrder(orderCode, paogs);
|
|
|
Map<Integer,List<AppraiseOrderStorage>> prdIdAOSListMap = node.prdIdAOSListMap;
|
|
|
Map<Integer,SellerOrderComputeResult> storageIdSOCRMap = node.storageIdSOCRMap;
|
|
|
|
|
|
List<ProductVo> productVoList = buildProductVoListWithSkuDetail(paogs, prdIdAOSListMap, storageIdSOCRMap);
|
|
|
|
...
|
...
|
@@ -443,7 +465,20 @@ public class SellerDepositOrderService extends AbsOrderViewService { |
|
|
return;
|
|
|
}
|
|
|
//split sku 2 order
|
|
|
|
|
|
List<AppraiseOrderGoods> paogList = appraiseOrderGoodsMapper.selectByOrderCode(orderCode);
|
|
|
OrderDataNode node = buildDataSourceOfParentOrder(orderCode, paogList);
|
|
|
Map<Integer,List<AppraiseOrderStorage>> prdIdAOSListMap = node.prdIdAOSListMap;
|
|
|
Map<Integer,SellerOrderComputeResult> storageIdSOCRMap = node.storageIdSOCRMap;
|
|
|
|
|
|
AppraiseOrder sellerDepositOrder = appraiseOrderMapper.selectByOrderCode(orderCode);
|
|
|
SellerDepositSubOrderContext context = SellerDepositSubOrderContext.builder()
|
|
|
.appraiseOrderGoodsList(paogList)
|
|
|
.sellerDepositOrder(sellerDepositOrder)
|
|
|
.storageIdFeeMetaMap(node.storageIdFeeMetaMap)
|
|
|
.storageIdSOCRMap(storageIdSOCRMap)
|
|
|
.prdIdAOSListMap(prdIdAOSListMap)
|
|
|
.build();
|
|
|
appraiseOrderCreateService.createSellerDepoistOrderOfSku(context);
|
|
|
|
|
|
|
|
|
//todo add express info
|
...
|
...
|
|