puzhibing
2023-08-01 98bc380ae322eaac2ee7e21d0c565e30eacce2b5
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
package com.stylefeng.guns.modular.api;
 
 
import com.stylefeng.guns.modular.system.service.IServerCarModelService;
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 java.util.List;
import java.util.Map;
 
 
@Api
@RestController
@RequestMapping("/base/serverCarModel")
public class ServerCarModelController {
 
    @Autowired
    private IServerCarModelService serverCarModelService;
 
 
    /**
     * 获取车型和预估价格
     * @param startLonLat
     * @param endLonLat
     * @param type
     * @return
     */
    @ResponseBody
    @PostMapping("/queryServerCarModel")
    @ApiOperation(value = "选择起点终点后获取车型和预估价格", 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=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)", name = "type", required = true, dataType = "int")
    })
    public ResultUtil<List<ServerCarModelWarpper>> queryServerCarModel(String startLonLat, String endLonLat, Integer type){
        try {
            return serverCarModelService.queryServerCarModel(startLonLat, endLonLat, type);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
    @ResponseBody
    @PostMapping("/queryServerCarModels")
    @ApiOperation(value = "获取业务对应的所有车型", tags = {"用户端-包车"}, notes = "")
    @ApiImplicitParams({
    })
    public ResultUtil<List<ServerCarModelWarpper>> queryServerCarModels(){
        try {
            List<Map<String, Object>> list = serverCarModelService.queryServerCarModels(3);
            return ResultUtil.success(ServerCarModelWarpper.getServerCarModelWarppers(list));
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
}