zhibing.pu
2024-04-19 2d3b7304911a393e73ec0dd48712f22ddfa8053a
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
package com.stylefeng.guns.modular.specialTrain.controller;
 
 
import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar;
import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService;
import com.stylefeng.guns.modular.system.service.IUserInfoService;
import com.stylefeng.guns.modular.system.util.PushUtil;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.BaseWarpper;
import io.swagger.annotations.Api;
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.Date;
 
@Api
@RestController
@RequestMapping("")
public class OrderPrivateCarController {
 
    @Autowired
    private IOrderPrivateCarService orderPrivateCarService;
 
    @Autowired
    private IUserInfoService userInfoService;
 
 
    @Autowired
    private PushUtil pushUtil;
 
    /**
     * 专车下单
     * @param serverCarModelId
     * @param travelTime
     * @param orderType
     * @param substitute
     * @param placementLon
     * @param placementLat
     * @param startLon
     * @param startLat
     * @param startAddress
     * @param endLon
     * @param endLat
     * @param endAddress
     * @param passengers
     * @param passengersPhone
     * @param orderSource
     * @param driverId
     * @param request
     * @return
     */
    @ResponseBody
    @PostMapping("/api/orderPrivateCar/saveOrderPrivateCar")
    @ApiOperation(value = "专车下单/扫码下单", tags = {"用户端-专车"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单类型(1=普通订单,2=摆渡订单)", name = "type", required = true, dataType = "int"),
            @ApiImplicitParam(value = "服务车型id(扫码下单不用上传)", name = "serverCarModelId", required = false, dataType = "int"),
            @ApiImplicitParam(value = "出行时间(2020-08-20 10:10)", name = "travelTime", required = true, dataType = "string"),
            @ApiImplicitParam(value = "是否预约(1=否,2=是)", name = "orderType", required = true, dataType = "int"),
            @ApiImplicitParam(value = "是否代下单(0=否,1=是)", name = "substitute", required = true, dataType = "int"),
            @ApiImplicitParam(value = "下单地点经度", name = "placementLon", required = true, dataType = "string"),
            @ApiImplicitParam(value = "下单地点纬度", name = "placementLat", required = true, dataType = "string"),
            @ApiImplicitParam(value = "起点经度", name = "startLon", required = true, dataType = "string"),
            @ApiImplicitParam(value = "起点纬度", name = "startLat", required = true, dataType = "string"),
            @ApiImplicitParam(value = "起点地址", name = "startAddress", required = true, dataType = "string"),
            @ApiImplicitParam(value = "终点经度", name = "endLon", required = true, dataType = "string"),
            @ApiImplicitParam(value = "终点纬度", name = "endLat", required = true, dataType = "string"),
            @ApiImplicitParam(value = "终点地址", name = "endAddress", required = true, dataType = "string"),
            @ApiImplicitParam(value = "订单来源(1:APP下单,2:扫码下单,3:小程序下单,4:司机下单,5:调度下单)", name = "orderSource", required = true, dataType = "int"),
            @ApiImplicitParam(value = "司机id(扫码下单必传)", name = "driverId", required = false, dataType = "int"),
            @ApiImplicitParam(value = "乘客姓名(代下单必传)", name = "passengers", required = false, dataType = "string"),
            @ApiImplicitParam(value = "乘客电话(代下单必传)", name = "passengersPhone", required = false, dataType = "string"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<BaseWarpper> saveOrderPrivateCar(Integer serverCarModelId, Date travelTime, Integer orderType, Integer substitute, String placementLon, String placementLat, String startLon, String startLat,
                                                       String startAddress, String endLon, String endLat, String endAddress, String passengers, String passengersPhone, Integer orderSource, Integer driverId,
                                                       Integer type, Integer language, HttpServletRequest request){
        try {
            Integer uid = userInfoService.getUserIdFormRedis(request);
            if(null == uid){
                return ResultUtil.tokenErr();
            }
            return orderPrivateCarService.saveOrderPrivateCar(serverCarModelId, travelTime, orderType, substitute, placementLon, placementLat,
                    startLon, startLat, startAddress, endLon, endLat, endAddress, passengers, passengersPhone, orderSource, driverId, type, uid, language);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
}