Showing
1 changed file
with
24 additions
and
30 deletions
@@ -372,12 +372,11 @@ public class BuyerOrderCancelService { | @@ -372,12 +372,11 @@ public class BuyerOrderCancelService { | ||
372 | } | 372 | } |
373 | 373 | ||
374 | @Data@Builder | 374 | @Data@Builder |
375 | - private static class RefundGoodsAmoutNode{ | 375 | + private static class RefundGoodsAmountNode { |
376 | BuyerOrder buyerOrder; | 376 | BuyerOrder buyerOrder; |
377 | int skup; | 377 | int skup; |
378 | OrderStatus targetOrderStatus; | 378 | OrderStatus targetOrderStatus; |
379 | BigDecimal leftBuyerMoney; | 379 | BigDecimal leftBuyerMoney; |
380 | - boolean needCompensateCoupon; | ||
381 | } | 380 | } |
382 | 381 | ||
383 | 382 | ||
@@ -552,8 +551,7 @@ public class BuyerOrderCancelService { | @@ -552,8 +551,7 @@ public class BuyerOrderCancelService { | ||
552 | 551 | ||
553 | String logTag; | 552 | String logTag; |
554 | private OrderStatus targetStatus; | 553 | private OrderStatus targetStatus; |
555 | - private Consumer<RefundGoodsAmoutNode> consumer; | ||
556 | - private boolean needCompensateCoupon; | 554 | + private Consumer<RefundGoodsAmountNode> refundGoodsAmountConsumer; |
557 | private BuyerOrder buyerOrder; | 555 | private BuyerOrder buyerOrder; |
558 | 556 | ||
559 | CancelOverseasOrderModel(long orderCode, String failReason, CutomsClearanceFailType failType) { | 557 | CancelOverseasOrderModel(long orderCode, String failReason, CutomsClearanceFailType failType) { |
@@ -569,17 +567,15 @@ public class BuyerOrderCancelService { | @@ -569,17 +567,15 @@ public class BuyerOrderCancelService { | ||
569 | throwServiceExceptionIf(orderCode <= 0L, "订单号不存在"); | 567 | throwServiceExceptionIf(orderCode <= 0L, "订单号不存在"); |
570 | throwServiceExceptionIf(StringUtils.isBlank(failReason), "失败原因不能为空"); | 568 | throwServiceExceptionIf(StringUtils.isBlank(failReason), "失败原因不能为空"); |
571 | targetStatus = null; | 569 | targetStatus = null; |
572 | - consumer = null; | ||
573 | - needCompensateCoupon = false; | 570 | + refundGoodsAmountConsumer = null; |
574 | switch (failType) { | 571 | switch (failType) { |
575 | case PLATFORM: | 572 | case PLATFORM: |
576 | targetStatus = OrderStatus.PLATFORM_BLOWN_CUSTOMS_CLEARANCE; | 573 | targetStatus = OrderStatus.PLATFORM_BLOWN_CUSTOMS_CLEARANCE; |
577 | - needCompensateCoupon = true; | ||
578 | - consumer = (buyerOrder1) -> cancelOverseasOrderByPlatform(buyerOrder1); | 574 | + refundGoodsAmountConsumer = refundGoodsAmountNode -> platformReason(refundGoodsAmountNode); |
579 | break; | 575 | break; |
580 | case BUYER: | 576 | case BUYER: |
581 | targetStatus = OrderStatus.BUYER_BLOWN_CUSTOMS_CLEARANCE; | 577 | targetStatus = OrderStatus.BUYER_BLOWN_CUSTOMS_CLEARANCE; |
582 | - consumer = (buyerOrder1) -> cancelOverseasOrderByBuyer(buyerOrder1); | 578 | + refundGoodsAmountConsumer = refundGoodsAmountNode -> userReason(refundGoodsAmountNode); |
583 | break; | 579 | break; |
584 | default: | 580 | default: |
585 | throwServiceException("无效的目标状态"); | 581 | throwServiceException("无效的目标状态"); |
@@ -603,7 +599,7 @@ public class BuyerOrderCancelService { | @@ -603,7 +599,7 @@ public class BuyerOrderCancelService { | ||
603 | int buyerUid = buyerOrder.getUid(); | 599 | int buyerUid = buyerOrder.getUid(); |
604 | boolean changeStatusFlag = buyerOrderMapper.updateStatusByOrderCode(orderCode, buyerUid, expectedStatus.getCode(), | 600 | boolean changeStatusFlag = buyerOrderMapper.updateStatusByOrderCode(orderCode, buyerUid, expectedStatus.getCode(), |
605 | targetStatus.getCode(), DateUtil.getCurrentTimeSecond()) > 0; | 601 | targetStatus.getCode(), DateUtil.getCurrentTimeSecond()) > 0; |
606 | - if (!changeStatusFlag){ | 602 | + if (!changeStatusFlag) { |
607 | logger.info("{} changeStatus fail", logTag); | 603 | logger.info("{} changeStatus fail", logTag); |
608 | throwServiceException("订单状态变更失败"); | 604 | throwServiceException("订单状态变更失败"); |
609 | } | 605 | } |
@@ -625,7 +621,7 @@ public class BuyerOrderCancelService { | @@ -625,7 +621,7 @@ public class BuyerOrderCancelService { | ||
625 | 621 | ||
626 | asyncRefundCoupon(buyerOrder.getUid(), buyerOrder.getOrderCode(), BuyerRefundCouponEvent.BizCase.PLATFORM_BLOWN_CUSTOMS_CLEARANCE); | 622 | asyncRefundCoupon(buyerOrder.getUid(), buyerOrder.getOrderCode(), BuyerRefundCouponEvent.BizCase.PLATFORM_BLOWN_CUSTOMS_CLEARANCE); |
627 | 623 | ||
628 | - orderStatusFlowService.addAsy(orderCode,targetStatus.getCode()); | 624 | + orderStatusFlowService.addAsy(orderCode, targetStatus.getCode()); |
629 | } | 625 | } |
630 | 626 | ||
631 | 627 | ||
@@ -639,15 +635,14 @@ public class BuyerOrderCancelService { | @@ -639,15 +635,14 @@ public class BuyerOrderCancelService { | ||
639 | Integer skup = pbog.getSkup(); | 635 | Integer skup = pbog.getSkup(); |
640 | buyerOrder.setStatus(targetStatus.getCode()); | 636 | buyerOrder.setStatus(targetStatus.getCode()); |
641 | 637 | ||
642 | - RefundGoodsAmoutNode rgaNode = RefundGoodsAmoutNode.builder() | 638 | + RefundGoodsAmountNode rgaNode = RefundGoodsAmountNode.builder() |
643 | .buyerOrder(buyerOrder) | 639 | .buyerOrder(buyerOrder) |
644 | .skup(skup) | 640 | .skup(skup) |
645 | .targetOrderStatus(targetStatus) | 641 | .targetOrderStatus(targetStatus) |
646 | .leftBuyerMoney(leftGoodsMoney) | 642 | .leftBuyerMoney(leftGoodsMoney) |
647 | - .needCompensateCoupon(needCompensateCoupon) | ||
648 | .build(); | 643 | .build(); |
649 | // | 644 | // |
650 | - consumer.accept(rgaNode); | 645 | + refundGoodsAmountConsumer.accept(rgaNode); |
651 | logger.info("{} asyncRefundGoodsAmount success", logTag); | 646 | logger.info("{} asyncRefundGoodsAmount success", logTag); |
652 | }); | 647 | }); |
653 | 648 | ||
@@ -674,17 +669,15 @@ public class BuyerOrderCancelService { | @@ -674,17 +669,15 @@ public class BuyerOrderCancelService { | ||
674 | * 货品平台自己吃了 | 669 | * 货品平台自己吃了 |
675 | * 买家钱退给买家 | 670 | * 买家钱退给买家 |
676 | * 赔偿卖家ufo券 券金额还未定 | 671 | * 赔偿卖家ufo券 券金额还未定 |
677 | - * @param rgaNode | 672 | + * @param refundGoodsAmountNode |
678 | */ | 673 | */ |
679 | - private void cancelOverseasOrderByPlatform(RefundGoodsAmoutNode rgaNode){ | ||
680 | - BuyerOrder buyerOrder = rgaNode.buyerOrder; | ||
681 | - int skup = rgaNode.skup; | ||
682 | - OrderStatus targetOrderStatus = rgaNode.targetOrderStatus; | ||
683 | - BigDecimal leftBuyerMoney = rgaNode.leftBuyerMoney; | ||
684 | - boolean needCompensateCoupon = rgaNode.needCompensateCoupon; | ||
685 | - if (needCompensateCoupon){ | ||
686 | - compensateCoupon2Buyer(buyerOrder.getAmount(), buyerOrder.getUid(), buyerOrder.getOrderCode()); | ||
687 | - } | 674 | + private void platformReason(RefundGoodsAmountNode refundGoodsAmountNode){ |
675 | + BuyerOrder buyerOrder = refundGoodsAmountNode.buyerOrder; | ||
676 | + int skup = refundGoodsAmountNode.skup; | ||
677 | + OrderStatus targetOrderStatus = refundGoodsAmountNode.targetOrderStatus; | ||
678 | + BigDecimal leftBuyerMoney = refundGoodsAmountNode.leftBuyerMoney; | ||
679 | + | ||
680 | + compensateCoupon2Buyer(buyerOrder.getAmount(), buyerOrder.getUid(), buyerOrder.getOrderCode()); | ||
688 | 681 | ||
689 | refundGoodsAmount(buyerOrder, skup, targetOrderStatus, leftBuyerMoney); | 682 | refundGoodsAmount(buyerOrder, skup, targetOrderStatus, leftBuyerMoney); |
690 | } | 683 | } |
@@ -693,13 +686,14 @@ public class BuyerOrderCancelService { | @@ -693,13 +686,14 @@ public class BuyerOrderCancelService { | ||
693 | * 买家原因失败 | 686 | * 买家原因失败 |
694 | * 货品平台自己吃了 | 687 | * 货品平台自己吃了 |
695 | * 货款钱退给买家 | 688 | * 货款钱退给买家 |
696 | - * @param rgaNode | 689 | + * @param refundGoodsAmountNode |
697 | */ | 690 | */ |
698 | - private void cancelOverseasOrderByBuyer(RefundGoodsAmoutNode rgaNode){ | ||
699 | - BuyerOrder buyerOrder = rgaNode.buyerOrder; | ||
700 | - int skup = rgaNode.skup; | ||
701 | - OrderStatus targetOrderStatus = rgaNode.targetOrderStatus; | ||
702 | - BigDecimal leftBuyerMoney = rgaNode.leftBuyerMoney; | 691 | + private void userReason(RefundGoodsAmountNode refundGoodsAmountNode){ |
692 | + BuyerOrder buyerOrder = refundGoodsAmountNode.buyerOrder; | ||
693 | + int skup = refundGoodsAmountNode.skup; | ||
694 | + OrderStatus targetOrderStatus = refundGoodsAmountNode.targetOrderStatus; | ||
695 | + BigDecimal leftBuyerMoney = refundGoodsAmountNode.leftBuyerMoney; | ||
696 | + | ||
703 | refundGoodsAmount(buyerOrder, skup, targetOrderStatus, leftBuyerMoney); | 697 | refundGoodsAmount(buyerOrder, skup, targetOrderStatus, leftBuyerMoney); |
704 | 698 | ||
705 | //notice | 699 | //notice |
-
Please register or login to post a comment