...
|
...
|
@@ -164,8 +164,12 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
.orderAttributes(getOrderAttributes())
|
|
|
.build();
|
|
|
appraiseOrderCreateService.createSellerDepoistOrder(context);
|
|
|
//TODO notice
|
|
|
|
|
|
//
|
|
|
SellerDepositOrderCancelAsyncEvent event = new SellerDepositOrderCancelAsyncEvent(this::handleOrderCancelAsyncEvent);
|
|
|
event.setUid(req.getUid());
|
|
|
event.setOrderCode(orderCode);
|
|
|
EventBusPublisher.publishEvent(event);
|
|
|
logger.info("submit seller deposit order , SellerDepositOrderCancelAsyncEvent send out, event {}", event);
|
|
|
return SellerDepositOrderSubmitResp.builder().orderCode(orderCode).build();
|
|
|
}
|
|
|
|
...
|
...
|
@@ -208,12 +212,12 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
case WAITING_PAY:
|
|
|
targetOrderStatus = AppraiseOrderStatus.CANCEL_BEFORE_PAY;
|
|
|
super.triggerStatusChange(orderCode, targetOrderStatus, appraiseOrderStatus);
|
|
|
inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetOrderStatus);
|
|
|
inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetOrderStatus, true);
|
|
|
break;
|
|
|
case HAS_PAYED:
|
|
|
targetOrderStatus = AppraiseOrderStatus.CANCEL_BEFORE_DELIVER;
|
|
|
super.triggerStatusChange(orderCode, targetOrderStatus , appraiseOrderStatus);
|
|
|
inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetOrderStatus);
|
|
|
inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetOrderStatus, true);
|
|
|
//refund amount
|
|
|
new GoodsServiceRefundHandler()
|
|
|
.loadLogger(logger)
|
...
|
...
|
@@ -231,6 +235,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
}
|
|
|
|
|
|
public int cancelByTimeout(OrderCancelEvent orderCancelEvent){
|
|
|
logger.info("in seller deposit order cancelByTimeout orderCancelEvent {}", orderCancelEvent);
|
|
|
Long orderCode = orderCancelEvent.getOrderCode();
|
|
|
int uid = orderCancelEvent.getUid();
|
|
|
if(!serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
|
...
|
...
|
@@ -255,17 +260,19 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
switch (appraiseOrderStatus){
|
|
|
case WAITING_PAY:
|
|
|
Payment payment = Payment.getPayment(pao.getPayment());
|
|
|
AbstractPayService payService = paymentService.getPayService(payment.getCode());
|
|
|
PayQueryBo payQueryBo = payService.payQuery(String.valueOf(orderCode), pao.getCreateTime());
|
|
|
|
|
|
if (payQueryBo != null && payQueryBo.isPayStatus()){
|
|
|
logger.info("seller deposit order auto cancel failed, confirm paid. uid is {}, orderCode is {}", uid, orderCode);
|
|
|
PayConfirmEvent event = new PayConfirmEvent(uid, orderCode, pao.getPayment());
|
|
|
EventBusPublisher.publishEvent(event);
|
|
|
}
|
|
|
// 如果近1分钟有预支付记录,则发送 自动取消延迟消息
|
|
|
if ( !orderCancelEvent.isFinalRetry()){
|
|
|
paymentService.checkPrePay(uid, orderCode);
|
|
|
if (Objects.nonNull(payment)) {
|
|
|
AbstractPayService payService = paymentService.getPayService(payment.getCode());
|
|
|
PayQueryBo payQueryBo = payService.payQuery(String.valueOf(orderCode), pao.getCreateTime());
|
|
|
|
|
|
if (payQueryBo != null && payQueryBo.isPayStatus()) {
|
|
|
logger.info("seller deposit order auto cancel failed, confirm paid. uid is {}, orderCode is {}", uid, orderCode);
|
|
|
PayConfirmEvent event = new PayConfirmEvent(uid, orderCode, pao.getPayment());
|
|
|
EventBusPublisher.publishEvent(event);
|
|
|
}
|
|
|
// 如果近1分钟有预支付记录,则发送 自动取消延迟消息
|
|
|
if (!orderCancelEvent.isFinalRetry()) {
|
|
|
paymentService.checkPrePay(uid, orderCode);
|
|
|
}
|
|
|
}
|
|
|
rows = super.triggerStatusChange(orderCode, AppraiseOrderStatus.CANCEL_TIMEOUT, appraiseOrderStatus);
|
|
|
break;
|
...
|
...
|
@@ -287,7 +294,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
Long orderCode = req.getOrderCode();
|
|
|
AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.SELLER_SEND_OUT;
|
|
|
//
|
|
|
inBoxFacade.sellerDepositOrderNotice(req.getUid(), orderCode, targetOrderStatus);
|
|
|
inBoxFacade.sellerDepositOrderNotice(req.getUid(), orderCode, targetOrderStatus, true);
|
|
|
//split sku 2 order
|
|
|
List<AppraiseOrderGoods> paogList = appraiseOrderGoodsMapper.selectByOrderCode(orderCode);
|
|
|
SellerDepositOrderListService.OrderDataNode node = sellerDepositOrderListService.buildDataSourceOfParentOrder(orderCode, paogList);
|
...
|
...
|
@@ -339,7 +346,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
triggerStatusConsistencyCheck(orderCode);
|
|
|
|
|
|
Long paidCode = pao.getParentOrderCode();
|
|
|
inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetStatus);
|
|
|
inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetStatus, false);
|
|
|
BigDecimal left = calLeftMoney(pao.getAmount(), orderCode);
|
|
|
if (left.compareTo(BigDecimal.ZERO)>0){
|
|
|
|
...
|
...
|
@@ -405,7 +412,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
triggerStatusConsistencyCheck(orderCode);
|
|
|
//
|
|
|
AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.CHECKING_FAKE;
|
|
|
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
|
|
|
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), orderCode, targetOrderStatus, false);
|
|
|
depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
|
|
|
return rows;
|
|
|
}
|
...
|
...
|
@@ -433,7 +440,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
.refund();
|
|
|
|
|
|
AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE;
|
|
|
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
|
|
|
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus, false);
|
|
|
depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
|
|
|
return rows;
|
|
|
}
|
...
|
...
|
@@ -451,10 +458,18 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
}
|
|
|
//
|
|
|
Long orderCode = appraiseOrder.getOrderCode();
|
|
|
triggerStatusConsistencyCheck(orderCode);
|
|
|
//
|
|
|
Long parentOrderCode;
|
|
|
boolean isParent = Objects.isNull(parentOrderCode=appraiseOrder.getParentOrderCode());
|
|
|
AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.SHAM_SEND_OUT;
|
|
|
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
|
|
|
AppraiseOrderStatus expectedStatus = AppraiseOrderStatus.SELLER_SEND_OUT;
|
|
|
if(isParent){
|
|
|
triggerStatusChangeByParentCode(parentOrderCode, targetOrderStatus, expectedStatus);
|
|
|
}else {
|
|
|
//no parent
|
|
|
triggerStatusConsistencyCheck(orderCode);
|
|
|
}
|
|
|
//notice
|
|
|
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), orderCode, targetOrderStatus, isParent);
|
|
|
//refund amount
|
|
|
new GoodsServiceRefundHandler()
|
|
|
.loadLogger(logger)
|
...
|
...
|
@@ -576,7 +591,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
Long orderCode = appraiseOrder.getOrderCode();
|
|
|
triggerStatusConsistencyCheck(orderCode);
|
|
|
AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.QUALITY_CHECK_FAKE;
|
|
|
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), orderCode, targetOrderStatus);
|
|
|
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), orderCode, targetOrderStatus, false);
|
|
|
new GoodsServiceRefundHandler()
|
|
|
.loadLogger(logger)
|
|
|
.loadUser(appraiseOrder.getUid())
|
...
|
...
|
@@ -606,12 +621,9 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
Long orderCode = orderInfo.getOrderCode();
|
|
|
Integer uid = orderInfo.getUid();
|
|
|
AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.HAS_PAYED;
|
|
|
inBoxFacade.sellerDepositOrderNotice(orderInfo.getUid(), orderInfo.getOrderCode(), targetOrderStatus);
|
|
|
SellerDepositOrderCancelAsyncEvent event = new SellerDepositOrderCancelAsyncEvent(this::handleOrderCancelAsyncEvent);
|
|
|
event.setUid(uid);
|
|
|
event.setOrderCode(orderCode);
|
|
|
EventBusPublisher.publishEvent(event);
|
|
|
logger.info("processAfterPay seller deposit order , SellerDepositOrderCancelAsyncEvent send out, event {}", event);
|
|
|
inBoxFacade.sellerDepositOrderNotice(uid, orderInfo.getOrderCode(), targetOrderStatus, true);
|
|
|
|
|
|
|
|
|
SellerCancelDeliverEvent cancelDeliverEvent =
|
|
|
SellerCancelDeliverEvent.builder()
|
|
|
.uid(orderInfo.getUid())
|
...
|
...
|
@@ -722,7 +734,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
|
|
|
if(rows>0){
|
|
|
AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
|
|
|
inBoxFacade.sellerDepositOrderNotice(uid, parentCode, targetOrderStatus);
|
|
|
inBoxFacade.sellerDepositOrderNotice(uid, parentCode, targetOrderStatus, true);
|
|
|
|
|
|
}
|
|
|
return rows;
|
...
|
...
|
@@ -750,7 +762,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
orderCode, parentOrderCode, prows);
|
|
|
if (prows>0){
|
|
|
AppraiseOrderStatus targetStatus = AppraiseOrderStatus.FINISH;
|
|
|
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), parentOrderCode, targetStatus);
|
|
|
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), parentOrderCode, targetStatus, true);
|
|
|
}
|
|
|
return prows;
|
|
|
}
|
...
|
...
|
@@ -758,6 +770,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
}
|
|
|
|
|
|
public void triggerStatusConsistencyCheck(long orderCode){
|
|
|
logger.info("triggerStatusConsistencyCheck orderCode {}", orderCode);
|
|
|
SellerDepositOrderStatusConsistencyAsyncEvent asyncEvent
|
|
|
= new SellerDepositOrderStatusConsistencyAsyncEvent(this::detectAppraiseFinish);
|
|
|
asyncEvent.setOrderCode(orderCode);
|
...
|
...
|
@@ -800,7 +813,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
.loadOrder(orderCode, orderCode, pao.getPayment(), pao.getAmount())
|
|
|
.refund();
|
|
|
//notice
|
|
|
inBoxFacade.sellerDepositOrderNotice(uid, orderCode, targetOrderStatus);
|
|
|
inBoxFacade.sellerDepositOrderNotice(uid, orderCode, targetOrderStatus, true);
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
|