puzhibing
2024-12-18 8dfa9f67a2505731910b4fb3933bb38b0869ab2d
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -14,8 +14,7 @@
import com.ruoyi.order.model.Order;
import com.ruoyi.order.service.CommissionService;
import com.ruoyi.order.service.OrderService;
import com.ruoyi.order.vo.OrderDetailVO;
import com.ruoyi.order.vo.OrderVO;
import com.ruoyi.order.vo.*;
import com.ruoyi.other.api.domain.BaseSetting;
import com.ruoyi.other.api.feignClient.BaseSettingClient;
import com.ruoyi.system.api.model.LoginUser;
@@ -55,7 +54,7 @@
     */
    @ApiOperation(value = "我的订单列表", tags = {"小程序-个人中心-我的订单"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单状态", name = "status", required = true, dataType = "int"),
            @ApiImplicitParam(value = "订单状态", name = "status", required = true, dataType = "int", paramType="query"),
    })
    @GetMapping("/getMyOrderList")
    public TableDataInfo<OrderVO> getMyOrderList(@ApiParam("订单状态") Integer status){
@@ -75,9 +74,9 @@
    /**
     * 订单详情
     */
    @ApiOperation(value = "订单详情", tags = {"小程序-订单详情"})
    @ApiOperation(value = "订单详情", tags = {"小程序-个人中心-我的订单-订单详情"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int", paramType="query"),
    })
    @GetMapping("/detail/{orderId}")
    public R<OrderDetailVO> detail(@PathVariable("orderId") Long orderId){
@@ -87,7 +86,7 @@
    /**
     * 扫码校验
     */
    @ApiOperation(value = "扫码校验", tags = {"小程序-个人中心-门店管理-扫码核销校验"})
    @ApiOperation(value = "扫码校验", tags = {"小程序-个人中心-门店管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "分享id", name = "shareId", required = true, dataType = "int", paramType="query"),
    })
@@ -102,9 +101,9 @@
    /**
     * 订单核销
     */
    @ApiOperation(value = "订单核销", tags = {"小程序-个人中心-门店管理-扫码核销"})
    @ApiOperation(value = "订单核销", tags = {"小程序-个人中心-门店管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单号", name = "code", required = true, dataType = "String"),
            @ApiImplicitParam(value = "订单号", name = "code", required = true, dataType = "String", paramType="query"),
    })
    @GetMapping("/writeOff/{code}/{shopId}")
    public R<Void> writeOff(@PathVariable("code") String code, @PathVariable("shopId") Integer shopId){
@@ -115,9 +114,9 @@
    /**
     * 取消订单
     */
    @ApiOperation(value = "取消订单", tags = {"小程序-个人中心-我的订单-取消订单"})
    @ApiOperation(value = "取消订单", tags = {"小程序-个人中心-我的订单"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int", paramType="query"),
    })
    @GetMapping("/cancel/{orderId}")
    public R<Void> cancel(@PathVariable("orderId") Long orderId){
@@ -130,9 +129,9 @@
    /**
     * 确认收货
     */
    @ApiOperation(value = "确认收货", tags = {"小程序-个人中心-我的订单-确认收货"})
    @ApiOperation(value = "确认收货", tags = {"小程序-个人中心-我的订单"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int", paramType="query"),
    })
    @GetMapping("/confirm/{orderId}")
    public R<Void> confirm(@PathVariable("orderId") Long orderId){
@@ -161,9 +160,9 @@
    /**
     * 更换收货地址
     */
    @ApiOperation(value = "更换收货地址", tags = {"小程序-个人中心-我的订单-更换收货地址"})
    @ApiOperation(value = "更换收货地址", tags = {"小程序-个人中心-我的订单"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int", paramType="query"),
    })
    @GetMapping("/changeAddress")
    public R<Void> changeAddress(@RequestParam("orderId") Long orderId, @RequestParam("addressId") Long addressId){
@@ -182,10 +181,7 @@
    /**
     * 更新订单状态
     */
    @ApiOperation(value = "更新订单状态", tags = {"后台-订单管理-更新订单状态"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单对象", name = "order", required = true, dataType = "Order"),
    })
    @ApiOperation(value = "更新订单状态", tags = {"后台-订单管理"})
    @PostMapping("/updateOrderStatus")
    public R<Void> updateOrderStatus(@RequestBody Order order){
        Order order1 = orderService.getById(order.getId());
@@ -199,14 +195,73 @@
     * 预约技师
     */
    @PostMapping("/subscribe")
    public R<Void> subscribe(@RequestParam(value = "id", required = false) Long id ,@RequestParam(value = "technicianId", required = false) Integer technicianId){
    public R<Void> subscribe(@RequestParam("id") Long id ,@RequestParam("technicianId") Integer technicianId){
        Order order = orderService.getById(id);
        order.setTechnicianId(technicianId);
        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
    @GetMapping("/getOrderPageList")
    @ApiOperation(value = "获取订单列表", tags = {"管理后台-订单管理", "门店后台-订单管理"})
    public TableDataInfo<OrderPageListVo> getOrderPageList(OrderPageList orderPageList){
        startPage();
        List<OrderPageListVo> list = orderService.getOrderPageList(orderPageList);
        return getDataTable(list);
    }
    @ResponseBody
    @PutMapping("/confirmDelivery/{orderId}")
    @ApiOperation(value = "已发货操作", tags = {"管理后台-订单管理"})
    public R confirmDelivery(@PathVariable("orderId") String orderId, String code){
        return orderService.confirmDelivery(orderId, code);
    }
    @ResponseBody
    @PutMapping("/cancelOrder/{orderId}")
    @ApiOperation(value = "取消订单操作", tags = {"管理后台-订单管理"})
    public R cancelOrder(@PathVariable("orderId") Long orderId){
        return orderService.cancelOrder(orderId);
    }
    @ResponseBody
    @PutMapping("/receivingOperation/{orderId}")
    @ApiOperation(value = "收货操作", tags = {"管理后台-订单管理"})
    public R receivingOperation(@PathVariable("orderId") Long orderId){
        return orderService.receivingOperation(orderId);
    }
    @ResponseBody
    @GetMapping("/getOrderInfo/{orderId}")
    @ApiOperation(value = "查询订单详情", tags = {"管理后台-订单管理"})
    public R<OrderInfoVo> getOrderInfo(@PathVariable("orderId") Long orderId){
        OrderInfoVo orderInfo = orderService.getOrderInfo(orderId);
        return R.ok(orderInfo);
    }
}