|
|
package com.yoho.ufo.order.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
...
|
...
|
@@ -250,6 +247,50 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
//如果前台传的手机号码为空,则重设
|
|
|
private void restMobileFromBuyer(BuyerOrderReq req,String orderCode){
|
|
|
LOGGER.info("restMobileFromBuyer enter req = {} ,orderCode = {} ",req,orderCode);
|
|
|
if(StringUtils.isBlank(req.getMobile())){
|
|
|
LOGGER.info("restMobileFromBuyer updateOrderStatus mobile is empty");
|
|
|
//获取买家的电话
|
|
|
BuyerOrderReq reqTmp = new BuyerOrderReq();
|
|
|
reqTmp.setOrderCode(orderCode);
|
|
|
LOGGER.info("restMobileFromBuyer updateOrderStatus mobile is empty ,get mobile info again by param {} ",reqTmp);
|
|
|
BuyerOrderResp buyerOrderResp = this.getReceiveInfoByOrderCode(reqTmp);
|
|
|
LOGGER.info("restMobileFromBuyer updateOrderStatus mobile is empty ,get mobile info again by param {},result {} ",reqTmp,buyerOrderResp);
|
|
|
if(buyerOrderResp!=null){
|
|
|
req.setMobile(buyerOrderResp.getReceiveMobile());
|
|
|
LOGGER.info("restMobileFromBuyer updateOrderStatus mobile is empty ,reset req mobile {} ",req);
|
|
|
}
|
|
|
}else{
|
|
|
LOGGER.info("restMobileFromBuyer updateOrderStatus mobile is ok ,{}",req.getMobile());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//如果前台传的手机号码为空,则重设
|
|
|
private void resetMobileFromSeller(BuyerOrderReq req,String orderCode){
|
|
|
LOGGER.info("resetMobileFromSeller enter req = {} ,orderCode = {} ",req,orderCode);
|
|
|
if(StringUtils.isBlank(req.getMobile())){
|
|
|
LOGGER.info("resetMobileFromSeller mobile is empty");
|
|
|
//获取卖家的电话
|
|
|
List<BuyerOrderGoods> buyerGoodsList = buyerOrderGoodsMapper.selectByOrderCode(Arrays.asList(orderCode));
|
|
|
if(CollectionUtils.isNotEmpty(buyerGoodsList)) {
|
|
|
BuyerOrderReq reqTmp=new BuyerOrderReq();
|
|
|
reqTmp.setSkup(buyerGoodsList.get(0).getSkup());
|
|
|
BuyerOrderResp buyerOrderResp = this.getSendBackInfoBySkup(reqTmp);
|
|
|
if(buyerOrderResp!=null){
|
|
|
req.setMobile(buyerOrderResp.getReceiveMobile());
|
|
|
LOGGER.info("appraiseSuccess updateOrderStatus mobile is empty ,reset req mobile {} ",req);
|
|
|
}
|
|
|
}else{
|
|
|
LOGGER.warn("appraiseSuccess updateOrderStatus mobile is empty ,can not reset ,{} ",req);
|
|
|
}
|
|
|
}else{
|
|
|
LOGGER.info("appraiseFail mobile is ok ,{}",req.getMobile());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public JSONObject updateOrderStatus(BuyerOrderReq req) {
|
|
|
if(null == req.getId() || null == req.getStatus()) {
|
...
|
...
|
@@ -266,9 +307,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_TO_BE_RECEIVED.getByteVal()) {//鉴定通过
|
|
|
args = "orderAppraise.appraiseSuccess";
|
|
|
//重新设置mobile
|
|
|
restMobileFromBuyer(req,buyerOrder.getOrderCode());
|
|
|
jsonObject = asyncCallAppraise(args, buyerOrder.getOrderCode(), req);
|
|
|
}else if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal()) {//鉴定不通过
|
|
|
args = "orderAppraise.appraiseFail";
|
|
|
//重新设置mobile
|
|
|
resetMobileFromSeller(req,buyerOrder.getOrderCode());
|
|
|
jsonObject = asyncCallAppraise(args, buyerOrder.getOrderCode(), req);
|
|
|
}else if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_JUDGING.getByteVal()) {//确认收货
|
|
|
args = "ufo-gateway.confirmReceive";
|
...
|
...
|
@@ -306,6 +351,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
|
|
|
//调用前台接口
|
|
|
String args = "orderAppraise.returnBack";
|
|
|
//重新设置mobile
|
|
|
resetMobileFromSeller(req,buyerOrder.getOrderCode());
|
|
|
JSONObject jsonObject = asyncCallAppraise(args, buyerOrder.getOrderCode(), req);
|
|
|
|
|
|
return jsonObject;
|
...
|
...
|
@@ -328,7 +375,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
bo.setMobile(req.getMobile());
|
|
|
|
|
|
if(StringUtils.isBlank(bo.getMobile())){
|
|
|
throw new ServiceException(400,"错误:物流收货人手机号不能为空!");
|
|
|
LOGGER.warn("callAppraise empty mobile,args {} orderCode is {},req {}, AppraiseExpressInfoBo is {}, startTime is {}", args,orderCode,req, bo ,DateUtil.getCurrentTimeSecond());
|
|
|
bo.setMobile("18012341234");//暂时保证数据不为空,正常情况下是mobile不会出现数据为空的,上线观察一段时间再去掉
|
|
|
//throw new ServiceException(400,"错误:物流收货人手机号不能为空!");
|
|
|
}
|
|
|
|
|
|
LOGGER.info("callAppraise orderCode is {}, AppraiseExpressInfoBo is {}, startTime is {}", orderCode, bo ,DateUtil.getCurrentTimeSecond());
|
...
|
...
|
|