rk
3 天以前 21bd711a3756850299b443848181ee60708c6377
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
155
156
157
158
159
160
161
162
163
164
165
package com.doumee.api.web;
 
import com.doumee.core.annotation.LoginDriverRequired;
import com.doumee.core.annotation.LoginRequired;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.dto.DriverActiveOrderDTO;
import com.doumee.dao.dto.DriverGrabOrderDTO;
import com.doumee.dao.dto.DriverLoginRequest;
import com.doumee.dao.dto.DriverRegisterRequest;
import com.doumee.dao.dto.DriverVerifyRequest;
import com.doumee.dao.vo.AccountResponse;
import com.doumee.dao.vo.DriverCenterVO;
import com.doumee.dao.vo.DriverGrabOrderVO;
import com.doumee.dao.vo.DriverOrderDetailVO;
import com.doumee.service.business.DriverInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.validation.Valid;
import java.util.List;
 
/**
 * 司机验证码登录接口
 * @author rk
 * @date 2026/04/08
 */
@Api(tags = "司机验证码登录")
@Trace(exclude = true)
@RestController
@RequestMapping("/web/driverInfo")
@Slf4j
public class DriverInfoApi extends ApiController {
 
    @Autowired
    private DriverInfoService driverInfoService;
 
    @Trace
    @ApiOperation(value = "发送验证码", notes = "司机验证码登录")
    @GetMapping("/sendCode")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "telephone", value = "手机号", required = true)
    })
    public ApiResponse sendCode(@RequestParam String telephone) {
        driverInfoService.sendRegisterCode(telephone);
        return ApiResponse.success("验证码发送成功");
    }
 
    @Trace
    @ApiOperation(value = "司机验证码登录", notes = "手机号+验证码,无账号自动注册并登录")
    @PostMapping("/register")
    public ApiResponse<AccountResponse> register(@RequestBody DriverRegisterRequest request) {
        return ApiResponse.success("注册成功", driverInfoService.register(request));
    }
 
    @Trace
    @ApiOperation(value = "司机登录", notes = "手机号+密码登录")
    @PostMapping("/login")
    public ApiResponse<AccountResponse> login(@RequestBody DriverLoginRequest request) {
        return ApiResponse.success("登录成功", driverInfoService.login(request));
    }
 
    @LoginDriverRequired
    @Trace
    @ApiOperation(value = "提交实名认证", notes = "初次提交或驳回后修改")
    @PostMapping("/submitVerify")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse submitVerify(@RequestBody DriverVerifyRequest request) {
        driverInfoService.submitVerify(this.getDriverId(), request);
        return ApiResponse.success("提交成功");
    }
 
    @LoginDriverRequired
    @Trace
    @ApiOperation(value = "查询实名认证详情", notes = "司机端查询")
    @GetMapping("/verifyDetail")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse verifyDetail() {
        return ApiResponse.success(driverInfoService.getVerifyDetail(this.getDriverId()));
    }
 
    @LoginDriverRequired
    @Trace
    @ApiOperation(value = "切换接单状态", notes = "0=未接单;1=接单中")
    @GetMapping("/updateAcceptingStatus")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "status", value = "接单状态:0=未接单;1=接单中", required = true)
    })
    public ApiResponse updateAcceptingStatus(@RequestParam Integer status) {
        driverInfoService.updateAcceptingStatus(this.getDriverId(), status);
        return ApiResponse.success("操作成功");
    }
 
    @LoginDriverRequired
    @Trace
    @ApiOperation(value = "更新实时定位", notes = "司机端上报当前位置经纬度")
    @GetMapping("/updateLocation")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Double", name = "longitude", value = "经度", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Double", name = "latitude", value = "纬度", required = true)
    })
    public ApiResponse updateLocation(@RequestParam Double longitude, @RequestParam Double latitude) {
        driverInfoService.updateLocation(this.getDriverId(), longitude, latitude);
        return ApiResponse.success("操作成功");
    }
 
    @LoginDriverRequired
    @Trace
    @ApiOperation(value = "司机端首页信息", notes = "姓名、头像、车牌号、评分、今日佣金、今日接单数、余额")
    @GetMapping("/centerInfo")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse<DriverCenterVO> centerInfo() {
        return ApiResponse.success("操作成功", driverInfoService.getDriverCenterInfo(this.getDriverId()));
    }
 
    @LoginDriverRequired
    @Trace
    @ApiOperation(value = "司机抢单大厅", notes = "分页查询可抢的异地寄存订单")
    @PostMapping("/grabOrderHall")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse<PageData<DriverGrabOrderVO>> grabOrderHall(@RequestBody PageWrap<DriverGrabOrderDTO> pageWrap) {
        return ApiResponse.success("操作成功", driverInfoService.grabOrderHall(this.getDriverId(), pageWrap));
    }
 
    @LoginDriverRequired
    @Trace
    @ApiOperation(value = "司机进行中订单", notes = "查询已抢单(status=3)或派送中(status=4)的订单列表")
    @PostMapping("/activeOrders")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse<List<DriverGrabOrderVO>> activeOrders(@RequestBody @Valid DriverActiveOrderDTO dto) {
        return ApiResponse.success("操作成功", driverInfoService.activeOrders(this.getDriverId(), dto));
    }
 
    @LoginDriverRequired
    @Trace
    @ApiOperation(value = "司机端订单详情", notes = "根据订单主键查询详情")
    @GetMapping("/orderDetail")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "orderId", value = "订单主键", required = true)
    })
    public ApiResponse<DriverOrderDetailVO> orderDetail(@RequestParam Integer orderId) {
        return ApiResponse.success("操作成功", driverInfoService.driverOrderDetail(this.getDriverId(), orderId));
    }
 
}