当前位置: 首页 > wzjs >正文

自我介绍ppt配图seo案例分享

自我介绍ppt配图,seo案例分享,淘宝上做淘宝客的网站,在哪家公司建设网站好文章目录 1、注册百度地图账号2、编写代码2.1、添加openfeign依赖2.2、主启动类加注解EnableFeignClients2.3、写远程调用的OpenFeign接口 3、测试&响应结果4、添加feign日志&注意事项4.1、添加日志4.2、注意事项 1、注册百度地图账号 https://lbsyun.baidu.com/apico…

文章目录

    • 1、注册百度地图账号
    • 2、编写代码
      • 2.1、添加openfeign依赖
      • 2.2、主启动类加注解@EnableFeignClients
      • 2.3、写远程调用的OpenFeign接口
    • 3、测试&响应结果
    • 4、添加feign日志&注意事项
      • 4.1、添加日志
      • 4.2、注意事项

1、注册百度地图账号

https://lbsyun.baidu.com/apiconsole/key

在这里插入图片描述
获取AK(COPY出来,以后要用)
在这里插入图片描述
查看百度地图逆地理解析接口文档:

PI服务地址
https://api.map.baidu.com/reverse_geocoding/v3/?ak=您的ak&extensions_poi=1&entire_poi=1&sort_strategy=distance&output=json&coordtype=bd09ll&location=39.951335108535, 116.51484487905
//GET请求

请求地址:

get: https://api.map.baidu.com/reverse_geocoding/v3/

请求参数如下:

在这里插入图片描述

keyvalue
ak:“PRyu1SQEdG4rihx0RDxxxxxxx”,
output:“json”,
extensionsPoi:“1”,
location:“31.225696563611,121.49884033194”

参数说明:

ak:百度地图 API Key(需要自己申请)

output:输出格式(json/xml)

extensions_poi 是一个 扩展参数,用于返回周边的 POI(兴趣点,Points of Interest) 信息,例如餐馆、商店、学校等。

location:经纬度(格式 lat,lng)

2、编写代码

2.1、添加openfeign依赖

        <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId></dependency>

2.2、主启动类加注解@EnableFeignClients

@EnableFeignClients
//@EnableDiscoveryClient //核心注解
@SpringBootApplication
public class OrderMainApplication {public static void main(String[] args) {SpringApplication.run(OrderMainApplication.class, args);}
}

2.3、写远程调用的OpenFeign接口

package com.tigerhhzz.order.openfeign;import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;/*** @Author tigerhhzz* @Date 2025 03 25 13 00**/
@FeignClient(value = "baidumap-client",url = "http://api.map.baidu.com")
public interface BaiduMapOpenfeign {@GetMapping("/reverse_geocoding/v3")String getLocationByLonLat(@RequestParam String ak, @RequestParam String output, @RequestParam String extensionsPoi, @RequestParam String location);}

3、测试&响应结果

package com.tigerhhzz.order;import com.tigerhhzz.order.openfeign.BaiduMapOpenfeign;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;/*** @Author tigerhhzz* @Date 2025 03 25 13 07**/
@SpringBootTest
public class BaidumapTest {@AutowiredBaiduMapOpenfeign baiduMapOpenfeign;@Testvoid test01(){String location = baiduMapOpenfeign.getLocationByLonLat("PRyu1SQEdG4rihxxxxxxS8NIcsc", "json", "1", "31.225696563611,121.49884033194");System.out.println(location);}
}

响应结果(包含 POI 信息):

{"status": 0,"result": {"location": {"lng": 121.49884033193993,"lat": 31.225696429417988},"formatted_address": "上海市黄浦区净土街31弄-4号","edz": {"name": "陆家嘴金融贸易区"},"business": "老西门,城隍庙,西藏南路","business_info": [{"name": "老西门","location": {"lng": 121.49270784559798,"lat": 31.22284211295233},"adcode": 310101,"distance": 0,"direction": "内"},{"name": "城隍庙","location": {"lng": 121.49754405297205,"lat": 31.231853482990294},"adcode": 310101,"distance": 394,"direction": "南"},{"name": "西藏南路","location": {"lng": 121.49155262471214,"lat": 31.219955867050826},"adcode": 310101,"distance": 629,"direction": "东北"}],"addressComponent": {"country": "中国","country_code": 0,"country_code_iso": "CHN","country_code_iso2": "CN","province": "上海市","city": "上海市","city_level": 2,"district": "黄浦区","town": "老西门街道","town_code": "310101019","distance": "58","direction": "北","adcode": "310101","street": "净土街","street_number": "31弄-4号"},"pois": [],"roads": [],"poiRegions": [],"sematic_description": "","formatted_address_poi": "","cityCode": 289}
}

formatted_address:地址信息

pois:POI 兴趣点列表

name:兴趣点名称

addr:兴趣点地址

point:兴趣点坐标

distance:距离查询点的距离(单位:米)

tag:类别(如景点、商场、餐厅等)

4、添加feign日志&注意事项

4.1、添加日志

在配置文件application.yml中添加:

logging:level:com.tigerhhzz.order.openfeign: debug

然后新建如下配置类:

package com.tigerhhzz.order.config;import feign.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;@Configuration
public class OrderServiceConfig {@Beanpublic RestTemplate restTemplate(){return new RestTemplate();}@BeanLogger.Level feignLoggerLevel(){return Logger.Level.FULL;}
}

日志输出:

在这里插入图片描述

4.2、注意事项

在百度地图控制台,相应的api接口中加上发送请求主机的ip白名单;否则会提示如下检验失败的信息:
在这里插入图片描述

在这里插入图片描述


真正的强大不是忘记,而是接受


http://www.dtcms.com/wzjs/168263.html

相关文章:

  • wordpress商品多选西安seo包年服务
  • 用网站做淘宝客的人多吗合肥百度快速排名提升
  • vr成品网站源码在线观看成人教育培训机构十大排名
  • 电商网站开发分析百度网盘搜索引擎网站
  • 负责政府网站建设管理维护竞价系统
  • 建设部勘察设计网站搜索图片
  • 室内设计专业作品集顺德搜索seo网络推广
  • 如何写网站代码是什么原因网站广告调词平台
  • fullpage wow做的网站产品营销软文
  • 长沙网站优化外包外链推广网站
  • 北滘网站设计西安seo网站建设
  • 做网站的被拘留了网络营销推广方案整合
  • 类似qq空间的网站拼多多seo怎么优化
  • 东莞土木建筑学会网站广州竞价外包
  • 在线商城网站模板上海百度推广开户
  • 博山政府网站建设哪家专业百度品牌广告
  • 网站的软文 怎么做推广网络推广外包公司排名
  • 潜江网站开发seo指导
  • 网站建设业务员沟通需求专业做网站公司
  • 制作卖东西网站seo排名快速
  • 熊掌号做网站推广的注意事项网络营销方案
  • 温州排名推广优化神马排名软件
  • 简历旅游网站开发经验百度pc网页版入口
  • asp.net网站开发pdf企业做推广有用吗
  • 网站建设_你真的懂吗?爱站网关键词密度查询
  • 模板网站制作多少钱怎么弄一个自己的网站
  • 做设计必看十大网站长沙网站推广和优化
  • 网站建设过程报告seo如何建立优化网站
  • 房地产建筑公司网站推广网站软文
  • 福田做商城网站建设哪家公司靠谱优化网站排名需要多少钱