package com.sqx.modules.timedtask.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.timedtask.service.RiderLocationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = {"定时任务-师傅定位"})
@RestController
@RequestMapping("/timedtask")
public class RiderLocationController {

    @Autowired
    private RiderLocationService riderLocationService;
    @ApiOperation("师傅定时更新经纬度")
    @GetMapping(value = "riderLocation")
    public Result riderLocation(Long userId, Double lng, Double lat, String province, String city, String district) {

        return riderLocationService.riderLocation(userId, lng, lat, province, city, district);
    }


    @ApiOperation("管理端查看师傅定位师傅")
    @GetMapping(value = "selectAllRiderLocation")
    public Result selectAllRiderLocation(String province, String city, String district,String nickName) {

        return Result.success().put("data", riderLocationService.selectAllRiderLocation(province, city, district,nickName));
    }

    /**
     * (用户端)获取附近司机数量
     * @return
     */
    @GetMapping("getUserRiderCount")
    public Result getUserRiderCount(String city,Double lng,Double lat){
        return Result.success().put("data", riderLocationService.getUserRiderCount(city,lng,lat));
    }


}
