Showing
1 changed file
with
69 additions
and
40 deletions
@@ -358,38 +358,57 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -358,38 +358,57 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
358 | } | 358 | } |
359 | 359 | ||
360 | ExpressInfoRespBo expressInfoRespBo = new ExpressInfoRespBo(); | 360 | ExpressInfoRespBo expressInfoRespBo = new ExpressInfoRespBo(); |
361 | + expressInfoRespBo.setExpressInfoDetailList(Lists.newArrayList()); | ||
362 | + expressInfoRespBo.setJudgeExpressInfoDetailList(Lists.newArrayList()); | ||
363 | + expressInfoRespBo.setSupplementExpressInfoDetailList(Lists.newArrayList()); | ||
361 | 364 | ||
365 | + List<Integer> expressTypeList = getCurrentExpressType4ExpressRecord(buyerOrder.getStatus(), actor); | ||
366 | + LOGGER.info("queryExpressDetailInfo getExpressType expressTypeList result = {}, uid={}, orderCode = {},actor = {} ",expressTypeList,uid, orderCode,actor); | ||
367 | + if(CollectionUtils.isEmpty(expressTypeList)){ | ||
368 | + LOGGER.info("queryExpressDetailInfo getExpressType expressTypeList return empty result = {}, uid={}, orderCode = {},actor = {} ",expressTypeList,uid, orderCode,actor); | ||
369 | + return expressInfoRespBo; | ||
370 | + } | ||
362 | 371 | ||
363 | - Integer expressType = getCurrentExpressType4ExpressRecord(buyerOrder.getStatus(), actor); | ||
364 | - LOGGER.info("queryExpressDetailInfo getExpressType expressType result = {}, uid={}, orderCode = {},actor = {} ",expressType,uid, orderCode,actor); | ||
365 | //1.物流单号信息 | 372 | //1.物流单号信息 |
366 | - constructWayBillInfo(orderCode,expressType,expressInfoRespBo); | ||
367 | - | ||
368 | - //2.设定最近一个阶段的物流 | ||
369 | - expressInfoRespBo.setExpressInfoDetailList(Lists.newArrayList()); | ||
370 | - List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressType); | ||
371 | - constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList()); | 373 | + constructWayBillInfo(orderCode,expressTypeList,expressInfoRespBo); |
374 | + | ||
375 | + // 构造物流信息 | ||
376 | + if(expressTypeList.size()==1){ | ||
377 | + //设定最近一个阶段的物流 | ||
378 | + List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressTypeList.get(0)); | ||
379 | + constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList()); | ||
380 | + }else if(expressTypeList.size()==2){ | ||
381 | + if(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().intValue()==expressTypeList.get(0)){ | ||
382 | + //设定鉴定的物流调拨信息 | ||
383 | + List<ExpressInfo> judgeExpressInfoList=getExpressInfoListByStage(actor, orderCode, EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode()); | ||
384 | + constructExpressInfo(actor,judgeExpressInfoList, expressInfoRespBo.getJudgeExpressInfoDetailList()); | ||
385 | + | ||
386 | + //获取上一阶段的辅助物流信息 | ||
387 | + constructSupplementExpress( actor,orderCode,expressTypeList.get(0),expressInfoRespBo); | ||
388 | + }else{ | ||
389 | + //设定最近一个阶段的物流 | ||
390 | + List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressTypeList.get(0)); | ||
391 | + constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList()); | ||
392 | + | ||
393 | + //获取上一阶段的辅助物流信息 | ||
394 | + constructSupplementExpress( actor,orderCode,expressTypeList.get(0),expressInfoRespBo); | ||
395 | + } | ||
396 | + }else if(expressTypeList.size()==3){ | ||
397 | + //设定最近一个阶段的物流 | ||
398 | + List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressTypeList.get(0)); | ||
399 | + constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList()); | ||
372 | 400 | ||
373 | - //3.设定鉴定的物流调拨信息 | ||
374 | - expressInfoRespBo.setJudgeExpressInfoDetailList(Lists.newArrayList()); | ||
375 | - List<ExpressInfo> judgeExpressInfoList=getExpressInfoListByStage(actor, orderCode, EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode()); | ||
376 | - constructExpressInfo(actor,judgeExpressInfoList, expressInfoRespBo.getJudgeExpressInfoDetailList()); | 401 | + //设定鉴定的物流调拨信息 |
402 | + List<ExpressInfo> judgeExpressInfoList=getExpressInfoListByStage(actor, orderCode, EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode()); | ||
403 | + constructExpressInfo(actor,judgeExpressInfoList, expressInfoRespBo.getJudgeExpressInfoDetailList()); | ||
377 | 404 | ||
378 | - //4.获取上一阶段的辅助物流信息 | ||
379 | - List<ExpressInfoDetail> supplementExpressInfoDetailList = Lists.newArrayList(); | ||
380 | - expressInfoRespBo.setSupplementExpressInfoDetailList(supplementExpressInfoDetailList); | ||
381 | - constructSupplementExpress( actor,orderCode,expressType,expressInfoRespBo); | 405 | + //获取上一阶段的辅助物流信息 |
406 | + constructSupplementExpress( actor,orderCode,expressTypeList.get(0),expressInfoRespBo); | ||
407 | + } | ||
382 | 408 | ||
383 | //5.设定三个阶段的信息 | 409 | //5.设定三个阶段的信息 |
384 | buildExpressStage(buyerOrder.getStatus(), expressInfoRespBo); | 410 | buildExpressStage(buyerOrder.getStatus(), expressInfoRespBo); |
385 | 411 | ||
386 | - //6.根据状态重设expressType | ||
387 | - if(Objects.equals(OrderStatus.PLATFORM_RECEIVE.getCode(),buyerOrder.getStatus()) | ||
388 | - ||Objects.equals(OrderStatus.PLATFORM_CHECKING.getCode(),buyerOrder.getStatus()) | ||
389 | - ){ | ||
390 | - expressInfoRespBo.setExpressType(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().byteValue()); | ||
391 | - } | ||
392 | - | ||
393 | LOGGER.info("queryExpressDetailInfo result = {}", JSON.toJSONString(expressInfoRespBo)); | 412 | LOGGER.info("queryExpressDetailInfo result = {}", JSON.toJSONString(expressInfoRespBo)); |
394 | return expressInfoRespBo; | 413 | return expressInfoRespBo; |
395 | } | 414 | } |
@@ -414,7 +433,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -414,7 +433,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
414 | } | 433 | } |
415 | 434 | ||
416 | private void constructSupplementExpress(TabType actor,Long orderCode,Integer expressType,ExpressInfoRespBo expressInfoRespBo){ | 435 | private void constructSupplementExpress(TabType actor,Long orderCode,Integer expressType,ExpressInfoRespBo expressInfoRespBo){ |
417 | - if(EnumExpressType.EXPRESS_TYPE_2.getCode().intValue()==expressType.intValue()){ | 436 | + if(EnumExpressType.EXPRESS_TYPE_2.getCode().intValue()==expressType.intValue() |
437 | + ||EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().intValue()==expressType.intValue()){ | ||
418 | //买家这个时候需要看卖家的物流 | 438 | //买家这个时候需要看卖家的物流 |
419 | //设置物流提示头信息 | 439 | //设置物流提示头信息 |
420 | if(StringUtils.isBlank(expressInfoRespBo.getExpressSender())){ | 440 | if(StringUtils.isBlank(expressInfoRespBo.getExpressSender())){ |
@@ -429,7 +449,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -429,7 +449,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
429 | //如果还没有新的物流信息,卖家显示上一个阶段的物流 | 449 | //如果还没有新的物流信息,卖家显示上一个阶段的物流 |
430 | if(StringUtils.isBlank(expressInfoRespBo.getExpressSender())){ | 450 | if(StringUtils.isBlank(expressInfoRespBo.getExpressSender())){ |
431 | //物流单号信息 | 451 | //物流单号信息 |
432 | - constructWayBillInfo(orderCode,EnumExpressType.EXPRESS_TYPE_1.getCode(),expressInfoRespBo); | 452 | + constructWayBillInfo(orderCode,Arrays.asList(EnumExpressType.EXPRESS_TYPE_1.getCode()),expressInfoRespBo); |
433 | } | 453 | } |
434 | List<ExpressInfo> previousExpressInfoList = getExpressInfoListByStage(actor,orderCode, EnumExpressType.EXPRESS_TYPE_1.getCode()); | 454 | List<ExpressInfo> previousExpressInfoList = getExpressInfoListByStage(actor,orderCode, EnumExpressType.EXPRESS_TYPE_1.getCode()); |
435 | constructExpressInfo(actor,previousExpressInfoList, expressInfoRespBo.getSupplementExpressInfoDetailList()); | 455 | constructExpressInfo(actor,previousExpressInfoList, expressInfoRespBo.getSupplementExpressInfoDetailList()); |
@@ -438,14 +458,22 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -438,14 +458,22 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
438 | } | 458 | } |
439 | 459 | ||
440 | //物流单号信息 | 460 | //物流单号信息 |
441 | - private void constructWayBillInfo(Long orderCode,Integer expressType,ExpressInfoRespBo expressInfoRespBo){ | 461 | + private void constructWayBillInfo(Long orderCode,List<Integer> expressTypeList,ExpressInfoRespBo expressInfoRespBo){ |
462 | + Integer expressType = 0; | ||
463 | + for(Integer i:expressTypeList){ | ||
464 | + if(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().equals(i)){ | ||
465 | + continue; | ||
466 | + } | ||
467 | + expressType = i; | ||
468 | + break; //循环一次 ,取最近的一个 | ||
469 | + } | ||
442 | ExpressRecord expressRecord = expressRecordMapper.selectByOrderCodeAndExpressType(orderCode,expressType); | 470 | ExpressRecord expressRecord = expressRecordMapper.selectByOrderCodeAndExpressType(orderCode,expressType); |
443 | if(expressRecord!=null){ | 471 | if(expressRecord!=null){ |
444 | expressInfoRespBo.setExpressInfoDetailList(new ArrayList<>()); | 472 | expressInfoRespBo.setExpressInfoDetailList(new ArrayList<>()); |
445 | // 快递单号 | 473 | // 快递单号 |
446 | expressInfoRespBo.setWayBillCode(expressRecord.getWaybillCode()); | 474 | expressInfoRespBo.setWayBillCode(expressRecord.getWaybillCode()); |
447 | //物流类型 | 475 | //物流类型 |
448 | - expressInfoRespBo.setExpressType(expressRecord.getExpressType()); | 476 | + expressInfoRespBo.setExpressType(expressTypeList.get(0).byteValue()); |
449 | //物流发货方 | 477 | //物流发货方 |
450 | expressInfoRespBo.setExpressSender(getSenderName(expressInfoRespBo.getExpressType().intValue())); | 478 | expressInfoRespBo.setExpressSender(getSenderName(expressInfoRespBo.getExpressType().intValue())); |
451 | // 快递公司名称 | 479 | // 快递公司名称 |
@@ -458,36 +486,37 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -458,36 +486,37 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
458 | * orderCode 一定是买家订单号 | 486 | * orderCode 一定是买家订单号 |
459 | * @return | 487 | * @return |
460 | */ | 488 | */ |
461 | - private Integer getCurrentExpressType4ExpressRecord(Integer status, TabType actor) { | 489 | + private List<Integer> getCurrentExpressType4ExpressRecord(Integer status, TabType actor) { |
462 | if(null==actor){ | 490 | if(null==actor){ |
463 | if(OrderStatus.SELLER_SEND_OUT.getCode()==status | 491 | if(OrderStatus.SELLER_SEND_OUT.getCode()==status |
464 | - ||OrderStatus.PLATFORM_RECEIVE.getCode()==status | ||
465 | - ||OrderStatus.PLATFORM_CHECKING.getCode()==status | ||
466 | ){ | 492 | ){ |
467 | - return EnumExpressType.EXPRESS_TYPE_1.getCode(); | 493 | + return Arrays.asList(EnumExpressType.EXPRESS_TYPE_1.getCode()); |
494 | + }else if(OrderStatus.PLATFORM_RECEIVE.getCode()==status | ||
495 | + ||OrderStatus.PLATFORM_CHECKING.getCode()==status){ | ||
496 | + return Arrays.asList(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode(),EnumExpressType.EXPRESS_TYPE_1.getCode()); | ||
468 | }else if(OrderStatus.WAITING_RECEIVE.getCode()==status||OrderStatus.DONE.getCode()==status){ | 497 | }else if(OrderStatus.WAITING_RECEIVE.getCode()==status||OrderStatus.DONE.getCode()==status){ |
469 | //4 和 5 状态有问题 ,买家查看物流是没问题的,卖家查看物流有问题啊. | 498 | //4 和 5 状态有问题 ,买家查看物流是没问题的,卖家查看物流有问题啊. |
470 | - return EnumExpressType.EXPRESS_TYPE_2.getCode(); | 499 | + return Arrays.asList(EnumExpressType.EXPRESS_TYPE_2.getCode(),EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode(),EnumExpressType.EXPRESS_TYPE_1.getCode()); |
471 | }else if(OrderStatus.CHECKING_FAKE.getCode()==status){ | 500 | }else if(OrderStatus.CHECKING_FAKE.getCode()==status){ |
472 | - return EnumExpressType.EXPRESS_TYPE_3.getCode(); | 501 | + return Arrays.asList(EnumExpressType.EXPRESS_TYPE_3.getCode(),EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode(),EnumExpressType.EXPRESS_TYPE_1.getCode()); |
473 | }else if(OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode()==status){ | 502 | }else if(OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode()==status){ |
474 | - return EnumExpressType.EXPRESS_TYPE_REBACK.getCode(); | 503 | + return Arrays.asList(EnumExpressType.EXPRESS_TYPE_REBACK.getCode(),EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode(),EnumExpressType.EXPRESS_TYPE_1.getCode()); |
475 | } | 504 | } |
476 | }else { | 505 | }else { |
477 | switch (actor){ | 506 | switch (actor){ |
478 | case BUY: | 507 | case BUY: |
479 | - return EnumExpressType.EXPRESS_TYPE_2.getCode(); | 508 | + return getExpressType4Buyer(status); |
480 | case SELL: | 509 | case SELL: |
481 | - return getCurrentExpressType4ExpressRecordAndSeller(status); | 510 | + return getExpressTypes4Seller(status); |
482 | default: | 511 | default: |
483 | - return 0; | 512 | + return null; |
484 | } | 513 | } |
485 | } | 514 | } |
486 | - return 0; | 515 | + return null; |
487 | 516 | ||
488 | } | 517 | } |
489 | 518 | ||
490 | - private Integer getCurrentExpressType4ExpressRecordAndSeller(Integer status){ | 519 | + /* private Integer getCurrentExpressType4ExpressRecordAndSeller(Integer status){ |
491 | 520 | ||
492 | Integer type ; | 521 | Integer type ; |
493 | if (Objects.equals(OrderStatus.CHECKING_FAKE.getCode(), status)){ | 522 | if (Objects.equals(OrderStatus.CHECKING_FAKE.getCode(), status)){ |
@@ -498,7 +527,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -498,7 +527,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
498 | type = EnumExpressType.EXPRESS_TYPE_1.getCode(); | 527 | type = EnumExpressType.EXPRESS_TYPE_1.getCode(); |
499 | } | 528 | } |
500 | return type; | 529 | return type; |
501 | - } | 530 | + }*/ |
502 | 531 | ||
503 | 532 | ||
504 | /** | 533 | /** |
-
Please register or login to post a comment