...
|
...
|
@@ -9,6 +9,8 @@ import java.util.concurrent.TimeUnit; |
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yoho.ufo.dal.ProductMapper;
|
|
|
import com.yoho.ufo.dal.model.Product;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.elasticsearch.common.collect.Lists;
|
...
|
...
|
@@ -110,6 +112,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
|
|
|
@Autowired
|
|
|
private OrderOperateRecordMapper orderOperateRecordMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private ProductMapper productMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private ServiceCaller serviceCaller;
|
...
|
...
|
@@ -198,7 +203,19 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
List<Integer> skupList = buyerGoodsList.stream().map(BuyerOrderGoods::getSkup).collect(Collectors.toList());
|
|
|
List<SellerOrderGoods> sellerGoodsList = sellerOrderGoodsMapper.selectByIds(skupList);
|
|
|
Map<Integer, SellerOrderGoods> sellerGoodsMap = sellerGoodsList.stream().collect(Collectors.toMap(SellerOrderGoods::getId, s->s));
|
|
|
|
|
|
|
|
|
//查询货号
|
|
|
Map<Integer,Integer> skupProductIdMap = sellerGoodsList.stream().collect(Collectors.toMap(SellerOrderGoods::getId, s->s.getProductId()));
|
|
|
List<Integer> sellerGoodsProductIdList= sellerGoodsList.stream().map(SellerOrderGoods::getProductId).collect(Collectors.toList());
|
|
|
List<Product> productList = productMapper.selectProductListByIds(sellerGoodsProductIdList);
|
|
|
Map<Integer, String> productIdAndCodeMap = productList.stream().collect(Collectors.toMap(Product::getId, s->s.getProductCode()));
|
|
|
Map<Integer, String> skupProductCodeMap = Maps.newHashMap();
|
|
|
String productCode;
|
|
|
for (Map.Entry<Integer, Integer> entry : skupProductIdMap.entrySet()) {
|
|
|
productCode = productIdAndCodeMap.get(entry.getValue());
|
|
|
skupProductCodeMap.put(entry.getKey(),StringUtils.isBlank(productCode)?"":productCode);
|
|
|
}
|
|
|
|
|
|
//查询seller_order
|
|
|
List<SellerOrder> sellerOrderList = sellerOrderMapper.selectBySkups(skupList);
|
|
|
Map<Integer, SellerOrder> sellerOrderMap = sellerOrderList.stream().collect(Collectors.toMap(SellerOrder::getSkup, s->s));
|
...
|
...
|
@@ -223,7 +240,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
companyMap = companyList.stream().collect(Collectors.toMap(ExpressCompany::getId, ExpressCompany::getCompanyName));
|
|
|
}
|
|
|
|
|
|
List<BuyerOrderResp> respList = convertToResp(orderList, buyerGoodsMap, sellerOrderMap, sellerGoodsMap,expressRecordMap, platformExpressRecordMap, companyMap);
|
|
|
List<BuyerOrderResp> respList = convertToResp(orderList, buyerGoodsMap, sellerOrderMap, sellerGoodsMap,expressRecordMap, platformExpressRecordMap, companyMap,skupProductCodeMap);
|
|
|
|
|
|
PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
|
|
|
result.setList(respList);
|
...
|
...
|
@@ -703,7 +720,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
|
|
|
private List<BuyerOrderResp> convertToResp(List<BuyerOrder> orderList, Map<String, BuyerOrderGoods> buyerGoodsMap,
|
|
|
Map<Integer, SellerOrder> sellerOrderMap, Map<Integer, SellerOrderGoods> sellerGoodsMap, Map<String, ExpressRecord> expressInfoMap,
|
|
|
Map<String, ExpressRecord> platformExpressRecordMap, Map<Integer, String> companyMap){
|
|
|
Map<String, ExpressRecord> platformExpressRecordMap, Map<Integer, String> companyMap,Map<Integer, String> skupProductCodeMap ){
|
|
|
List<BuyerOrderResp> respList = Lists.newArrayList();
|
|
|
for(BuyerOrder item : orderList) {
|
|
|
if(null == buyerGoodsMap.get(item.getOrderCode())) {
|
...
|
...
|
@@ -724,6 +741,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
resp.setSkup(skup);
|
|
|
resp.setCreateTimeStr(null == item.getCreateTime() ? "" : DateUtil.long2DateStr(item.getCreateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setUid(item.getUid());
|
|
|
resp.setProductCode(skupProductCodeMap.get(skup));
|
|
|
resp.setProductName(sellerGoodsMap.get(skup).getProductName());
|
|
|
resp.setColorName(sellerGoodsMap.get(skup).getColorName());
|
|
|
resp.setSizeName(sellerGoodsMap.get(skup).getSizeName());
|
...
|
...
|
|