Pu Zhibing
2024-12-17 1d4473f81abe4ef200f23b781756a7da689dc718
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -22,7 +22,6 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigInteger;
import java.time.LocalDateTime;
import java.util.List;
@@ -75,7 +74,7 @@
    /**
     * 订单详情
     */
    @ApiOperation(value = "订单详情", tags = {"小程序-订单详情"})
    @ApiOperation(value = "订单详情", tags = {"小程序-个人中心-我的订单-订单详情"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
    })
@@ -87,7 +86,7 @@
    /**
     * 扫码校验
     */
    @ApiOperation(value = "扫码校验", tags = {"小程序-个人中心-门店管理-扫码核销校验"})
    @ApiOperation(value = "扫码校验", tags = {"小程序-个人中心-门店管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "分享id", name = "shareId", required = true, dataType = "int", paramType="query"),
    })
@@ -102,7 +101,7 @@
    /**
     * 订单核销
     */
    @ApiOperation(value = "订单核销", tags = {"小程序-个人中心-门店管理-扫码核销"})
    @ApiOperation(value = "订单核销", tags = {"小程序-个人中心-门店管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单号", name = "code", required = true, dataType = "String"),
    })
@@ -115,7 +114,7 @@
    /**
     * 取消订单
     */
    @ApiOperation(value = "取消订单", tags = {"小程序-个人中心-我的订单-取消订单"})
    @ApiOperation(value = "取消订单", tags = {"小程序-个人中心-我的订单"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
    })
@@ -130,7 +129,7 @@
    /**
     * 确认收货
     */
    @ApiOperation(value = "确认收货", tags = {"小程序-个人中心-我的订单-确认收货"})
    @ApiOperation(value = "确认收货", tags = {"小程序-个人中心-我的订单"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
    })
@@ -161,7 +160,7 @@
    /**
     * 更换收货地址
     */
    @ApiOperation(value = "更换收货地址", tags = {"小程序-个人中心-我的订单-更换收货地址"})
    @ApiOperation(value = "更换收货地址", tags = {"小程序-个人中心-我的订单"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
    })
@@ -182,7 +181,7 @@
    /**
     * 更新订单状态
     */
    @ApiOperation(value = "更新订单状态", tags = {"后台-订单管理-更新订单状态"})
    @ApiOperation(value = "更新订单状态", tags = {"后台-订单管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单对象", name = "order", required = true, dataType = "Order"),
    })
@@ -205,6 +204,23 @@
        orderService.updateById(order);
        return R.ok();
    }
    @PostMapping("/getLastOrder")
    public R<Order> getLastOrder(@RequestParam("appUserId") Long appUserId){
        Order one = orderService.lambdaQuery().eq(Order::getAppUserId, appUserId).orderByDesc(Order::getCreateTime).last("limit 1").one();
        return R.ok(one);
    }
    @PostMapping("/byUserId")
    public R<List<Order>> byUserId(@RequestParam("appUserId") Long appUserId){
        return R.ok(orderService.lambdaQuery().eq(Order::getAppUserId, appUserId).list());
    }
    @PostMapping("/byShopId")
    public R<List<Order>> byShopId(@RequestParam("shopId") Integer shopId){
        return R.ok(orderService.lambdaQuery().isNotNull(Order::getEndTime).eq(Order::getShopId, shopId).groupBy(Order::getAppUserId).list());
    }
    
    
    @ResponseBody