SpringBoot + 腾讯地图实战:打造全能型地理位置服务平台,开箱即用!

news2026/3/14 12:11:15
大家好我是小悟。什么是腾讯地图腾讯地图Tencent Map是腾讯公司推出的一款数字地图服务提供丰富的地图展示、定位、搜索、导航等功能。作为国内领先的地图服务提供商腾讯地图拥有以下特点海量数据覆盖覆盖全国近400个城市、3000多个区县的地图数据实时更新的POI兴趣点数据包含餐饮、酒店、商场等各类场所精准的路网信息和实时路况数据强大的功能特性位置服务提供逆/地理编码实现坐标与地址的相互转换路径规划支持驾车、步行、骑行、公交等多种出行方式的路线规划周边搜索基于位置的周边信息查询距离矩阵计算多个地点之间的时间和距离IP定位通过IP地址获取大致位置天气查询结合位置信息的实时天气数据技术优势高精度定位能力支持GPS、Wi-Fi、基站等多种定位方式毫秒级响应速度保障业务实时性99.9%的服务可用性SLA保障丰富的API接口支持HTTP/HTTPS协议应用场景电商物流配送路线规划、配送范围计算出行服务网约车、共享单车位置服务社交应用位置分享、附近的人生活服务周边美食、酒店查询企业管理门店分布、员工签到SpringBoot集成腾讯地图SDK详细步骤1. 准备工作1.1 注册腾讯地图开发者访问腾讯位置服务官网使用QQ/微信登录开发者账号完成开发者认证1.2 创建应用获取Key进入控制台 - 应用管理 - 我的应用点击创建应用填写应用名称选择应用类型如WebService启用所需服务如地点搜索、路线规划等获取Key用于API调用认证2. 创建SpringBoot项目2.1 使用Spring Initializr创建项目使用IDE创建项目选择以下依赖Spring WebLombokSpring Configuration Processor2.2 项目结构src/main/java/com/example/mapdemo/ ├── MapDemoApplication.java ├── config/ │ └── TencentMapConfig.java ├── controller/ │ └── MapController.java ├── service/ │ ├── TencentMapService.java │ └── impl/ │ └── TencentMapServiceImpl.java ├── dto/ │ ├── request/ │ │ └── LocationRequest.java │ └── response/ │ └── MapResponse.java └── utils/ └── HttpClientUtil.java3. 核心代码实现3.1 Maven依赖配置pom.xml?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd modelVersion4.0.0/modelVersion parent groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-parent/artifactId version2.7.14/version /parent groupIdcom.example/groupId artifactIdtencent-map-demo/artifactId version1.0.0/version properties java.version1.8/java.version /properties dependencies !-- Spring Boot Web -- dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-web/artifactId /dependency !-- Lombok -- dependency groupIdorg.projectlombok/groupId artifactIdlombok/artifactId optionaltrue/optional /dependency !-- Configuration Processor -- dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-configuration-processor/artifactId optionaltrue/optional /dependency !-- HttpClient -- dependency groupIdorg.apache.httpcomponents/groupId artifactIdhttpclient/artifactId version4.5.14/version /dependency !-- FastJSON -- dependency groupIdcom.alibaba/groupId artifactIdfastjson/artifactId version2.0.32/version /dependency !-- Commons Lang3 -- dependency groupIdorg.apache.commons/groupId artifactIdcommons-lang3/artifactId /dependency /dependencies /project3.2 配置文件application.ymlserver: port: 8080 tencent: map: key: 你的腾讯地图Key secret-key: 你的密钥可选用于数字签名 base-url: https://apis.map.qq.com connect-timeout: 5000 read-timeout: 5000 logging: level: com.example.mapdemo: DEBUG3.3 配置类package com.example.mapdemo.config; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; Data Configuration ConfigurationProperties(prefix tencent.map) public class TencentMapConfig { private String key; private String secretKey; private String baseUrl https://apis.map.qq.com; private int connectTimeout 5000; private int readTimeout 5000; }3.4 数据模型类LocationRequest.java- 请求参数package com.example.mapdemo.dto.request; import lombok.Data; import javax.validation.constraints.NotBlank; Data public class LocationRequest { NotBlank(message 地址不能为空) private String address; private String city; // 城市名称可选 private Double latitude; // 纬度 private Double longitude; // 经度 private Integer radius 1000; // 搜索半径默认1000米 private String keyword; // 搜索关键词 }MapResponse.java- 响应结果package com.example.mapdemo.dto.response; import lombok.Builder; import lombok.Data; import java.util.List; import java.util.Map; Data Builder public class MapResponseT { private Integer status; // 状态码0为成功 private String message; // 状态信息 private T data; // 返回数据 private Long requestTime; // 请求时间戳 public static T MapResponseT success(T data) { return MapResponse.Tbuilder() .status(0) .message(success) .data(data) .requestTime(System.currentTimeMillis()) .build(); } public static T MapResponseT error(Integer status, String message) { return MapResponse.Tbuilder() .status(status) .message(message) .requestTime(System.currentTimeMillis()) .build(); } }3.5 HTTP工具类package com.example.mapdemo.utils; import lombok.extern.slf4j.Slf4j; import org.apache.http.HttpEntity; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.utils.URIBuilder; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.springframework.stereotype.Component; import java.io.IOException; import java.net.URI; import java.nio.charset.StandardCharsets; import java.util.Map; Slf4j Component public class HttpClientUtil { private final CloseableHttpClient httpClient; private final RequestConfig requestConfig; public HttpClientUtil() { this.httpClient HttpClients.createDefault(); this.requestConfig RequestConfig.custom() .setConnectTimeout(5000) .setSocketTimeout(5000) .setConnectionRequestTimeout(5000) .build(); } /** * GET请求 */ public String doGet(String url, MapString, String params) { try { URIBuilder uriBuilder new URIBuilder(url); if (params ! null !params.isEmpty()) { params.forEach(uriBuilder::addParameter); } URI uri uriBuilder.build(); HttpGet httpGet new HttpGet(uri); httpGet.setConfig(requestConfig); httpGet.setHeader(Content-Type, application/json;charsetutf8); try (CloseableHttpResponse response httpClient.execute(httpGet)) { HttpEntity entity response.getEntity(); if (entity ! null) { String result EntityUtils.toString(entity, StandardCharsets.UTF_8); log.debug(GET请求响应: {}, result); return result; } } } catch (Exception e) { log.error(GET请求异常, e); } return null; } /** * POST请求JSON格式 */ public String doPostJson(String url, String json) { try { HttpPost httpPost new HttpPost(url); httpPost.setConfig(requestConfig); httpPost.setHeader(Content-Type, application/json;charsetutf8); StringEntity stringEntity new StringEntity(json, StandardCharsets.UTF_8); httpPost.setEntity(stringEntity); try (CloseableHttpResponse response httpClient.execute(httpPost)) { HttpEntity entity response.getEntity(); if (entity ! null) { String result EntityUtils.toString(entity, StandardCharsets.UTF_8); log.debug(POST请求响应: {}, result); return result; } } } catch (Exception e) { log.error(POST请求异常, e); } return null; } }3.6 服务接口package com.example.mapdemo.service; import com.example.mapdemo.dto.request.LocationRequest; import com.example.mapdemo.dto.response.MapResponse; import java.util.Map; public interface TencentMapService { /** * 地理编码地址转坐标 */ MapResponse? geocoder(String address, String city); /** * 逆地理编码坐标转地址 */ MapResponse? reverseGeocoder(Double latitude, Double longitude); /** * 地点搜索 */ MapResponse? searchPoi(String keyword, Double latitude, Double longitude, Integer radius); /** * 驾车路线规划 */ MapResponse? drivingRoute(String origin, String destination); /** * 距离矩阵计算 */ MapResponse? distanceMatrix(String[] origins, String[] destinations); /** * IP定位 */ MapResponse? ipLocation(String ip); /** * 天气查询 */ MapResponse? weather(Double latitude, Double longitude); }3.7 服务实现类package com.example.mapdemo.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.example.mapdemo.config.TencentMapConfig; import com.example.mapdemo.dto.response.MapResponse; import com.example.mapdemo.service.TencentMapService; import com.example.mapdemo.utils.HttpClientUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import java.util.HashMap; import java.util.Map; Slf4j Service RequiredArgsConstructor public class TencentMapServiceImpl implements TencentMapService { private final TencentMapConfig mapConfig; private final HttpClientUtil httpClientUtil; /** * 地理编码 - 地址转坐标 * API文档https://lbs.qq.com/service/webService/webServiceGuide/webServiceGeocoder */ Override public MapResponse? geocoder(String address, String city) { try { MapString, String params new HashMap(); params.put(key, mapConfig.getKey()); params.put(address, address); if (StringUtils.hasText(city)) { params.put(region, city); } String url mapConfig.getBaseUrl() /ws/geocoder/v1/; String result httpClientUtil.doGet(url, params); JSONObject jsonResult JSON.parseObject(result); if (jsonResult.getInteger(status) 0) { JSONObject location jsonResult.getJSONObject(result).getJSONObject(location); return MapResponse.success(location); } else { return MapResponse.error(jsonResult.getInteger(status), jsonResult.getString(message)); } } catch (Exception e) { log.error(地理编码失败, e); return MapResponse.error(-1, 地理编码失败 e.getMessage()); } } /** * 逆地理编码 - 坐标转地址 */ Override public MapResponse? reverseGeocoder(Double latitude, Double longitude) { try { MapString, String params new HashMap(); params.put(key, mapConfig.getKey()); params.put(location, latitude , longitude); params.put(get_poi, 1); // 是否返回周边POI String url mapConfig.getBaseUrl() /ws/geocoder/v1/; String result httpClientUtil.doGet(url, params); JSONObject jsonResult JSON.parseObject(result); if (jsonResult.getInteger(status) 0) { return MapResponse.success(jsonResult.getJSONObject(result)); } else { return MapResponse.error(jsonResult.getInteger(status), jsonResult.getString(message)); } } catch (Exception e) { log.error(逆地理编码失败, e); return MapResponse.error(-1, 逆地理编码失败 e.getMessage()); } } /** * 地点搜索 */ Override public MapResponse? searchPoi(String keyword, Double latitude, Double longitude, Integer radius) { try { MapString, String params new HashMap(); params.put(key, mapConfig.getKey()); params.put(keyword, keyword); params.put(boundary, nearby( latitude , longitude , radius )); params.put(page_size, 20); params.put(page_index, 1); String url mapConfig.getBaseUrl() /ws/place/v1/search/; String result httpClientUtil.doGet(url, params); JSONObject jsonResult JSON.parseObject(result); if (jsonResult.getInteger(status) 0) { return MapResponse.success(jsonResult.getJSONObject(data)); } else { return MapResponse.error(jsonResult.getInteger(status), jsonResult.getString(message)); } } catch (Exception e) { log.error(地点搜索失败, e); return MapResponse.error(-1, 地点搜索失败 e.getMessage()); } } /** * 驾车路线规划 */ Override public MapResponse? drivingRoute(String origin, String destination) { try { MapString, String params new HashMap(); params.put(key, mapConfig.getKey()); params.put(from, origin); params.put(to, destination); params.put(output, json); String url mapConfig.getBaseUrl() /ws/direction/v1/driving/; String result httpClientUtil.doGet(url, params); JSONObject jsonResult JSON.parseObject(result); if (jsonResult.getInteger(status) 0) { return MapResponse.success(jsonResult.getJSONObject(result)); } else { return MapResponse.error(jsonResult.getInteger(status), jsonResult.getString(message)); } } catch (Exception e) { log.error(路线规划失败, e); return MapResponse.error(-1, 路线规划失败 e.getMessage()); } } /** * 距离矩阵计算 */ Override public MapResponse? distanceMatrix(String[] origins, String[] destinations) { try { MapString, String params new HashMap(); params.put(key, mapConfig.getKey()); params.put(from, String.join(;, origins)); params.put(to, String.join(;, destinations)); params.put(mode, driving); // 驾车模式 String url mapConfig.getBaseUrl() /ws/distance/v1/matrix/; String result httpClientUtil.doGet(url, params); JSONObject jsonResult JSON.parseObject(result); if (jsonResult.getInteger(status) 0) { return MapResponse.success(jsonResult.getJSONObject(result)); } else { return MapResponse.error(jsonResult.getInteger(status), jsonResult.getString(message)); } } catch (Exception e) { log.error(距离矩阵计算失败, e); return MapResponse.error(-1, 距离矩阵计算失败 e.getMessage()); } } /** * IP定位 */ Override public MapResponse? ipLocation(String ip) { try { MapString, String params new HashMap(); params.put(key, mapConfig.getKey()); params.put(ip, ip); params.put(output, json); String url mapConfig.getBaseUrl() /ws/location/v1/ip/; String result httpClientUtil.doGet(url, params); JSONObject jsonResult JSON.parseObject(result); if (jsonResult.getInteger(status) 0) { return MapResponse.success(jsonResult.getJSONObject(result)); } else { return MapResponse.error(jsonResult.getInteger(status), jsonResult.getString(message)); } } catch (Exception e) { log.error(IP定位失败, e); return MapResponse.error(-1, IP定位失败 e.getMessage()); } } /** * 天气查询 */ Override public MapResponse? weather(Double latitude, Double longitude) { try { MapString, String params new HashMap(); params.put(key, mapConfig.getKey()); params.put(location, latitude , longitude); params.put(output, json); String url mapConfig.getBaseUrl() /ws/weather/v1/; String result httpClientUtil.doGet(url, params); JSONObject jsonResult JSON.parseObject(result); if (jsonResult.getInteger(status) 0) { return MapResponse.success(jsonResult.getJSONObject(result)); } else { return MapResponse.error(jsonResult.getInteger(status), jsonResult.getString(message)); } } catch (Exception e) { log.error(天气查询失败, e); return MapResponse.error(-1, 天气查询失败 e.getMessage()); } } }3.8 控制器类package com.example.mapdemo.controller; import com.example.mapdemo.dto.request.LocationRequest; import com.example.mapdemo.dto.response.MapResponse; import com.example.mapdemo.service.TencentMapService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; Slf4j RestController RequestMapping(/api/map) RequiredArgsConstructor public class MapController { private final TencentMapService mapService; /** * 地理编码地址转坐标 */ GetMapping(/geocoder) public MapResponse? geocoder( RequestParam String address, RequestParam(required false) String city) { log.info(地理编码请求 - 地址: {}, 城市: {}, address, city); return mapService.geocoder(address, city); } /** * 逆地理编码坐标转地址 */ GetMapping(/reverse-geocoder) public MapResponse? reverseGeocoder( RequestParam Double latitude, RequestParam Double longitude) { log.info(逆地理编码请求 - 坐标: ({}, {}), latitude, longitude); return mapService.reverseGeocoder(latitude, longitude); } /** * 地点搜索 */ GetMapping(/search) public MapResponse? search( RequestParam String keyword, RequestParam Double latitude, RequestParam Double longitude, RequestParam(defaultValue 1000) Integer radius) { log.info(地点搜索请求 - 关键词: {}, 坐标: ({}, {}), 半径: {}, keyword, latitude, longitude, radius); return mapService.searchPoi(keyword, latitude, longitude, radius); } /** * 路线规划 */ GetMapping(/route) public MapResponse? route( RequestParam String origin, RequestParam String destination) { log.info(路线规划请求 - 起点: {}, 终点: {}, origin, destination); return mapService.drivingRoute(origin, destination); } /** * IP定位 */ GetMapping(/ip-location) public MapResponse? ipLocation(RequestParam String ip) { log.info(IP定位请求 - IP: {}, ip); return mapService.ipLocation(ip); } /** * 天气查询 */ GetMapping(/weather) public MapResponse? weather( RequestParam Double latitude, RequestParam Double longitude) { log.info(天气查询请求 - 坐标: ({}, {}), latitude, longitude); return mapService.weather(latitude, longitude); } /** * 距离矩阵计算 */ PostMapping(/distance-matrix) public MapResponse? distanceMatrix(Valid RequestBody LocationRequest request) { // 这里简化处理实际应根据请求构建参数 String[] origins {request.getLatitude() , request.getLongitude()}; String[] destinations {39.984154,116.307490, 39.995120,116.327450}; // 示例坐标 return mapService.distanceMatrix(origins, destinations); } }4. 启动类package com.example.mapdemo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; SpringBootApplication EnableConfigurationProperties public class MapDemoApplication { public static void main(String[] args) { SpringApplication.run(MapDemoApplication.class, args); } }测试与使用1. 启动应用运行MapDemoApplication.java的 main 方法2. API测试地理编码测试curl http://localhost:8080/api/map/geocoder?address北京市海淀区city北京地点搜索测试curl http://localhost:8080/api/map/search?keyword餐厅latitude39.984154longitude116.307490radius2000详细总结1. 集成要点总结1.1 准备工作的重要性Key管理腾讯地图API的Key是访问服务的凭证需要妥善保管建议使用配置文件管理权限配置在腾讯地图控制台正确配置应用权限确保所需服务已开通配额限制了解各API的免费配额和计费规则避免超出限制导致服务中断1.2 架构设计特点分层设计Controller-Service-Repository三层架构职责清晰配置分离使用ConfigurationProperties将配置独立管理便于维护工具类封装HttpClientUtil封装HTTP请求提高代码复用性统一响应MapResponse统一API返回格式便于前端处理1.3 关键技术实现HTTP客户端使用Apache HttpClient处理API请求支持连接池和超时配置JSON处理FastJSON实现请求参数和响应结果的序列化/反序列化参数验证使用Spring Validation进行请求参数校验异常处理全局异常捕获确保服务稳定性2. 性能优化2.1 缓存策略// 可以考虑使用Redis缓存高频查询结果 Cacheable(value geocoder, key #address _ #city) public MapResponse? geocoder(String address, String city) { // 实现代码 }2.2 连接池优化// 优化HttpClient配置 PoolingHttpClientConnectionManager connectionManager new PoolingHttpClientConnectionManager(); connectionManager.setMaxTotal(200); // 最大连接数 connectionManager.setDefaultMaxPerRoute(20); // 每个路由最大连接数2.3 异步处理// 使用CompletableFuture实现异步调用 Async public CompletableFutureMapResponse? asyncGeocoder(String address) { return CompletableFuture.completedFuture(geocoder(address, null)); }3. 安全性考虑3.1 Key保护禁止在前端代码中暴露Key使用环境变量或配置中心管理敏感信息定期更换Key降低泄露风险3.2 请求签名// 添加签名验证如腾讯地图支持 public String generateSignature(MapString, String params) { // 按照腾讯地图签名规则生成签名 // 1. 参数排序 // 2. 拼接字符串 // 3. MD5加密 }3.3 访问控制// 添加接口限流 RateLimiter(limit 10, timeout 1) public MapResponse? geocoder(String address) { // 实现代码 }4. 监控与运维4.1 日志记录Slf4j Component public class MapApiInterceptor { Around(execution(* com.example.mapdemo.service.*.*(..))) public Object logApiCall(ProceedingJoinPoint pjp) throws Throwable { long startTime System.currentTimeMillis(); String methodName pjp.getSignature().getName(); try { Object result pjp.proceed(); long duration System.currentTimeMillis() - startTime; log.info(API调用 - {} - 耗时: {}ms, methodName, duration); return result; } catch (Exception e) { log.error(API调用异常 - {}, methodName, e); throw e; } } }4.2 健康检查Endpoint(id map) Component public class MapHealthEndpoint { private final TencentMapService mapService; ReadOperation public MapString, Object health() { MapString, Object health new HashMap(); try { // 简单测试API可用性 mapService.geocoder(北京市, null); health.put(status, UP); } catch (Exception e) { health.put(status, DOWN); health.put(error, e.getMessage()); } return health; } }5. 常见问题与解决方案5.1 返回状态码处理状态码含义解决方案0成功-110请求来源非法检查Key是否正确311参数缺失检查必填参数320请求超过配额升级服务或优化调用403请求被拒绝检查IP白名单设置5.2 性能问题QPS限制实现请求队列和限流机制超时设置根据业务需求调整连接超时和读取超时时间数据缓存对不经常变化的数据增加缓存6. 扩展建议6.1 功能扩展接入腾讯地图Web JS API实现前端地图展示开发地图数据可视化功能实现路径规划的多种模式避开高速、少收费等7. 最佳实践总结通过以上步骤实现了SpringBoot与腾讯地图SDK的集成实现了以下核心功能完整的功能覆盖实现了地理编码、逆地理编码、地点搜索等主流地图服务良好的架构设计采用分层架构代码结构清晰易于维护完善的错误处理统一的响应格式和异常处理机制可扩展性预留了缓存、限流等扩展点便于后续优化谢谢你看我的文章既然看到这里了如果觉得不错随手点个赞、转发、在看三连吧感谢感谢。那我们下次再见。您的一键三连是我更新的最大动力谢谢山水有相逢来日皆可期谢谢阅读我们再会我手中的金箍棒上能通天下能探海

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2411051.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

SpringBoot-17-MyBatis动态SQL标签之常用标签

文章目录 1 代码1.1 实体User.java1.2 接口UserMapper.java1.3 映射UserMapper.xml1.3.1 标签if1.3.2 标签if和where1.3.3 标签choose和when和otherwise1.4 UserController.java2 常用动态SQL标签2.1 标签set2.1.1 UserMapper.java2.1.2 UserMapper.xml2.1.3 UserController.ja…

wordpress后台更新后 前端没变化的解决方法

使用siteground主机的wordpress网站,会出现更新了网站内容和修改了php模板文件、js文件、css文件、图片文件后,网站没有变化的情况。 不熟悉siteground主机的新手,遇到这个问题,就很抓狂,明明是哪都没操作错误&#x…

网络编程(Modbus进阶)

思维导图 Modbus RTU(先学一点理论) 概念 Modbus RTU 是工业自动化领域 最广泛应用的串行通信协议,由 Modicon 公司(现施耐德电气)于 1979 年推出。它以 高效率、强健性、易实现的特点成为工业控制系统的通信标准。 包…

UE5 学习系列(二)用户操作界面及介绍

这篇博客是 UE5 学习系列博客的第二篇,在第一篇的基础上展开这篇内容。博客参考的 B 站视频资料和第一篇的链接如下: 【Note】:如果你已经完成安装等操作,可以只执行第一篇博客中 2. 新建一个空白游戏项目 章节操作,重…

IDEA运行Tomcat出现乱码问题解决汇总

最近正值期末周,有很多同学在写期末Java web作业时,运行tomcat出现乱码问题,经过多次解决与研究,我做了如下整理: 原因: IDEA本身编码与tomcat的编码与Windows编码不同导致,Windows 系统控制台…

利用最小二乘法找圆心和半径

#include <iostream> #include <vector> #include <cmath> #include <Eigen/Dense> // 需安装Eigen库用于矩阵运算 // 定义点结构 struct Point { double x, y; Point(double x_, double y_) : x(x_), y(y_) {} }; // 最小二乘法求圆心和半径 …

使用docker在3台服务器上搭建基于redis 6.x的一主两从三台均是哨兵模式

一、环境及版本说明 如果服务器已经安装了docker,则忽略此步骤,如果没有安装,则可以按照一下方式安装: 1. 在线安装(有互联网环境): 请看我这篇文章 传送阵>> 点我查看 2. 离线安装(内网环境):请看我这篇文章 传送阵>> 点我查看 说明&#xff1a;假设每台服务器已…

XML Group端口详解

在XML数据映射过程中&#xff0c;经常需要对数据进行分组聚合操作。例如&#xff0c;当处理包含多个物料明细的XML文件时&#xff0c;可能需要将相同物料号的明细归为一组&#xff0c;或对相同物料号的数量进行求和计算。传统实现方式通常需要编写脚本代码&#xff0c;增加了开…

LBE-LEX系列工业语音播放器|预警播报器|喇叭蜂鸣器的上位机配置操作说明

LBE-LEX系列工业语音播放器|预警播报器|喇叭蜂鸣器专为工业环境精心打造&#xff0c;完美适配AGV和无人叉车。同时&#xff0c;集成以太网与语音合成技术&#xff0c;为各类高级系统&#xff08;如MES、调度系统、库位管理、立库等&#xff09;提供高效便捷的语音交互体验。 L…

(LeetCode 每日一题) 3442. 奇偶频次间的最大差值 I (哈希、字符串)

题目&#xff1a;3442. 奇偶频次间的最大差值 I 思路 &#xff1a;哈希&#xff0c;时间复杂度0(n)。 用哈希表来记录每个字符串中字符的分布情况&#xff0c;哈希表这里用数组即可实现。 C版本&#xff1a; class Solution { public:int maxDifference(string s) {int a[26]…

【大模型RAG】拍照搜题技术架构速览:三层管道、两级检索、兜底大模型

摘要 拍照搜题系统采用“三层管道&#xff08;多模态 OCR → 语义检索 → 答案渲染&#xff09;、两级检索&#xff08;倒排 BM25 向量 HNSW&#xff09;并以大语言模型兜底”的整体框架&#xff1a; 多模态 OCR 层 将题目图片经过超分、去噪、倾斜校正后&#xff0c;分别用…

【Axure高保真原型】引导弹窗

今天和大家中分享引导弹窗的原型模板&#xff0c;载入页面后&#xff0c;会显示引导弹窗&#xff0c;适用于引导用户使用页面&#xff0c;点击完成后&#xff0c;会显示下一个引导弹窗&#xff0c;直至最后一个引导弹窗完成后进入首页。具体效果可以点击下方视频观看或打开下方…

接口测试中缓存处理策略

在接口测试中&#xff0c;缓存处理策略是一个关键环节&#xff0c;直接影响测试结果的准确性和可靠性。合理的缓存处理策略能够确保测试环境的一致性&#xff0c;避免因缓存数据导致的测试偏差。以下是接口测试中常见的缓存处理策略及其详细说明&#xff1a; 一、缓存处理的核…

龙虎榜——20250610

上证指数放量收阴线&#xff0c;个股多数下跌&#xff0c;盘中受消息影响大幅波动。 深证指数放量收阴线形成顶分型&#xff0c;指数短线有调整的需求&#xff0c;大概需要一两天。 2025年6月10日龙虎榜行业方向分析 1. 金融科技 代表标的&#xff1a;御银股份、雄帝科技 驱动…

观成科技:隐蔽隧道工具Ligolo-ng加密流量分析

1.工具介绍 Ligolo-ng是一款由go编写的高效隧道工具&#xff0c;该工具基于TUN接口实现其功能&#xff0c;利用反向TCP/TLS连接建立一条隐蔽的通信信道&#xff0c;支持使用Let’s Encrypt自动生成证书。Ligolo-ng的通信隐蔽性体现在其支持多种连接方式&#xff0c;适应复杂网…

铭豹扩展坞 USB转网口 突然无法识别解决方法

当 USB 转网口扩展坞在一台笔记本上无法识别,但在其他电脑上正常工作时,问题通常出在笔记本自身或其与扩展坞的兼容性上。以下是系统化的定位思路和排查步骤,帮助你快速找到故障原因: 背景: 一个M-pard(铭豹)扩展坞的网卡突然无法识别了,扩展出来的三个USB接口正常。…

未来机器人的大脑:如何用神经网络模拟器实现更智能的决策?

编辑&#xff1a;陈萍萍的公主一点人工一点智能 未来机器人的大脑&#xff1a;如何用神经网络模拟器实现更智能的决策&#xff1f;RWM通过双自回归机制有效解决了复合误差、部分可观测性和随机动力学等关键挑战&#xff0c;在不依赖领域特定归纳偏见的条件下实现了卓越的预测准…

Linux应用开发之网络套接字编程(实例篇)

服务端与客户端单连接 服务端代码 #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <pthread.h> …

华为云AI开发平台ModelArts

华为云ModelArts&#xff1a;重塑AI开发流程的“智能引擎”与“创新加速器”&#xff01; 在人工智能浪潮席卷全球的2025年&#xff0c;企业拥抱AI的意愿空前高涨&#xff0c;但技术门槛高、流程复杂、资源投入巨大的现实&#xff0c;却让许多创新构想止步于实验室。数据科学家…

深度学习在微纳光子学中的应用

深度学习在微纳光子学中的主要应用方向 深度学习与微纳光子学的结合主要集中在以下几个方向&#xff1a; 逆向设计 通过神经网络快速预测微纳结构的光学响应&#xff0c;替代传统耗时的数值模拟方法。例如设计超表面、光子晶体等结构。 特征提取与优化 从复杂的光学数据中自…