package com.yami.shop.api.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yami.shop.bean.app.param.OrderPayInfoParam;
import com.yami.shop.bean.model.OrderRiderLocation;
import com.yami.shop.common.util.R;
import com.yami.shop.service.OrderRiderLocationService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * 订单配送骑手位置实现
 *
 * @author fbj
 * @version 1.0.0
 * @since 2025-10-15
 */
@RestController
@RequestMapping("/p/location")
public class OrderRiderLocationController {

    @Resource
    private OrderRiderLocationService orderRiderLocationService;


//    /**
//     * 分页获取
//     *
//     * @param pageParam          分页参数
//     * @param orderRiderLocation 订单配送骑手位置
//     */
//    @GetMapping("/page")
//    public Page<OrderRiderLocation> page(Page<OrderRiderLocation> pageParam, OrderRiderLocation orderRiderLocation) {
//        return orderRiderLocationService.page(pageParam, orderRiderLocation);
//    }

    /**
     * 通过订单号获取骑手位置信息
     * @param orderNumber 订单号
     *
     */
    @GetMapping("/info")
    @ApiOperation(value = "通过订单号获取", notes = "通过订单号获取")
    @ApiImplicitParam(name = "orderNumber", value = "订单流水号", required = true, dataType = "String")
    public R<OrderRiderLocation> getOrderPayInfoByOrderNumber(@RequestParam("orderNumber") String orderNumber) {

        return R.SUCCESS(orderRiderLocationService.getOne(new LambdaQueryWrapper<OrderRiderLocation>()
                .eq(OrderRiderLocation::getOrderNumber, orderNumber)));
    }


}
