Authored by chenchao

fix platform off shelve bug

... ... @@ -19,7 +19,6 @@ public class AlarmEventBuilder {
SmsAlarmEvent smsAlarmEvent = null;
String content = null;
switch(targetSOStatus){
case PLAY_SELF:
content = "卖家" + sellerUid + "退保证金订单"+ sellerOrderCode +"失败";
smsAlarmEvent = new SmsAlarmEvent("notPaidSellerOrder.selfCancel", "cancelBeforeBuy", content);
... ... @@ -29,22 +28,24 @@ public class AlarmEventBuilder {
AlarmConfig alarmConfig = AlarmConfig.APPRAISE_SUCCESS;
smsAlarmEvent = new SmsAlarmEvent(alarmConfig.getRefundName(), alarmConfig.name(), content);
break;
case YOHO_CANCEL_SELL:
content = "下架skup时,退用户" + sellerUid + "保证金订单"+ sellerOrderCode +"失败";
smsAlarmEvent = new SmsAlarmEvent("PaidSellerOrder.PlatformCancel", "cancelBeforeBuy", content);
break;
}
return smsAlarmEvent;
}
public static SmsAlarmEvent buildRefundSellerEarnestMoneyAlarmEvent(OrderStatus orderStatus,Integer sellerUid,
Long buyerOrderCode){
SmsAlarmEvent smsAlarmEvent = null;
String content = null;
switch(orderStatus){
case BUYER_CANCEL_BEFORE_SELLER_DELIVER:
case BUYER_CANCEL_BEFORE_DEPOT_RECEIVE:
content = "用户" + sellerUid + "退保证金订单"+ buyerOrderCode +"失败";
content = "买家取消订单"+ buyerOrderCode +"给卖家" + sellerUid + "退保证金失败";
smsAlarmEvent = new SmsAlarmEvent("buyerPaidOrder.selfCancel", "cancel", content);
break;
}
... ...
... ... @@ -37,11 +37,11 @@ public class BatchPublishTailHandler implements IEventHandler<BatchPublishTailEv
}
private void batchPublishTailProcess(SellerOrderSubmitHandler.ForkJoinResult fjr,
SellerWallet sellerWallet, boolean isSurper,
SellerWallet sellerWallet, boolean isSuper,
int sellerUid){
// (异步实现)记录保证金流水
if(!isSurper) {
if(!isSuper) {
List<OrderInfo> orderList = fjr.getSellerOrderList().parallelStream().map(sellerOrder ->
OrderInfo.builder().orderCode(sellerOrder.getOrderCode())
.amount(sellerOrder.getEarnestMoney()).build()
... ...
... ... @@ -859,7 +859,6 @@ public class AppraiseService {
.loadRefundAction(payRefundService::refund)
.loadBillLogEventBuilder(bleb)
.loadPaymentRequest(refundReqOfSeller)
.loadBuyer(null, null, null)
.loadSeller(sellerUid, sellerIsSuper, orderCode, targetSoStatus)
.loadLogger(LOGGER)
.refund();
... ...
... ... @@ -5,7 +5,6 @@ import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo;
import com.yohobuy.ufo.model.order.common.*;
import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohoufo.common.alarm.SmsAlarmEvent;
import com.yohoufo.common.alarm.UfoInfluxdbEvent;
import com.yohoufo.common.alarm.UfoInfluxdbVo;
import com.yohoufo.common.constant.InfluxdbFieldEnum;
... ... @@ -14,11 +13,13 @@ import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.*;
import com.yohoufo.dal.order.model.*;
import com.yohoufo.order.common.*;
import com.yohoufo.order.common.ActionStatusHold;
import com.yohoufo.order.common.Payment;
import com.yohoufo.order.common.RefundCase;
import com.yohoufo.order.common.TransferCase;
import com.yohoufo.order.constants.AlarmConfig;
import com.yohoufo.order.event.*;
import com.yohoufo.order.model.PayQueryBo;
import com.yohoufo.order.model.PayRefundBo;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.model.request.PaymentRequest;
import com.yohoufo.order.model.request.TranseferCellNode;
... ... @@ -477,7 +478,6 @@ public class SellerOrderCancelService {
.loadRefundAction(payRefundService::refund)
.loadBillLogEventBuilder(bleb)
.loadPaymentRequest(refundReq)
.loadBuyer(null, null, null)
.loadSeller(sellerUid, isSuper, orderCode, targetSOStatus)
.loadLogger(logger)
.refund();
... ... @@ -715,8 +715,8 @@ public class SellerOrderCancelService {
}
SkupStatus expectSkupStatus = SkupStatus.CAN_SELL;
boolean isPayEarnestMoney = expectSkupStatus.getCode() == skupStatus;
if (!isPayEarnestMoney){
boolean earnestMoneyPaidFlag = expectSkupStatus.getCode() == skupStatus;
if (!earnestMoneyPaidFlag){
logger.warn("in offShelveCancelCase, SellerOrderGoods status illegal, skup {}, status {}", skup, skupStatus);
return;
}
... ... @@ -750,42 +750,41 @@ public class SellerOrderCancelService {
double earnestMoney = sellerOrder.getEarnestMoney().doubleValue();
Integer sop = sellerOrder.getPayment() == null ? 0 : sellerOrder.getPayment();
PaymentRequest refundReq = PaymentRequest.builder().uid(sellerUid)
.orderCode(orderCode)
.refundCase(RefundCase.SELLER_EARNEST_MONEY)
.payment(sop)
.refundAmount(earnestMoney).build();
boolean sellerIsSurper = sellerService.isSuperEntrySeller(sellerUid);
refundReq.setSuper(sellerIsSurper);
//
if(!sellerIsSurper && PaymentHelper.isWallet(sop)){
MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(sellerUid)
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()).build();
refundReq.setRefundattch(moai);
}
BillLogEvent.BillLogEventBuilder bleb = BillLogEvent.builder()
.sellerUid(sellerUid).orderCode(orderCode)
.payType(sellerOrder.getPayment()).refundCase(RefundCase.SELLER_EARNEST_MONEY)
.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)
.build();
try {
PayRefundBo payRefundBo = payRefundService.refund(refundReq, bleb);
logger.info("in yoho Off Shelve Cancel , refund earnestMoney finish, seller {}, order code {}, skup {}, earnestMoney {}",
sellerUid, orderCode, skup, earnestMoney);
boolean refundEarnMoneyFlag = new RefundEarnestMoneyHandler()
.loadRefundAction(payRefundService::refund)
.loadBillLogEventBuilder(bleb)
.loadPaymentRequest(refundReq)
.loadSeller(sellerUid, sellerIsSuper, orderCode, targetSellerOrderStatus)
.loadLogger(logger)
.refund();
if (refundEarnMoneyFlag){
inBoxFacade.notifyUnshelfCauseBySpecialReason(sellerUid, psog);
}catch (Exception ex){
logger.warn("in yoho Off Shelve Cancel, refund earnestMoney fail, seller {}, order code {}, skup {}, earnestMoney {}",
sellerUid, orderCode, skup, earnestMoney, ex);
if(!sellerIsSurper) {
BillLogEvent sellerBillLogEvent = bleb.tradeStatus(BillTradeStatus.FAIL.getCode())
.build();
EventBusPublisher.publishEvent(sellerBillLogEvent);
}
String content = "下架skup时,退用户" + sellerUid + "保证金订单"+ orderCode +"失败";
SmsAlarmEvent smsAlarmEvent = new SmsAlarmEvent("PaidSellerOrder.PlatformCancel", "cancelBeforeBuy", content);
EventBusPublisher.publishEvent(smsAlarmEvent);
}
}
... ...
... ... @@ -776,15 +776,15 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic
private SellerWallet sellerWallet;
private boolean isSurper;
private boolean isSuper;
public BatchProcessTask(SellerOrderContext ctx, CountDownLatch countDownLatch,
int num, SellerWallet sellerWallet, boolean isSurper) {
int num, SellerWallet sellerWallet, boolean isSuper) {
this.ctx = ctx;
this.countDownLatch = countDownLatch;
this.num = num;
this.sellerWallet = sellerWallet;
this.isSurper = isSurper;
this.isSuper = isSuper;
}
@Override
... ... @@ -802,7 +802,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic
//(异步实现)同步数据到prd,记录支付,
BatchPublishTailEvent bpte = BatchPublishTailEvent.builder()
.sellerUid(uid)
.isSurper(isSurper)
.isSurper(isSuper)
.fjr(fjr).sellerWallet(sellerWallet).build();
EventBusPublisher.publishEvent(bpte);
... ...