package com.ruoyi.ibs.grid.controller;

import com.fasterxml.jackson.databind.JsonNode;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.ibs.grid.service.BaiduApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author 吴凯程
 * @Date 2025/8/11
 **/
@Api(tags = "百度接口")
@RestController
@RequestMapping("/baidu")
public class BaiduApiController {
    @Resource
    private BaiduApiService baiduApiService;

    @Anonymous
    @ApiOperation("百度地理编码接口")
    @GetMapping("/geocoding")
    public JsonNode geocoding(String address) {
        return baiduApiService.geocodingByJSON(address);
    }

    @Anonymous
    @ApiOperation("百度逆地理编码接口")
    @GetMapping("/reverse/geocoding")
    public JsonNode reverseGeocoding(String location) {
        return baiduApiService.reverseGeocoding(location);
    }

}
