|
|
package com.yohoufo.order.service.impl;
|
|
|
|
|
|
import com.sun.jmx.snmp.tasks.ThreadService;
|
|
|
import com.yohobuy.ufo.model.order.common.OrderStatus;
|
|
|
import com.yohobuy.ufo.model.order.common.SkupStatus;
|
|
|
import com.yohoufo.common.utils.DateUtil;
|
...
|
...
|
@@ -17,23 +16,22 @@ import com.yohoufo.order.common.TransferCase; |
|
|
import com.yohoufo.order.event.BeforeDepotReceiveEvent;
|
|
|
import com.yohoufo.order.event.BeforeSellerDeliverEvent;
|
|
|
import com.yohoufo.order.event.BillLogEvent;
|
|
|
import com.yohoufo.order.model.PayRefundBo;
|
|
|
import com.yohoufo.order.model.bo.CouponBo;
|
|
|
import com.yohoufo.order.model.request.PaymentRequest;
|
|
|
import com.yohoufo.order.model.request.TransferMoneyRequest;
|
|
|
import com.yohoufo.order.service.IPaymentService;
|
|
|
import com.yohoufo.order.service.concurrent.ThreadPoolFactory;
|
|
|
import com.yohoufo.order.service.proxy.CouponProxyService;
|
|
|
import com.yohoufo.order.service.proxy.InBoxThreadFactory;
|
|
|
import com.yohoufo.order.utils.LoggerUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.concurrent.*;
|
|
|
import java.util.concurrent.Callable;
|
|
|
import java.util.concurrent.Future;
|
|
|
|
|
|
/**
|
|
|
* Created by chao.chen on 2018/11/13.
|
...
|
...
|
@@ -93,7 +91,8 @@ public class BuyerOrderCancelService { |
|
|
//(退费)扣除赔偿款,计算剩余的货款,退给买家
|
|
|
BuyerCancelAfterProcessTask bcapt = new BuyerCancelAfterProcessTask(buyerUid, orderCode, skup,
|
|
|
compensate, transferCase);
|
|
|
ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt);
|
|
|
Future<PayRefundBo> future = ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt);
|
|
|
|
|
|
logger.info("use one thread to execute buyer cancel BeforeSellerDeliver buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}",
|
|
|
buyerUid, orderCode, skup, compensate, transferCase);
|
|
|
}
|
...
|
...
|
@@ -125,13 +124,14 @@ public class BuyerOrderCancelService { |
|
|
TransferCase transferCase = TransferCase.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE;
|
|
|
BuyerCancelAfterProcessTask bcapt = new BuyerCancelAfterProcessTask(buyerUid, orderCode, skup,
|
|
|
compensate, transferCase);
|
|
|
ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt);
|
|
|
Future<PayRefundBo> future = ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt);
|
|
|
|
|
|
logger.info("use one thread to execute buyer cancel BeforeDepotReceive buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}",
|
|
|
buyerUid, orderCode, skup, compensate, transferCase);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
class BuyerCancelAfterProcessTask implements Callable{
|
|
|
class BuyerCancelAfterProcessTask implements Callable<PayRefundBo>{
|
|
|
int buyerUid;
|
|
|
long orderCode;
|
|
|
int skup;
|
...
|
...
|
@@ -148,9 +148,11 @@ public class BuyerOrderCancelService { |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Object call() throws Exception {
|
|
|
public PayRefundBo call() throws Exception {
|
|
|
// 整个过程异步去执行(考虑退费依赖订单状态)
|
|
|
//(退费)退保证金给卖家
|
|
|
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();
|
...
|
...
|
@@ -162,7 +164,7 @@ public class BuyerOrderCancelService { |
|
|
.buyerUid(buyerUid).sellerUid(sellerUid).orderCode(sellerOrder.getOrderCode())
|
|
|
.payType(sellerOrder.getPayment()).refundCase(RefundCase.SELLER_EARNEST_MONEY)
|
|
|
.skup(skup);
|
|
|
payRefundService.refund(req, bleb);
|
|
|
PayRefundBo prb = payRefundService.refund(req, bleb);
|
|
|
|
|
|
//(转账)瓜分指定赔偿款给卖家和平台
|
|
|
|
...
|
...
|
@@ -184,8 +186,9 @@ public class BuyerOrderCancelService { |
|
|
.payType(buyerOrder.getPayment()).refundCase(RefundCase.BUYER_GOODS_MONEY)
|
|
|
.skup(skup);
|
|
|
payRefundService.refund(rprOfBuyer, blebOfBuyer);
|
|
|
|
|
|
return null;
|
|
|
logger.info("out BuyerCancelAfterProcessTask call buyerUid {}, orderCode {}, skup {}, transferCase {}, compensate {}",
|
|
|
buyerUid, orderCode, skup, transferCase, compensate);
|
|
|
return prb;
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|