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 register(@RequestBody DriverRegisterRequest request) { return ApiResponse.success("注册成功", driverInfoService.register(request)); } @Trace @ApiOperation(value = "司机登录", notes = "手机号+密码登录") @PostMapping("/login") public ApiResponse 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 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> grabOrderHall(@RequestBody PageWrap 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> 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 orderDetail(@RequestParam Integer orderId) { return ApiResponse.success("操作成功", driverInfoService.driverOrderDetail(this.getDriverId(), orderId)); } }