yanghb
2023-04-06 4f406ca4ce377c3bab7ef622496af73e1076dc71
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
package com.stylefeng.guns.modular.api;
 
import com.stylefeng.guns.modular.system.service.ITaxiCardService;
import com.stylefeng.guns.modular.system.service.IUserInfoService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.TaxiCardWapper;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
import java.util.List;
 
/**
* 打车卡
* @author pzb
* @Date 2022/1/28 11:34
*/
@RestController
@RequestMapping("/api/taxiCard")
public class TaxiCardController {
 
    @Autowired
    private ITaxiCardService taxiCardService;
 
    @Autowired
    private IUserInfoService userInfoService;
 
 
 
 
 
    @ResponseBody
    @PostMapping("/getTaxiCardList")
    @ApiOperation(value = "1.0-获取购买打车卡列表", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-小件物流"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单类型(1=专车/快车,2=出租车,3=机场专线,7=景区直通车,8=公务出行)", name = "orderType", required = true, dataType = "int"),
            @ApiImplicitParam(value = "当前定位经度", name = "lon", required = true, dataType = "string"),
            @ApiImplicitParam(value = "当前定位纬度", name = "lat", required = true, dataType = "string"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<List<TaxiCardWapper>> getTaxiCardList(Integer orderType, String lon, String lat, HttpServletRequest request){
        try {
            Integer uid = userInfoService.getUserIdFormRedis(request);
            if(null == uid){
                return ResultUtil.tokenErr();
            }
            return taxiCardService.getTaxiCardList(uid, orderType, lon, lat);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
 
    @ResponseBody
    @PostMapping("/getTaxiCardInfo")
    @ApiOperation(value = "1.0-获取打车卡详情", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-小件物流"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "打车卡id", name = "id", required = true, dataType = "int"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<TaxiCardWapper> getTaxiCardInfo(Integer id){
        try {
            TaxiCardWapper taxiCardInfo = taxiCardService.getTaxiCardInfo(id);
            return ResultUtil.success(taxiCardInfo);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
    @ResponseBody
    @PostMapping("/payTaxiCard")
    @ApiOperation(value = "1.0-购买出行卡", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-小件物流"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "打车卡id", name = "id", required = true, dataType = "int"),
            @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝,3=其他)", name = "payType", required = true, dataType = "int"),
            @ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = true, dataType = "int"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil payTaxiCard(Integer id, Integer payType, Integer type, HttpServletRequest request){
        try {
            Integer uid = userInfoService.getUserIdFormRedis(request);
            if(null == uid){
                return ResultUtil.tokenErr();
            }
            return taxiCardService.payTaxiCard(uid, id, payType, type);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
 
 
    @ResponseBody
    @PostMapping("/getMyTaxiCardList")
    @ApiOperation(value = "1.0-获取我的出行卡列表", tags = {"用户端-个人中心"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单类型(1=专车/快车,2=出租车,3=机场专线,7=景区直通车,8=公务出行)", name = "orderType", required = true, dataType = "int"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<List<TaxiCardWapper>> getMyTaxiCardList(Integer orderType, HttpServletRequest request){
        try {
            Integer uid = userInfoService.getUserIdFormRedis(request);
            if(null == uid){
                return ResultUtil.tokenErr();
            }
            List<TaxiCardWapper> myTaxiCardList = taxiCardService.getMyTaxiCardList(uid, orderType);
            return ResultUtil.success(myTaxiCardList);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
    @ResponseBody
    @PostMapping("/getMyTaxiCardInfo")
    @ApiOperation(value = "1.0-获取我的出行卡详情", tags = {"用户端-个人中心"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "出行卡id", name = "id", required = true, dataType = "int"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<TaxiCardWapper> getMyTaxiCardInfo(Integer id){
        try {
            TaxiCardWapper myTaxiCardInfo = taxiCardService.getMyTaxiCardInfo(id);
            return ResultUtil.success(myTaxiCardInfo);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
}