|
@@ -33,6 +33,7 @@ import com.yohoufo.order.service.proxy.CouponProxyService; |
|
@@ -33,6 +33,7 @@ import com.yohoufo.order.service.proxy.CouponProxyService; |
33
|
import com.yohoufo.order.service.proxy.InBoxFacade;
|
33
|
import com.yohoufo.order.service.proxy.InBoxFacade;
|
34
|
import com.yohoufo.order.service.proxy.OrderStatusFlowService;
|
34
|
import com.yohoufo.order.service.proxy.OrderStatusFlowService;
|
35
|
import com.yohoufo.order.utils.LoggerUtils;
|
35
|
import com.yohoufo.order.utils.LoggerUtils;
|
|
|
36
|
+import com.yohoufo.order.utils.OrderAssist;
|
36
|
import com.yohoufo.order.utils.PaymentHelper;
|
37
|
import com.yohoufo.order.utils.PaymentHelper;
|
37
|
import lombok.Setter;
|
38
|
import lombok.Setter;
|
38
|
import org.slf4j.Logger;
|
39
|
import org.slf4j.Logger;
|
|
@@ -122,17 +123,27 @@ public class BuyerOrderCancelService { |
|
@@ -122,17 +123,27 @@ public class BuyerOrderCancelService { |
122
|
//退还优惠券
|
123
|
//退还优惠券
|
123
|
refundCouponIfNeed(buyerUid, orderCode);
|
124
|
refundCouponIfNeed(buyerUid, orderCode);
|
124
|
int skup = bsdEvent.getSkup();
|
125
|
int skup = bsdEvent.getSkup();
|
|
|
126
|
+ SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
|
|
|
127
|
+ int targetGoodsStatus = SkupStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER.getCode();
|
|
|
128
|
+ int targetSellerOrderStatus = SellerOrderStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER.getCode();
|
|
|
129
|
+ //重新上架标志
|
|
|
130
|
+ boolean reSellAfterCancel=(OrderAssist.skupIsCommonInStock(psog.getAttributes())||OrderAssist.skupIsAdvance(psog.getAttributes()))?true:false;
|
|
|
131
|
+ if(reSellAfterCancel){
|
|
|
132
|
+ targetGoodsStatus = SkupStatus.CAN_SELL.getCode();
|
|
|
133
|
+ targetSellerOrderStatus = SellerOrderStatus.HAS_PAYED.getCode();
|
|
|
134
|
+ }
|
|
|
135
|
+
|
125
|
SellerOrderGoods targetGoods = new SellerOrderGoods();
|
136
|
SellerOrderGoods targetGoods = new SellerOrderGoods();
|
126
|
targetGoods.setId(skup);
|
137
|
targetGoods.setId(skup);
|
127
|
- targetGoods.setStatus(SkupStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER.getCode());
|
138
|
+ targetGoods.setStatus(targetGoodsStatus);
|
128
|
targetGoods.setExceptStatus(SkupStatus.SELL_OUT.getCode());
|
139
|
targetGoods.setExceptStatus(SkupStatus.SELL_OUT.getCode());
|
129
|
sellerOrderGoodsMapper.updateStatusBySkpu(targetGoods);
|
140
|
sellerOrderGoodsMapper.updateStatusBySkpu(targetGoods);
|
130
|
|
141
|
|
131
|
SellerOrder soc = new SellerOrder();
|
142
|
SellerOrder soc = new SellerOrder();
|
132
|
- soc.setStatus(SellerOrderStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER.getCode());
|
143
|
+ soc.setStatus(targetSellerOrderStatus);
|
133
|
soc.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
144
|
soc.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
134
|
sellerOrderMapper.updateBySkups(soc, Arrays.asList(skup));
|
145
|
sellerOrderMapper.updateBySkups(soc, Arrays.asList(skup));
|
135
|
- SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
|
146
|
+
|
136
|
if (noResponsibility){
|
147
|
if (noResponsibility){
|
137
|
inBoxFacade.noticeSellerWhenBuyerCancelNoResponsibility(psog, orderCode);
|
148
|
inBoxFacade.noticeSellerWhenBuyerCancelNoResponsibility(psog, orderCode);
|
138
|
}else {
|
149
|
}else {
|
|
@@ -145,7 +156,7 @@ public class BuyerOrderCancelService { |
|
@@ -145,7 +156,7 @@ public class BuyerOrderCancelService { |
145
|
TransferCase transferCase = TransferCase.PART_GOODS_MONEY_TO_SELLER;
|
156
|
TransferCase transferCase = TransferCase.PART_GOODS_MONEY_TO_SELLER;
|
146
|
//(退费)扣除赔偿款,计算剩余的货款,退给买家
|
157
|
//(退费)扣除赔偿款,计算剩余的货款,退给买家
|
147
|
BuyerCancelAfterProcessTask bcapt = new BuyerCancelAfterProcessTask(buyerOrder, skup,
|
158
|
BuyerCancelAfterProcessTask bcapt = new BuyerCancelAfterProcessTask(buyerOrder, skup,
|
148
|
- bpcr, transferCase);
|
159
|
+ bpcr, transferCase,reSellAfterCancel);
|
149
|
bcapt.targetOrderStatus = targetOrderStatus;
|
160
|
bcapt.targetOrderStatus = targetOrderStatus;
|
150
|
bcapt.setSwdType(SellerWalletDetail.Type.BUYER_CANCEL_NO_DELIVERY);
|
161
|
bcapt.setSwdType(SellerWalletDetail.Type.BUYER_CANCEL_NO_DELIVERY);
|
151
|
Future<PayRefundBo> future = ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt);
|
162
|
Future<PayRefundBo> future = ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt);
|
|
@@ -262,7 +273,7 @@ public class BuyerOrderCancelService { |
|
@@ -262,7 +273,7 @@ public class BuyerOrderCancelService { |
262
|
//(退费)扣除赔偿款,计算剩余的货款,退给买家
|
273
|
//(退费)扣除赔偿款,计算剩余的货款,退给买家
|
263
|
TransferCase transferCase = TransferCase.PART_GOODS_MONEY_TO_SELLER;
|
274
|
TransferCase transferCase = TransferCase.PART_GOODS_MONEY_TO_SELLER;
|
264
|
BuyerCancelAfterProcessTask bcapt = new BuyerCancelAfterProcessTask(buyerOrder, skup,
|
275
|
BuyerCancelAfterProcessTask bcapt = new BuyerCancelAfterProcessTask(buyerOrder, skup,
|
265
|
- bpcr, transferCase);
|
276
|
+ bpcr, transferCase,false);
|
266
|
bcapt.targetOrderStatus = targetOrderStatus;
|
277
|
bcapt.targetOrderStatus = targetOrderStatus;
|
267
|
bcapt.setSwdType(SellerWalletDetail.Type.BUYER_CANCEL_DELIVERY);
|
278
|
bcapt.setSwdType(SellerWalletDetail.Type.BUYER_CANCEL_DELIVERY);
|
268
|
Future<PayRefundBo> future = ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt);
|
279
|
Future<PayRefundBo> future = ThreadPoolFactory.getBuyerCancelThreadPool().submit(bcapt);
|
|
@@ -293,17 +304,19 @@ public class BuyerOrderCancelService { |
|
@@ -293,17 +304,19 @@ public class BuyerOrderCancelService { |
293
|
BuyerOrder buyerOrder;
|
304
|
BuyerOrder buyerOrder;
|
294
|
TransferCase transferCase;
|
305
|
TransferCase transferCase;
|
295
|
OrderStatus targetOrderStatus;
|
306
|
OrderStatus targetOrderStatus;
|
|
|
307
|
+ boolean reSellFlag;//重新上架标志,重新上架则不退保证金了
|
296
|
|
308
|
|
297
|
@Setter
|
309
|
@Setter
|
298
|
SellerWalletDetail.Type swdType;
|
310
|
SellerWalletDetail.Type swdType;
|
299
|
|
311
|
|
300
|
- public BuyerCancelAfterProcessTask(BuyerOrder buyerOrder, int skup, BuyerPenaltyCalResult bpcr, TransferCase transferCase) {
|
312
|
+ public BuyerCancelAfterProcessTask(BuyerOrder buyerOrder, int skup, BuyerPenaltyCalResult bpcr, TransferCase transferCase,boolean reSellFlag) {
|
301
|
this.buyerUid = buyerOrder.getUid();
|
313
|
this.buyerUid = buyerOrder.getUid();
|
302
|
this.orderCode = buyerOrder.getOrderCode();
|
314
|
this.orderCode = buyerOrder.getOrderCode();
|
303
|
this.skup = skup;
|
315
|
this.skup = skup;
|
304
|
this.bpcr = bpcr;
|
316
|
this.bpcr = bpcr;
|
305
|
this.transferCase = transferCase;
|
317
|
this.transferCase = transferCase;
|
306
|
this.buyerOrder = buyerOrder;
|
318
|
this.buyerOrder = buyerOrder;
|
|
|
319
|
+ this.reSellFlag = reSellFlag;
|
307
|
}
|
320
|
}
|
308
|
|
321
|
|
309
|
private PayRefundBo refundSellerEarnestMoney(SellerOrder sellerOrder){
|
322
|
private PayRefundBo refundSellerEarnestMoney(SellerOrder sellerOrder){
|
|
@@ -421,14 +434,17 @@ public class BuyerOrderCancelService { |
|
@@ -421,14 +434,17 @@ public class BuyerOrderCancelService { |
421
|
public PayRefundBo call() throws Exception {
|
434
|
public PayRefundBo call() throws Exception {
|
422
|
// 整个过程异步去执行(考虑退费依赖订单状态)
|
435
|
// 整个过程异步去执行(考虑退费依赖订单状态)
|
423
|
//(退费)退保证金给卖家
|
436
|
//(退费)退保证金给卖家
|
424
|
- logger.info("in BuyerCancelAfterProcessTask call buyerUid {}, orderCode {}, skup {}, transferCase {}, compensate {}",
|
|
|
425
|
- buyerUid, orderCode, skup, transferCase, bpcr);
|
437
|
+ logger.info("in BuyerCancelAfterProcessTask call buyerUid {}, orderCode {}, skup {}, transferCase {}, compensate {},reSellFlag {}",
|
|
|
438
|
+ buyerUid, orderCode, skup, transferCase, bpcr,reSellFlag);
|
426
|
PayRefundBo prb = null;
|
439
|
PayRefundBo prb = null;
|
427
|
try {
|
440
|
try {
|
428
|
SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(skup);
|
441
|
SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(skup);
|
429
|
- logger.info("in BuyerCancelAfterProcessTask call sellerOrderMapper.selectBySkup, buyerUid {}, orderCode {}, skup {}",
|
|
|
430
|
- buyerUid, orderCode, skup );
|
|
|
431
|
- prb = refundSellerEarnestMoney(sellerOrder);
|
442
|
+ logger.info("in BuyerCancelAfterProcessTask call sellerOrderMapper.selectBySkup, buyerUid {}, orderCode {}, skup {},reSellFlag {}",
|
|
|
443
|
+ buyerUid, orderCode, skup,reSellFlag );
|
|
|
444
|
+ if(!reSellFlag){
|
|
|
445
|
+ //只有不重新上架,才退保证金
|
|
|
446
|
+ prb = refundSellerEarnestMoney(sellerOrder);
|
|
|
447
|
+ }
|
432
|
|
448
|
|
433
|
//(转账)瓜分指定赔偿款给卖家和平台
|
449
|
//(转账)瓜分指定赔偿款给卖家和平台
|
434
|
transferPenalty(bpcr);
|
450
|
transferPenalty(bpcr);
|