...
|
...
|
@@ -177,42 +177,49 @@ public class BuyerOrderCancelService { |
|
|
//(退费)退保证金给卖家
|
|
|
logger.info("in BuyerCancelAfterProcessTask call buyerUid {}, orderCode {}, skup {}, transferCase {}, compensate {}",
|
|
|
buyerUid, orderCode, skup, transferCase, compensate);
|
|
|
SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCode(orderCode);
|
|
|
int sellerUid = sellerOrder.getUid();
|
|
|
long sellerOrderCode = sellerOrder.getOrderCode();
|
|
|
BigDecimal earnestMoney = sellerOrder.getEarnestMoney();
|
|
|
PaymentRequest req = PaymentRequest.builder().uid(sellerUid)
|
|
|
.orderCode(sellerOrderCode).refundAmount(earnestMoney.doubleValue())
|
|
|
.build();
|
|
|
BillLogEvent.BillLogEventBuilder bleb = BillLogEvent.builder()
|
|
|
.buyerUid(buyerUid).sellerUid(sellerUid).orderCode(sellerOrder.getOrderCode())
|
|
|
.payType(sellerOrder.getPayment()).refundCase(RefundCase.SELLER_EARNEST_MONEY)
|
|
|
.skup(skup);
|
|
|
PayRefundBo prb = payRefundService.refund(req, bleb);
|
|
|
|
|
|
//(转账)瓜分指定赔偿款给卖家和平台
|
|
|
|
|
|
TransferMoneyRequest tmReq = TransferMoneyRequest.builder().buyerOrderCode(orderCode)
|
|
|
.type(transferCase.getCode()).transferCase(transferCase).build();
|
|
|
paymentService.transferMon(tmReq);
|
|
|
|
|
|
//(退费)扣除赔偿款,计算剩余的货款,退给买家
|
|
|
BigDecimal compensateMoney = compensate.getBuyerCompensateMoney();
|
|
|
|
|
|
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
|
|
|
BigDecimal leftBuyerMoney = buyerOrder.getAmount().subtract(compensateMoney);
|
|
|
PaymentRequest rprOfBuyer = PaymentRequest.builder().uid(buyerUid)
|
|
|
.orderCode(orderCode).refundAmount(leftBuyerMoney.doubleValue())
|
|
|
.build();
|
|
|
BillLogEvent.BillLogEventBuilder blebOfBuyer = BillLogEvent.builder()
|
|
|
.buyerUid(buyerUid).sellerUid(sellerUid).orderCode(orderCode)
|
|
|
.payType(buyerOrder.getPayment()).refundCase(RefundCase.BUYER_GOODS_MONEY)
|
|
|
.skup(skup);
|
|
|
payRefundService.refund(rprOfBuyer, blebOfBuyer);
|
|
|
logger.info("out BuyerCancelAfterProcessTask call buyerUid {}, orderCode {}, skup {}, transferCase {}, compensate {}",
|
|
|
buyerUid, orderCode, skup, transferCase, compensate);
|
|
|
PayRefundBo prb = null;
|
|
|
try {
|
|
|
SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCode(orderCode);
|
|
|
int sellerUid = sellerOrder.getUid();
|
|
|
long sellerOrderCode = sellerOrder.getOrderCode();
|
|
|
BigDecimal earnestMoney = sellerOrder.getEarnestMoney();
|
|
|
PaymentRequest req = PaymentRequest.builder().uid(sellerUid)
|
|
|
.orderCode(sellerOrderCode).refundAmount(earnestMoney.doubleValue())
|
|
|
.build();
|
|
|
BillLogEvent.BillLogEventBuilder bleb = BillLogEvent.builder()
|
|
|
.buyerUid(buyerUid).sellerUid(sellerUid).orderCode(sellerOrder.getOrderCode())
|
|
|
.payType(sellerOrder.getPayment()).refundCase(RefundCase.SELLER_EARNEST_MONEY)
|
|
|
.skup(skup);
|
|
|
prb = payRefundService.refund(req, bleb);
|
|
|
|
|
|
//(转账)瓜分指定赔偿款给卖家和平台
|
|
|
|
|
|
TransferMoneyRequest tmReq = TransferMoneyRequest.builder().buyerOrderCode(orderCode)
|
|
|
.type(transferCase.getCode()).transferCase(transferCase).build();
|
|
|
paymentService.transferMon(tmReq);
|
|
|
|
|
|
//(退费)扣除赔偿款,计算剩余的货款,退给买家
|
|
|
BigDecimal compensateMoney = compensate.getBuyerCompensateMoney();
|
|
|
|
|
|
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
|
|
|
BigDecimal leftBuyerMoney = buyerOrder.getAmount().subtract(compensateMoney);
|
|
|
PaymentRequest rprOfBuyer = PaymentRequest.builder().uid(buyerUid)
|
|
|
.orderCode(orderCode).refundAmount(leftBuyerMoney.doubleValue())
|
|
|
.build();
|
|
|
BillLogEvent.BillLogEventBuilder blebOfBuyer = BillLogEvent.builder()
|
|
|
.buyerUid(buyerUid).sellerUid(sellerUid).orderCode(orderCode)
|
|
|
.payType(buyerOrder.getPayment()).refundCase(RefundCase.BUYER_GOODS_MONEY)
|
|
|
.skup(skup);
|
|
|
payRefundService.refund(rprOfBuyer, blebOfBuyer);
|
|
|
logger.info("out BuyerCancelAfterProcessTask call buyerUid {}, orderCode {}, skup {}, transferCase {}, compensate {}",
|
|
|
buyerUid, orderCode, skup, transferCase, compensate);
|
|
|
}catch (Exception ex){
|
|
|
logger.info("occur error BuyerCancelAfterProcessTask call buyerUid {}, orderCode {}, skup {}, transferCase {}, compensate {}",
|
|
|
buyerUid, orderCode, skup, transferCase, compensate, ex);
|
|
|
}
|
|
|
return prb;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|