puzhibing
2023-02-15 2811bab657aab4145b65a45a824fb63e93b58e30
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
package com.stylefeng.guns.modular.crossCity.controller;
 
 
import com.stylefeng.guns.modular.crossCity.server.ILineSiteService;
import com.stylefeng.guns.modular.crossCity.warpper.LineSiteWarpper;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.util.SystemException;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
import java.util.Map;
 
/**
 * 线路排班控制器
 */
@Api
@RestController
@RequestMapping("")
public class LineSiteController {
 
    @Autowired
    private ILineSiteService lineSiteService;
 
 
 
    @ResponseBody
    @RequestMapping(value = "/base/lineSite/queryDriver", method = RequestMethod.POST)
    @ApiOperation(value = "根据线路id获取线路排班数据", tags = {"用户端-跨城"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "线路id", name = "lineId", required = true, dataType = "int"),
            @ApiImplicitParam(value = "查询天(2020-09-03)", name = "day", required = true, dataType = "string"),
            @ApiImplicitParam(value = "司机id", name = "driverId", required = false, dataType = "int")
    })
    public ResultUtil<List<LineSiteWarpper>> queryDriver(Integer lineId, String day, Integer driverId){
        try {
            List<Map<String, Object>> list = lineSiteService.queryDriver(lineId, day, driverId);
            return ResultUtil.success(LineSiteWarpper.getLineSiteWarppers(list));
        } catch (SystemException se){
            return ResultUtil.error(se.getMessage());
        } catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
 
 
    @ResponseBody
    @RequestMapping(value = "/base/lineSite/querySeat", method = RequestMethod.POST)
    @ApiOperation(value = "根据司机的排班id获取剩余座位数据", tags = {"用户端-跨城"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "司机排班id", name = "id", required = true, dataType = "int"),
    })
    public ResultUtil<BaseWarpper> querySeat(Integer id){
        try {
            Map<String, Object> map = lineSiteService.querySeat(id);
            return ResultUtil.success(BaseWarpper.getBaseWarpper(map));
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
}