puzhibing
2026-04-24 7ea060d3acfdee74d24e2207e746c2061ee78a48
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package com.xiaopeng.operation.controller;
 
 
import com.xiaopeng.api.dto.order.HistoryEndPointsDto;
import com.xiaopeng.api.dto.order.HistoryStartPointsDto;
import com.xiaopeng.api.model.operation.XpPoint;
import com.xiaopeng.api.vo.order.XpHistoryEndPointsVo;
import com.xiaopeng.api.vo.order.XpHistoryStartPointsVo;
import com.xiaopeng.api.vo.order.XpPointInfoVo;
import com.xiaopeng.api.vo.order.XpPointsListVo;
import com.xiaopeng.api.vo.order.XpPointsSearchVo;
import com.xiaopeng.common.core.domain.R;
import com.xiaopeng.common.core.web.controller.BaseController;
import com.xiaopeng.operation.dto.NearestDto;
import com.xiaopeng.operation.query.PointByNameQuery;
import com.xiaopeng.operation.service.XpPointService;
import com.xiaopeng.operation.vo.NearestVo;
import com.xiaopeng.operation.vo.OrderDistanceVo;
import com.xiaopeng.unifiedverification.interceptor.XpClientCheck;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
import java.util.Set;
 
@Slf4j
@RestController
@RequestMapping("")
@Api(tags = "点位模块")
public class XpPointController extends BaseController {
 
    private final XpPointService xpPointService;
 
    public XpPointController(XpPointService xpPointService) {
        this.xpPointService = xpPointService;
    }
 
 
    /**
     * 获取附近上车站点
     */
    @ApiOperation(value = "获取附近上车站点",tags = {"小程序-附近上车站点"},response = XpPoint.class)
    @PostMapping("/base/v1/mini-program/pickup/nearest")
    @XpClientCheck(checkToken = false, checkOtpToken = true)
    public R<NearestVo> nearest(@RequestBody @Valid NearestDto dto, HttpServletRequest request) {
        // uid已通过拦截器otp校验,可以直接使用
        String uid = request.getHeader("XP-Uid");
        return R.ok(xpPointService.nearest(dto, uid));
    }
 
 
    /**
     * 获取历史上车站点
     * @param historyStartPointsDto
     * @return
     */
    @PostMapping("/base/v1/xp-point/getHistoryStartPoints")
    public R<List<XpHistoryStartPointsVo>> getHistoryStartPoints(@RequestBody HistoryStartPointsDto historyStartPointsDto){
        List<XpHistoryStartPointsVo> xpPoints = xpPointService.getHistoryStartPoints(historyStartPointsDto);
        return R.ok(xpPoints);
    }
 
    /**
     * 获取历史下车站点
     * @param historyEndPointsDto
     * @return
     */
    @PostMapping("/base/v1/xp-point/getHistoryEndPoints")
    public R<List<XpHistoryEndPointsVo>> getHistoryEndPoints(@RequestBody HistoryEndPointsDto historyEndPointsDto){
        List<XpHistoryEndPointsVo> xpPoints = xpPointService.getHistoryEndPoints(historyEndPointsDto);
        return R.ok(xpPoints);
    }
 
 
    /**
     * 根据名称获取点位列表
     */
    @ApiOperation(value = "根据名称poi获取点位列表",tags = {"小程序-根据名称获取点位列表"},response = XpPoint.class)
    @PostMapping("/base/v1/mini-program/xp-point/queryPointByName")
    @XpClientCheck(checkToken = false, checkOtpToken = true)
    public R<XpPointsSearchVo> listAll(@RequestBody @Valid PointByNameQuery query, HttpServletRequest request) {
        String uid = request.getHeader("XP-Uid");
        XpPointsSearchVo vo = xpPointService.queryPointByName(query, uid);
        return R.ok(vo);
    }
 
 
    @PostMapping("/logan/inner/v1/point/getPointsInfo")
    public R<List<XpPoint>> getPointsInfo(@RequestBody Set<Long> points){
        List<XpPoint> xpPoints = xpPointService.listByIds(points);
        return R.ok(xpPoints);
    }
 
    @GetMapping("/logan/inner/v1/point/getStationChildren")
    public R<List<XpPointsListVo>> getStationChildren(@RequestParam Long stationId){
        return R.ok(xpPointService.getStationChildren(stationId));
    }
 
    /**
     * 获取下单最大距离 最小距离
     */
    @ApiOperation(value = "获取可下单最大距离 最小距离",tags = {"小程序-获取可下单最大距离 最小距离"},response = XpPoint.class)
    @GetMapping("/base/v1/mini-program/xp-point/getOrderDistance")
    public R<OrderDistanceVo> getOrderDistance() {
        OrderDistanceVo vo = xpPointService.getOrderDistance();
        return R.ok(vo);
    }
 
 
    /**
     * 判断点位是在有效期内
     * @param pointId
     * @return
     */
    @GetMapping("/logan/inner/v1/point/nowInTimePoint")
    public R<Boolean> nowInTimePoint(@RequestParam Long pointId){
        return R.ok(xpPointService.nowInTimePoint(pointId));
    }
 
 
 
 
}