From cf98926793932b132000e237a487ba4343084410 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期一, 09 九月 2024 19:50:47 +0800
Subject: [PATCH] 下单接口

---
 xinquan-modules/xinquan-order/src/main/java/com/xinquan/order/controller/client/ClientOrderController.java |   41 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/xinquan-modules/xinquan-order/src/main/java/com/xinquan/order/controller/client/ClientOrderController.java b/xinquan-modules/xinquan-order/src/main/java/com/xinquan/order/controller/client/ClientOrderController.java
index 18ad2af..59e2d49 100644
--- a/xinquan-modules/xinquan-order/src/main/java/com/xinquan/order/controller/client/ClientOrderController.java
+++ b/xinquan-modules/xinquan-order/src/main/java/com/xinquan/order/controller/client/ClientOrderController.java
@@ -2,12 +2,16 @@
 
 
 import com.xinquan.common.core.domain.R;
+import com.xinquan.order.domain.vo.ClientPlaceOrderVO;
 import com.xinquan.order.service.OrderService;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 /**
@@ -26,10 +30,39 @@
 
     private OrderService orderService;
 
-    @PostMapping("/createOrder")
-    @ApiOperation(value = "创建订单")
-    public R<?> createOrder() {
-        return R.ok();
+    /**
+     * 创建待支付订单
+     *
+     * @param targetId    目标id
+     * @param orderFrom   订单来源 1=冥想音频 2=课程
+     * @param receiverId  被赠送课程APP用户id
+     * @param balanceFlag 是否使用余额抵扣 1=是 2=否
+     * @param payType     支付方式 1=微信 2=支付宝
+     * @return 下单返回数据视图对象
+     * @see com.xinquan.order.domain.vo.ClientPlaceOrderVO
+     */
+    @PostMapping("/placeOrder")
+    @ApiOperation(value = "创建待支付订单", notes = "微信|支付宝")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "targetId", value = "目标id", dataType = "Long", required = true),
+            @ApiImplicitParam(name = "orderFrom", value = "订单来源 1=冥想音频 2=课程", dataType = "Integer", required = true),
+            @ApiImplicitParam(name = "receiverId", value = "被赠送课程APP用户id", dataType = "Long", required = false),
+            @ApiImplicitParam(name = "balanceFlag", value = "是否使用余额抵扣 1=是 2=否", dataType = "Integer", required = true),
+            @ApiImplicitParam(name = "payType", value = "支付方式 1=微信 2=支付宝", dataType = "Integer", required = true)
+    })
+    public R<ClientPlaceOrderVO> placeOrder(
+            @RequestParam(value = "targetId") Long targetId,
+            @RequestParam(value = "orderFrom") Integer orderFrom,
+            @RequestParam(value = "receiverId", required = false) Long receiverId,
+            @RequestParam(value = "balanceFlag") Integer balanceFlag,
+            @RequestParam(value = "payType") Integer payType) {
+        try {
+            return R.ok(
+                    orderService.placeOrder(targetId, orderFrom, receiverId,
+                            balanceFlag, payType));
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
     }
 }
 

--
Gitblit v1.7.1