...
|
...
|
@@ -358,38 +358,57 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
}
|
|
|
|
|
|
ExpressInfoRespBo expressInfoRespBo = new ExpressInfoRespBo();
|
|
|
expressInfoRespBo.setExpressInfoDetailList(Lists.newArrayList());
|
|
|
expressInfoRespBo.setJudgeExpressInfoDetailList(Lists.newArrayList());
|
|
|
expressInfoRespBo.setSupplementExpressInfoDetailList(Lists.newArrayList());
|
|
|
|
|
|
List<Integer> expressTypeList = getCurrentExpressType4ExpressRecord(buyerOrder.getStatus(), actor);
|
|
|
LOGGER.info("queryExpressDetailInfo getExpressType expressTypeList result = {}, uid={}, orderCode = {},actor = {} ",expressTypeList,uid, orderCode,actor);
|
|
|
if(CollectionUtils.isEmpty(expressTypeList)){
|
|
|
LOGGER.info("queryExpressDetailInfo getExpressType expressTypeList return empty result = {}, uid={}, orderCode = {},actor = {} ",expressTypeList,uid, orderCode,actor);
|
|
|
return expressInfoRespBo;
|
|
|
}
|
|
|
|
|
|
Integer expressType = getCurrentExpressType4ExpressRecord(buyerOrder.getStatus(), actor);
|
|
|
LOGGER.info("queryExpressDetailInfo getExpressType expressType result = {}, uid={}, orderCode = {},actor = {} ",expressType,uid, orderCode,actor);
|
|
|
//1.物流单号信息
|
|
|
constructWayBillInfo(orderCode,expressType,expressInfoRespBo);
|
|
|
|
|
|
//2.设定最近一个阶段的物流
|
|
|
expressInfoRespBo.setExpressInfoDetailList(Lists.newArrayList());
|
|
|
List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressType);
|
|
|
constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
|
|
|
constructWayBillInfo(orderCode,expressTypeList,expressInfoRespBo);
|
|
|
|
|
|
// 构造物流信息
|
|
|
if(expressTypeList.size()==1){
|
|
|
//设定最近一个阶段的物流
|
|
|
List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressTypeList.get(0));
|
|
|
constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
|
|
|
}else if(expressTypeList.size()==2){
|
|
|
if(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().intValue()==expressTypeList.get(0)){
|
|
|
//设定鉴定的物流调拨信息
|
|
|
List<ExpressInfo> judgeExpressInfoList=getExpressInfoListByStage(actor, orderCode, EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode());
|
|
|
constructExpressInfo(actor,judgeExpressInfoList, expressInfoRespBo.getJudgeExpressInfoDetailList());
|
|
|
|
|
|
//获取上一阶段的辅助物流信息
|
|
|
constructSupplementExpress( actor,orderCode,expressTypeList.get(0),expressInfoRespBo);
|
|
|
}else{
|
|
|
//设定最近一个阶段的物流
|
|
|
List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressTypeList.get(0));
|
|
|
constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
|
|
|
|
|
|
//获取上一阶段的辅助物流信息
|
|
|
constructSupplementExpress( actor,orderCode,expressTypeList.get(0),expressInfoRespBo);
|
|
|
}
|
|
|
}else if(expressTypeList.size()==3){
|
|
|
//设定最近一个阶段的物流
|
|
|
List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressTypeList.get(0));
|
|
|
constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
|
|
|
|
|
|
//3.设定鉴定的物流调拨信息
|
|
|
expressInfoRespBo.setJudgeExpressInfoDetailList(Lists.newArrayList());
|
|
|
List<ExpressInfo> judgeExpressInfoList=getExpressInfoListByStage(actor, orderCode, EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode());
|
|
|
constructExpressInfo(actor,judgeExpressInfoList, expressInfoRespBo.getJudgeExpressInfoDetailList());
|
|
|
//设定鉴定的物流调拨信息
|
|
|
List<ExpressInfo> judgeExpressInfoList=getExpressInfoListByStage(actor, orderCode, EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode());
|
|
|
constructExpressInfo(actor,judgeExpressInfoList, expressInfoRespBo.getJudgeExpressInfoDetailList());
|
|
|
|
|
|
//4.获取上一阶段的辅助物流信息
|
|
|
List<ExpressInfoDetail> supplementExpressInfoDetailList = Lists.newArrayList();
|
|
|
expressInfoRespBo.setSupplementExpressInfoDetailList(supplementExpressInfoDetailList);
|
|
|
constructSupplementExpress( actor,orderCode,expressType,expressInfoRespBo);
|
|
|
//获取上一阶段的辅助物流信息
|
|
|
constructSupplementExpress( actor,orderCode,expressTypeList.get(0),expressInfoRespBo);
|
|
|
}
|
|
|
|
|
|
//5.设定三个阶段的信息
|
|
|
buildExpressStage(buyerOrder.getStatus(), expressInfoRespBo);
|
|
|
|
|
|
//6.根据状态重设expressType
|
|
|
if(Objects.equals(OrderStatus.PLATFORM_RECEIVE.getCode(),buyerOrder.getStatus())
|
|
|
||Objects.equals(OrderStatus.PLATFORM_CHECKING.getCode(),buyerOrder.getStatus())
|
|
|
){
|
|
|
expressInfoRespBo.setExpressType(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().byteValue());
|
|
|
}
|
|
|
|
|
|
LOGGER.info("queryExpressDetailInfo result = {}", JSON.toJSONString(expressInfoRespBo));
|
|
|
return expressInfoRespBo;
|
|
|
}
|
...
|
...
|
@@ -414,7 +433,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
}
|
|
|
|
|
|
private void constructSupplementExpress(TabType actor,Long orderCode,Integer expressType,ExpressInfoRespBo expressInfoRespBo){
|
|
|
if(EnumExpressType.EXPRESS_TYPE_2.getCode().intValue()==expressType.intValue()){
|
|
|
if(EnumExpressType.EXPRESS_TYPE_2.getCode().intValue()==expressType.intValue()
|
|
|
||EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().intValue()==expressType.intValue()){
|
|
|
//买家这个时候需要看卖家的物流
|
|
|
//设置物流提示头信息
|
|
|
if(StringUtils.isBlank(expressInfoRespBo.getExpressSender())){
|
...
|
...
|
@@ -429,7 +449,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
//如果还没有新的物流信息,卖家显示上一个阶段的物流
|
|
|
if(StringUtils.isBlank(expressInfoRespBo.getExpressSender())){
|
|
|
//物流单号信息
|
|
|
constructWayBillInfo(orderCode,EnumExpressType.EXPRESS_TYPE_1.getCode(),expressInfoRespBo);
|
|
|
constructWayBillInfo(orderCode,Arrays.asList(EnumExpressType.EXPRESS_TYPE_1.getCode()),expressInfoRespBo);
|
|
|
}
|
|
|
List<ExpressInfo> previousExpressInfoList = getExpressInfoListByStage(actor,orderCode, EnumExpressType.EXPRESS_TYPE_1.getCode());
|
|
|
constructExpressInfo(actor,previousExpressInfoList, expressInfoRespBo.getSupplementExpressInfoDetailList());
|
...
|
...
|
@@ -438,14 +458,22 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
}
|
|
|
|
|
|
//物流单号信息
|
|
|
private void constructWayBillInfo(Long orderCode,Integer expressType,ExpressInfoRespBo expressInfoRespBo){
|
|
|
private void constructWayBillInfo(Long orderCode,List<Integer> expressTypeList,ExpressInfoRespBo expressInfoRespBo){
|
|
|
Integer expressType = 0;
|
|
|
for(Integer i:expressTypeList){
|
|
|
if(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().equals(i)){
|
|
|
continue;
|
|
|
}
|
|
|
expressType = i;
|
|
|
break; //循环一次 ,取最近的一个
|
|
|
}
|
|
|
ExpressRecord expressRecord = expressRecordMapper.selectByOrderCodeAndExpressType(orderCode,expressType);
|
|
|
if(expressRecord!=null){
|
|
|
expressInfoRespBo.setExpressInfoDetailList(new ArrayList<>());
|
|
|
// 快递单号
|
|
|
expressInfoRespBo.setWayBillCode(expressRecord.getWaybillCode());
|
|
|
//物流类型
|
|
|
expressInfoRespBo.setExpressType(expressRecord.getExpressType());
|
|
|
expressInfoRespBo.setExpressType(expressTypeList.get(0).byteValue());
|
|
|
//物流发货方
|
|
|
expressInfoRespBo.setExpressSender(getSenderName(expressInfoRespBo.getExpressType().intValue()));
|
|
|
// 快递公司名称
|
...
|
...
|
@@ -458,36 +486,37 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
* orderCode 一定是买家订单号
|
|
|
* @return
|
|
|
*/
|
|
|
private Integer getCurrentExpressType4ExpressRecord(Integer status, TabType actor) {
|
|
|
private List<Integer> getCurrentExpressType4ExpressRecord(Integer status, TabType actor) {
|
|
|
if(null==actor){
|
|
|
if(OrderStatus.SELLER_SEND_OUT.getCode()==status
|
|
|
||OrderStatus.PLATFORM_RECEIVE.getCode()==status
|
|
|
||OrderStatus.PLATFORM_CHECKING.getCode()==status
|
|
|
){
|
|
|
return EnumExpressType.EXPRESS_TYPE_1.getCode();
|
|
|
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_1.getCode());
|
|
|
}else if(OrderStatus.PLATFORM_RECEIVE.getCode()==status
|
|
|
||OrderStatus.PLATFORM_CHECKING.getCode()==status){
|
|
|
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode(),EnumExpressType.EXPRESS_TYPE_1.getCode());
|
|
|
}else if(OrderStatus.WAITING_RECEIVE.getCode()==status||OrderStatus.DONE.getCode()==status){
|
|
|
//4 和 5 状态有问题 ,买家查看物流是没问题的,卖家查看物流有问题啊.
|
|
|
return EnumExpressType.EXPRESS_TYPE_2.getCode();
|
|
|
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_2.getCode(),EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode(),EnumExpressType.EXPRESS_TYPE_1.getCode());
|
|
|
}else if(OrderStatus.CHECKING_FAKE.getCode()==status){
|
|
|
return EnumExpressType.EXPRESS_TYPE_3.getCode();
|
|
|
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_3.getCode(),EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode(),EnumExpressType.EXPRESS_TYPE_1.getCode());
|
|
|
}else if(OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode()==status){
|
|
|
return EnumExpressType.EXPRESS_TYPE_REBACK.getCode();
|
|
|
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_REBACK.getCode(),EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode(),EnumExpressType.EXPRESS_TYPE_1.getCode());
|
|
|
}
|
|
|
}else {
|
|
|
switch (actor){
|
|
|
case BUY:
|
|
|
return EnumExpressType.EXPRESS_TYPE_2.getCode();
|
|
|
return getExpressType4Buyer(status);
|
|
|
case SELL:
|
|
|
return getCurrentExpressType4ExpressRecordAndSeller(status);
|
|
|
return getExpressTypes4Seller(status);
|
|
|
default:
|
|
|
return 0;
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
return 0;
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
private Integer getCurrentExpressType4ExpressRecordAndSeller(Integer status){
|
|
|
/* private Integer getCurrentExpressType4ExpressRecordAndSeller(Integer status){
|
|
|
|
|
|
Integer type ;
|
|
|
if (Objects.equals(OrderStatus.CHECKING_FAKE.getCode(), status)){
|
...
|
...
|
@@ -498,7 +527,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
type = EnumExpressType.EXPRESS_TYPE_1.getCode();
|
|
|
}
|
|
|
return type;
|
|
|
}
|
|
|
}*/
|
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|