package com.bohuikeji.frame.module.admin.controller.api.open;

import com.bohuikeji.frame.module.admin.base.ApiController;
import com.bohuikeji.frame.module.admin.entity.back.APIEntity;
import com.bohuikeji.frame.module.admin.entity.vo.AddressVo;
import com.bohuikeji.frame.module.admin.utils.MapUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 高德地图开放接口
 * @author 孙劲辉
 */
@Slf4j
@Api(tags = {"第三方开放平台——高德地图相关接口"})
@RestController
@RequestMapping("/api/open/gd")
public class GaoDeApi extends ApiController {
    /**
     * 高德逆地理编码接口
     * @param location
     * @return
     */
    @ApiOperation("逆地理编码")
    @GetMapping("/get/address")
    @ApiImplicitParams({
            @ApiImplicitParam(name="location",value="坐标地址经纬度(经度,维度)",dataType="String", paramType = "query",example="116.310003,39.991957",required=true)})
    public APIEntity<AddressVo> getAddress(String location){
        return APIEntity.success(MapUtils.getAddressReGeo(location));
    }
}
