...
|
...
|
@@ -6,6 +6,7 @@ import com.google.common.collect.Lists; |
|
|
import com.yoho.core.rabbitmq.YhProducer;
|
|
|
import com.yoho.error.ServiceError;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yohobuy.ufo.model.order.common.OrderStatus;
|
|
|
import com.yohobuy.ufo.model.order.common.TabType;
|
|
|
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
|
|
|
import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo;
|
...
|
...
|
@@ -15,7 +16,6 @@ import com.yohoufo.common.utils.DateUtil; |
|
|
import com.yohoufo.dal.order.*;
|
|
|
import com.yohoufo.dal.order.model.*;
|
|
|
import com.yohoufo.order.common.ExpressForMqSend;
|
|
|
import com.yohobuy.ufo.model.order.common.OrderStatus;
|
|
|
import com.yohoufo.order.constants.MetaKey;
|
|
|
import com.yohoufo.order.model.AddressInfo;
|
|
|
import com.yohoufo.order.model.response.AppraiseAddressResp;
|
...
|
...
|
@@ -35,6 +35,7 @@ import javax.annotation.Resource; |
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* @author kun.wang
|
...
|
...
|
@@ -243,19 +244,38 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
public ExpressInfoRespBo queryExpressDetailInfo(Integer uid,Long orderCode) {
|
|
|
LOGGER.info("queryExpressDetailInfo uid={}, orderCode = {}",uid, orderCode);
|
|
|
public ExpressInfoRespBo queryExpressDetailInfo(Integer uid,Long orderCode,TabType actor) {
|
|
|
LOGGER.info("queryExpressDetailInfo uid={}, orderCode = {},actor = {} ",uid, orderCode,actor);
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
|
|
|
if (buyerOrder == null){
|
|
|
LOGGER.warn("getOrderInfo order not exist, orderCode is {}", orderCode);
|
|
|
LOGGER.warn("queryExpressDetailInfo getOrderInfo order not exist, orderCode is {}", orderCode);
|
|
|
throw new ServiceException(ServiceError.ORDER_NULL);
|
|
|
}
|
|
|
|
|
|
//验证订单和tabType匹配
|
|
|
if(actor!=null){
|
|
|
switch (actor){
|
|
|
case BUY:
|
|
|
if(uid!=buyerOrder.getUid()){
|
|
|
//验证是买家
|
|
|
LOGGER.warn("queryExpressDetailInfo check order not match buyer , uid = {} ,order is {} ", orderCode ,JSON.toJSONString(buyerOrder) );
|
|
|
throw new ServiceException(ServiceError.ORDER_NULL);
|
|
|
}
|
|
|
case SELL:
|
|
|
if(uid!=buyerOrder.getSellerUid()){
|
|
|
//验证是卖家
|
|
|
LOGGER.warn("queryExpressDetailInfo check order not match seller , uid = {} ,order is {} ", orderCode ,JSON.toJSONString(buyerOrder) );
|
|
|
throw new ServiceException(ServiceError.ORDER_NULL);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
ExpressInfoRespBo expressInfoRespBo = new ExpressInfoRespBo();
|
|
|
Integer expressType = getExpressType(buyerOrder);
|
|
|
Integer expressType = getExpressType(buyerOrder,actor);
|
|
|
LOGGER.info("getExpressType result = {}", expressType);
|
|
|
List<ExpressInfo> expressInfoList = expressInfoMapper.selectAllExpressInfo(uid, orderCode, expressType);
|
|
|
processExpressInfo(expressInfoList, expressInfoRespBo);
|
|
|
|
|
|
//获取上一阶段的辅助物流信息
|
|
|
List<ExpressInfoDetail> supplementExpressInfoDetailList = Lists.newArrayList();
|
|
|
expressInfoRespBo.setSupplementExpressInfoDetailList(supplementExpressInfoDetailList);
|
...
|
...
|
@@ -324,9 +344,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
|
|
|
private void constructExpressInfo(List<ExpressInfo> expressInfoList, List<ExpressInfoDetail> supplementExpressInfoDetailList) {
|
|
|
if (CollectionUtils.isNotEmpty(expressInfoList)) {
|
|
|
ExpressInfoDetail expressInfoDetail;
|
|
|
for (ExpressInfo expressInfo : expressInfoList) {
|
|
|
expressInfoDetail = new ExpressInfoDetail();
|
|
|
ExpressInfoDetail expressInfoDetail = new ExpressInfoDetail();
|
|
|
// 运单接收地
|
|
|
expressInfoDetail.setAcceptAddress(expressInfo.getAcceptAddress());
|
|
|
// 运单信息
|
...
|
...
|
@@ -341,20 +360,50 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
* orderCode 一定是买家订单号
|
|
|
* @return
|
|
|
*/
|
|
|
private Integer getExpressType(BuyerOrder buyerOrder) {
|
|
|
if(OrderStatus.SELLER_SEND_OUT.getCode()==buyerOrder.getStatus()||OrderStatus.PLATFORM_CHECKING.getCode()==buyerOrder.getStatus()){
|
|
|
return ExpressInfoConstant.EXPRESS_TYPE_1;
|
|
|
}else if(OrderStatus.CHECKING_FAKE.getCode()==buyerOrder.getStatus()){
|
|
|
return ExpressInfoConstant.EXPRESS_TYPE_3;
|
|
|
}else if(OrderStatus.WAITING_RECEIVE.getCode()==buyerOrder.getStatus()||OrderStatus.DONE.getCode()==buyerOrder.getStatus()){
|
|
|
return ExpressInfoConstant.EXPRESS_TYPE_2;
|
|
|
}else if(OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode()==buyerOrder.getStatus()){
|
|
|
return ExpressInfoConstant.EXPRESS_TYPE_REBACK;
|
|
|
private Integer getExpressType(BuyerOrder buyerOrder,TabType actor) {
|
|
|
if(null==actor){
|
|
|
if(OrderStatus.SELLER_SEND_OUT.getCode()==buyerOrder.getStatus()||OrderStatus.PLATFORM_CHECKING.getCode()==buyerOrder.getStatus()){
|
|
|
return ExpressInfoConstant.EXPRESS_TYPE_1;
|
|
|
}else if(OrderStatus.WAITING_RECEIVE.getCode()==buyerOrder.getStatus()||OrderStatus.DONE.getCode()==buyerOrder.getStatus()){
|
|
|
//4 和 5 状态有问题 ,买家查看物流是没问题的,卖家查看物流有问题啊.
|
|
|
return ExpressInfoConstant.EXPRESS_TYPE_2;
|
|
|
}else if(OrderStatus.CHECKING_FAKE.getCode()==buyerOrder.getStatus()){
|
|
|
return ExpressInfoConstant.EXPRESS_TYPE_3;
|
|
|
}else if(OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode()==buyerOrder.getStatus()){
|
|
|
return ExpressInfoConstant.EXPRESS_TYPE_REBACK;
|
|
|
}
|
|
|
}else {
|
|
|
switch (actor){
|
|
|
case BUY:
|
|
|
return getExpressTypeBuyer(buyerOrder);
|
|
|
case SELL:
|
|
|
return getExpressTypeSeller(buyerOrder);
|
|
|
default:
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
private Integer getExpressTypeSeller(BuyerOrder buyerOrder){
|
|
|
Integer status = buyerOrder.getStatus();
|
|
|
|
|
|
Integer type ;
|
|
|
if (Objects.equals(OrderStatus.CHECKING_FAKE.getCode(), status)){
|
|
|
type = ExpressInfoConstant.EXPRESS_TYPE_3;
|
|
|
}else if(Objects.equals(OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode(), status)){
|
|
|
type = ExpressInfoConstant.EXPRESS_TYPE_REBACK;
|
|
|
}else{
|
|
|
type = ExpressInfoConstant.EXPRESS_TYPE_1;
|
|
|
}
|
|
|
return type;
|
|
|
}
|
|
|
|
|
|
private Integer getExpressTypeBuyer(BuyerOrder buyerOrder){
|
|
|
return ExpressInfoConstant.EXPRESS_TYPE_2;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据用户默认地址的省份定位到鉴定中心的地址返回
|
|
|
*
|
...
|
...
|
|