|
@@ -6,6 +6,7 @@ import com.google.common.collect.Lists; |
|
@@ -6,6 +6,7 @@ import com.google.common.collect.Lists; |
6
|
import com.yoho.core.rabbitmq.YhProducer;
|
6
|
import com.yoho.core.rabbitmq.YhProducer;
|
7
|
import com.yoho.error.ServiceError;
|
7
|
import com.yoho.error.ServiceError;
|
8
|
import com.yoho.error.exception.ServiceException;
|
8
|
import com.yoho.error.exception.ServiceException;
|
|
|
9
|
+import com.yohobuy.ufo.model.order.common.OrderStatus;
|
9
|
import com.yohobuy.ufo.model.order.common.TabType;
|
10
|
import com.yohobuy.ufo.model.order.common.TabType;
|
10
|
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
|
11
|
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
|
11
|
import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo;
|
12
|
import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo;
|
|
@@ -15,7 +16,6 @@ import com.yohoufo.common.utils.DateUtil; |
|
@@ -15,7 +16,6 @@ import com.yohoufo.common.utils.DateUtil; |
15
|
import com.yohoufo.dal.order.*;
|
16
|
import com.yohoufo.dal.order.*;
|
16
|
import com.yohoufo.dal.order.model.*;
|
17
|
import com.yohoufo.dal.order.model.*;
|
17
|
import com.yohoufo.order.common.ExpressForMqSend;
|
18
|
import com.yohoufo.order.common.ExpressForMqSend;
|
18
|
-import com.yohobuy.ufo.model.order.common.OrderStatus;
|
|
|
19
|
import com.yohoufo.order.constants.MetaKey;
|
19
|
import com.yohoufo.order.constants.MetaKey;
|
20
|
import com.yohoufo.order.model.AddressInfo;
|
20
|
import com.yohoufo.order.model.AddressInfo;
|
21
|
import com.yohoufo.order.model.response.AppraiseAddressResp;
|
21
|
import com.yohoufo.order.model.response.AppraiseAddressResp;
|
|
@@ -35,6 +35,7 @@ import javax.annotation.Resource; |
|
@@ -35,6 +35,7 @@ import javax.annotation.Resource; |
35
|
import java.util.ArrayList;
|
35
|
import java.util.ArrayList;
|
36
|
import java.util.Arrays;
|
36
|
import java.util.Arrays;
|
37
|
import java.util.List;
|
37
|
import java.util.List;
|
|
|
38
|
+import java.util.Objects;
|
38
|
|
39
|
|
39
|
/**
|
40
|
/**
|
40
|
* @author kun.wang
|
41
|
* @author kun.wang
|
|
@@ -243,19 +244,38 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
@@ -243,19 +244,38 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
243
|
* @return
|
244
|
* @return
|
244
|
*/
|
245
|
*/
|
245
|
@Override
|
246
|
@Override
|
246
|
- public ExpressInfoRespBo queryExpressDetailInfo(Integer uid,Long orderCode) {
|
|
|
247
|
- LOGGER.info("queryExpressDetailInfo uid={}, orderCode = {}",uid, orderCode);
|
247
|
+ public ExpressInfoRespBo queryExpressDetailInfo(Integer uid,Long orderCode,TabType actor) {
|
|
|
248
|
+ LOGGER.info("queryExpressDetailInfo uid={}, orderCode = {},actor = {} ",uid, orderCode,actor);
|
248
|
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
|
249
|
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
|
249
|
if (buyerOrder == null){
|
250
|
if (buyerOrder == null){
|
250
|
- LOGGER.warn("getOrderInfo order not exist, orderCode is {}", orderCode);
|
251
|
+ LOGGER.warn("queryExpressDetailInfo getOrderInfo order not exist, orderCode is {}", orderCode);
|
251
|
throw new ServiceException(ServiceError.ORDER_NULL);
|
252
|
throw new ServiceException(ServiceError.ORDER_NULL);
|
252
|
}
|
253
|
}
|
253
|
|
254
|
|
|
|
255
|
+ //验证订单和tabType匹配
|
|
|
256
|
+ if(actor!=null){
|
|
|
257
|
+ switch (actor){
|
|
|
258
|
+ case BUY:
|
|
|
259
|
+ if(uid!=buyerOrder.getUid()){
|
|
|
260
|
+ //验证是买家
|
|
|
261
|
+ LOGGER.warn("queryExpressDetailInfo check order not match buyer , uid = {} ,order is {} ", orderCode ,JSON.toJSONString(buyerOrder) );
|
|
|
262
|
+ throw new ServiceException(ServiceError.ORDER_NULL);
|
|
|
263
|
+ }
|
|
|
264
|
+ case SELL:
|
|
|
265
|
+ if(uid!=buyerOrder.getSellerUid()){
|
|
|
266
|
+ //验证是卖家
|
|
|
267
|
+ LOGGER.warn("queryExpressDetailInfo check order not match seller , uid = {} ,order is {} ", orderCode ,JSON.toJSONString(buyerOrder) );
|
|
|
268
|
+ throw new ServiceException(ServiceError.ORDER_NULL);
|
|
|
269
|
+ }
|
|
|
270
|
+ }
|
|
|
271
|
+ }
|
|
|
272
|
+
|
254
|
ExpressInfoRespBo expressInfoRespBo = new ExpressInfoRespBo();
|
273
|
ExpressInfoRespBo expressInfoRespBo = new ExpressInfoRespBo();
|
255
|
- Integer expressType = getExpressType(buyerOrder);
|
274
|
+ Integer expressType = getExpressType(buyerOrder,actor);
|
256
|
LOGGER.info("getExpressType result = {}", expressType);
|
275
|
LOGGER.info("getExpressType result = {}", expressType);
|
257
|
List<ExpressInfo> expressInfoList = expressInfoMapper.selectAllExpressInfo(uid, orderCode, expressType);
|
276
|
List<ExpressInfo> expressInfoList = expressInfoMapper.selectAllExpressInfo(uid, orderCode, expressType);
|
258
|
processExpressInfo(expressInfoList, expressInfoRespBo);
|
277
|
processExpressInfo(expressInfoList, expressInfoRespBo);
|
|
|
278
|
+
|
259
|
//获取上一阶段的辅助物流信息
|
279
|
//获取上一阶段的辅助物流信息
|
260
|
List<ExpressInfoDetail> supplementExpressInfoDetailList = Lists.newArrayList();
|
280
|
List<ExpressInfoDetail> supplementExpressInfoDetailList = Lists.newArrayList();
|
261
|
expressInfoRespBo.setSupplementExpressInfoDetailList(supplementExpressInfoDetailList);
|
281
|
expressInfoRespBo.setSupplementExpressInfoDetailList(supplementExpressInfoDetailList);
|
|
@@ -324,9 +344,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
@@ -324,9 +344,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
324
|
|
344
|
|
325
|
private void constructExpressInfo(List<ExpressInfo> expressInfoList, List<ExpressInfoDetail> supplementExpressInfoDetailList) {
|
345
|
private void constructExpressInfo(List<ExpressInfo> expressInfoList, List<ExpressInfoDetail> supplementExpressInfoDetailList) {
|
326
|
if (CollectionUtils.isNotEmpty(expressInfoList)) {
|
346
|
if (CollectionUtils.isNotEmpty(expressInfoList)) {
|
327
|
- ExpressInfoDetail expressInfoDetail;
|
|
|
328
|
for (ExpressInfo expressInfo : expressInfoList) {
|
347
|
for (ExpressInfo expressInfo : expressInfoList) {
|
329
|
- expressInfoDetail = new ExpressInfoDetail();
|
348
|
+ ExpressInfoDetail expressInfoDetail = new ExpressInfoDetail();
|
330
|
// 运单接收地
|
349
|
// 运单接收地
|
331
|
expressInfoDetail.setAcceptAddress(expressInfo.getAcceptAddress());
|
350
|
expressInfoDetail.setAcceptAddress(expressInfo.getAcceptAddress());
|
332
|
// 运单信息
|
351
|
// 运单信息
|
|
@@ -341,20 +360,50 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
@@ -341,20 +360,50 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
341
|
* orderCode 一定是买家订单号
|
360
|
* orderCode 一定是买家订单号
|
342
|
* @return
|
361
|
* @return
|
343
|
*/
|
362
|
*/
|
344
|
- private Integer getExpressType(BuyerOrder buyerOrder) {
|
363
|
+ private Integer getExpressType(BuyerOrder buyerOrder,TabType actor) {
|
|
|
364
|
+ if(null==actor){
|
345
|
if(OrderStatus.SELLER_SEND_OUT.getCode()==buyerOrder.getStatus()||OrderStatus.PLATFORM_CHECKING.getCode()==buyerOrder.getStatus()){
|
365
|
if(OrderStatus.SELLER_SEND_OUT.getCode()==buyerOrder.getStatus()||OrderStatus.PLATFORM_CHECKING.getCode()==buyerOrder.getStatus()){
|
346
|
return ExpressInfoConstant.EXPRESS_TYPE_1;
|
366
|
return ExpressInfoConstant.EXPRESS_TYPE_1;
|
347
|
- }else if(OrderStatus.CHECKING_FAKE.getCode()==buyerOrder.getStatus()){
|
|
|
348
|
- return ExpressInfoConstant.EXPRESS_TYPE_3;
|
|
|
349
|
}else if(OrderStatus.WAITING_RECEIVE.getCode()==buyerOrder.getStatus()||OrderStatus.DONE.getCode()==buyerOrder.getStatus()){
|
367
|
}else if(OrderStatus.WAITING_RECEIVE.getCode()==buyerOrder.getStatus()||OrderStatus.DONE.getCode()==buyerOrder.getStatus()){
|
|
|
368
|
+ //4 和 5 状态有问题 ,买家查看物流是没问题的,卖家查看物流有问题啊.
|
350
|
return ExpressInfoConstant.EXPRESS_TYPE_2;
|
369
|
return ExpressInfoConstant.EXPRESS_TYPE_2;
|
|
|
370
|
+ }else if(OrderStatus.CHECKING_FAKE.getCode()==buyerOrder.getStatus()){
|
|
|
371
|
+ return ExpressInfoConstant.EXPRESS_TYPE_3;
|
351
|
}else if(OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode()==buyerOrder.getStatus()){
|
372
|
}else if(OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode()==buyerOrder.getStatus()){
|
352
|
return ExpressInfoConstant.EXPRESS_TYPE_REBACK;
|
373
|
return ExpressInfoConstant.EXPRESS_TYPE_REBACK;
|
353
|
}
|
374
|
}
|
|
|
375
|
+ }else {
|
|
|
376
|
+ switch (actor){
|
|
|
377
|
+ case BUY:
|
|
|
378
|
+ return getExpressTypeBuyer(buyerOrder);
|
|
|
379
|
+ case SELL:
|
|
|
380
|
+ return getExpressTypeSeller(buyerOrder);
|
|
|
381
|
+ default:
|
|
|
382
|
+ return 0;
|
|
|
383
|
+ }
|
|
|
384
|
+ }
|
354
|
return 0;
|
385
|
return 0;
|
355
|
|
386
|
|
356
|
}
|
387
|
}
|
357
|
|
388
|
|
|
|
389
|
+ private Integer getExpressTypeSeller(BuyerOrder buyerOrder){
|
|
|
390
|
+ Integer status = buyerOrder.getStatus();
|
|
|
391
|
+
|
|
|
392
|
+ Integer type ;
|
|
|
393
|
+ if (Objects.equals(OrderStatus.CHECKING_FAKE.getCode(), status)){
|
|
|
394
|
+ type = ExpressInfoConstant.EXPRESS_TYPE_3;
|
|
|
395
|
+ }else if(Objects.equals(OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode(), status)){
|
|
|
396
|
+ type = ExpressInfoConstant.EXPRESS_TYPE_REBACK;
|
|
|
397
|
+ }else{
|
|
|
398
|
+ type = ExpressInfoConstant.EXPRESS_TYPE_1;
|
|
|
399
|
+ }
|
|
|
400
|
+ return type;
|
|
|
401
|
+ }
|
|
|
402
|
+
|
|
|
403
|
+ private Integer getExpressTypeBuyer(BuyerOrder buyerOrder){
|
|
|
404
|
+ return ExpressInfoConstant.EXPRESS_TYPE_2;
|
|
|
405
|
+ }
|
|
|
406
|
+
|
358
|
/**
|
407
|
/**
|
359
|
* 根据用户默认地址的省份定位到鉴定中心的地址返回
|
408
|
* 根据用户默认地址的省份定位到鉴定中心的地址返回
|
360
|
*
|
409
|
*
|