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.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 io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.validation.Valid;
|
import java.util.List;
|
import java.util.Set;
|
|
@Slf4j
|
@RestController
|
@RequestMapping("/base/v1/mini-program")
|
@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("/pickup/nearest")
|
public R<NearestVo> nearest(@RequestBody @Valid NearestDto dto) {
|
return R.ok(xpPointService.nearest(dto));
|
}
|
|
|
/**
|
* 获取历史上车站点
|
* @param historyStartPointsDto
|
* @return
|
*/
|
@PostMapping("/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("/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("/xp-point/queryPointByName")
|
public R<XpPointsSearchVo> listAll(@RequestBody @Valid PointByNameQuery query) {
|
XpPointsSearchVo vo = xpPointService.queryPointByName(query);
|
return R.ok(vo);
|
}
|
|
|
@PostMapping("/inner/point/getPointsInfo")
|
public R<List<XpPoint>> getPointsInfo(@RequestBody Set<Long> points){
|
List<XpPoint> xpPoints = xpPointService.listByIds(points);
|
return R.ok(xpPoints);
|
}
|
|
/**
|
* 获取下单最大距离 最小距离
|
*/
|
@ApiOperation(value = "获取可下单最大距离 最小距离",tags = {"小程序-获取可下单最大距离 最小距离"},response = XpPoint.class)
|
@GetMapping("/xp-point/getOrderDistance")
|
public R<OrderDistanceVo> getOrderDistance() {
|
OrderDistanceVo vo = xpPointService.getOrderDistance();
|
return R.ok(vo);
|
}
|
|
|
/**
|
* 判断点位是在有效期内
|
* @param pointId
|
* @return
|
*/
|
@GetMapping("/inner/point/nowInTimePoint")
|
public R<Boolean> nowInTimePoint(@RequestParam Long pointId){
|
return R.ok(xpPointService.nowInTimePoint(pointId));
|
}
|
|
|
}
|