huliguo
2025-06-05 0a492b64ca1a4e40cc9ea56eddd1afe2c09a12b3
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
package com.ruoyi.web.controller.system;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.wx.RefundCallbackResult;
import com.ruoyi.system.pojo.dto.AppUserPageDTO;
import com.ruoyi.system.pojo.dto.OrderPageDTO;
import com.ruoyi.system.pojo.vo.*;
import com.ruoyi.system.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
 
@Slf4j
@RestController
@RequestMapping("/system/order")
@Api( tags = "后台-订单管理")
public class OrderController {
    @Resource
    private OrderService orderService;
 
    /**
     * 分页
     */
    @PostMapping("/getOrderPage")
    @ApiOperation(value = "订单分页")
    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R<IPage<OrderPageVO>> getOrderPage(@RequestBody OrderPageDTO dto) {
        return R.ok(orderService.getOrderPage(dto));
    }
    /**
     * 查看详情
     */
    @GetMapping("/detail/{id}")
    @ApiOperation(value = "查看详情-基础信息")
    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R<OrderDetailVO> detail(@PathVariable("id") String id) {
        return R.ok(orderService.detail(id));
    }
 
    /**
     * 企业工商信息
     */
    @GetMapping("/business/{id}")
    @ApiOperation(value = "查看详情-企业工商信息")
    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R<BusinessVO> business(@PathVariable("id") String id) {
        return R.ok(orderService.business(id));
    }
 
 
    /**
     * todo redis 企业异常信息
     */
    @GetMapping("/error/{id}")
    @ApiOperation(value = "查看详情-企业异常信息")
    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R<ErrorVO> error(@PathVariable("id") String id) {
        return R.ok(orderService.error(id));
    }
    /**
     * todo redis 企业变更信息
     */
    @GetMapping("/change/{id}")
    @ApiOperation(value = "查看详情-企业变更信息")
    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R<ChangeVO> change(@PathVariable("id") String id) {
        return R.ok(orderService.change(id));
    }
    /**
     * todo redis 企业纳税信息
     */
    @GetMapping("/tax/{id}")
    @ApiOperation(value = "查看详情-企业纳税信息")
    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R<TaxVO> tax(@PathVariable("id") String id) {
        return R.ok(orderService.tax(id));
    }
 
    /**
     * todo redis 企业发票信息
     */
    @GetMapping("/invoice/{id}")
    @ApiOperation(value = "查看详情-企业纳税信息")
    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R<InvoiceVO> invoice(@PathVariable("id") String id) {
        return R.ok(orderService.invoice(id));
    }
    /**
     *  删除
     */
    @DeleteMapping("/delete/{id}")
    @ApiOperation(value = "删除")
    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R delete(@PathVariable("id") String id) {
        orderService.delete(id);
        return R.ok();
    }
 
 
    /**
     * 上、下架
     */
    @PutMapping("/shelves/{id}")
    @ApiOperation(value = "上、下架")
    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R shelves(@PathVariable("id") String id) {
        orderService.shelves(id);
        return R.ok();
    }
 
    /**
     * 取消交易
     */
    @PutMapping("/cancel/{id}")
    @ApiOperation(value = "取消交易")
    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R cancel(@PathVariable("id") String id) {
        orderService.cancel(id);
        return R.ok();
    }
 
    /**
     * 订单取消支付回退
     *
     * @param refundCallbackResult
     * @param response
     * @return
     */
    @ResponseBody
    @GetMapping("/refundPayMoneyCallback")
    public void refundPayMoneyCallback(RefundCallbackResult refundCallbackResult, HttpServletResponse response) {
        R callback = orderService.refundPayMoneyCallback(refundCallbackResult);
        if (callback.getCode() == 200) {
            response.setStatus(200);
            PrintWriter out = null;
            try {
                out = response.getWriter();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            out.println("success");
            out.flush();
            out.close();
        }
    }
}