...
|
...
|
@@ -17,6 +17,7 @@ import com.yohoufo.order.common.OrderStatus; |
|
|
import com.yohoufo.order.common.RefundCase;
|
|
|
import com.yohoufo.order.common.SellerOrderStatus;
|
|
|
import com.yohoufo.order.common.TransferCase;
|
|
|
import com.yohoufo.order.constants.AlarmConfig;
|
|
|
import com.yohoufo.order.event.BillLogEvent;
|
|
|
import com.yohoufo.order.event.BuyerConfirmEvent;
|
|
|
import com.yohoufo.order.model.request.PaymentRequest;
|
...
|
...
|
@@ -62,6 +63,10 @@ public class AppraiseService { |
|
|
private InBoxFacade inBoxFacade;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
TransferService transferService;
|
|
|
|
|
|
|
|
|
public boolean appraiseSuccess(Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum){
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
|
|
|
|
...
|
...
|
@@ -83,6 +88,11 @@ public class AppraiseService { |
|
|
final Integer sellerUid = sellerOrder.getUid();
|
|
|
final Long sellerOrderCode = sellerOrder.getOrderCode();
|
|
|
|
|
|
TransferCase transferCase = TransferCase.APPRAISE_SUCCESS;
|
|
|
TransferMoneyRequest tmReq = TransferMoneyRequest.builder().buyerOrderCode(orderCode)
|
|
|
.type(transferCase.getCode()).transferCase(transferCase).build();
|
|
|
transferService.transfer(tmReq);
|
|
|
|
|
|
/**
|
|
|
* 退保证金给卖家
|
|
|
*/
|
...
|
...
|
@@ -99,10 +109,7 @@ public class AppraiseService { |
|
|
.skup(skup);
|
|
|
try {
|
|
|
paymentService.refund(req);
|
|
|
//分账
|
|
|
TransferMoneyRequest tmReq = TransferMoneyRequest.builder().buyerOrderCode(orderCode)
|
|
|
.type(TransferCase.APPRAISE_SUCCESS.getCode()).build();
|
|
|
paymentService.transferMon(tmReq);
|
|
|
|
|
|
//通知卖家退还保证金
|
|
|
BuyerConfirmEvent buyerConfirmEvent = BuyerConfirmEvent.builder().uid(buyerUid).orderCode(orderCode).build();
|
|
|
EventBusPublisher.publishEvent(buyerConfirmEvent);
|
...
|
...
|
@@ -118,10 +125,14 @@ public class AppraiseService { |
|
|
inBoxFacade.depotDeliver2Buyer(buyerUid, orderCode);
|
|
|
|
|
|
}catch (Exception ex){
|
|
|
LOGGER.warn("in appraiseSuccess,transferMon or refund fail, req {}", req, ex);
|
|
|
LOGGER.warn("in appraiseSuccess,refund fail, req {}", req, ex);
|
|
|
BillLogEvent sellerBillLogEvent = bleb.tradeStatus(200)
|
|
|
.build();
|
|
|
EventBusPublisher.publishEvent(sellerBillLogEvent);
|
|
|
String content = "鉴定通过时,订单"+ orderCode + "退还保证金失败";
|
|
|
AlarmConfig alarmConfig = AlarmConfig.APPRAISE_SUCCESS;
|
|
|
SmsAlarmEvent smsAlarmEvent = new SmsAlarmEvent(alarmConfig.getRefundName(), alarmConfig.name(), content);
|
|
|
EventBusPublisher.publishEvent(smsAlarmEvent);
|
|
|
}finally {
|
|
|
// 更新买家订单状态
|
|
|
LOGGER.info("appraiseSuccess update buyer order {} ", buyerOrder);
|
...
|
...
|
@@ -158,6 +169,7 @@ public class AppraiseService { |
|
|
return true;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 更新发到卖家的物流信息
|
|
|
* 将卖家的保证金分账给平台和买家
|
...
|
...
|
@@ -188,16 +200,10 @@ public class AppraiseService { |
|
|
int skup = bog.getSkup();
|
|
|
|
|
|
//将卖家的保证金分账给平台和买家
|
|
|
TransferCase transferCase = TransferCase.APPRAISE_FAIL;
|
|
|
TransferMoneyRequest tmReq = TransferMoneyRequest.builder().buyerOrderCode(orderCode)
|
|
|
.type(TransferCase.APPRAISE_FAIL.getCode()).build();
|
|
|
try{
|
|
|
paymentService.transferMon(tmReq);
|
|
|
}catch (Exception ex){
|
|
|
LOGGER.warn("in appraiseFail ,Transfer fail,req {}", tmReq, ex);
|
|
|
String content = "鉴定不通过时,订单"+ orderCode + "保证金分账失败";
|
|
|
SmsAlarmEvent smsAlarmEvent = new SmsAlarmEvent("buyerOrder.appraiseFail", "cancel", content);
|
|
|
EventBusPublisher.publishEvent(smsAlarmEvent);
|
|
|
}
|
|
|
.type(transferCase.getCode()).transferCase(transferCase).build();
|
|
|
transferService.transfer(tmReq);
|
|
|
|
|
|
BigDecimal goodsMoney = buyerOrder.getAmount();
|
|
|
PaymentRequest req = PaymentRequest.builder().uid(buyerUid)
|
...
|
...
|
@@ -224,7 +230,9 @@ public class AppraiseService { |
|
|
.build();
|
|
|
EventBusPublisher.publishEvent(buyererBillLogEvent);
|
|
|
String content = "鉴定不通过时,退用户" + sellerUid + "货款订单"+ orderCode +"失败";
|
|
|
SmsAlarmEvent smsAlarmEvent = new SmsAlarmEvent("buyerOrder.appraiseFail", "cancel", content);
|
|
|
|
|
|
AlarmConfig alarmConfig = AlarmConfig.APPRAISE_FAIL;
|
|
|
SmsAlarmEvent smsAlarmEvent = new SmsAlarmEvent(alarmConfig.getRefundName(), alarmConfig.name(), content);
|
|
|
EventBusPublisher.publishEvent(smsAlarmEvent);
|
|
|
|
|
|
}finally {
|
...
|
...
|
|