Authored by chenchao

fix: 卖家从个人卖家升级到超级后操作之前订单,不退还保证金

... ... @@ -5,9 +5,11 @@ import com.yohobuy.ufo.model.order.common.SellerOrderStatus;
import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohoufo.common.alarm.SmsAlarmEvent;
import com.yohoufo.order.common.BillTradeStatus;
import com.yohoufo.order.common.RefundCase;
import com.yohoufo.order.convert.builder.AlarmEventBuilder;
import com.yohoufo.order.event.BillLogEvent;
import com.yohoufo.order.model.request.PaymentRequest;
import com.yohoufo.order.utils.PaymentHelper;
import org.slf4j.Logger;
import java.util.Objects;
... ... @@ -65,6 +67,13 @@ public class RefundEarnestMoneyHandler extends AbsRefundOrderHandler{
public boolean refund(){
try {
boolean toSeller = paymentRequest.getRefundCase() !=null
&& RefundCase.SELLER_EARNEST_MONEY == paymentRequest.getRefundCase();
boolean isWalletPay = PaymentHelper.isWallet(paymentRequest.getPayment());
if(paymentRequest.isSuper() && toSeller && isWalletPay){
logger.warn("in RefundEarnestMoneyHandler.refund no need refund, refundReq {}", paymentRequest);
return false;
}
refundConsumer.accept(paymentRequest, bleb);
return true;
}catch (Exception ex){
... ...
... ... @@ -565,9 +565,11 @@ public class AppraiseService {
//退保证金给卖家
private PaymentRequest refundEarnestMoney(SellerWalletDetail.Type swdType,Long orderCode,Integer sellerUid ,SellerOrder sellerOrder,int skup,Integer buyerUid,SellerOrderStatus targetSoStatus ,double refundMoney){
Long sellerOrderCode = sellerOrder.getOrderCode();
Integer sop = sellerOrder.getPayment() == null ? 0 : sellerOrder.getPayment();
PaymentRequest refundReqOfSeller = PaymentRequest.builder().uid(sellerUid)
.refundCase(RefundCase.SELLER_EARNEST_MONEY)
.orderCode(sellerOrderCode).refundAmount(refundMoney)
.payment(sop)
.build();
boolean sellerIsSuper = sellerService.isSuperEntrySeller(sellerUid);
refundReqOfSeller.setSuper(sellerIsSuper);
... ... @@ -575,7 +577,7 @@ public class AppraiseService {
,orderCode ,swdType,
sellerUid,sellerIsSuper, sellerOrderCode, skup, refundMoney ,refundReqOfSeller);
if (!sellerIsSuper && PaymentHelper.isWallet(sellerOrder.getPayment())){
if (!sellerIsSuper && PaymentHelper.isWallet(sop)){
LOGGER.info("in refundEarnestMoney begin set MerchantOrderAttachInfo orderCode {} ,swdType {} seller uid {},sellerIsSuper {},seller order code {}, skup {}, refundMoney {},refundReqOfSeller {}"
,orderCode ,swdType,
sellerUid,sellerIsSuper, sellerOrderCode, skup, refundMoney ,refundReqOfSeller);
... ... @@ -598,7 +600,7 @@ public class AppraiseService {
sellerUid,sellerIsSuper, sellerOrderCode, skup, refundMoney ,refundReqOfSeller);
BillLogEvent.BillLogEventBuilder bleb = BillLogEvent.builder()
.buyerUid(buyerUid).sellerUid(sellerUid).orderCode(sellerOrder.getOrderCode())
.payType(sellerOrder.getPayment()).refundCase(RefundCase.SELLER_EARNEST_MONEY)
.payType(sop).refundCase(RefundCase.SELLER_EARNEST_MONEY)
.skup(skup);
new RefundEarnestMoneyHandler()
... ...
... ... @@ -288,12 +288,14 @@ public class BuyerOrderCancelService {
int sellerUid = sellerOrder.getUid();
long sellerOrderCode = sellerOrder.getOrderCode();
BigDecimal earnestMoney = sellerOrder.getEarnestMoney();
Integer sop = sellerOrder.getPayment() == null ? 0 : sellerOrder.getPayment();
PaymentRequest refundReqOfSeller = PaymentRequest.builder().uid(sellerUid).refundCase(RefundCase.SELLER_EARNEST_MONEY)
.orderCode(sellerOrderCode).refundAmount(earnestMoney.doubleValue())
.payment(sop)
.build();
boolean sellerIsSuper = sellerService.isSuperEntrySeller(sellerUid);
refundReqOfSeller.setSuper(sellerIsSuper);
if (!sellerIsSuper && PaymentHelper.isWallet(sellerOrder.getPayment())){
if (!sellerIsSuper && PaymentHelper.isWallet(sop)){
MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(sellerUid)
.orderCode(sellerOrderCode).skup(skup).earnestMoney(sellerOrder.getEarnestMoney())
... ...
... ... @@ -9,6 +9,7 @@ import com.yohoufo.order.model.PayRefundBo;
import com.yohoufo.order.model.request.PaymentRequest;
import com.yohoufo.order.service.IPaymentService;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.PaymentHelper;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -26,10 +27,7 @@ public class PayRefundService {
public PayRefundBo refund(PaymentRequest refundReq, BillLogEvent.BillLogEventBuilder bleBuilder){
logger.info("in pay refund, refundReq {}", refundReq);
boolean toSeller = refundReq.getRefundCase() !=null && RefundCase.SELLER_EARNEST_MONEY == refundReq.getRefundCase();
if(refundReq.isSuper() && toSeller){
return null;
}
PayRefundBo refundResp = paymentService.refund(refundReq);
... ...
... ... @@ -343,11 +343,14 @@ public class SellerOrderCancelService {
if(result > 0 ){
double earnestMoney = sellerOrder.getEarnestMoney().doubleValue();
boolean isSuper = sellerService.isSuperEntrySeller(sellerUid);
Integer sop = sellerOrder.getPayment() == null ? 0 : sellerOrder.getPayment();
PaymentRequest refundReq = PaymentRequest.builder().uid(sellerUid)
.orderCode(orderCode).isSuper(isSuper)
.refundCase(RefundCase.SELLER_EARNEST_MONEY)
.payment(sop)
.refundAmount(earnestMoney).build();
if (!isSuper && PaymentHelper.isWallet(sellerOrder.getPayment())){
if (!isSuper && PaymentHelper.isWallet(sop)){
SellerWalletDetail.Type swdType = SellerWalletDetail.Type.SELLER_OFF;
MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(sellerUid)
.orderCode(orderCode).skup(skup).earnestMoney(sellerOrder.getEarnestMoney())
... ... @@ -652,15 +655,16 @@ public class SellerOrderCancelService {
cacheCleaner.cleanSellerDetail(psog);
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();
Integer payment = sellerOrder.getPayment();
boolean sellerIsSurper = sellerService.isSuperEntrySeller(sellerUid);
refundReq.setSuper(sellerIsSurper);
//
if(!sellerIsSurper && PaymentHelper.isWallet(payment)){
if(!sellerIsSurper && PaymentHelper.isWallet(sop)){
MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(sellerUid)
.orderCode(orderCode).skup(skup).earnestMoney(sellerOrder.getEarnestMoney())
.type(SellerWalletDetail.Type.SYSTEM_OFF.getValue()).build();
... ...