mitao
2024-08-16 d7dc4db8d005a58f51d21d35147317762a16373f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
package com.ruoyi.order.controller.management;
 
 
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.page.PageDTO;
import com.ruoyi.order.controller.management.dto.MgtOrderConfirmShipmentDTO;
import com.ruoyi.order.controller.management.dto.MgtOrderQuery;
import com.ruoyi.order.controller.management.vo.MgtOrderVO;
import com.ruoyi.order.service.IOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
 
/**
 * <p>
 * 订单表 前端控制器
 * </p>
 *
 * @author mitao
 * @since 2024-05-16
 */
@Slf4j
@RestController
@RequestMapping("/mgt/order")
@RequiredArgsConstructor
@Api(tags = "管理后台-订单管理相关接口", value = "管理后台-订单管理相关接口")
public class MgtOrderController {
 
    private final IOrderService orderService;
 
    /**
     * 商城订单分页列表
     *
     * @param query 商城订单查询对象
     * @return PageDTO<MgtMallOrderVO>
     */
    @ApiOperation("订单分页列表")
    @PostMapping("/page")
    public R<PageDTO<MgtOrderVO>> getOrderPage(
            @Validated @RequestBody MgtOrderQuery query) {
        return R.ok(orderService.getOrderPage(query));
    }
 
    /**
     * 获取商城订单详情
     *
     * @param id 订单id
     * @return MgtMallOrderVO
     */
    @ApiOperation("查看详情")
    @GetMapping("/detail/{id}")
    public R<MgtOrderVO> getMallOrderDetail(
            @ApiParam(name = "id", value = "订单id", required = true)
            @Validated @PathVariable("id") Long id) {
        return R.ok(orderService.getOrderDetail(id));
    }
 
    /**
     * 确认发货
     *
     * @param dto 确认发货请求对象
     */
    @ApiOperation("确认发货")
    @PutMapping("/confirm-shipment")
    public R<?> confirmShipmentOrder(@Validated @RequestBody MgtOrderConfirmShipmentDTO dto) {
        orderService.confirmShipmentOrder(dto);
        return R.ok();
    }
 
    /**
     * 已收货
     *
     * @param id 订单id
     */
    @ApiOperation("已收货")
    @PutMapping("/received-goods/{id}")
    public R<?> receivedGoods(
            @ApiParam(name = "id", value = "订单id", required = true) @PathVariable("id") Long id) {
        orderService.receivedGoods(id);
        return R.ok();
    }
 
    /**
     * 退款
     *
     * @param id 订单id
     */
    @ApiOperation("退款")
    @GetMapping("/refund/{id}")
    public R<?> refund(
            @ApiParam(name = "id", value = "订单id", required = true) @PathVariable("id") Long id) {
        orderService.refund(id);
        return R.ok();
    }
 
    /**
     * 退款退货
     *
     * @param id 订单id
     */
    @ApiOperation("退款退货")
    @GetMapping("/refund-return/{id}")
    public R<?> refundReturn(
            @ApiParam(name = "id", value = "订单id", required = true) @PathVariable("id") Long id) {
        orderService.refundReturn(id);
        return R.ok();
    }
 
    /**
     * 拍卖订单退保证金
     *
     * @param id 订单id
     */
    @ApiOperation("拍卖订单退保证金")
    @PutMapping("/refund-bond/{id}")
    public R<?> refundBond(
            @ApiParam(name = "id", value = "订单id", required = true) @PathVariable("id") Long id) {
        orderService.refundBond(id);
        return R.ok();
    }
}