1
|
package com.yohoufo.order.service.impl;
|
1
|
package com.yohoufo.order.service.impl;
|
2
|
|
2
|
|
3
|
-import com.sun.jmx.snmp.tasks.ThreadService;
|
|
|
4
|
import com.yohobuy.ufo.model.order.common.OrderStatus;
|
3
|
import com.yohobuy.ufo.model.order.common.OrderStatus;
|
5
|
import com.yohobuy.ufo.model.order.common.SkupStatus;
|
4
|
import com.yohobuy.ufo.model.order.common.SkupStatus;
|
6
|
import com.yohoufo.common.utils.DateUtil;
|
5
|
import com.yohoufo.common.utils.DateUtil;
|
|
@@ -17,23 +16,22 @@ import com.yohoufo.order.common.TransferCase; |
|
@@ -17,23 +16,22 @@ import com.yohoufo.order.common.TransferCase; |
17
|
import com.yohoufo.order.event.BeforeDepotReceiveEvent;
|
16
|
import com.yohoufo.order.event.BeforeDepotReceiveEvent;
|
18
|
import com.yohoufo.order.event.BeforeSellerDeliverEvent;
|
17
|
import com.yohoufo.order.event.BeforeSellerDeliverEvent;
|
19
|
import com.yohoufo.order.event.BillLogEvent;
|
18
|
import com.yohoufo.order.event.BillLogEvent;
|
|
|
19
|
+import com.yohoufo.order.model.PayRefundBo;
|
20
|
import com.yohoufo.order.model.bo.CouponBo;
|
20
|
import com.yohoufo.order.model.bo.CouponBo;
|
21
|
import com.yohoufo.order.model.request.PaymentRequest;
|
21
|
import com.yohoufo.order.model.request.PaymentRequest;
|
22
|
import com.yohoufo.order.model.request.TransferMoneyRequest;
|
22
|
import com.yohoufo.order.model.request.TransferMoneyRequest;
|
23
|
import com.yohoufo.order.service.IPaymentService;
|
23
|
import com.yohoufo.order.service.IPaymentService;
|
24
|
import com.yohoufo.order.service.concurrent.ThreadPoolFactory;
|
24
|
import com.yohoufo.order.service.concurrent.ThreadPoolFactory;
|
25
|
import com.yohoufo.order.service.proxy.CouponProxyService;
|
25
|
import com.yohoufo.order.service.proxy.CouponProxyService;
|
26
|
-import com.yohoufo.order.service.proxy.InBoxThreadFactory;
|
|
|
27
|
import com.yohoufo.order.utils.LoggerUtils;
|
26
|
import com.yohoufo.order.utils.LoggerUtils;
|
28
|
import org.slf4j.Logger;
|
27
|
import org.slf4j.Logger;
|
29
|
import org.springframework.beans.factory.annotation.Autowired;
|
28
|
import org.springframework.beans.factory.annotation.Autowired;
|
30
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
31
|
import org.springframework.stereotype.Service;
|
29
|
import org.springframework.stereotype.Service;
|
32
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
33
|
|
30
|
|
34
|
import javax.annotation.Resource;
|
31
|
import javax.annotation.Resource;
|
35
|
import java.math.BigDecimal;
|
32
|
import java.math.BigDecimal;
|
36
|
-import java.util.concurrent.*;
|
33
|
+import java.util.concurrent.Callable;
|
|
|
34
|
+import java.util.concurrent.Future;
|
37
|
|
35
|
|
38
|
/**
|
36
|
/**
|
39
|
* Created by chao.chen on 2018/11/13.
|
37
|
* Created by chao.chen on 2018/11/13.
|
|
@@ -93,7 +91,8 @@ public class BuyerOrderCancelService { |
|
@@ -93,7 +91,8 @@ public class BuyerOrderCancelService { |
93
|
//(退费)扣除赔偿款,计算剩余的货款,退给买家
|
91
|
//(退费)扣除赔偿款,计算剩余的货款,退给买家
|
94
|
BuyerCancelAfterProcessTask bcapt = new BuyerCancelAfterProcessTask(buyerUid, orderCode, skup,
|
92
|
BuyerCancelAfterProcessTask bcapt = new BuyerCancelAfterProcessTask(buyerUid, orderCode, skup,
|
95
|
compensate, transferCase);
|
93
|
compensate, transferCase);
|
96
|
- ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt);
|
94
|
+ Future<PayRefundBo> future = ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt);
|
|
|
95
|
+
|
97
|
logger.info("use one thread to execute buyer cancel BeforeSellerDeliver buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}",
|
96
|
logger.info("use one thread to execute buyer cancel BeforeSellerDeliver buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}",
|
98
|
buyerUid, orderCode, skup, compensate, transferCase);
|
97
|
buyerUid, orderCode, skup, compensate, transferCase);
|
99
|
}
|
98
|
}
|
|
@@ -125,13 +124,14 @@ public class BuyerOrderCancelService { |
|
@@ -125,13 +124,14 @@ public class BuyerOrderCancelService { |
125
|
TransferCase transferCase = TransferCase.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE;
|
124
|
TransferCase transferCase = TransferCase.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE;
|
126
|
BuyerCancelAfterProcessTask bcapt = new BuyerCancelAfterProcessTask(buyerUid, orderCode, skup,
|
125
|
BuyerCancelAfterProcessTask bcapt = new BuyerCancelAfterProcessTask(buyerUid, orderCode, skup,
|
127
|
compensate, transferCase);
|
126
|
compensate, transferCase);
|
128
|
- ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt);
|
127
|
+ Future<PayRefundBo> future = ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt);
|
|
|
128
|
+
|
129
|
logger.info("use one thread to execute buyer cancel BeforeDepotReceive buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}",
|
129
|
logger.info("use one thread to execute buyer cancel BeforeDepotReceive buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}",
|
130
|
buyerUid, orderCode, skup, compensate, transferCase);
|
130
|
buyerUid, orderCode, skup, compensate, transferCase);
|
131
|
}
|
131
|
}
|
132
|
}
|
132
|
}
|
133
|
|
133
|
|
134
|
- class BuyerCancelAfterProcessTask implements Callable{
|
134
|
+ class BuyerCancelAfterProcessTask implements Callable<PayRefundBo>{
|
135
|
int buyerUid;
|
135
|
int buyerUid;
|
136
|
long orderCode;
|
136
|
long orderCode;
|
137
|
int skup;
|
137
|
int skup;
|
|
@@ -148,9 +148,11 @@ public class BuyerOrderCancelService { |
|
@@ -148,9 +148,11 @@ public class BuyerOrderCancelService { |
148
|
}
|
148
|
}
|
149
|
|
149
|
|
150
|
@Override
|
150
|
@Override
|
151
|
- public Object call() throws Exception {
|
151
|
+ public PayRefundBo call() throws Exception {
|
152
|
// 整个过程异步去执行(考虑退费依赖订单状态)
|
152
|
// 整个过程异步去执行(考虑退费依赖订单状态)
|
153
|
//(退费)退保证金给卖家
|
153
|
//(退费)退保证金给卖家
|
|
|
154
|
+ logger.info("in BuyerCancelAfterProcessTask call buyerUid {}, orderCode {}, skup {}, transferCase {}, compensate {}",
|
|
|
155
|
+ buyerUid, orderCode, skup, transferCase, compensate);
|
154
|
SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCode(orderCode);
|
156
|
SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCode(orderCode);
|
155
|
int sellerUid = sellerOrder.getUid();
|
157
|
int sellerUid = sellerOrder.getUid();
|
156
|
long sellerOrderCode = sellerOrder.getOrderCode();
|
158
|
long sellerOrderCode = sellerOrder.getOrderCode();
|
|
@@ -162,7 +164,7 @@ public class BuyerOrderCancelService { |
|
@@ -162,7 +164,7 @@ public class BuyerOrderCancelService { |
162
|
.buyerUid(buyerUid).sellerUid(sellerUid).orderCode(sellerOrder.getOrderCode())
|
164
|
.buyerUid(buyerUid).sellerUid(sellerUid).orderCode(sellerOrder.getOrderCode())
|
163
|
.payType(sellerOrder.getPayment()).refundCase(RefundCase.SELLER_EARNEST_MONEY)
|
165
|
.payType(sellerOrder.getPayment()).refundCase(RefundCase.SELLER_EARNEST_MONEY)
|
164
|
.skup(skup);
|
166
|
.skup(skup);
|
165
|
- payRefundService.refund(req, bleb);
|
167
|
+ PayRefundBo prb = payRefundService.refund(req, bleb);
|
166
|
|
168
|
|
167
|
//(转账)瓜分指定赔偿款给卖家和平台
|
169
|
//(转账)瓜分指定赔偿款给卖家和平台
|
168
|
|
170
|
|
|
@@ -184,8 +186,9 @@ public class BuyerOrderCancelService { |
|
@@ -184,8 +186,9 @@ public class BuyerOrderCancelService { |
184
|
.payType(buyerOrder.getPayment()).refundCase(RefundCase.BUYER_GOODS_MONEY)
|
186
|
.payType(buyerOrder.getPayment()).refundCase(RefundCase.BUYER_GOODS_MONEY)
|
185
|
.skup(skup);
|
187
|
.skup(skup);
|
186
|
payRefundService.refund(rprOfBuyer, blebOfBuyer);
|
188
|
payRefundService.refund(rprOfBuyer, blebOfBuyer);
|
187
|
-
|
|
|
188
|
- return null;
|
189
|
+ logger.info("out BuyerCancelAfterProcessTask call buyerUid {}, orderCode {}, skup {}, transferCase {}, compensate {}",
|
|
|
190
|
+ buyerUid, orderCode, skup, transferCase, compensate);
|
|
|
191
|
+ return prb;
|
189
|
}
|
192
|
}
|
190
|
}
|
193
|
}
|
191
|
|
194
|
|