Authored by chenchao

fix refund earnest money logic

... ... @@ -55,7 +55,8 @@ public class SellerWalletDetail {
APPRAISE_OK("鉴定通过", 51),
APPRAISE_UNSURE("商品无法鉴定", 52),
MERCHANT_EXIT("商家退出入驻", 61),
CANCEL_DELIVER("不寄了", 71);
CANCEL_DELIVER("不寄了", 71),
FLAW("瑕疵品",72);
private String name;
private int value;
... ...
... ... @@ -42,5 +42,17 @@ public interface IGoodsService {
OrderAttributes getOrderAttributes();
/**
* 虚假发货
* @param appraiseOrder
* @return
*/
int shamDeliver(AppraiseOrder appraiseOrder);
/**
* 瑕疵
* @param appraiseOrder
* @return
*/
int findFlaw(AppraiseOrder appraiseOrder);
}
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.order.service.handler;
import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo;
import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohoufo.common.alarm.SmsAlarmEvent;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.dal.order.model.SellerWalletDetail;
import com.yohoufo.order.common.BillTradeStatus;
import com.yohoufo.order.common.RefundCase;
... ... @@ -61,7 +62,9 @@ public class GoodsServiceRefundHandler extends AbsRefundOrderHandler {
@Override
public boolean refund() {
if (paidOrderCode == null){
throw new UfoServiceException(400, "退款订单不存在");
}
try {
MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder()
... ...
... ... @@ -137,4 +137,15 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService {
logger.info("appraise order appraiseFake update status, orderCode {} rows {}", orderCode, rows);
return rows;
}
@Override
public int findFlaw(AppraiseOrder appraiseOrder){
long orderCode = appraiseOrder.getOrderCode();
AppraiseOrderStatus targetStatus = AppraiseOrderStatus.FLAW,
expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus);
logger.info("appraise order appraiseFake update status, orderCode {} rows {}", orderCode, rows);
return rows;
}
}
... ...
... ... @@ -1284,7 +1284,8 @@ public class AppraiseService {
ApiResponse apiResponse = new ApiResponse();
if(serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
LOGGER.info("judgeCenterPass isGoodsServiceOrder orderCode {}", orderCode);
serviceOrderProcessor.findGoodsServiceInstance(orderCode).appraisePass(orderCode);
ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.findGoodsServiceInstanceAndExt(orderCode);
existenceNode.getGoodsService().appraisePass(existenceNode.getAppraiseOrder());
apiResponse.setCode(200);
return apiResponse;
}
... ...
... ... @@ -279,7 +279,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
new GoodsServiceRefundHandler()
.loadLogger(logger)
.loadUser(pao.getUid())
.loadActionCase(SellerWalletDetail.Type.CANCEL_DELIVER)
.loadActionCase(SellerWalletDetail.Type.APPRAISE_OK)
.loadRefundAction(payRefundService::refund)
.loadOrder(orderCode, paidCode, pao.getPayment(), left)
.refund();
... ... @@ -350,12 +350,25 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
return rows;
}
/**
* 确认收货环节发现少件,取消订单保证金原路退回
* @param appraiseOrder
* @return
*/
@Override
public int shamDeliver(AppraiseOrder appraiseOrder){
int rows = super.shamDeliver(appraiseOrder);
if (rows == 0){
return rows;
}
//refund amount
new GoodsServiceRefundHandler()
.loadLogger(logger)
.loadUser(appraiseOrder.getUid())
.loadActionCase(SellerWalletDetail.Type.SELLER_SHAM_SEND_OUT)
.loadRefundAction(payRefundService::refund)
.loadOrder(appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode(), appraiseOrder.getPayment(), appraiseOrder.getAmount())
.refund();
depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
return rows;
}
... ... @@ -456,5 +469,27 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
return rows;
}
/**
* 瑕疵
* 退回对应保证金至卖家账户
* @param appraiseOrder
* @return
*/
public int findFlaw(AppraiseOrder appraiseOrder){
int rows = super.findFlaw(appraiseOrder);
if (rows == 0){
return rows;
}
new GoodsServiceRefundHandler()
.loadLogger(logger)
.loadUser(appraiseOrder.getUid())
.loadActionCase(SellerWalletDetail.Type.FLAW)
.loadRefundAction(payRefundService::refund)
.loadOrder(appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode(), appraiseOrder.getPayment(), appraiseOrder.getAmount())
.refund();
depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
return rows;
}
}
... ...