package com.stylefeng.guns.modular.api;
|
|
import com.stylefeng.guns.modular.system.service.IDispatchService;
|
import com.stylefeng.guns.modular.system.service.ILineService;
|
import com.stylefeng.guns.modular.system.service.ILineShiftService;
|
import com.stylefeng.guns.modular.system.service.IOrderCrossCityService;
|
import com.stylefeng.guns.modular.system.util.ResultUtil;
|
import com.stylefeng.guns.modular.system.warpper.BaseWarpper;
|
import com.stylefeng.guns.modular.system.warpper.RosterWarpper;
|
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.*;
|
|
import javax.servlet.http.HttpServletRequest;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* 线路控制器
|
*/
|
@Api
|
@RestController
|
@RequestMapping("/api/line")
|
public class LineController {
|
|
@Autowired
|
private ILineService lineService;
|
|
@Autowired
|
private IDispatchService dispatchService;
|
|
@Autowired
|
private ILineShiftService lineShiftService;
|
|
@Autowired
|
private IOrderCrossCityService orderCrossCityService;
|
|
|
|
|
|
/**
|
* 获取所有线路
|
* @param request
|
* @return
|
*/
|
@ResponseBody
|
@PostMapping("/queryLine")
|
@ApiOperation(value = "获取所有线路", tags = {"调度端-订单管理", "调度端-排班管理"}, notes = "")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
|
})
|
public ResultUtil<List<BaseWarpper>> queryLine(HttpServletRequest request){
|
try {
|
Integer uid = dispatchService.getUserIdFormRedis(request);
|
if(null == uid){
|
return ResultUtil.tokenErr();
|
}
|
List<Map<String, Object>> list = lineService.queryLine(uid);
|
return ResultUtil.success(BaseWarpper.getBaseWarppers(list));
|
}catch (Exception e){
|
e.printStackTrace();
|
return ResultUtil.runErr();
|
}
|
}
|
|
|
/**
|
* 根据选择的起点和终点获取线路
|
* @param startId
|
* @param endId
|
* @return
|
*/
|
@ResponseBody
|
@RequestMapping(value = "/queryLines", method = RequestMethod.POST)
|
@ApiOperation(value = "根据选择的起点和终点获取线路", tags = {"调度端-添加订单"}, notes = "")
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "起始站点id", name = "startId", required = true, dataType = "int"),
|
@ApiImplicitParam(value = "终点站点id", name = "endId", required = true, dataType = "int"),
|
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
|
})
|
public ResultUtil<List<BaseWarpper>> queryLines(Integer startId, Integer endId, HttpServletRequest request){
|
try {
|
Integer uid = dispatchService.getUserIdFormRedis(request);
|
if(null == uid){
|
return ResultUtil.tokenErr();
|
}
|
List<Map<String, Object>> list = lineService.queryLines(startId, endId, uid);
|
return ResultUtil.success(BaseWarpper.getBaseWarppers(list));
|
}catch (Exception e){
|
e.printStackTrace();
|
return ResultUtil.runErr();
|
}
|
}
|
|
/**
|
* 获取线路排班数据
|
* @param lineId
|
* @return
|
*/
|
@ResponseBody
|
@RequestMapping(value = "/queryLineShiftByLineId", method = RequestMethod.POST)
|
@ApiOperation(value = "获取线路排班数据", tags = {"调度端-排班管理"}, notes = "")
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "线路id", name = "lineId", required = true, dataType = "int"),
|
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
|
})
|
public ResultUtil<List<BaseWarpper>> queryByLineId(Integer lineId){
|
try {
|
List<Map<String, Object>> list = lineShiftService.queryByLineId(lineId);
|
return ResultUtil.success(BaseWarpper.getBaseWarppers(list));
|
}catch (Exception e){
|
e.printStackTrace();
|
return ResultUtil.runErr();
|
}
|
}
|
|
|
/**
|
* 获取排班详情
|
* @param lineShiftId
|
* @param time
|
* @return
|
*/
|
@ResponseBody
|
@RequestMapping(value = "/queryLineShiftInfo", method = RequestMethod.POST)
|
@ApiOperation(value = "获取排班详情", tags = {"调度端-排班管理"}, notes = "")
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "排班数据id", name = "lineShiftId", required = true, dataType = "int"),
|
@ApiImplicitParam(value = "查询日期(2020-10-13)", name = "time", required = true, dataType = "string"),
|
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
|
})
|
public ResultUtil<List<RosterWarpper>> queryLineShiftInfo(Integer lineShiftId, String time){
|
try {
|
List<Map<String, Object>> list = lineShiftService.queryLineShiftInfo(lineShiftId, time);
|
return ResultUtil.success(RosterWarpper.getRosterWarppers(list));
|
}catch (Exception e){
|
e.printStackTrace();
|
return ResultUtil.runErr();
|
}
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/queryOrderMoney", method = RequestMethod.POST)
|
@ApiOperation(value = "获取跨城的支付金额", tags = {"调度端-添加订单"}, notes = "distance:距离数(米),price:支付金额")
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "起点坐标(103.32123,30.6232)", name = "startLonLat", required = true, dataType = "int"),
|
@ApiImplicitParam(value = "终点坐标(103.32123,30.6232)", name = "endLonLat", required = true, dataType = "int"),
|
@ApiImplicitParam(value = "乘车人数", name = "peopleNumber", required = true, dataType = "int"),
|
@ApiImplicitParam(value = "出行方式(1=拼车,2=包车)", name = "travelMode", required = true, dataType = "int"),
|
@ApiImplicitParam(value = "线路id", name = "lineId", required = true, dataType = "int"),
|
@ApiImplicitParam(value = "服务车型id", name = "serverCarModelId", required = true, dataType = "int"),
|
@ApiImplicitParam(value = "车辆总座位数", name = "totalSeat", required = true, dataType = "int"),
|
@ApiImplicitParam(value = "座位编号(1,3,4)", name = "seatNumber", required = true, dataType = "int")
|
})
|
public ResultUtil queryOrderMoney(String startLonLat, String endLonLat, Integer peopleNumber, Integer travelMode,
|
Integer lineId, Integer serverCarModelId, Integer totalSeat, String seatNumber){
|
try {
|
return orderCrossCityService.queryOrderMoney(startLonLat, endLonLat, peopleNumber, travelMode, lineId, serverCarModelId, totalSeat, seatNumber);
|
}catch (Exception e){
|
e.printStackTrace();
|
return ResultUtil.runErr();
|
}
|
}
|
|
|
}
|