Authored by qinchao

fix : 鉴定通过、不通过、直接寄回,如果前台传入的手机号码为空,则后台查询一下

@@ -275,6 +275,7 @@ public class BuyerOrderReq extends PageRequestBO{ @@ -275,6 +275,7 @@ public class BuyerOrderReq extends PageRequestBO{
275 "receiveAreaCode=" + receiveAreaCode + '\'' + 275 "receiveAreaCode=" + receiveAreaCode + '\'' +
276 "expressCompanyId=" + expressCompanyId + '\'' + 276 "expressCompanyId=" + expressCompanyId + '\'' +
277 "waybillCode=" + waybillCode + '\'' + 277 "waybillCode=" + waybillCode + '\'' +
  278 + "mobile="+mobile+ '\'' +
278 '}'; 279 '}';
279 } 280 }
280 } 281 }
1 package com.yoho.ufo.order.service.impl; 1 package com.yoho.ufo.order.service.impl;
2 2
3 import java.math.BigDecimal; 3 import java.math.BigDecimal;
4 -import java.util.ArrayList;  
5 -import java.util.Collections;  
6 -import java.util.List;  
7 -import java.util.Map; 4 +import java.util.*;
8 import java.util.concurrent.TimeUnit; 5 import java.util.concurrent.TimeUnit;
9 import java.util.stream.Collectors; 6 import java.util.stream.Collectors;
10 7
@@ -250,6 +247,50 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -250,6 +247,50 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
250 247
251 return result; 248 return result;
252 } 249 }
  250 +
  251 +
  252 + //如果前台传的手机号码为空,则重设
  253 + private void restMobileFromBuyer(BuyerOrderReq req,String orderCode){
  254 + LOGGER.info("restMobileFromBuyer enter req = {} ,orderCode = {} ",req,orderCode);
  255 + if(StringUtils.isBlank(req.getMobile())){
  256 + LOGGER.info("restMobileFromBuyer updateOrderStatus mobile is empty");
  257 + //获取买家的电话
  258 + BuyerOrderReq reqTmp = new BuyerOrderReq();
  259 + reqTmp.setOrderCode(orderCode);
  260 + LOGGER.info("restMobileFromBuyer updateOrderStatus mobile is empty ,get mobile info again by param {} ",reqTmp);
  261 + BuyerOrderResp buyerOrderResp = this.getReceiveInfoByOrderCode(reqTmp);
  262 + LOGGER.info("restMobileFromBuyer updateOrderStatus mobile is empty ,get mobile info again by param {},result {} ",reqTmp,buyerOrderResp);
  263 + if(buyerOrderResp!=null){
  264 + req.setMobile(buyerOrderResp.getReceiveMobile());
  265 + LOGGER.info("restMobileFromBuyer updateOrderStatus mobile is empty ,reset req mobile {} ",req);
  266 + }
  267 + }else{
  268 + LOGGER.info("restMobileFromBuyer updateOrderStatus mobile is ok ,{}",req.getMobile());
  269 + }
  270 + }
  271 +
  272 + //如果前台传的手机号码为空,则重设
  273 + private void resetMobileFromSeller(BuyerOrderReq req,String orderCode){
  274 + LOGGER.info("resetMobileFromSeller enter req = {} ,orderCode = {} ",req,orderCode);
  275 + if(StringUtils.isBlank(req.getMobile())){
  276 + LOGGER.info("resetMobileFromSeller mobile is empty");
  277 + //获取卖家的电话
  278 + List<BuyerOrderGoods> buyerGoodsList = buyerOrderGoodsMapper.selectByOrderCode(Arrays.asList(orderCode));
  279 + if(CollectionUtils.isNotEmpty(buyerGoodsList)) {
  280 + BuyerOrderReq reqTmp=new BuyerOrderReq();
  281 + reqTmp.setSkup(buyerGoodsList.get(0).getSkup());
  282 + BuyerOrderResp buyerOrderResp = this.getSendBackInfoBySkup(reqTmp);
  283 + if(buyerOrderResp!=null){
  284 + req.setMobile(buyerOrderResp.getReceiveMobile());
  285 + LOGGER.info("appraiseSuccess updateOrderStatus mobile is empty ,reset req mobile {} ",req);
  286 + }
  287 + }else{
  288 + LOGGER.warn("appraiseSuccess updateOrderStatus mobile is empty ,can not reset ,{} ",req);
  289 + }
  290 + }else{
  291 + LOGGER.info("appraiseFail mobile is ok ,{}",req.getMobile());
  292 + }
  293 + }
253 294
254 public JSONObject updateOrderStatus(BuyerOrderReq req) { 295 public JSONObject updateOrderStatus(BuyerOrderReq req) {
255 if(null == req.getId() || null == req.getStatus()) { 296 if(null == req.getId() || null == req.getStatus()) {
@@ -266,9 +307,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -266,9 +307,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
266 JSONObject jsonObject = new JSONObject(); 307 JSONObject jsonObject = new JSONObject();
267 if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_TO_BE_RECEIVED.getByteVal()) {//鉴定通过 308 if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_TO_BE_RECEIVED.getByteVal()) {//鉴定通过
268 args = "orderAppraise.appraiseSuccess"; 309 args = "orderAppraise.appraiseSuccess";
  310 + //重新设置mobile
  311 + restMobileFromBuyer(req,buyerOrder.getOrderCode());
269 jsonObject = asyncCallAppraise(args, buyerOrder.getOrderCode(), req); 312 jsonObject = asyncCallAppraise(args, buyerOrder.getOrderCode(), req);
270 }else if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal()) {//鉴定不通过 313 }else if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal()) {//鉴定不通过
271 args = "orderAppraise.appraiseFail"; 314 args = "orderAppraise.appraiseFail";
  315 + //重新设置mobile
  316 + resetMobileFromSeller(req,buyerOrder.getOrderCode());
272 jsonObject = asyncCallAppraise(args, buyerOrder.getOrderCode(), req); 317 jsonObject = asyncCallAppraise(args, buyerOrder.getOrderCode(), req);
273 }else if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_JUDGING.getByteVal()) {//确认收货 318 }else if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_JUDGING.getByteVal()) {//确认收货
274 args = "ufo-gateway.confirmReceive"; 319 args = "ufo-gateway.confirmReceive";
@@ -306,6 +351,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -306,6 +351,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
306 351
307 //调用前台接口 352 //调用前台接口
308 String args = "orderAppraise.returnBack"; 353 String args = "orderAppraise.returnBack";
  354 + //重新设置mobile
  355 + resetMobileFromSeller(req,buyerOrder.getOrderCode());
309 JSONObject jsonObject = asyncCallAppraise(args, buyerOrder.getOrderCode(), req); 356 JSONObject jsonObject = asyncCallAppraise(args, buyerOrder.getOrderCode(), req);
310 357
311 return jsonObject; 358 return jsonObject;
@@ -328,7 +375,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -328,7 +375,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
328 bo.setMobile(req.getMobile()); 375 bo.setMobile(req.getMobile());
329 376
330 if(StringUtils.isBlank(bo.getMobile())){ 377 if(StringUtils.isBlank(bo.getMobile())){
331 - throw new ServiceException(400,"错误:物流收货人手机号不能为空!"); 378 + LOGGER.warn("callAppraise empty mobile,args {} orderCode is {},req {}, AppraiseExpressInfoBo is {}, startTime is {}", args,orderCode,req, bo ,DateUtil.getCurrentTimeSecond());
  379 + bo.setMobile("18012341234");//暂时保证数据不为空,正常情况下是mobile不会出现数据为空的,上线观察一段时间再去掉
  380 + //throw new ServiceException(400,"错误:物流收货人手机号不能为空!");
332 } 381 }
333 382
334 LOGGER.info("callAppraise orderCode is {}, AppraiseExpressInfoBo is {}, startTime is {}", orderCode, bo ,DateUtil.getCurrentTimeSecond()); 383 LOGGER.info("callAppraise orderCode is {}, AppraiseExpressInfoBo is {}, startTime is {}", orderCode, bo ,DateUtil.getCurrentTimeSecond());