From fc772cecd6b662204909b37c7a68e9e9906e0d57 Mon Sep 17 00:00:00 2001
From: “mitao” <“2763622819@qq.com”>
Date: 星期一, 22 十二月 2025 18:05:26 +0800
Subject: [PATCH] feat:管理后台积分结算接口

---
 ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/OrderController.java |   87 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 83 insertions(+), 4 deletions(-)

diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/OrderController.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/OrderController.java
index 295ff4f..721ebfc 100644
--- a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/OrderController.java
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/OrderController.java
@@ -1,14 +1,19 @@
 package com.ruoyi.web.controller.api;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.framework.web.service.TokenService;
 import com.ruoyi.system.dto.BigGiftPlaceOrderDTO;
 import com.ruoyi.system.dto.FinalPaymentDTO;
 import com.ruoyi.system.dto.PhysicalGoodsPlaceOrderDTO;
 import com.ruoyi.system.model.TAppUser;
+import com.ruoyi.system.query.AppletOrderListQuery;
+import com.ruoyi.system.service.AppletOrderService;
 import com.ruoyi.system.service.TAppUserService;
 import com.ruoyi.system.service.TBigGiftPackageOrderService;
 import com.ruoyi.system.service.TPhysicalGoodsOrderService;
+import com.ruoyi.system.vo.AppletOrderDetailVO;
+import com.ruoyi.system.vo.AppletOrderListVO;
 import com.ruoyi.system.vo.PlaceOrderVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -16,10 +21,7 @@
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
 
@@ -41,6 +43,21 @@
     private final TAppUserService appUserService;
     private final TBigGiftPackageOrderService bigGiftPackageOrderService;
     private final TPhysicalGoodsOrderService physicalGoodsOrderService;
+    private final AppletOrderService appletOrderService;
+
+    /**
+     * 订单列表分页查询
+     *
+     * @param query 查询条件
+     * @return 订单列表
+     */
+    @ApiOperation(value = "订单列表分页查询", response = AppletOrderListVO.class)
+    @PostMapping("/list")
+    public R<Page<AppletOrderListVO>> getOrderList(@RequestBody AppletOrderListQuery query) {
+        Integer userId = tokenService.getLoginUserApplet().getUserId();
+        Page<AppletOrderListVO> page = appletOrderService.getOrderList(query, userId);
+        return R.ok(page);
+    }
 
     /**
      * 大礼包商品下单
@@ -110,4 +127,66 @@
         PlaceOrderVO result = bigGiftPackageOrderService.payFinalPayment(dto.getOrderId(), userId, appUser.getOpenid());
         return R.ok(result);
     }
+
+    /**
+     * 实物商品订单详情
+     *
+     * @param id 订单ID
+     * @return 订单详情
+     */
+    @ApiOperation(value = "实物商品订单详情", response = AppletOrderDetailVO.class)
+    @GetMapping("/physical/detail/{id}")
+    public R<AppletOrderDetailVO> getPhysicalOrderDetail(@PathVariable Integer id) {
+        Integer userId = tokenService.getLoginUserApplet().getUserId();
+        AppletOrderDetailVO detail = appletOrderService.getPhysicalOrderDetail(id, userId);
+        if (detail == null) {
+            return R.fail("订单不存在或无权查看");
+        }
+        return R.ok(detail);
+    }
+
+    /**
+     * 大礼包订单详情
+     *
+     * @param id 订单ID
+     * @return 订单详情
+     */
+    @ApiOperation(value = "大礼包订单详情", response = AppletOrderDetailVO.class)
+    @GetMapping("/big-gift/detail/{id}")
+    public R<AppletOrderDetailVO> getBigGiftOrderDetail(@PathVariable Integer id) {
+        Integer userId = tokenService.getLoginUserApplet().getUserId();
+        AppletOrderDetailVO detail = appletOrderService.getBigGiftOrderDetail(id, userId);
+        if (detail == null) {
+            return R.fail("订单不存在或无权查看");
+        }
+        return R.ok(detail);
+    }
+
+    /**
+     * 实物商品确认收货
+     *
+     * @param id 订单ID
+     * @return 操作结果
+     */
+    @ApiOperation(value = "实物商品确认收货")
+    @GetMapping("/physical/confirm/{id}")
+    public R<Void> confirmPhysicalOrder(@PathVariable Integer id) {
+        Integer userId = tokenService.getLoginUserApplet().getUserId();
+        boolean success = appletOrderService.confirmPhysicalOrder(id, userId);
+        return success ? R.ok() : R.fail("确认收货失败,订单不存在或状态不正确");
+    }
+
+    /**
+     * 大礼包确认收货
+     *
+     * @param id 订单ID
+     * @return 操作结果
+     */
+    @ApiOperation(value = "大礼包确认收货")
+    @GetMapping("/big-gift/confirm/{id}")
+    public R<Void> confirmBigGiftOrder(@PathVariable Integer id) {
+        Integer userId = tokenService.getLoginUserApplet().getUserId();
+        boolean success = appletOrderService.confirmBigGiftOrder(id, userId);
+        return success ? R.ok() : R.fail("确认收货失败,订单不存在或状态不正确");
+    }
 }

--
Gitblit v1.7.1