yanghb
2023-04-26 eac64ab2177983cba3a13d2b1a50baa9ab6ff75c
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
package com.stylefeng.guns.modular.taxi.controller;
 
import com.alibaba.fastjson.JSON;
import com.stylefeng.guns.modular.system.service.IDriverService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.OrderDriverWarpper;
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 java.util.Map;
 
/**
 * 出租车模块的司机控制器
 */
@RestController
@RequestMapping("/api/taxiDrive")
public class TaxiDriverController {
 
    @Autowired
    private IDriverService driverService;
 
 
    /**
     * 根据订单id获取司机数据
     * @param id
     * @return
     */
    @ResponseBody
    @PostMapping("/queryOrderDriver")
    @ApiOperation(value = "根据订单id获取司机数据", tags = {"用户端-出租车", "用户端-专车"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"),
            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<OrderDriverWarpper> queryOrderDriver(Integer id, Integer orderType){
        try {
            Map<String, Object> map = driverService.queryOrderDriver(id, orderType);
            // TODO: 2020/5/25 需要推送订单数据
            OrderDriverWarpper orderDriverWarpper = OrderDriverWarpper.getOrderDriverWarpper(map);
            System.out.println(JSON.toJSONString(orderDriverWarpper));
            return ResultUtil.success(orderDriverWarpper);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
}