用户支付
This commit is contained in:
parent
1fa3897af7
commit
ab590e25c2
@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @author yanglei
|
||||
@ -17,6 +18,14 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
@FeignClient(name = "ebike-payment", configuration = {ExampleFeignConfiguration.class, FeignTokenInterceptor.class})
|
||||
public interface PaymentFeignClient {
|
||||
|
||||
/**
|
||||
* 用户支付下单
|
||||
*
|
||||
* @param orderId 订单id
|
||||
*/
|
||||
@GetMapping("wxPayment/prepay")
|
||||
JsonResult<?> prepay(@RequestParam(name = "orderId") Long orderId);
|
||||
|
||||
/**
|
||||
* 用户退款
|
||||
*
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
package com.cdzy.user.controller;
|
||||
|
||||
import com.cdzy.common.enums.Code;
|
||||
import com.cdzy.common.ex.EbikeException;
|
||||
import com.cdzy.common.model.response.JsonResult;
|
||||
import com.cdzy.user.model.entity.EbikePayment;
|
||||
import com.cdzy.user.service.EbikePaymentService;
|
||||
import com.ebike.feign.clients.PaymentFeignClient;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -23,6 +26,9 @@ public class EbikePaymentController {
|
||||
@Resource
|
||||
private EbikePaymentService ebikePaymentService;
|
||||
|
||||
@Resource
|
||||
private PaymentFeignClient paymentFeignClient;
|
||||
|
||||
/**
|
||||
* 根据订单号获取支付订单
|
||||
*
|
||||
@ -34,4 +40,16 @@ public class EbikePaymentController {
|
||||
EbikePayment ebikePayment = ebikePaymentService.queryPaymentInfo(orderId);
|
||||
return JsonResult.success(ebikePayment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付下单。
|
||||
*/
|
||||
@GetMapping("/prepay")
|
||||
public JsonResult<?> prepay(@RequestParam("orderId") Long orderId) {
|
||||
JsonResult<?> jsonResult = paymentFeignClient.prepay(orderId);
|
||||
if (jsonResult.getCode() != Code.SUCCESS) {
|
||||
throw new EbikeException(jsonResult.getMessage());
|
||||
}
|
||||
return JsonResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user