package com.stylefeng.guns.modular.CharteredCar.controller; import com.stylefeng.guns.modular.CharteredCar.server.IOrderCharteredCarService; import com.stylefeng.guns.modular.system.service.IUserInfoService; import com.stylefeng.guns.modular.system.util.ResultUtil; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; 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("/api/orderCharteredCar") public class OrderCharteredCarController { @Autowired private IOrderCharteredCarService orderCharteredCarService; @Autowired private IUserInfoService userInfoService; @ResponseBody @RequestMapping(value = "/orderCharteredCar", method = RequestMethod.POST) @ApiOperation(value = "提交包车订单", tags = {"用户端-包车"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "出行时间(2020-09-21 16:00:00)", name = "travelTime", required = true, dataType = "string"), @ApiImplicitParam(value = "用车时长", name = "carTime", required = true, dataType = "int"), @ApiImplicitParam(value = "服务车型id", name = "serverCarModelId", required = true, dataType = "int"), @ApiImplicitParam(value = "车型用途", name = "modelUse", required = true, dataType = "string"), @ApiImplicitParam(value = "出行人数", name = "peopleNumber", required = true, dataType = "int"), @ApiImplicitParam(value = "联系人", name = "contactPerson", required = true, dataType = "string"), @ApiImplicitParam(value = "联系电话", name = "contactPhone", required = true, dataType = "string"), @ApiImplicitParam(value = "下单地点经纬度(103.1233,30.135412)", name = "placeLonLat", required = true, dataType = "string"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil orderCharteredCar(Date travelTime, Integer carTime, Integer serverCarModelId, String modelUse, Integer peopleNumber, String contactPerson, String contactPhone, String placeLonLat, Integer language, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } return orderCharteredCarService.orderCharteredCar(travelTime, carTime, serverCarModelId, modelUse, peopleNumber, contactPerson, contactPhone, placeLonLat, uid, language); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } }