package com.stylefeng.guns.modular.api; import com.stylefeng.guns.modular.system.service.IServerCarModelService; import com.stylefeng.guns.modular.system.service.IUserInfoService; import com.stylefeng.guns.modular.system.util.ResultUtil; import com.stylefeng.guns.modular.system.warpper.ServerCarModelWarpper; 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.List; import java.util.Map; @Api @RestController @RequestMapping("/base/serverCarModel") public class ServerCarModelController { @Autowired private IServerCarModelService serverCarModelService; @Autowired private IUserInfoService userInfoService; /** * 获取车型和预估价格 * @param startLonLat * @param endLonLat * @param type * @return */ @ResponseBody @PostMapping("/queryServerCarModel") @ApiOperation(value = "选择起点终点后获取车型和预估价格【2.0】", tags = {"用户端-专车", "用户端-小件物流"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "起点经纬度(103.22121,,30.26123)", name = "startLonLat", required = true, dataType = "string"), @ApiImplicitParam(value = "终点经纬度(103.22121,,30.26123)", name = "endLonLat", required = true, dataType = "string"), @ApiImplicitParam(value = "语言类型(1=简体中文,2=英语,3=法语)", name = "language", required = false, dataType = "int"), @ApiImplicitParam(value = "业务类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)", name = "type", required = true, dataType = "int") }) public ResultUtil> queryServerCarModel(String startLonLat, String endLonLat, Integer type, Integer language, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); return serverCarModelService.queryServerCarModel(uid, startLonLat, endLonLat, type, language); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @ResponseBody @PostMapping("/queryServerCarModels") @ApiOperation(value = "获取业务对应的所有车型", tags = {"用户端-包车"}, notes = "") @ApiImplicitParams({ }) public ResultUtil> queryServerCarModels(){ try { List> list = serverCarModelService.queryServerCarModels(3); return ResultUtil.success(ServerCarModelWarpper.getServerCarModelWarppers(list)); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } }