无关风月
2024-09-07 531c94e27fd3dc2abe8ad72485f66e9e141a0bae
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
package com.ruoyi.order.controller;
 
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.order.service.TVipOrderService;
import com.ruoyi.payment.api.vo.AliQueryOrder;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
 
 
@RestController
@RequestMapping("/callBack")
public class CallBackController {
 
    @Resource
    private TVipOrderService tVipOrderService;
 
    @ResponseBody
    @PostMapping(value = "/ali/all")
    public void chargingOrderALICallback(@RequestBody AliQueryOrder aliQueryOrder, HttpServletResponse response) {
        try {
            String out_trade_no = aliQueryOrder.getOutTradeNo();
            String transaction_id = aliQueryOrder.getTradeNo();
            String attach = aliQueryOrder.getPassbackParams();
            String substring = out_trade_no.substring(0, 2);
            switch (substring){
                //购物订单
                case "GW":
 
                    break;
                case "HY":
                    tVipOrderService.payBack(out_trade_no);
                    break;
            }
 
//            AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach);
//            if (ajaxResult.isSuccess()) {
//                PrintWriter writer = response.getWriter();
//                writer.println("success");
//                writer.flush();
//                writer.close();
//            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}