Showing
1 changed file
with
60 additions
and
0 deletions
1 | package com.yohoufo.order.controller; | 1 | package com.yohoufo.order.controller; |
2 | 2 | ||
3 | +import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo; | ||
3 | import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; | 4 | import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; |
4 | import com.yohoufo.common.ApiResponse; | 5 | import com.yohoufo.common.ApiResponse; |
5 | import com.yohoufo.common.annotation.IgnoreSession; | 6 | import com.yohoufo.common.annotation.IgnoreSession; |
6 | import com.yohoufo.common.annotation.IgnoreSignature; | 7 | import com.yohoufo.common.annotation.IgnoreSignature; |
7 | import com.yohoufo.common.annotation.InnerApi; | 8 | import com.yohoufo.common.annotation.InnerApi; |
9 | +import com.yohoufo.dal.order.BuyerOrderGoodsMapper; | ||
10 | +import com.yohoufo.dal.order.BuyerOrderMapper; | ||
11 | +import com.yohoufo.dal.order.SellerOrderMapper; | ||
12 | +import com.yohoufo.dal.order.model.BuyerOrder; | ||
13 | +import com.yohoufo.dal.order.model.BuyerOrderGoods; | ||
14 | +import com.yohoufo.dal.order.model.SellerOrder; | ||
15 | +import com.yohoufo.dal.order.model.SellerWalletDetail; | ||
16 | +import com.yohoufo.order.common.RefundCase; | ||
17 | +import com.yohoufo.order.event.BillLogEvent; | ||
8 | import com.yohoufo.order.model.request.OrderRequest; | 18 | import com.yohoufo.order.model.request.OrderRequest; |
19 | +import com.yohoufo.order.model.request.PaymentRequest; | ||
9 | import com.yohoufo.order.model.request.TransferMoneyRequest; | 20 | import com.yohoufo.order.model.request.TransferMoneyRequest; |
10 | import com.yohoufo.order.service.IBuyerOrderService; | 21 | import com.yohoufo.order.service.IBuyerOrderService; |
11 | import com.yohoufo.order.service.impl.BuyerOrderCancelService; | 22 | import com.yohoufo.order.service.impl.BuyerOrderCancelService; |
23 | +import com.yohoufo.order.service.impl.PayRefundService; | ||
12 | import com.yohoufo.order.service.impl.PaymentServiceImpl; | 24 | import com.yohoufo.order.service.impl.PaymentServiceImpl; |
13 | import com.yohoufo.order.service.impl.TransferService; | 25 | import com.yohoufo.order.service.impl.TransferService; |
14 | import com.yohoufo.order.service.pay.alipay.AlipayOuyinService; | 26 | import com.yohoufo.order.service.pay.alipay.AlipayOuyinService; |
@@ -44,6 +56,15 @@ public class OrderHelpController { | @@ -44,6 +56,15 @@ public class OrderHelpController { | ||
44 | @Autowired | 56 | @Autowired |
45 | BuyerOrderCancelService buyerOrderCancelService; | 57 | BuyerOrderCancelService buyerOrderCancelService; |
46 | 58 | ||
59 | + @Autowired | ||
60 | + PayRefundService payRefundService; | ||
61 | + @Autowired | ||
62 | + private SellerOrderMapper sellerOrderMapper; | ||
63 | + @Autowired | ||
64 | + private BuyerOrderMapper buyerOrderMapper; | ||
65 | + | ||
66 | + @Autowired | ||
67 | + private BuyerOrderGoodsMapper buyerOrderGoodsMapper; | ||
47 | 68 | ||
48 | /** | 69 | /** |
49 | * 转账 | 70 | * 转账 |
@@ -59,6 +80,45 @@ public class OrderHelpController { | @@ -59,6 +80,45 @@ public class OrderHelpController { | ||
59 | .build(); | 80 | .build(); |
60 | } | 81 | } |
61 | 82 | ||
83 | + | ||
84 | + @Data | ||
85 | + public static class RefundEarnestMoneyRequest { | ||
86 | + private Integer uid; | ||
87 | + private Integer orderCode; | ||
88 | + private BigDecimal refundAmount; | ||
89 | + } | ||
90 | + | ||
91 | + @IgnoreSession | ||
92 | + @IgnoreSignature | ||
93 | + @InnerApi | ||
94 | + @RequestMapping(value = "/refundEarnestMoney") | ||
95 | + public ApiResponse refundEarnestMoney(@RequestBody RefundEarnestMoneyRequest request) { | ||
96 | + BuyerOrderGoods orderGoods = buyerOrderGoodsMapper.selectByOrderCode(request.getUid(), request.getOrderCode()); | ||
97 | + Integer skup = orderGoods.getSkup(); | ||
98 | + SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(skup); | ||
99 | + PaymentRequest refundReq = PaymentRequest.builder() | ||
100 | + .uid(sellerOrder.getUid()) | ||
101 | + .refundCase(RefundCase.SELLER_EARNEST_MONEY) | ||
102 | + .orderCode(sellerOrder.getOrderCode()) | ||
103 | + .refundAmount(request.getRefundAmount().doubleValue()) | ||
104 | + .refundattch(MerchantOrderAttachInfo.builder().type(SellerWalletDetail.Type.SELLER_CAN_NOT_SEND_OUT.getValue()).build()) | ||
105 | + .build(); | ||
106 | + BillLogEvent.BillLogEventBuilder bleBuilder = BillLogEvent.builder() | ||
107 | + .buyerUid(request.getUid()) | ||
108 | + .sellerUid(sellerOrder.getUid()) | ||
109 | + .orderCode(sellerOrder.getOrderCode()) | ||
110 | + .payType(sellerOrder.getPayment()) | ||
111 | + .refundCase(RefundCase.SELLER_EARNEST_MONEY) | ||
112 | + .amount(request.getRefundAmount()) | ||
113 | + .skup(skup); | ||
114 | + | ||
115 | + return new ApiResponse.ApiResponseBuilder() | ||
116 | + .code(200) | ||
117 | + .data(payRefundService.refund(refundReq, bleBuilder)) | ||
118 | + .message("处理成功") | ||
119 | + .build(); | ||
120 | + } | ||
121 | + | ||
62 | /** | 122 | /** |
63 | * 转账 | 123 | * 转账 |
64 | */ | 124 | */ |
-
Please register or login to post a comment