|
@@ -28,9 +28,12 @@ import com.yohoufo.order.model.dto.BuyerPenaltyCalResult; |
|
@@ -28,9 +28,12 @@ import com.yohoufo.order.model.dto.BuyerPenaltyCalResult; |
28
|
import com.yohoufo.order.model.request.PaymentRequest;
|
28
|
import com.yohoufo.order.model.request.PaymentRequest;
|
29
|
import com.yohoufo.order.model.request.TranseferCellNode;
|
29
|
import com.yohoufo.order.model.request.TranseferCellNode;
|
30
|
import com.yohoufo.order.model.request.TransferMoneyRequest;
|
30
|
import com.yohoufo.order.model.request.TransferMoneyRequest;
|
|
|
31
|
+import com.yohoufo.order.service.DepositService;
|
|
|
32
|
+import com.yohoufo.order.service.IBuyerOrderMetaService;
|
31
|
import com.yohoufo.order.service.cache.CacheCleaner;
|
33
|
import com.yohoufo.order.service.cache.CacheCleaner;
|
32
|
import com.yohoufo.order.service.cache.CacheKeyBuilder;
|
34
|
import com.yohoufo.order.service.cache.CacheKeyBuilder;
|
33
|
import com.yohoufo.order.service.concurrent.ThreadPoolFactory;
|
35
|
import com.yohoufo.order.service.concurrent.ThreadPoolFactory;
|
|
|
36
|
+import com.yohoufo.order.service.deposit.DepositOrderService;
|
34
|
import com.yohoufo.order.service.handler.BuyerCancelCompensateComputeHandler;
|
37
|
import com.yohoufo.order.service.handler.BuyerCancelCompensateComputeHandler;
|
35
|
import com.yohoufo.order.service.handler.RefundEarnestMoneyHandler;
|
38
|
import com.yohoufo.order.service.handler.RefundEarnestMoneyHandler;
|
36
|
import com.yohoufo.order.service.handler.RefundGoodsMoneyHandler;
|
39
|
import com.yohoufo.order.service.handler.RefundGoodsMoneyHandler;
|
|
@@ -140,6 +143,12 @@ public class BuyerOrderCancelService { |
|
@@ -140,6 +143,12 @@ public class BuyerOrderCancelService { |
140
|
@Resource(name = "tradeMqProducer")
|
143
|
@Resource(name = "tradeMqProducer")
|
141
|
private YhProducer tradeMqProducer;
|
144
|
private YhProducer tradeMqProducer;
|
142
|
|
145
|
|
|
|
146
|
+ @Autowired
|
|
|
147
|
+ private DepositService depositService;
|
|
|
148
|
+
|
|
|
149
|
+ @Autowired
|
|
|
150
|
+ private IBuyerOrderMetaService buyerOrderMetaService;
|
|
|
151
|
+
|
143
|
public void cancel(BeforeSellerDeliverEvent bsdEvent){
|
152
|
public void cancel(BeforeSellerDeliverEvent bsdEvent){
|
144
|
int buyerUid = bsdEvent.getBuyerUid();
|
153
|
int buyerUid = bsdEvent.getBuyerUid();
|
145
|
int sellerUid = bsdEvent.getSellerUid();
|
154
|
int sellerUid = bsdEvent.getSellerUid();
|
|
@@ -353,11 +362,30 @@ public class BuyerOrderCancelService { |
|
@@ -353,11 +362,30 @@ public class BuyerOrderCancelService { |
353
|
EventBusPublisher.publishEvent(new UfoInfluxdbEvent(new UfoInfluxdbVo.Builder().setMeasurement(InfluxdbMeasurementEnum.MEASUREMENT_ORDER_CANCEL)
|
362
|
EventBusPublisher.publishEvent(new UfoInfluxdbEvent(new UfoInfluxdbVo.Builder().setMeasurement(InfluxdbMeasurementEnum.MEASUREMENT_ORDER_CANCEL)
|
354
|
.addInitField(InfluxdbFieldEnum.FIELD_COUNT).build())); // 统计取消订单的次数
|
363
|
.addInitField(InfluxdbFieldEnum.FIELD_COUNT).build())); // 统计取消订单的次数
|
355
|
|
364
|
|
|
|
365
|
+ //
|
|
|
366
|
+ String depositCode = buyerOrderMetaService.getDepositCode(buyerUid, orderCode);
|
|
|
367
|
+ if (StringUtils.isNotBlank(depositCode)){
|
|
|
368
|
+ logger.info("cancel buyer order Before Depot Receive trigger DepositGoodsCompensateAsyncEvent orderCode {} depositCode {}", orderCode, depositCode);
|
|
|
369
|
+ triggerDepositGoodsCompensateAsyncEvent(sellerUid, depositCode);
|
|
|
370
|
+ }
|
356
|
logger.info("use one thread to execute buyer cancel BeforeDepotReceive buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}",
|
371
|
logger.info("use one thread to execute buyer cancel BeforeDepotReceive buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}",
|
357
|
buyerUid, orderCode, skup, bpcr, transferCase);
|
372
|
buyerUid, orderCode, skup, bpcr, transferCase);
|
358
|
}
|
373
|
}
|
359
|
}
|
374
|
}
|
360
|
|
375
|
|
|
|
376
|
+ private int compensateDepositGoods(DepositGoodsCompensateAsyncEvent event){
|
|
|
377
|
+ logger.info("cancel buyer order compensateDepositGoods, event {}", event);
|
|
|
378
|
+ return depositService.updateDepositAfterCancelBuy(event.getUid(), event.getDepositCode());
|
|
|
379
|
+ }
|
|
|
380
|
+
|
|
|
381
|
+ private void triggerDepositGoodsCompensateAsyncEvent(int sellerUid, String depositCode){
|
|
|
382
|
+ logger.info("trigger DepositGoodsCompensateAsyncEvent sellerUid {} depositCode {}", sellerUid, depositCode);
|
|
|
383
|
+ DepositGoodsCompensateAsyncEvent asyncEvent
|
|
|
384
|
+ = new DepositGoodsCompensateAsyncEvent(this::compensateDepositGoods);
|
|
|
385
|
+ asyncEvent.setUid(sellerUid);
|
|
|
386
|
+ asyncEvent.setDepositCode(depositCode);
|
|
|
387
|
+ EventBusPublisher.publishEvent(asyncEvent);
|
|
|
388
|
+ }
|
361
|
|
389
|
|
362
|
public void clearanceFail(long orderCode, String failReason, ClearanceFailType failType){
|
390
|
public void clearanceFail(long orderCode, String failReason, ClearanceFailType failType){
|
363
|
new ClearanceFailModel(orderCode, failReason, failType).invoke().cancel();
|
391
|
new ClearanceFailModel(orderCode, failReason, failType).invoke().cancel();
|