Controller
import cn.o.base.BaseController;
import cn.o.base.WebResult;
import cn.o.exception.JcException;
import cn.o.mapGrids.MapGridsService;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@Api(tags = "高德地图和网格", description = "高德地图和网格相关的 Rest API")
@RestController
@RequestMapping("/GaoDe")
public class GaoDeController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Resource
GoaDeService goaDeService;
@Resource
MapGridsService mapGridsService;
@ApiOperation("通过传入经纬度获取地区名,坐标点所在乡镇,乡镇街道编码")
@ApiImplicitParams({
@ApiImplicitParam(name = "location", value = "经纬度", required = true)
})
@RequestMapping("/nGet")
public WebResult NGetGaoDeAreaCode(String location) {
try {
return new WebResult(goaDeService.NGetGaoDeAreaCode(location));
} catch (JcException j) {
logger.error(j.toString(), j);
return new WebResult(j.getMessage());
} catch (Exception e) {
JcException je = loopGetExp(logger, e);
return new WebResult(je.getMessage());
}
}
@ApiOperation("通过传入地区名获取经纬度")
@ApiImplicitParams({
@ApiImplicitParam(name = "address", value = "地址名", required = true)
})
@RequestMapping("/getCoordinate")
public WebResult GetGaoDeCoordinate(String address) {
try {
return new WebResult(goaDeService.GetGaoDeCoordinate(address));
} catch (JcException j) {
logger.error(j.toString(), j);
return new WebResult(j.getMessage());
} catch (Exception e) {
JcException je = loopGetExp(logger, e);
return new WebResult(je.getMessage());
}
}
@ApiOperation("通过传入84经纬度获取地区名,坐标点所在乡镇,乡镇街道编码")
@ApiImplicitParams