...
|
...
|
@@ -338,10 +338,8 @@ public class SellerOrderCancelService { |
|
|
|
|
|
if (payQueryBo != null && payQueryBo.isPayStatus()){
|
|
|
logger.info("in seller timeout cancel failed, confirm paid. uid is {}, orderCode is {}", uid, orderCode);
|
|
|
|
|
|
PayConfirmEvent event = new PayConfirmEvent(sellerOrder.getUid(), sellerOrder.getOrderCode(), sellerOrder.getPayment());
|
|
|
EventBusPublisher.publishEvent(event);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -717,87 +715,7 @@ public class SellerOrderCancelService { |
|
|
logger.info("in cancel offShelveCancelCase {}", skup);
|
|
|
SkupStatus expectSkupStatus = SkupStatus.CAN_SELL;
|
|
|
final SellerOrderStatus targetSellerOrderStatus = SellerOrderStatus.YOHO_CANCEL_SELL;
|
|
|
/*
|
|
|
if (skup <= 0){
|
|
|
logger.warn("in offShelveCancelCase ,skup is illegal, skup {}", skup);
|
|
|
return;
|
|
|
}
|
|
|
SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
|
|
|
Integer skupStatus;
|
|
|
if (psog == null || (skupStatus = psog.getStatus() )== null){
|
|
|
logger.warn("in offShelveCancelCase, SellerOrderGoods or it's status illegal, skup {}", skup);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
boolean earnestMoneyPaidFlag = expectSkupStatus.getCode() == skupStatus;
|
|
|
if (!earnestMoneyPaidFlag){
|
|
|
logger.warn("in offShelveCancelCase, SellerOrderGoods status illegal, skup {}, status {}", skup, skupStatus);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
SellerOrderGoods targetGoods = new SellerOrderGoods();
|
|
|
targetGoods.setId(skup);
|
|
|
targetGoods.setStatus(targetSellerOrderStatus.getSkupStatus().getCode());
|
|
|
targetGoods.setExceptStatus(skupStatus);
|
|
|
//利用数据库做并发控制
|
|
|
int result = sellerOrderGoodsMapper.updateStatusBySkpu(targetGoods);
|
|
|
|
|
|
if (result == 0) {
|
|
|
logger.warn("in offShelveCancelCase, update status fail, skup {}, skupStatus {}", skup, skupStatus);
|
|
|
return;
|
|
|
}
|
|
|
SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(skup);
|
|
|
Integer sellerUid = sellerOrder.getUid();
|
|
|
final Long orderCode = sellerOrder.getOrderCode();
|
|
|
//update
|
|
|
SellerOrder tso = new SellerOrder();
|
|
|
tso.setOrderCode(orderCode);
|
|
|
tso.setExceptStatus(sellerOrder.getStatus());
|
|
|
tso.setStatus(targetSellerOrderStatus.getCode());
|
|
|
tso.setUid(sellerUid);
|
|
|
tso.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
|
|
sellerOrderMapper.updateByOrderCode(tso);
|
|
|
//
|
|
|
cacheCleaner.cleanList(sellerUid, TabType.SELL.getValue());
|
|
|
cacheCleaner.cleanSellerDetail(psog);
|
|
|
double earnestMoney = sellerOrder.getEarnestMoney().doubleValue();
|
|
|
|
|
|
Integer sop = sellerOrder.getPayment() == null ? 0 : sellerOrder.getPayment();
|
|
|
|
|
|
boolean sellerIsSuper = sellerService.isSuperEntrySeller(sellerUid);
|
|
|
|
|
|
//不是超级卖家 ,上架商品用钱包支付保证金
|
|
|
MerchantOrderAttachInfo moai = null;
|
|
|
if(!sellerIsSuper && PaymentHelper.isWallet(sop)){
|
|
|
moai = MerchantOrderAttachInfo.builder().uid(sellerUid)
|
|
|
.orderCode(orderCode).skup(skup).earnestMoney(sellerOrder.getEarnestMoney())
|
|
|
.type(SellerWalletDetail.Type.SYSTEM_OFF.getValue()).buildSellerBo();
|
|
|
}
|
|
|
|
|
|
BillLogEvent.BillLogEventBuilder bleb = BillLogEvent.builder()
|
|
|
.sellerUid(sellerUid).orderCode(orderCode)
|
|
|
.payType(sellerOrder.getPayment())
|
|
|
.refundCase(RefundCase.SELLER_EARNEST_MONEY)
|
|
|
.skup(skup);
|
|
|
PaymentRequest refundReq = PaymentRequest.builder().uid(sellerUid)
|
|
|
.orderCode(orderCode)
|
|
|
.refundCase(RefundCase.SELLER_EARNEST_MONEY)
|
|
|
.payment(sop)
|
|
|
.refundAmount(earnestMoney)
|
|
|
.isSuper(sellerIsSuper)
|
|
|
.refundattch(moai)
|
|
|
.buildSellerBo();
|
|
|
|
|
|
boolean refundEarnMoneyFlag = new RefundEarnestMoneyHandler()
|
|
|
.loadRefundAction(payRefundService::refund)
|
|
|
.loadBillLogEventBuilder(bleb)
|
|
|
.loadPaymentRequest(refundReq)
|
|
|
.loadSeller(sellerUid, sellerIsSuper, orderCode, targetSellerOrderStatus)
|
|
|
.loadLogger(logger)
|
|
|
.refund();
|
|
|
*/
|
|
|
CancelStatusNode csn = new CancelStatusNode();
|
|
|
csn.skup = skup;
|
|
|
csn.expectSkupStatus = expectSkupStatus;
|
...
|
...
|
|