|
|
package com.yohoufo.order.controller;
|
|
|
|
|
|
import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo;
|
|
|
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
|
|
|
import com.yohoufo.common.ApiResponse;
|
|
|
import com.yohoufo.common.annotation.IgnoreSession;
|
|
|
import com.yohoufo.common.annotation.IgnoreSignature;
|
|
|
import com.yohoufo.common.annotation.InnerApi;
|
|
|
import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
|
|
|
import com.yohoufo.dal.order.BuyerOrderMapper;
|
|
|
import com.yohoufo.dal.order.SellerOrderMapper;
|
|
|
import com.yohoufo.dal.order.model.BuyerOrder;
|
|
|
import com.yohoufo.dal.order.model.BuyerOrderGoods;
|
|
|
import com.yohoufo.dal.order.model.SellerOrder;
|
|
|
import com.yohoufo.dal.order.model.SellerWalletDetail;
|
|
|
import com.yohoufo.order.common.RefundCase;
|
|
|
import com.yohoufo.order.event.BillLogEvent;
|
|
|
import com.yohoufo.order.model.request.OrderRequest;
|
|
|
import com.yohoufo.order.model.request.PaymentRequest;
|
|
|
import com.yohoufo.order.model.request.TransferMoneyRequest;
|
|
|
import com.yohoufo.order.service.IBuyerOrderService;
|
|
|
import com.yohoufo.order.service.impl.BuyerOrderCancelService;
|
|
|
import com.yohoufo.order.service.impl.PayRefundService;
|
|
|
import com.yohoufo.order.service.impl.PaymentServiceImpl;
|
|
|
import com.yohoufo.order.service.impl.TransferService;
|
|
|
import com.yohoufo.order.service.pay.alipay.AlipayOuyinService;
|
...
|
...
|
@@ -44,6 +56,15 @@ public class OrderHelpController { |
|
|
@Autowired
|
|
|
BuyerOrderCancelService buyerOrderCancelService;
|
|
|
|
|
|
@Autowired
|
|
|
PayRefundService payRefundService;
|
|
|
@Autowired
|
|
|
private SellerOrderMapper sellerOrderMapper;
|
|
|
@Autowired
|
|
|
private BuyerOrderMapper buyerOrderMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private BuyerOrderGoodsMapper buyerOrderGoodsMapper;
|
|
|
|
|
|
/**
|
|
|
* 转账
|
...
|
...
|
@@ -59,6 +80,45 @@ public class OrderHelpController { |
|
|
.build();
|
|
|
}
|
|
|
|
|
|
|
|
|
@Data
|
|
|
public static class RefundEarnestMoneyRequest {
|
|
|
private Integer uid;
|
|
|
private Integer orderCode;
|
|
|
private BigDecimal refundAmount;
|
|
|
}
|
|
|
|
|
|
@IgnoreSession
|
|
|
@IgnoreSignature
|
|
|
@InnerApi
|
|
|
@RequestMapping(value = "/refundEarnestMoney")
|
|
|
public ApiResponse refundEarnestMoney(@RequestBody RefundEarnestMoneyRequest request) {
|
|
|
BuyerOrderGoods orderGoods = buyerOrderGoodsMapper.selectByOrderCode(request.getUid(), request.getOrderCode());
|
|
|
Integer skup = orderGoods.getSkup();
|
|
|
SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(skup);
|
|
|
PaymentRequest refundReq = PaymentRequest.builder()
|
|
|
.uid(sellerOrder.getUid())
|
|
|
.refundCase(RefundCase.SELLER_EARNEST_MONEY)
|
|
|
.orderCode(sellerOrder.getOrderCode())
|
|
|
.refundAmount(request.getRefundAmount().doubleValue())
|
|
|
.refundattch(MerchantOrderAttachInfo.builder().type(SellerWalletDetail.Type.SELLER_CAN_NOT_SEND_OUT.getValue()).build())
|
|
|
.build();
|
|
|
BillLogEvent.BillLogEventBuilder bleBuilder = BillLogEvent.builder()
|
|
|
.buyerUid(request.getUid())
|
|
|
.sellerUid(sellerOrder.getUid())
|
|
|
.orderCode(sellerOrder.getOrderCode())
|
|
|
.payType(sellerOrder.getPayment())
|
|
|
.refundCase(RefundCase.SELLER_EARNEST_MONEY)
|
|
|
.amount(request.getRefundAmount())
|
|
|
.skup(skup);
|
|
|
|
|
|
return new ApiResponse.ApiResponseBuilder()
|
|
|
.code(200)
|
|
|
.data(payRefundService.refund(refundReq, bleBuilder))
|
|
|
.message("处理成功")
|
|
|
.build();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 转账
|
|
|
*/
|
...
|
...
|
|