Authored by qinchao

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

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