Authored by qinchao

物流查看兼容:多订单一个物流号

@@ -591,14 +591,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -591,14 +591,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
591 591
592 private List<ExpressInfo> getExpressInfoListByStage(String orderCode, String expressType){ 592 private List<ExpressInfo> getExpressInfoListByStage(String orderCode, String expressType){
593 LOGGER.info("getExpressInfoListByStage orderCode is {}, expressTypeStr is {}", orderCode, expressType); 593 LOGGER.info("getExpressInfoListByStage orderCode is {}, expressTypeStr is {}", orderCode, expressType);
594 - //原来的情况,根据订单号直接查询物流,如果存在物流信息,则直接返回,否则有可能是多单一号  
595 - List<ExpressInfo> list = expressInfoMapper.selectByOrderCodeAndType(orderCode, convertExpressType(expressType));  
596 - if(CollectionUtils.isNotEmpty(list)) {  
597 - LOGGER.info("getExpressInfoListByStage success have data in express info orderCode = {} ,expressType = {} ",orderCode,expressType);  
598 - return list;  
599 - }  
600 -  
601 - LOGGER.info("getExpressInfoListByStage begin query express record ,orderCode = {} ,expressType = {} ",orderCode,expressType);  
602 List<String> orderCodeList = Lists.newArrayList(); 594 List<String> orderCodeList = Lists.newArrayList();
603 orderCodeList.add(orderCode); 595 orderCodeList.add(orderCode);
604 List<ExpressRecord> records = expressRecordMapper.selectByOrderCodeListAndType(orderCodeList,convertExpressType(expressType)); 596 List<ExpressRecord> records = expressRecordMapper.selectByOrderCodeListAndType(orderCodeList,convertExpressType(expressType));
@@ -607,12 +599,26 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -607,12 +599,26 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
607 return Lists.newArrayList(); 599 return Lists.newArrayList();
608 } 600 }
609 601
610 - LOGGER.info("getExpressInfoListByStage orderCode is {}, expressTypeStr is {},records size is {} ,records is {}", orderCode, expressType , records.size(),JSON.toJSONString(records));  
611 -  
612 ExpressRecord record = records.get(0); 602 ExpressRecord record = records.get(0);
  603 + LOGGER.info("getExpressInfoListByStage begin , orderCode = {} ,expressType = {}, expressRecord = {} ",orderCode,expressType,record);
613 String waybillCode = record.getWaybillCode(); 604 String waybillCode = record.getWaybillCode();
614 Integer logisticsType = record.getLogisticsType(); 605 Integer logisticsType = record.getLogisticsType();
615 - LOGGER.info("getExpressInfoListByStage begin , orderCode = {} ,expressType = {}, expressRecord = {} ",orderCode,expressType,record); 606 +
  607 + //原来的情况,根据订单号直接查询物流,如果存在物流信息,则直接返回,否则有可能是多单一号
  608 + List<ExpressInfo> list = expressInfoMapper.selectByOrderCodeAndType(orderCode, convertExpressType(expressType));
  609 +
  610 + //有可能存在一个订单号,多个物流的情况,比如原来的物流填错了,修改了新的物流,只保留新的物流号的信息
  611 + if(CollectionUtils.isNotEmpty(list)){
  612 + list = list.stream().filter(info -> StringUtils.equals(waybillCode,info.getWaybillCode())).collect(Collectors.toList());
  613 + }
  614 +
  615 + if(CollectionUtils.isNotEmpty(list)) {
  616 + LOGGER.info("getExpressInfoListByStage success have data in express info orderCode = {} ,expressType = {} ",orderCode,expressType);
  617 + return list;
  618 + }
  619 +
  620 + LOGGER.info("getExpressInfoListByStage orderCode is {}, expressTypeStr is {},records size is {} ,records is {}", orderCode, expressType , records.size(),JSON.toJSONString(records));
  621 +
616 return expressInfoMapper.selectExpressInfoListByWaybillCodeAndLogisticsType(waybillCode,logisticsType); 622 return expressInfoMapper.selectExpressInfoListByWaybillCodeAndLogisticsType(waybillCode,logisticsType);
617 } 623 }
618 624